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

Commit

Permalink
fix: Typo in constant name (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
D4nte committed Jun 28, 2022
1 parent ba37d81 commit 9063b65
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/libp2p-peer-id/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const baseDecoder = Object
const LIBP2P_KEY_CODE = 0x72

const MARSHALLED_ED225519_PUBLIC_KEY_LENGTH = 36
const MARSHALLED_SECP258K1_PUBLIC_KEY_LENGTH = 37
const MARSHALLED_SECP256K1_PUBLIC_KEY_LENGTH = 37

interface PeerIdInit {
type: 'RSA' | 'Ed25519' | 'secp256k1'
Expand Down Expand Up @@ -195,7 +195,7 @@ export function peerIdFromBytes (buf: Uint8Array) {
if (multihash.code === identity.code) {
if (multihash.digest.length === MARSHALLED_ED225519_PUBLIC_KEY_LENGTH) {
return new Ed25519PeerIdImpl({ multihash })
} else if (multihash.digest.length === MARSHALLED_SECP258K1_PUBLIC_KEY_LENGTH) {
} else if (multihash.digest.length === MARSHALLED_SECP256K1_PUBLIC_KEY_LENGTH) {
return new Secp256k1PeerIdImpl({ multihash })
}
}
Expand All @@ -222,7 +222,7 @@ export function peerIdFromCID (cid: CID): PeerId {
} else if (multihash.code === identity.code) {
if (multihash.digest.length === MARSHALLED_ED225519_PUBLIC_KEY_LENGTH) {
return new Ed25519PeerIdImpl({ multihash: cid.multihash })
} else if (multihash.digest.length === MARSHALLED_SECP258K1_PUBLIC_KEY_LENGTH) {
} else if (multihash.digest.length === MARSHALLED_SECP256K1_PUBLIC_KEY_LENGTH) {
return new Secp256k1PeerIdImpl({ multihash: cid.multihash })
}
}
Expand All @@ -239,7 +239,7 @@ export async function peerIdFromKeys (publicKey: Uint8Array, privateKey?: Uint8A
return new Ed25519PeerIdImpl({ multihash: Digest.create(identity.code, publicKey), privateKey })
}

if (publicKey.length === MARSHALLED_SECP258K1_PUBLIC_KEY_LENGTH) {
if (publicKey.length === MARSHALLED_SECP256K1_PUBLIC_KEY_LENGTH) {
return new Secp256k1PeerIdImpl({ multihash: Digest.create(identity.code, publicKey), privateKey })
}

Expand Down

0 comments on commit 9063b65

Please sign in to comment.