Expand description

Web3Utilities

web3utilities crate is a library offering commonly used cryptographic and timestamp data structures common in Web3, asymmetric cryptography, symmetric cryptography and timestamps.

This crate has implementations for constant-time equality by default for all data structures that involve symmetric, timestamp and asymmetric cryptography. There are also fmt::Debug implementations using Base58 encoding for Ed25519 and SR25519 data structures and hex encoding for X25519 and hashing data structures.

Utilities struct is also provided for commonly methods for conversions.

Structs

A representation of a 12 byte ChaCha AEAD Nonce default constant time equality checks, hex fmt::Debug and hex fmt::Display, and an implementation for Borsh encoding that ensure no two binary representations that deserialize into the same object and a possibly smaller code size compared to serde binary representations.

A representation of a 16 byte ChaCha AEAD Tag default constant time equality checks, hex fmt::Debug and hex fmt::Display, and an implementation for Borsh encoding that ensure no two binary representations that deserialize into the same object and a possibly smaller code size compared to serde binary representations.

A representation of a 24 byte ChaCha AEAD Extended Nonce default constant time equality checks, hex fmt::Debug and hex fmt::Display, and an implementation for Borsh encoding that ensure no two binary representations that deserialize into the same object and a possibly smaller code size compared to serde binary representations.

A representation of Blake3 hash byte representation with default constant time equality checks, hex fmt::Debug and hex fmt::Display, and an implementation for Borsh encoding that ensure no two binary representations that deserialize into the same object and a possibly smaller code size compared to serde binary representations.

A representation of a 32 byte Ed25519 public key with default constant time equality checks, hex fmt::Debug and hex fmt::Display, and an implementation for Borsh encoding that ensure no two binary representations that deserialize into the same object and a possibly smaller code size compared to serde binary representations.

A representation of a 64 byte Ed25519 signature with default constant time equality checks, hex fmt::Debug and hex fmt::Display, and an implementation for Borsh encoding that ensure no two binary representations that deserialize into the same object and a possibly smaller code size compared to serde binary representations.

A representation of a Vec of bytes with default constant time equality checks, hex fmt::Debug and hex fmt::Display, implementation for zeroize for zeroing memory when the value is dropped and an implementation for Borsh encoding that ensure no two binary representations that deserialize into the same object and a possibly smaller code size compared to serde binary representations.

A representation of a 32 byte secret key with default constant time equality checks, hex fmt::Debug and hex fmt::Display, implementation for zeroize for zeroing memory when the value is dropped and an implementation for Borsh encoding that ensure no two binary representations that deserialize into the same object and a possibly smaller code size compared to serde binary representations.

A representation of a Vec of bytes with default constant time equality checks, hex fmt::Debug and hex fmt::Display, implementation for zeroize for zeroing memory when the value is dropped and an implementation for Borsh encoding that ensure no two binary representations that deserialize into the same object and a possibly smaller code size compared to serde binary representations.

A representation of a 32 byte Sr25519 public key with default constant time equality checks, hex fmt::Debug and hex fmt::Display, and an implementation for Borsh encoding that ensure no two binary representations that deserialize into the same object and a possibly smaller code size compared to serde binary representations.

A representation of a 64 byte Sr25519 signature with default constant time equality checks, hex fmt::Debug and hex fmt::Display, and an implementation for Borsh encoding that ensure no two binary representations that deserialize into the same object and a possibly smaller code size compared to serde binary representations.

A representation of 12 byte Tai64N monotonic timestamp byte with default constant time equality checks, hex fmt::Debug and hex fmt::Display, and an implementation for Borsh encoding that ensure no two binary representations that deserialize into the same object and a possibly smaller code size compared to serde binary representations.

Utilities struct is used to group common methods for manipulation of bytes

The tally of the votes cast.

A representation of a 32 byte X25519 public key with default constant time equality checks, hex fmt::Debug and hex fmt::Display, and an implementation for Borsh encoding that ensure no two binary representations that deserialize into the same object and a possibly smaller code size compared to serde binary representations.

Enums

Implemetation for From<std::io::ErrorKind> for this crate

The total number of items or members required from a list in order to execute or approve a certain task

Common Errors

An instruction to either accept or reject a vote

An outcome of an election

Type Definitions

An array of 12 bytes. This does not implement hex or base58 fmt::Debug or constant time equality checks.

An array of 16 bytes common for ChaCha symmetric encryption AEAD tags. This does not implement hex or base58 fmt::Debug or constant time equality checks.

An array of 24 bytes common for 192 bit cryptographic keys. This does not implement hex or base58 fmt::Debug or constant time equality checks.

An array of 32 bytes common for 256 bit private and public keys. This does not implement hex or base58 fmt::Debug or constant time equality checks.

An array of 64 bytes common for 512 bit private and public keys. This does not implement hex or base58 fmt::Debug or constant time equality checks.

An array of 128 bytes common for 1024 bit private and public keys. This does not implement hex or base58 fmt::Debug or constant time equality checks.

An array of 256 bytes common for 2048 bit private and public keys. This does not implement hex or base58 fmt::Debug or constant time equality checks.

Common Unix timestamps are represented as u64

Common Unix timestamps are represented as i64

This data structure implements From for error types of the dependencies of this crate