Skip to content

Commit

Permalink
chore: upgrade aegir to 38.1.2 (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
maschad authored Feb 10, 2023
1 parent 070a8b0 commit e0fd5e3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
10 changes: 5 additions & 5 deletions src/envelope/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<RecordEnvelope> => {
const envelopeData = Protobuf.decode(data)
const peerId = await peerIdFromKeys(envelopeData.publicKey)

Expand All @@ -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<RecordEnvelope> => {
if (peerId.privateKey == null) {
throw new Error('Missing private key')
}
Expand All @@ -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<RecordEnvelope> => {
const envelope = await RecordEnvelope.createFromProtobuf(data)
const valid = await envelope.validate(domain)

Expand Down Expand Up @@ -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<boolean> {
const signData = formatSignaturePayload(domain, this.payloadType, this.payload)

if (this.peerId.publicKey == null) {
Expand Down
4 changes: 2 additions & 2 deletions src/peer-record/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions test/envelope.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
}
Expand Down

0 comments on commit e0fd5e3

Please sign in to comment.