Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[spec] facilitate message authentication with candid serialization #124

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions spec/Candid.md
Original file line number Diff line number Diff line change
Expand Up @@ -1127,6 +1127,11 @@ Note:
`M` maps an Candid value to a byte sequence representing that value. The definition is indexed by type.
We assume that the fields in a record value are sorted by increasing id.

Given a fixed type, we guarantee that there is a one-to-one mapping between the Candid value and the byte sequence.
This property ensures that we can use `M` for message authentication when both the sender and receiver agree on the same type.
As a corollary, the `leb128` and `sleb128` encodings should be deterministic for serialization,
preferably using the shortest encoding. For deserialization, we can decode any valid `leb128` or `sleb128` encoding.

```
M : <val> -> <primtype> -> i8*
M(n : nat) = leb128(n)
Expand Down