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

deps: bump aegir from 38.1.8 to 39.0.10 #69

Merged
merged 2 commits into from
Jun 15, 2023
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 package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"release": "npm run docs:no-publish && aegir run release && npm run docs"
},
"dependencies": {
"aegir": "^38.1.0"
"aegir": "^39.0.10"
},
"workspaces": [
"packages/*"
Expand Down
5 changes: 2 additions & 3 deletions packages/libp2p-peer-id-factory/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,8 @@
"uint8arrays": "^4.0.2"
},
"devDependencies": {
"aegir": "^38.1.0",
"protons": "^7.0.2",
"util": "^0.12.4"
"aegir": "^39.0.10",
"protons": "^7.0.2"
},
"typedoc": {
"entryPoint": "./src/index.ts"
Expand Down
14 changes: 7 additions & 7 deletions packages/libp2p-peer-id-factory/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { generateKeyPair, marshalPrivateKey, unmarshalPrivateKey, marshalPublicKey, unmarshalPublicKey } from '@libp2p/crypto/keys'
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
import { peerIdFromKeys, peerIdFromBytes } from '@libp2p/peer-id'
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
import { PeerIdProto } from './proto.js'
import type { PublicKey, PrivateKey } from '@libp2p/interface-keys'
import type { RSAPeerId, Ed25519PeerId, Secp256k1PeerId, PeerId } from '@libp2p/interface-peer-id'
Expand Down Expand Up @@ -39,11 +39,11 @@ export const createRSAPeerId = async (opts?: { bits: number }): Promise<RSAPeerI
}

export async function createFromPubKey (publicKey: PublicKey): Promise<PeerId> {
return await peerIdFromKeys(marshalPublicKey(publicKey))
return peerIdFromKeys(marshalPublicKey(publicKey))
}

export async function createFromPrivKey (privateKey: PrivateKey): Promise<PeerId> {
return await peerIdFromKeys(marshalPublicKey(privateKey.public), marshalPrivateKey(privateKey))
return peerIdFromKeys(marshalPublicKey(privateKey.public), marshalPrivateKey(privateKey))
}

export function exportToProtobuf (peerId: RSAPeerId | Ed25519PeerId | Secp256k1PeerId, excludePrivateKey?: boolean): Uint8Array {
Expand All @@ -61,15 +61,15 @@ export async function createFromProtobuf (buf: Uint8Array): Promise<PeerId> {
pubKey
} = PeerIdProto.decode(buf)

return await createFromParts(
return createFromParts(
id ?? new Uint8Array(0),
privKey,
pubKey
)
}

export async function createFromJSON (obj: { id: string, privKey?: string, pubKey?: string }): Promise<PeerId> {
return await createFromParts(
return createFromParts(
uint8ArrayFromString(obj.id, 'base58btc'),
obj.privKey != null ? uint8ArrayFromString(obj.privKey, 'base64pad') : undefined,
obj.pubKey != null ? uint8ArrayFromString(obj.pubKey, 'base64pad') : undefined
Expand All @@ -80,11 +80,11 @@ async function createFromParts (multihash: Uint8Array, privKey?: Uint8Array, pub
if (privKey != null) {
const key = await unmarshalPrivateKey(privKey)

return await createFromPrivKey(key)
return createFromPrivKey(key)
} else if (pubKey != null) {
const key = unmarshalPublicKey(pubKey)

return await createFromPubKey(key)
return createFromPubKey(key)
}

return peerIdFromBytes(multihash)
Expand Down
12 changes: 6 additions & 6 deletions packages/libp2p-peer-id-factory/test/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/* eslint max-nested-callbacks: ["error", 8] */
/* eslint-env mocha */

import { expect } from 'aegir/chai'
import util from 'util'
import { keys } from '@libp2p/crypto'
import { CID } from 'multiformats/cid'
import * as Digest from 'multiformats/hashes/digest'
import { peerIdFromString, peerIdFromBytes, peerIdFromCID, createPeerId } from '@libp2p/peer-id'
import { expect } from 'aegir/chai'
import { base16 } from 'multiformats/bases/base16'
import { base36 } from 'multiformats/bases/base36'
import { base58btc } from 'multiformats/bases/base58'
import { CID } from 'multiformats/cid'
import * as Digest from 'multiformats/hashes/digest'
import { identity } from 'multiformats/hashes/identity'
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
import { toString as uint8ArrayToString } from 'uint8arrays/to-string'
import { peerIdFromString, peerIdFromBytes, peerIdFromCID, createPeerId } from '@libp2p/peer-id'
import * as PeerIdFactory from '../src/index.js'
import util from 'util'
import testId from './fixtures/sample-id.js'
import goId from './fixtures/go-private-key.js'
import testId from './fixtures/sample-id.js'

const LIBP2P_KEY_CODE = 0x72
const RAW_CODE = 0x55
Expand Down
2 changes: 1 addition & 1 deletion packages/libp2p-peer-id/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
"uint8arrays": "^4.0.2"
},
"devDependencies": {
"aegir": "^38.1.0"
"aegir": "^39.0.10"
},
"typedoc": {
"entryPoint": "./src/index.ts"
Expand Down
15 changes: 6 additions & 9 deletions packages/libp2p-peer-id/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import { CID } from 'multiformats/cid'
import { bases } from 'multiformats/basics'
import { type Ed25519PeerId, type PeerIdType, type RSAPeerId, type Secp256k1PeerId, symbol, type PeerId } from '@libp2p/interface-peer-id'
import { CodeError } from '@libp2p/interfaces/errors'
import { base58btc } from 'multiformats/bases/base58'
import { bases } from 'multiformats/basics'
import { CID } from 'multiformats/cid'
import * as Digest from 'multiformats/hashes/digest'
import { identity } from 'multiformats/hashes/identity'
import { equals as uint8ArrayEquals } from 'uint8arrays/equals'
import { sha256 } from 'multiformats/hashes/sha2'
import { CodeError } from '@libp2p/interfaces/errors'
import { Ed25519PeerId, PeerIdType, RSAPeerId, Secp256k1PeerId, symbol } from '@libp2p/interface-peer-id'
import { equals as uint8ArrayEquals } from 'uint8arrays/equals'
import type { MultibaseDecoder } from 'multiformats/bases/interface'
import type { MultihashDigest } from 'multiformats/hashes/interface'
import type { PeerId } from '@libp2p/interface-peer-id'

const inspect = Symbol.for('nodejs.util.inspect.custom')

Expand Down Expand Up @@ -70,9 +69,7 @@ class PeerIdImpl {
return `PeerId(${this.toString()})`
}

get [symbol] (): boolean {
return true
}
readonly [symbol] = true

toString (): string {
if (this.string == null) {
Expand Down
2 changes: 1 addition & 1 deletion packages/libp2p-peer-id/test/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-env mocha */
import { expect } from 'aegir/chai'
import { createPeerId, peerIdFromBytes, peerIdFromString } from '../src/index.js'
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
import { createPeerId, peerIdFromBytes, peerIdFromString } from '../src/index.js'

describe('PeerId', () => {
it('create an id without \'new\'', () => {
Expand Down