This module implements Signed Envelope.
Types
Envelope = object publicKey*: PublicKey domain*: string payloadType*: seq[byte] payload: seq[byte] signature*: Signature
- Source Edit
EnvelopeError = enum EnvelopeInvalidProtobuf, EnvelopeFieldMissing, EnvelopeInvalidSignature, EnvelopeWrongType
- Source Edit
SignedPayload[T] = object envelope*: Envelope data*: T
- Source Edit
Procs
proc decode(T: typedesc[Envelope]; buf: seq[byte]; domain: string): Result[ Envelope, EnvelopeError] {....raises: [Defect].}
- Source Edit
proc decode[T](_: typedesc[SignedPayload[T]]; buffer: seq[byte]): Result[ SignedPayload[T], EnvelopeError] {....raises: [Defect].}
- Source Edit
proc encode(env: Envelope): Result[seq[byte], CryptoError] {....raises: [Defect], tags: [].}
- Source Edit
proc encode[T](msg: SignedPayload[T]): Result[seq[byte], CryptoError] {. ...raises: [Defect].}
- Source Edit
proc getField(pb: ProtoBuffer; field: int; value: var Envelope; domain: string): ProtoResult[ bool] {.inline, ...raises: [Defect], tags: [RootEffect].}
- Source Edit
proc getField[T](pb: ProtoBuffer; field: int; value: var SignedPayload[T]): ProtoResult[ bool] {.inline, ...raises: [Defect].}
- Source Edit
proc init(T: typedesc[Envelope]; privateKey: PrivateKey; payloadType: seq[byte]; payload: seq[byte]; domain: string): Result[Envelope, CryptoError] {. ...raises: [Defect].}
- Source Edit
proc init[T](_: typedesc[SignedPayload[T]]; privateKey: PrivateKey; data: T): Result[ SignedPayload[T], CryptoError] {....raises: [Defect].}
- Source Edit
Exports
-
Signature, shortLog, $, toBytes, DigestSheme, init, write, sign, SupportedSchemesInt, decodeExchange, macOpenArray, supported, Secret, $, selectBest, init, getBytes, toRawBytes, init, createExchange, init, getBytes, public, getRawBytes, init, getField, init, toBytes, random, random, init, write, decodeProposal, ephemeral, newRng, write, getPublicKey, getBytes, init, random, ephemeral, init, key, stretchKeys, getField, iv, ==, verify, init, SupportedSchemes, init, libp2p_pki_schemes, toBytes, shuffle, CryptoError, ==, ECDHEScheme, createProposal, mac, write, random, keyOpenArray, CryptoResult, init, init, shortLog, init, shortLog, PKScheme, PublicKey, init, init, PrivateKey, write, ivOpenArray, RsaDefaultKeySize, orError, goffset, getOrder, KeyPair, init, init