Crate bc_envelope

Crate bc_envelope 

Source
Expand description

§Gordian Envelope: A Flexible Container for Structured Data

§Introduction

The Gordian Envelope protocol specifies a structured format for hierarchical binary data focused on the ability to transmit it in a privacy-focused way. Envelopes are designed to facilitate “smart documents” and have a number of unique features including: easy representation of a variety of semantic structures, a built-in Merkle-like digest tree, deterministic representation using CBOR, and the ability for the holder of a document to selectively encrypt or elide specific parts of a document without invalidating the document structure including the digest tree, or any cryptographic signatures that rely on it.

§Getting Started

[dependencies]
bc-envelope = "0.35.1"

§Specification

Gordian Envelope is currently specified in this IETF Internet Draft.

Envelopes are immutable. You create “mutations” by creating new envelopes from old envelopes.

§Basic Envelope Creation

§Adding Assertions

§Adding Assertions with a Predicate and Object

§Adding Assertions with an Assertion Envelope

§Removing and Replacing Assertions

§Queries

§Getting the basic parts of an envelope

§Getting assertions on an envelope

§Getting the specific types of an envelope

§Determining the type of an envelope

§Determining the type of an envelope’s subject

§Getting assertions and parts of assertions

§Extracting parts of envelopes as specific types

§Other queries

§Wrapping and Unwrapping Envelopes

§Formatting Envelopes

§Envelope notation

§Tree notation

  • Envelope::tree_format Formats an envelope in envelope tree notation.
  • [Envelope::tree_format_with_target] Formats an envelope in envelope tree notation, highlighting a target set of elements.

§CBOR diagnostic notation

§CBOR hexadecimal notation

  • Envelope::hex Formats an envelope in CBOR hexadecimal notation.
  • Envelope::hex_opt Formats an envelope in CBOR hexadecimal notation, with optional annotations.

§Working with the Digest Tree

§Semantic equivalence

§Structural identicality

§Signing and Verifying Signatures

§Signing

  • Envelope::add_signature Creates a signature for the envelope’s subject and returns a new envelope with a 'signed': Signature assertion.
  • Envelope::add_signature_opt Creates a signature for the envelope’s subject and returns a new envelope with a 'signed': Signature assertion.
  • Envelope::add_signatures Creates several signatures for the envelope’s subject and returns a new envelope with additional 'signed': Signature assertions.
  • Envelope::add_signatures_opt Creates several signatures for the envelope’s subject and returns a new envelope with additional 'signed': Signature assertions.
  • Envelope::add_signature Creates a signature for the envelope’s subject and returns a new envelope with a 'signed': Signature assertion.

§Verifying by returning a boolean

§Verifying by returning a result

§Helpers

§Splitting Envelopes with SSKR

§Encryption

§Public Key Encryption

§Compression

§Eliding, Encrypting, or Compressing Parts of an Envelope

§Decorrelating Envelopes using Salt

§Walking an Envelope’s Hierarchy

  • Envelope::walk Walk the envelope, calling the visitor function for each element.

§Envelope Expressions

§Constructing Expressions, Requests, and Responses

§Decoding Parameters and Results

Re-exports§

pub use base::Assertion;
pub use base::Envelope;
pub use base::EnvelopeCase;
pub use base::EnvelopeEncodable;
pub use base::Error;
pub use base::Result;
pub use base::elide;
pub use base::elide::ObscureAction;
pub use base::walk;
pub use base::walk::EdgeType;
pub use format::DigestDisplayFormat;
pub use format::EnvelopeSummary;
pub use format::FormatContext;
pub use format::FormatContextOpt;
pub use format::GLOBAL_FORMAT_CONTEXT;
pub use format::MermaidFormatOpts;
pub use format::MermaidOrientation;
pub use format::MermaidTheme;
pub use format::TreeFormatOpts;
pub use format::register_tags;
pub use format::register_tags_in;
pub use extension::SignatureMetadata;
pub use extension::attachment::Attachable;
pub use extension::attachment::Attachments;
pub use extension::expressions::Event;
pub use extension::expressions::EventBehavior;
pub use extension::expressions::Expression;
pub use extension::expressions::ExpressionBehavior;
pub use extension::expressions::Function;
pub use extension::expressions::IntoExpression;
pub use extension::expressions::Parameter;
pub use extension::expressions::Request;
pub use extension::expressions::RequestBehavior;
pub use extension::expressions::Response;
pub use extension::expressions::ResponseBehavior;
pub use extension::expressions::functions;
pub use extension::expressions::parameters;
pub use known_values;

Modules§

base
extension
format
prelude
seal
Envelope Sealing and Unsealing

Macros§

function_constant
A macro that declares a function at compile time.
impl_attachable
A macro for easily implementing the Attachable trait for types with an attachments field.
impl_envelope_decodable
parameter_constant
A macro that declares a parameter at compile time.
with_format_context
A macro to access the global format context for read-only operations.
with_format_context_mut
A macro to access the global format context for read-write operations.

Structs§

KnownValue
A value in a namespace of unsigned integers that represents a stand-alone ontological concept.
KnownValuesStore
A store that maps between Known Values and their assigned names.
PrivateKeyBase
A secure foundation for deriving multiple cryptographic keys.
PublicKeys
A container for an entity’s public cryptographic keys.

Enums§

EncapsulationPrivateKey
A private key used for key encapsulation mechanisms (KEM).
SigningOptions
Options for configuring signature creation.

Statics§

KNOWN_VALUES
The global registry of Known Values.

Traits§

Encrypter
A trait for types that can encapsulate shared secrets for public key encryption.
Signer
A trait for types capable of creating digital signatures.
Verifier
A trait for types capable of verifying digital signatures.