gossipsub: introduce message signing policy, see libp2p/go-libp2p-pubsub#359

This commit is contained in:
protolambda
2020-09-14 22:59:07 +02:00
parent 2cb3e7b971
commit df4e932851
2 changed files with 29 additions and 0 deletions

View File

@@ -153,6 +153,10 @@ and
Messages can be optionally signed, and it is up to the peer whether to accept and forward
unsigned messages.
When the receiver expects unsigned content-based messages, and thus does not expect
the `from`, `seqno`, `signature`, or `key` fields, it may reject the messages (`StrictNoSign`).
And if not, the receiver may choose to enforce signatures strictly (`StrictSign`).
This optionality is configurable with the signing policy options starting from `v1.1`.
For signing purposes, the `signature` and `key` fields are used:
- The `signature` field contains the signature.
@@ -160,6 +164,7 @@ For signing purposes, the `signature` and `key` fields are used:
When present, it must match the peer ID.
The signature is computed over the marshalled message protobuf _excluding_ the key field.
This includes any fields that are not recognized, but still included in the marshalled data.
The protobuf blob is prefixed by the string `libp2p-pubsub:` before signing.
When signature validation fails for a signed message, the implementation must