Skip to content
This repository has been archived by the owner on Jun 26, 2023. It is now read-only.

feat!: pubsub Message types for signature policies #266

Merged
merged 1 commit into from
Jul 31, 2022

Conversation

wemeetagain
Copy link
Member

BREAKING CHANGE: The Message type is now either a StrictSignMessage
or a StrictNoSignMessage

key?: Uint8Array
}

export interface StrictNoSignMessage {
topic: string
Copy link
Member

Choose a reason for hiding this comment

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

No from field in unsigned messages?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, see the comment on StrictNoSign. looks like the text was taken from here: https://github.com/libp2p/specs/tree/master/pubsub#signature-policy-options

@achingbrain
Copy link
Member

Could just be SignedMessage and UnsignedMessage? Strict... was more a reference to the policy than the output.

@achingbrain
Copy link
Member

achingbrain commented Jun 29, 2022

Do these things need a type: 'signed' | 'unsigned' field to allow tsc to disambiguate at compile time?

We've needed that in other places, eg:

if (msg.type === 'signed') {
  // now safe to access `msg.sequenceNumber`, `msg.signature` etc without casting
}

BREAKING CHANGE: The `Message` type is now either a `StrictSignMessage`
or a `StrictNoSignMessage`
@achingbrain achingbrain merged commit 9eb710b into master Jul 31, 2022
@achingbrain achingbrain deleted the feat/pubsub-message-type branch July 31, 2022 09:08
github-actions bot pushed a commit that referenced this pull request Jul 31, 2022
## [@libp2p/interface-pubsub-v2.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-v1.0.4...@libp2p/interface-pubsub-v2.0.0) (2022-07-31)

### ⚠ BREAKING CHANGES

* The `Message` type is now either a `SignedMessage`
or a `UnsignedMessage`
* the inbound/outbound stream types have changed

### Features

* pubsub Message types for signature policies ([#266](#266)) ([9eb710b](9eb710b))

### Bug Fixes

* make stream types Uint8ArrayLists ([#272](#272)) ([ace7e0c](ace7e0c))

### Trivial Changes

* update project config ([#271](#271)) ([59c0bf5](59c0bf5))
@github-actions
Copy link

🎉 This PR is included in version @libp2p/interface-pubsub-v2.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

github-actions bot pushed a commit that referenced this pull request Jul 31, 2022
## [@libp2p/interface-pubsub-compliance-tests-v2.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-compliance-tests-v1.0.4...@libp2p/interface-pubsub-compliance-tests-v2.0.0) (2022-07-31)

### ⚠ BREAKING CHANGES

* The `Message` type is now either a `SignedMessage`
or a `UnsignedMessage`

### Features

* pubsub Message types for signature policies ([#266](#266)) ([9eb710b](9eb710b))

### Trivial Changes

* update project config ([#271](#271)) ([59c0bf5](59c0bf5))
* update sibling dependencies [skip ci] ([fbd5281](fbd5281))
@github-actions
Copy link

🎉 This PR is included in version @libp2p/interface-pubsub-compliance-tests-v2.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants