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

Commit ba54f6a

Browse files
deps: bump aegir from 37.12.1 to 38.1.0 (#46)
* deps: bump aegir from 37.12.1 to 38.1.0 Bumps [aegir](https://github.com/ipfs/aegir) from 37.12.1 to 38.1.0. - [Release notes](https://github.com/ipfs/aegir/releases) - [Changelog](https://github.com/ipfs/aegir/blob/master/CHANGELOG.md) - [Commits](ipfs/aegir@v37.12.1...v38.1.0) --- updated-dependencies: - dependency-name: aegir dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * fix: add return types to methods and remove pointless awaits Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: achingbrain <alex@achingbrain.net>
1 parent 06e39f0 commit ba54f6a

File tree

6 files changed

+23
-23
lines changed

6 files changed

+23
-23
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"release": "npm run docs:no-publish && aegir run release && npm run docs"
4141
},
4242
"dependencies": {
43-
"aegir": "^37.9.0"
43+
"aegir": "^38.1.0"
4444
},
4545
"workspaces": [
4646
"packages/*"

packages/libp2p-peer-id-factory/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@
152152
"uint8arrays": "^4.0.2"
153153
},
154154
"devDependencies": {
155-
"aegir": "^37.9.0",
155+
"aegir": "^38.1.0",
156156
"protons": "^6.0.0",
157157
"util": "^0.12.4"
158158
},

packages/libp2p-peer-id-factory/src/index.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export function exportToProtobuf (peerId: RSAPeerId | Ed25519PeerId | Secp256k1P
5454
})
5555
}
5656

