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

fix: remove redundant entries check in ad constructor #6

Merged
merged 1 commit into from
May 12, 2023
Merged
Show file tree
Hide file tree
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
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Construct A Provider with the peerID and signing keys, and pass it to an Adverti
Call `advertisement.signAndEncode()` to export a valid Advertisement ready for encoding as IPLD.

```js
import fs from 'node:fs/promises'
import fs from 'node:fs'
import { CID } from 'multiformats/cid'
import * as Block from 'multiformats/block'
import { sha256 } from 'multiformats/hashes/sha2'
Expand Down Expand Up @@ -94,7 +94,6 @@ An `dag-json` encoded Advertisement (re-formated for readability):
}
```


## Extended Providers

Encode a signed advertisement with an Extended Providers section where the entries are available from multiple providers or different protocols.
Expand Down
3 changes: 1 addition & 2 deletions advertisement.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class Advertisement {
* @param {boolean} [config.override]
*/
constructor ({ previous, providers, context, entries = NO_ENTRIES, remove = false, override = false }) {
if (!providers || !entries || !context) {
if (!providers || !context) {
throw new Error('providers and context are required')
}
if (previous === undefined) {
Expand Down Expand Up @@ -126,7 +126,6 @@ export class Advertisement {
* Serialize the fields use for signing the Advertisement
* note: peerId and multiaddr string bytes are signed rather than using their byte encodings!
* impl: https://github.com/ipni/go-libipni/blob/afe2d8ea45b86c2a22f756ee521741c8f99675e5/ingest/schema/envelope.go#L84
* spec: https://github.com/ipni/specs/blob/main/IPNI.md#extendedprovider
*/
signableBytes () {
const text = new TextEncoder()
Expand Down