Skip to content

Instantly share code, notes, and snippets.

@sappenin
Created April 12, 2020 00:47
Show Gist options
  • Save sappenin/b5925e86a2cc6e8042650e6802800a7a to your computer and use it in GitHub Desktop.
Save sappenin/b5925e86a2cc6e8042650e6802800a7a to your computer and use it in GitHub Desktop.
Proposed STREAM Receipt ASN.1 OER
FrameSet FRAME ::= {
{1 ConnectionError} |
{2 ConnectionNewAddress} |
{3 ConnectionMaxData} |
{4 ConnectionDataBlocked} |
{5 ConnectionMaxStreamId} |
{6 ConnectionStreamIdBlocked} |
{16 StreamClose} |
{17 StreamMoney} |
{18 StreamMaxMoney} |
{19 StreamMoneyBlocked} |
{20 StreamData} |
{21 StreamMaxData} |
{22 StreamDataBlocked}
{22 StreamDataBlocked} |
{23 StreamReceipt}
}
...
StreamReceipt ::= SEQUENCE {
-- Identifier of the stream
streamId VarUInt,
-- Length-prefixed Receipt for verifying the total amount received on this stream
-- The sender is not expected to decode the Receipt fields but must be able to decode the
-- receipt string in the frame, even if it represents an unsupported Receipt version
receipt ReceiptPacket
}
RECEIPT ::= CLASS {
&typeId UInt8 UNIQUE,
&Type // was &Type
} WITH SYNTAX {&typeId &Type}
ReceiptSet RECEIPT ::= {
{1 Receipt}
}
ReceiptPacket ::= SEQUENCE {
-- One byte type ID
type RECEIPT.&typeId ({ReceiptSet}),
-- Length-prefixed data
data RECEIPT.&Type ({ReceiptSet}{@type})
}
Receipt ::= SEQUENCE {
-- Identifier of the connection
nonce UInt128,
-- Identifier of the stream
streamId UInt8,
-- Total amount the stream has received so far
totalReceived UInt64,
-- HMAC-SHA256 using a 32 byte Secret
-- The message is the concatenation of all other fields, in the order listed above
hmac UInt256
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment