commit e2436d60143ec7cb530188145916f02b018a7483 parent bd9c5dbf226ab66bd1a0358b5596a94301d2eb7d Author: Martin Schanzenbach <schanzen@gnunet.org> Date: Sun, 2 Nov 2025 13:15:01 +0100 Add some message definitions Diffstat:
| M | design-documents/070-alias-directory-mailbox.rst | | | 49 | +++++++++++++++++++++++++++++++++++++++++-------- |
1 file changed, 41 insertions(+), 8 deletions(-)
diff --git a/design-documents/070-alias-directory-mailbox.rst b/design-documents/070-alias-directory-mailbox.rst @@ -255,25 +255,58 @@ For example, DNS or GNS validators will publish the mappings under zones of the Mailbox ------- +Messages are retuned from the API with a fixed length. +The configured messages length must be obtained through the +mailbox service configuration endpoint. +The first two bytes of the message are 16 bit unsigned integers +in network byte order that specify the message type. +The remaining bytes contain the encrypted message (including the MAC). +Messages are encrypted using HPKE (X25519 with ChaChaPoly1305 as AEAD). +This means that the encrypted message payload also contains a 32 byte +encapsulation as well as a 16 byte MAC. + +The plaintext payload of messages is defined as follows: + Wire format MailboxMessage: .. _MailboxMessage: .. ts:def:: MailboxMessage - interface MailboxMessage { + type MailboxMessage = (PaymentInvoiceRequestMessage | SendMoneyMessage) & MailboxMessageCommon + + +.. _PaymentInvoiceRequestMessage: +.. ts:def:: PaymentInvoiceRequestMessage + + interface PaymentInvoiceRequestMessage { + + // Pay push URI. + payPushUri: string; + - // Type of message. - // A 32 bit integer - message_type: Integer; + } + +.. _SendMoneyMessage: +.. ts:def:: SendMoneyMessage + + interface SendMoneyMessage { - // SHA-512 hash over all messages to delete. - expiration: Timestamp; + // Pay pull URI. + payPullUri: string; - // The message payload - payload: byte[]; } +.. ts:def:: MailboxMessageCommon + + interface MailboxMessageCommon { + // Message identifier + messageId: string; + + // Freeform text from sender. + senderHint: string; + + } Definition of Done ==================