Skip to content
This repository was archived by the owner on Jul 21, 2023. It is now read-only.

Commit e0fd5e3

Browse files
authored
chore: upgrade aegir to 38.1.2 (#48)
1 parent 070a8b0 commit e0fd5e3

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@
171171
"@libp2p/interface-record-compliance-tests": "^2.0.0",
172172
"@libp2p/peer-id-factory": "^2.0.0",
173173
"@types/varint": "^6.0.0",
174-
"aegir": "^37.9.1",
174+
"aegir": "^38.1.2",
175175
"protons": "^6.0.0",
176176
"sinon": "^15.0.0"
177177
}

src/envelope/index.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export class RecordEnvelope implements Envelope {
2121
/**
2222
* Unmarshal a serialized Envelope protobuf message
2323
*/
24-
static createFromProtobuf = async (data: Uint8Array | Uint8ArrayList) => {
24+
static createFromProtobuf = async (data: Uint8Array | Uint8ArrayList): Promise<RecordEnvelope> => {
2525
const envelopeData = Protobuf.decode(data)
2626
const peerId = await peerIdFromKeys(envelopeData.publicKey)
2727

@@ -37,7 +37,7 @@ export class RecordEnvelope implements Envelope {
3737
* Seal marshals the given Record, places the marshaled bytes inside an Envelope
3838
* and signs it with the given peerId's private key
3939
*/
40-
static seal = async (record: Record, peerId: PeerId) => {
40+
static seal = async (record: Record, peerId: PeerId): Promise<RecordEnvelope> => {
4141
if (peerId.privateKey == null) {
4242
throw new Error('Missing private key')
4343
}
@@ -61,7 +61,7 @@ export class RecordEnvelope implements Envelope {
6161
* Open and certify a given marshalled envelope.
6262
* Data is unmarshalled and the signature validated for the given domain.
6363
*/
64-
static openAndCertify = async (data: Uint8Array | Uint8ArrayList, domain: string) => {
64+
static openAndCertify = async (data: Uint8Array | Uint8ArrayList, domain: string): Promise<RecordEnvelope> => {
6565
const envelope = await RecordEnvelope.createFromProtobuf(data)
6666
const valid = await envelope.validate(domain)
6767

@@ -114,14 +114,14 @@ export class RecordEnvelope implements Envelope {
114114
/**
115115
* Verifies if the other Envelope is identical to this one
116116
*/
117-
equals (other: Envelope) {
117+
equals (other: Envelope): boolean {
118118
return uint8ArrayEquals(this.marshal(), other.marshal())
119119
}
120120

121121
/**
122122
* Validate envelope data signature for the given domain
123123
*/
124-
async validate (domain: string) {
124+
async validate (domain: string): Promise<boolean> {
125125
const signData = formatSignaturePayload(domain, this.payloadType, this.payload)
126126

127127
if (this.peerId.publicKey == null) {

src/peer-record/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export class PeerRecord {
6262
/**
6363
* Marshal a record to be used in an envelope
6464
*/
65-
marshal () {
65+
marshal (): Uint8Array {
6666
if (this.marshaled == null) {
6767
this.marshaled = Protobuf.encode({
6868
peerId: this.peerId.toBytes(),
@@ -79,7 +79,7 @@ export class PeerRecord {
7979
/**
8080
* Returns true if `this` record equals the `other`
8181
*/
82-
equals (other: unknown) {
82+
equals (other: unknown): boolean {
8383
if (!(other instanceof PeerRecord)) {
8484
return false
8585
}

test/envelope.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ class TestRecord implements Record {
2121
this.data = data
2222
}
2323

24-
marshal () {
24+
marshal (): Uint8Array {
2525
return uint8arrayFromString(this.data)
2626
}
2727

28-
equals (other: Record) {
28+
equals (other: Record): boolean {
2929
return uint8ArrayEquals(this.marshal(), other.marshal())
3030
}
3131
}

0 commit comments

Comments
 (0)