57-
export async function createFromProtobuf (buf: Uint8Array) {
57+
export async function createFromProtobuf (buf: Uint8Array): Promise<PeerId> {
5858
const {
5959
id,
6060
privKey,
@@ -68,21 +68,21 @@ export async function createFromProtobuf (buf: Uint8Array) {
6868
)
6969
}
7070

71-
export async function createFromJSON (obj: { id: string, privKey?: string, pubKey?: string }) {
71+
export async function createFromJSON (obj: { id: string, privKey?: string, pubKey?: string }): Promise<PeerId> {
7272
return await createFromParts(
7373
uint8ArrayFromString(obj.id, 'base58btc'),
7474
obj.privKey != null ? uint8ArrayFromString(obj.privKey, 'base64pad') : undefined,
7575
obj.pubKey != null ? uint8ArrayFromString(obj.pubKey, 'base64pad') : undefined
7676
)
7777
}
7878

79-
async function createFromParts (multihash: Uint8Array, privKey?: Uint8Array, pubKey?: Uint8Array) {
79+
async function createFromParts (multihash: Uint8Array, privKey?: Uint8Array, pubKey?: Uint8Array): Promise<PeerId> {
8080
if (privKey != null) {
8181
const key = await unmarshalPrivateKey(privKey)
8282

8383
return await createFromPrivKey(key)
8484
} else if (pubKey != null) {
85-
const key = await unmarshalPublicKey(pubKey)
85+
const key = unmarshalPublicKey(pubKey)
8686

8787
return await createFromPubKey(key)
8888
}

packages/libp2p-peer-id-factory/test/index.spec.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ describe('PeerId', () => {
4040

4141
it('can be created for a secp256k1 key', async () => {
4242
const id = await PeerIdFactory.createSecp256k1PeerId()
43-
const expB58 = base58btc.encode((await identity.digest(id.publicKey)).bytes).slice(1)
43+
const expB58 = base58btc.encode((identity.digest(id.publicKey)).bytes).slice(1)
4444
expect(id.toString()).to.equal(expB58)
4545
})
4646

@@ -154,33 +154,33 @@ describe('PeerId', () => {
154154

155155
it('recreate from embedded ed25519 key', async () => {
156156
const key = '12D3KooWRm8J3iL796zPFi2EtGGtUJn58AG67gcqzMFHZnnsTzqD'
157-
const id = await peerIdFromString(key)
157+
const id = peerIdFromString(key)
158158
expect(id.toString()).to.equal(key)
159159

160160
if (id.publicKey == null) {
161161
throw new Error('No pubic key found on Ed25519 key')
162162
}
163163

164-
const expB58 = base58btc.encode((await identity.digest(id.publicKey)).bytes).slice(1)
164+
const expB58 = base58btc.encode((identity.digest(id.publicKey)).bytes).slice(1)
165165
expect(id.toString()).to.equal(expB58)
166166
})
167167

168168
it('recreate from embedded secp256k1 key', async () => {
169169
const key = '16Uiu2HAm5qw8UyXP2RLxQUx5KvtSN8DsTKz8quRGqGNC3SYiaB8E'
170-
const id = await peerIdFromString(key)
170+
const id = peerIdFromString(key)
171171
expect(id.toString()).to.equal(key)
172172

173173
if (id.publicKey == null) {
174174
throw new Error('No pubic key found on secp256k1 key')
175175
}
176176

177-
const expB58 = base58btc.encode((await identity.digest(id.publicKey)).bytes).slice(1)
177+
const expB58 = base58btc.encode((identity.digest(id.publicKey)).bytes).slice(1)
178178
expect(id.toString()).to.equal(expB58)
179179
})
180180

181181
it('recreate from string key', async () => {
182182
const key = 'QmRsooYQasV5f5r834NSpdUtmejdQcpxXkK6qsozZWEihC'
183-
const id = await peerIdFromString(key)
183+
const id = peerIdFromString(key)
184184
expect(id.toString()).to.equal(key)
185185
})
186186

@@ -192,7 +192,7 @@ describe('PeerId', () => {
192192
throw new Error('No public key found on peer id created from secp256k1 public key')
193193
}
194194

195-
const expB58 = base58btc.encode((await identity.digest(id.publicKey)).bytes).slice(1)
195+
const expB58 = base58btc.encode((identity.digest(id.publicKey)).bytes).slice(1)
196196
expect(id.toString()).to.equal(expB58)
197197
})
198198

@@ -204,7 +204,7 @@ describe('PeerId', () => {
204204
throw new Error('No public key found on peer id created from secp256k1 private key')
205205
}
206206

207-
const expB58 = base58btc.encode((await identity.digest(id.publicKey)).bytes).slice(1)
207+
const expB58 = base58btc.encode((identity.digest(id.publicKey)).bytes).slice(1)
208208
expect(id.toString()).to.equal(expB58)
209209
})
210210

packages/libp2p-peer-id/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@
144144
"uint8arrays": "^4.0.2"
145145
},
146146
"devDependencies": {
147-
"aegir": "^37.9.0"
147+
"aegir": "^38.1.0"
148148
},
149149
"typedoc": {
150150
"entryPoint": "./src/index.ts"

packages/libp2p-peer-id/src/index.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,15 @@ class PeerIdImpl {
6666
})
6767
}
6868

69-
get [Symbol.toStringTag] () {
69+
get [Symbol.toStringTag] (): string {
7070
return `PeerId(${this.toString()})`
7171
}
7272

73-
get [symbol] () {
73+
get [symbol] (): boolean {
7474
return true
7575
}
7676

77-
toString () {
77+
toString (): string {
7878
if (this.string == null) {
7979
this.string = base58btc.encode(this.multihash.bytes).slice(1)
8080
}
@@ -84,18 +84,18 @@ class PeerIdImpl {
8484

8585
// return self-describing String representation
8686
// in default format from RFC 0001: https://github.com/libp2p/specs/pull/209
87-
toCID () {
87+
toCID (): CID {
8888
return CID.createV1(LIBP2P_KEY_CODE, this.multihash)
8989
}
9090

91-
toBytes () {
91+
toBytes (): Uint8Array {
9292
return this.multihash.bytes
9393
}
9494

9595
/**
96-
* Returns Multiaddr as a JSON encoded object
96+
* Returns Multiaddr as a JSON string
9797
*/
98-
toJSON () {
98+
toJSON (): string {
9999
return this.toString()
100100
}
101101

@@ -216,7 +216,7 @@ export function peerIdFromString (str: string, decoder?: MultibaseDecoder<any>):
216216
return peerIdFromBytes(baseDecoder.decode(str))
217217
}
218218

219-
export function peerIdFromBytes (buf: Uint8Array) {
219+
export function peerIdFromBytes (buf: Uint8Array): PeerId {
220220
try {
221221
const multihash = Digest.decode(buf)
222222

0 commit comments

Comments
 (0)