@libp2p/peer-id 1.1.13 → 1.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/src/index.js CHANGED
@@ -15,7 +15,7 @@ const baseDecoder = Object
15
15
  // these values are from https://github.com/multiformats/multicodec/blob/master/table.csv
16
16
  const LIBP2P_KEY_CODE = 0x72;
17
17
  const MARSHALLED_ED225519_PUBLIC_KEY_LENGTH = 36;
18
- const MARSHALLED_SECP258K1_PUBLIC_KEY_LENGTH = 37;
18
+ const MARSHALLED_SECP256K1_PUBLIC_KEY_LENGTH = 37;
19
19
  class PeerIdImpl {
20
20
  constructor(init) {
21
21
  this.type = init.type;
@@ -133,7 +133,7 @@ export function peerIdFromBytes(buf) {
133
133
  if (multihash.digest.length === MARSHALLED_ED225519_PUBLIC_KEY_LENGTH) {
134
134
  return new Ed25519PeerIdImpl({ multihash });
135
135
  }
136
- else if (multihash.digest.length === MARSHALLED_SECP258K1_PUBLIC_KEY_LENGTH) {
136
+ else if (multihash.digest.length === MARSHALLED_SECP256K1_PUBLIC_KEY_LENGTH) {
137
137
  return new Secp256k1PeerIdImpl({ multihash });
138
138
  }
139
139
  }
@@ -158,7 +158,7 @@ export function peerIdFromCID(cid) {
158
158
  if (multihash.digest.length === MARSHALLED_ED225519_PUBLIC_KEY_LENGTH) {
159
159
  return new Ed25519PeerIdImpl({ multihash: cid.multihash });
160
160
  }
161
- else if (multihash.digest.length === MARSHALLED_SECP258K1_PUBLIC_KEY_LENGTH) {
161
+ else if (multihash.digest.length === MARSHALLED_SECP256K1_PUBLIC_KEY_LENGTH) {
162
162
  return new Secp256k1PeerIdImpl({ multihash: cid.multihash });
163
163
  }
164
164
  }
@@ -172,7 +172,7 @@ export async function peerIdFromKeys(publicKey, privateKey) {
172
172
  if (publicKey.length === MARSHALLED_ED225519_PUBLIC_KEY_LENGTH) {
173
173
  return new Ed25519PeerIdImpl({ multihash: Digest.create(identity.code, publicKey), privateKey });
174
174
  }
175
- if (publicKey.length === MARSHALLED_SECP258K1_PUBLIC_KEY_LENGTH) {
175
+ if (publicKey.length === MARSHALLED_SECP256K1_PUBLIC_KEY_LENGTH) {
176
176
  return new Secp256k1PeerIdImpl({ multihash: Digest.create(identity.code, publicKey), privateKey });
177
177
  }
178
178
  return new RSAPeerIdImpl({ multihash: await sha256.digest(publicKey), publicKey, privateKey });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@libp2p/peer-id",
3
- "version": "1.1.13",
3
+ "version": "1.1.14",
4
4
  "description": "Implementation of @libp2p/interface-peer-d",
5
5
  "license": "Apache-2.0 OR MIT",
6
6
  "homepage": "https://github.com/libp2p/js-libp2p-peer-id/tree/master/packages/libp2p-peer-id#readme",
package/src/index.ts CHANGED
@@ -21,7 +21,7 @@ const baseDecoder = Object
21
21
  const LIBP2P_KEY_CODE = 0x72
22
22
 
23
23
  const MARSHALLED_ED225519_PUBLIC_KEY_LENGTH = 36
24
- const MARSHALLED_SECP258K1_PUBLIC_KEY_LENGTH = 37
24
+ const MARSHALLED_SECP256K1_PUBLIC_KEY_LENGTH = 37
25
25
 
26
26
  interface PeerIdInit {
27
27
  type: 'RSA' | 'Ed25519' | 'secp256k1'
@@ -195,7 +195,7 @@ export function peerIdFromBytes (buf: Uint8Array) {
195
195
  if (multihash.code === identity.code) {
196
196
  if (multihash.digest.length === MARSHALLED_ED225519_PUBLIC_KEY_LENGTH) {
197
197
  return new Ed25519PeerIdImpl({ multihash })
198
- } else if (multihash.digest.length === MARSHALLED_SECP258K1_PUBLIC_KEY_LENGTH) {
198
+ } else if (multihash.digest.length === MARSHALLED_SECP256K1_PUBLIC_KEY_LENGTH) {
199
199
  return new Secp256k1PeerIdImpl({ multihash })
200
200
  }
201
201
  }
@@ -222,7 +222,7 @@ export function peerIdFromCID (cid: CID): PeerId {
222
222
  } else if (multihash.code === identity.code) {
223
223
  if (multihash.digest.length === MARSHALLED_ED225519_PUBLIC_KEY_LENGTH) {
224
224
  return new Ed25519PeerIdImpl({ multihash: cid.multihash })
225
- } else if (multihash.digest.length === MARSHALLED_SECP258K1_PUBLIC_KEY_LENGTH) {
225
+ } else if (multihash.digest.length === MARSHALLED_SECP256K1_PUBLIC_KEY_LENGTH) {
226
226
  return new Secp256k1PeerIdImpl({ multihash: cid.multihash })
227
227
  }
228
228
  }
@@ -239,7 +239,7 @@ export async function peerIdFromKeys (publicKey: Uint8Array, privateKey?: Uint8A
239
239
  return new Ed25519PeerIdImpl({ multihash: Digest.create(identity.code, publicKey), privateKey })
240
240
  }
241
241
 
242
- if (publicKey.length === MARSHALLED_SECP258K1_PUBLIC_KEY_LENGTH) {
242
+ if (publicKey.length === MARSHALLED_SECP256K1_PUBLIC_KEY_LENGTH) {
243
243
  return new Secp256k1PeerIdImpl({ multihash: Digest.create(identity.code, publicKey), privateKey })
244
244
  }
245
245