From e0fd5e3ef3cddd82b4c65817835a783edaebfb3b Mon Sep 17 00:00:00 2001 From: Chad Nehemiah Date: Thu, 9 Feb 2023 23:17:47 -0500 Subject: [PATCH] chore: upgrade `aegir` to `38.1.2` (#48) --- package.json | 2 +- src/envelope/index.ts | 10 +++++----- src/peer-record/index.ts | 4 ++-- test/envelope.spec.ts | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index bfad34aa74..5d94ded59a 100644 --- a/package.json +++ b/package.json @@ -171,7 +171,7 @@ "@libp2p/interface-record-compliance-tests": "^2.0.0", "@libp2p/peer-id-factory": "^2.0.0", "@types/varint": "^6.0.0", - "aegir": "^37.9.1", + "aegir": "^38.1.2", "protons": "^6.0.0", "sinon": "^15.0.0" } diff --git a/src/envelope/index.ts b/src/envelope/index.ts index 630f86b314..e81ad798ff 100644 --- a/src/envelope/index.ts +++ b/src/envelope/index.ts @@ -21,7 +21,7 @@ export class RecordEnvelope implements Envelope { /** * Unmarshal a serialized Envelope protobuf message */ - static createFromProtobuf = async (data: Uint8Array | Uint8ArrayList) => { + static createFromProtobuf = async (data: Uint8Array | Uint8ArrayList): Promise => { const envelopeData = Protobuf.decode(data) const peerId = await peerIdFromKeys(envelopeData.publicKey) @@ -37,7 +37,7 @@ export class RecordEnvelope implements Envelope { * Seal marshals the given Record, places the marshaled bytes inside an Envelope * and signs it with the given peerId's private key */ - static seal = async (record: Record, peerId: PeerId) => { + static seal = async (record: Record, peerId: PeerId): Promise => { if (peerId.privateKey == null) { throw new Error('Missing private key') } @@ -61,7 +61,7 @@ export class RecordEnvelope implements Envelope { * Open and certify a given marshalled envelope. * Data is unmarshalled and the signature validated for the given domain. */ - static openAndCertify = async (data: Uint8Array | Uint8ArrayList, domain: string) => { + static openAndCertify = async (data: Uint8Array | Uint8ArrayList, domain: string): Promise => { const envelope = await RecordEnvelope.createFromProtobuf(data) const valid = await envelope.validate(domain) @@ -114,14 +114,14 @@ export class RecordEnvelope implements Envelope { /** * Verifies if the other Envelope is identical to this one */ - equals (other: Envelope) { + equals (other: Envelope): boolean { return uint8ArrayEquals(this.marshal(), other.marshal()) } /** * Validate envelope data signature for the given domain */ - async validate (domain: string) { + async validate (domain: string): Promise { const signData = formatSignaturePayload(domain, this.payloadType, this.payload) if (this.peerId.publicKey == null) { diff --git a/src/peer-record/index.ts b/src/peer-record/index.ts index bfd729ebdc..a9979a6741 100644 --- a/src/peer-record/index.ts +++ b/src/peer-record/index.ts @@ -62,7 +62,7 @@ export class PeerRecord { /** * Marshal a record to be used in an envelope */ - marshal () { + marshal (): Uint8Array { if (this.marshaled == null) { this.marshaled = Protobuf.encode({ peerId: this.peerId.toBytes(), @@ -79,7 +79,7 @@ export class PeerRecord { /** * Returns true if `this` record equals the `other` */ - equals (other: unknown) { + equals (other: unknown): boolean { if (!(other instanceof PeerRecord)) { return false } diff --git a/test/envelope.spec.ts b/test/envelope.spec.ts index fc243e1ab8..0a68dc17db 100644 --- a/test/envelope.spec.ts +++ b/test/envelope.spec.ts @@ -21,11 +21,11 @@ class TestRecord implements Record { this.data = data } - marshal () { + marshal (): Uint8Array { return uint8arrayFromString(this.data) } - equals (other: Record) { + equals (other: Record): boolean { return uint8ArrayEquals(this.marshal(), other.marshal()) } }