This module implementes API for libp2p peer.Serialization/Deserialization helpers
Procs
func extractPublicKey(pid: PeerId; pubkey: var PublicKey): bool {....raises: [], public, ...tags: [RootEffect], forbids: [].}
-
Returns true if public key was successfully decoded from PeerId pidand stored to pubkey.
Returns false otherwise.
Source Edit func getField(pb: ProtoBuffer; field: int; pid: var PeerId): ProtoResult[bool] {. inline, ...raises: [], public, ...tags: [], forbids: [].}
- Read PeerId from ProtoBuf's message and validate it Source Edit
func hasPublicKey(pid: PeerId): bool {....raises: [], public, ...tags: [], forbids: [].}
- Returns true if pid is small enough to hold public key inside. Source Edit
func init(pid: var PeerId; data: openArray[byte]): bool {....raises: [], public, ...tags: [], forbids: [].}
-
Initialize peer id from raw binary representation data.
Returns true if peer was successfully initialiazed.
Source Edit func init(pid: var PeerId; data: string): bool {....raises: [], public, ...tags: [], forbids: [].}
-
Initialize peer id from base58 encoded string representation.
Returns true if peer was successfully initialiazed.
Source Edit func init(t: typedesc[PeerId]; data: openArray[byte]): Result[PeerId, cstring] {. ...raises: [], public.}
- Create new peer id from raw binary representation data. Source Edit
func init(t: typedesc[PeerId]; data: string): Result[PeerId, cstring] {. ...raises: [], public.}
- Create new peer id from base58 encoded string representation data. Source Edit
func match(pid: PeerId; pubkey: PublicKey): bool {....raises: [], public, ...tags: [RootEffect], forbids: [].}
- Returns true if pid matches public key pubkey. Source Edit
func match(pid: PeerId; seckey: PrivateKey): bool {....raises: [], public, ...tags: [RootEffect], forbids: [].}
- Returns true if pid matches private key seckey. Source Edit
func write(pb: var ProtoBuffer; field: int; pid: PeerId) {....raises: [], public, ...tags: [], forbids: [].}
- Write PeerId value peerid to object pb using ProtoBuf's encoding. Source Edit
Templates
template formatItIMPL(it: PeerId): auto
- Source Edit