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

fix: Typo in constant name #7

Merged
merged 1 commit into from
Jun 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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