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: [].}
- Source Edit
proc decode[T](_: typedesc[SignedPayload[T]]; buffer: seq[byte]): Result[ SignedPayload[T], EnvelopeError] {....raises: [].}
- Source Edit
proc encode(env: Envelope): Result[seq[byte], CryptoError] {....raises: [], tags: [].}
- Source Edit
proc encode[T](msg: SignedPayload[T]): Result[seq[byte], CryptoError] {. ...raises: [].}
- Source Edit
proc getField(pb: ProtoBuffer; field: int; value: var Envelope; domain: string): ProtoResult[ bool] {.inline, ...raises: [], tags: [RootEffect].}
- Source Edit
proc getField[T](pb: ProtoBuffer; field: int; value: var SignedPayload[T]): ProtoResult[ bool] {.inline, ...raises: [].}
- Source Edit
proc init(T: typedesc[Envelope]; privateKey: PrivateKey; payloadType: seq[byte]; payload: seq[byte]; domain: string): Result[Envelope, CryptoError] {. ...raises: [].}
- Source Edit
proc init[T](_: typedesc[SignedPayload[T]]; privateKey: PrivateKey; data: T): Result[ SignedPayload[T], CryptoError] {....raises: [].}
- Source Edit
proc write(pb: var ProtoBuffer; field: int; env: Envelope): Result[void, CryptoError] {....raises: [], tags: [].}
- Source Edit
Exports
-
Signature, decodeProposal, shortLog, toBytes, DigestSheme, init, write, sign, SupportedSchemesInt, macOpenArray, supported, Secret, $, ephemeral, selectBest, init, getBytes, safeConvert, init, createExchange, init, getBytes, public, toRawBytes, init, getField, init, toBytes, libp2p_pki_schemes, random, random, createProposal, init, write, write, key, newRng, getBytes, getPublicKey, getRawBytes, init, random, stretchKeys, exceptionToAssert, init, init, init, getField, iv, ==, verify, init, SupportedSchemes, toBytes, shuffle, CryptoError, ==, ECDHEScheme, mac, write, random, keyOpenArray, CryptoResult, ephemeral, init, init, shortLog, init, PublicKey, shortLog, PKScheme, init, init, PrivateKey, write, ivOpenArray, RsaDefaultKeySize, compilesOr, orError, decodeExchange, $, goffset, getOrder, KeyPair, init