Skip to content

Conversation

@gabriel-indik
Copy link
Contributor

@gabriel-indik gabriel-indik commented Aug 1, 2022

When sending a message or transferring a blob, the recipient ID can now contain an additional identifier. Also, the sender can be explicitly included which may also contain an additional identifier.

Example:
POST /api/v1/messages

Payload:

{
    "recipient": "org-b/ns-a",
    "sender": "org-a/ns-x",
    "message": "test 1-2-3"
}

Response:

{
    "requestId": "cee8e73e-4a97-4be7-abc8-f82de1e62939"
}

Sender receives event:

{
    "id": "58e7a4b8-046e-478b-a82c-daa9eb9aae01",
    "type": "message-delivered",
    "message": "test 1-2-3",
    "sender": "org-a/ns-y",
    "recipient": "org-b/ns-x",
    "requestId": "cee8e73e-4a97-4be7-abc8-f82de1e62939"
}

Recipient receives event:

{
    "id": "8d3351a8-bb83-4ce2-906d-4d099f8e2492",
    "type": "message-received",
    "sender": "org-a/ns-y",
    "recipient": "org-b/ns-x",
    "message": "test 1-2-3"
}

Similarly when transferring blobs:
POST /api/v1/transfers

Payload:

{
    "path": "/photo.jpg",
    "sender": "org-a/ns-x",
    "recipient": "org-b/ns-y"
}

Response:

{
    "requestId": "ba830d2c-dd39-48ce-ab70-dbfa610dc606"
}

Sender receives event:

{
    "id": "16354dfb-1644-404e-a23c-51dd62d0d5d9",
    "type": "blob-delivered",
    "path": "/photo.jpg",
    "sender": "org-a/ns-x",
    "recipient": "org-b/ns-y",
    "requestId": "ba830d2c-dd39-48ce-ab70-dbfa610dc606"
}

Recipient receives event:

{
    "id": "bb745fe8-8837-436f-9d20-315dc0da01a5",
    "type": "blob-received",
    "sender": "org-a/ns-x",
    "recipient": "org-b/ns-y",
    "path": "received/org-a/ns-x/photo.jpg",
    "hash": "9707a075644e450ebec9c87dfa3b79b53e51f878cfc0394b80c30949f4d2000c",
    "size": 146866,
    "lastUpdate": 1658437514514
}

Notice the folder structure, the file is stored in a subdirectory based on the additional identifier.
Note also that these changes are backward compatible as the additional identifiers are optional.

Also included in this PR:

  • Updated certificates for development (original ones were expired)
  • Headers updated (2021 -> 2022)

Signed-off-by: Gabriel Indik <gabriel.indik@kaleido.io>
Signed-off-by: Gabriel Indik <gabriel.indik@kaleido.io>
Signed-off-by: Gabriel Indik <gabriel.indik@kaleido.io>
Signed-off-by: Gabriel Indik <gabriel.indik@kaleido.io>
Copy link
Contributor

@awrichar awrichar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with changes in hyperledger/firefly#916 - looks good.

@peterbroadhurst peterbroadhurst merged commit f8f4e5e into main Aug 1, 2022
@peterbroadhurst peterbroadhurst deleted the destinations branch August 1, 2022 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants