@libp2p/peer-id
Advanced tools
Comparing version 1.1.1 to 1.1.2
import { CID } from 'multiformats/cid'; | ||
import type { MultibaseDecoder, MultibaseEncoder } from 'multiformats/bases/interface'; | ||
import type { MultihashDigest } from 'multiformats/hashes/interface'; | ||
declare const peerIdSymbol: unique symbol; | ||
interface PeerIdOptions { | ||
@@ -28,2 +29,5 @@ type: 'RSA' | 'Ed25519' | 'secp256k1'; | ||
constructor(opts: PeerIdOptions); | ||
static isPeerId(other: any): other is PeerId; | ||
get [Symbol.toStringTag](): string; | ||
get [peerIdSymbol](): boolean; | ||
toString(codec?: MultibaseEncoder<any>): string; | ||
@@ -30,0 +34,0 @@ toCID(): CID; |
@@ -9,2 +9,3 @@ import { CID } from 'multiformats/cid'; | ||
import errcode from 'err-code'; | ||
const peerIdSymbol = Symbol.for('@libp2p/peer-id'); | ||
const baseDecoder = Object | ||
@@ -25,2 +26,11 @@ .values(bases) | ||
} | ||
static isPeerId(other) { | ||
return peerIdSymbol in other; | ||
} | ||
get [Symbol.toStringTag]() { | ||
return peerIdSymbol.toString(); | ||
} | ||
get [peerIdSymbol]() { | ||
return true; | ||
} | ||
toString(codec) { | ||
@@ -27,0 +37,0 @@ if (codec == null) { |
{ | ||
"name": "@libp2p/peer-id", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "IPFS Peer Id implementation in Node.js", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0 OR MIT", |
@@ -12,2 +12,4 @@ import { CID } from 'multiformats/cid' | ||
const peerIdSymbol = Symbol.for('@libp2p/peer-id') | ||
const baseDecoder = Object | ||
@@ -59,2 +61,14 @@ .values(bases) | ||
static isPeerId (other: any): other is PeerId { | ||
return peerIdSymbol in other | ||
} | ||
get [Symbol.toStringTag] () { | ||
return peerIdSymbol.toString() | ||
} | ||
get [peerIdSymbol] () { | ||
return true | ||
} | ||
toString (codec?: MultibaseEncoder<any>) { | ||
@@ -61,0 +75,0 @@ if (codec == null) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27368
422