This module implementes API for libp2p peer.Serialization/Deserialization helpersprotobuf_serialization extension
Procs
func computeFieldSize(field: int; value: PeerId; ProtoType: type ProtobufExt; skipDefault: static bool): int {....raises: [].}
- Source Edit
func computeFieldSize(field`gensym100: int; value`gensym100: seq[PeerId]; ProtoType`gensym100: type ProtobufExt; skipDefault`gensym100: static bool): int {....raises: [].}
- Source Edit
func extractPublicKey(pid: PeerId; pubkey: var PublicKey): bool {....raises: [], 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] {. ...raises: [], tags: [], forbids: [].}
- Read PeerId from ProtoBuf's message and validate it Source Edit
func hasPublicKey(pid: PeerId): bool {....raises: [], 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: [], tags: [], forbids: [].}
-
Initialize peer id from raw binary representation data.
Returns true if peer was successfully initialiazed.
Source Edit proc init(pid: var PeerId; data: string): bool {....raises: [], tags: [RootEffect], forbids: [].}
-
Initialize peer id from legacy raw base58btc multihash text or CIDv1 libp2p-key multibase text.
Returns true if peer was successfully initialiazed.
Source Edit func init(t: typedesc[PeerId]; data: openArray[byte]): Result[PeerId, cstring] {. ...raises: [].}
- Create new peer id from raw binary representation data. Source Edit
proc init(t: typedesc[PeerId]; data: string): Result[PeerId, cstring] {. ...raises: [].}
- Create new peer id from legacy raw base58btc multihash text or CIDv1 libp2p-key multibase text. Source Edit
func match(pid: PeerId; pubkey: PublicKey): bool {....raises: [], tags: [RootEffect], forbids: [].}
- Returns true if pid matches public key pubkey. Source Edit
func match(pid: PeerId; seckey: PrivateKey): bool {....raises: [], tags: [RootEffect], forbids: [].}
- Returns true if pid matches private key seckey. Source Edit
proc readFieldInto(stream: InputStream; value: var PeerId; header: FieldHeader; ProtoType: type ProtobufExt): bool {. ...raises: [SerializationError, IOError], raises: [].}
- Source Edit
proc readFieldInto(stream`gensym100: InputStream; value`gensym100: var seq[PeerId]; header`gensym100: FieldHeader; ProtoType`gensym100: type ProtobufExt): bool {. ...raises: [SerializationError, IOError], raises: [].}
- Source Edit
func supportsPacked(_: type PeerId; ProtoType`gensym100: type ProtobufExt): bool {. ...raises: [].}
- Source Edit
func supportsPacked(_: type seq[PeerId]; ProtoType`gensym100: type ProtobufExt): bool {. ...raises: [].}
- Source Edit
proc toCidString(pid: PeerId; encoding = "base32"): Result[string, cstring] {. ...raises: [], tags: [RootEffect], forbids: [].}
- Return pid as CIDv1 libp2p-key text using multibase encoding. Source Edit
func write(pb: var ProtoBuffer; field: int; pid: PeerId) {....raises: [], tags: [], forbids: [].}
- Write PeerId value peerid to object pb using ProtoBuf's encoding. Source Edit
proc writeField(stream: OutputStream; field: int; value: PeerId; ProtoType: type ProtobufExt; skipDefault: static bool = false) {. ...raises: [IOError], raises: [].}
- Source Edit
proc writeField(stream`gensym100: OutputStream; field`gensym100: int; value`gensym100: seq[PeerId]; ProtoType`gensym100: type ProtobufExt; skipDefault`gensym100: static bool = false) {....raises: [IOError], raises: [].}
- Source Edit
Templates
template chroniclesFormatItIMPL(it: Opt[PeerId]): auto {..}
- Source Edit
template chroniclesFormatItIMPL(it: PeerId): auto {..}
- Source Edit