Expand description

Overview

This crate contains a “lean” client to verify AKD proofs which doesn’t depend on any dependencies other than the native hashing implementation. This makes it suitable for embedded applications, e.g. inside limited clients (Android, iPhone, WebAssembly, etc) which may not have a large dependency library they can pull upon.

Present proof validation

At the time of this documentation authoring, we presently support LookupProof verification without depending on the full AKD library.

Planned future support

Going forward this crate will re-implement the client verifications of the base crate, but with this “lean” mentality in mind. Should you not be running in a constrained environment then feel free to simply use the base AKD library crate.

Features

The features of this library are

  1. default blake3: Blake3 256-bit hashing
  2. sha256: SHA2 256-bit hashing
  3. sha512: SHA3 512-bit hashing
  4. sha3_256: SHA3 256-bit hashing
  5. sha3_512: SHA3 512-bit hashing

which dictate which hashing function is used by the verification components. Blake3 256-bit hashing is the default implementation and utilizes the blake3 crate. Features sha256 and sha512 both utilize SHA2 cryptographic functions from the [sha2] crate. Lastly sha3_256 and sha3_512 features utilize the [sha3] crate for their hashing implementations. To utilize a hash implementation other than blake3, you should compile with

//          [disable blake3]      [enable other hash]
cargo build --no-default-features --features sha3_256

Additional features

Additionally there are some features not related to the underlying hash function utilization

  1. wasm: Compile with web-assembly support for WASM compilation
  2. wee_alloc: Utilize the WEE allocator, which is roughly 1KB instead of 10KB as a allocator but slower. This is helpful in cases of constrained binary footprint size to help minimize
  3. nostd: Disable use of the std library

You can compile and pack the WASM output with

wasm-pack build --features wasm

which currently has a resultant WASM file size of ~142KB and enabling wee_alloc yields roughly ~137KB binary size

Client Types

A small note about the types in this library. They are specifically independent of the main AKD crate because it’s assumed that to perform a verification at the edge, the client will have had to receive some over-the-air message which contains the data inside the proof. Therefore they’d need to be deserialized and handled independently of the AKD crate which wouldn’t be a dependency anyways. This is why the types are independent and specified separately from the core AKD types.

Modules

This module contains all of the structs which need to be constructed to verify any of the following AKD proofs

This module contains the client verification calls to verify different membership types

Structs

AKD client verification error

Enums

Client verification error codes

Type Definitions