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

fix!: make record property and return types lists #276

Merged
merged 2 commits into from
Aug 3, 2022
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
2 changes: 1 addition & 1 deletion packages/interface-record-compliance-tests/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default (test: TestSetup<Record>) => {

it('is able to marshal', () => {
const rawData = record.marshal()
expect(rawData).to.be.an.instanceof(Uint8Array)
expect(rawData).to.have.property('byteLength')
})

it('is able to compare two records', () => {
Expand Down
3 changes: 2 additions & 1 deletion packages/interface-record/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@
"release": "aegir release"
},
"dependencies": {
"@libp2p/interface-peer-id": "^1.0.0"
"@libp2p/interface-peer-id": "^1.0.0",
"uint8arraylist": "^2.0.0"
},
"devDependencies": {
"aegir": "^37.4.0"
Expand Down
11 changes: 6 additions & 5 deletions packages/interface-record/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { PeerId } from '@libp2p/interface-peer-id'
import type { Uint8ArrayList } from 'uint8arraylist'

/**
* Record is the base implementation of a record that can be used as the payload of a libp2p envelope.
Expand All @@ -15,7 +16,7 @@ export interface Record {
/**
* Marshal a record to be used in an envelope.
*/
marshal: () => Uint8Array
marshal: () => Uint8ArrayList
/**
* Verifies if the other provided Record is identical to this one.
*/
Expand All @@ -24,11 +25,11 @@ export interface Record {

export interface Envelope {
peerId: PeerId
payloadType: Uint8Array
payload: Uint8Array
signature: Uint8Array
payloadType: Uint8Array | Uint8ArrayList
payload: Uint8Array | Uint8ArrayList
signature: Uint8Array | Uint8ArrayList

marshal: () => Uint8Array
marshal: () => Uint8ArrayList
validate: (domain: string) => Promise<boolean>
equals: (other: Envelope) => boolean
}