pub enum MatterCode {
Show 110 variants
Ed25519Seed,
Ed25519N,
X25519,
Ed25519,
Blake3_256,
Blake2b_256,
Blake2s_256,
SHA3_256,
SHA2_256,
ECDSA256k1Seed,
Ed448Seed,
X448,
Short,
Big,
X25519Private,
X25519CipherSeed,
ECDSA256r1Seed,
Tall,
Large,
Great,
Vast,
Label1,
Label2,
Tag3,
Tag7,
Tag11,
Salt256,
Salt128,
Ed25519Sig,
ECDSA256k1Sig,
Blake3_512,
Blake2b_512,
SHA3_512,
SHA2_512,
Long,
ECDSA256r1Sig,
Tag1,
Tag2,
Tag5,
Tag6,
Tag9,
Tag10,
GramHeadNeck,
GramHead,
GramHeadAIDNeck,
GramHeadAID,
ECDSA256k1N,
ECDSA256k1,
Ed448N,
Ed448,
Ed448Sig,
Tag4,
DateTime,
X25519CipherSalt,
ECDSA256r1N,
ECDSA256r1,
Null,
No,
Yes,
Tag8,
Escape,
Empty,
TBD0S,
TBD0,
TBD1S,
TBD1,
TBD2S,
TBD2,
StrB64_L0,
StrB64_L1,
StrB64_L2,
StrB64Big_L0,
StrB64Big_L1,
StrB64Big_L2,
Bytes_L0,
Bytes_L1,
Bytes_L2,
BytesBig_L0,
BytesBig_L1,
BytesBig_L2,
X25519Cipher_L0,
X25519Cipher_L1,
X25519Cipher_L2,
X25519CipherBig_L0,
X25519CipherBig_L1,
X25519CipherBig_L2,
X25519CipherQB64_L0,
X25519CipherQB64_L1,
X25519CipherQB64_L2,
X25519CipherQB64Big_L0,
X25519CipherQB64Big_L1,
X25519CipherQB64Big_L2,
X25519CipherQB2_L0,
X25519CipherQB2_L1,
X25519CipherQB2_L2,
X25519CipherQB2Big_L0,
X25519CipherQB2Big_L1,
X25519CipherQB2Big_L2,
HPKEBaseCipher_L0,
HPKEBaseCipher_L1,
HPKEBaseCipher_L2,
HPKEBaseCipherBig_L0,
HPKEBaseCipherBig_L1,
HPKEBaseCipherBig_L2,
Decimal_L0,
Decimal_L1,
Decimal_L2,
DecimalBig_L0,
DecimalBig_L1,
DecimalBig_L2,
}core only.Expand description
All Matter CESR primitive codes as a single untyped enum.
Each variant maps to a unique Base64 code string via #[strum(serialize = "...")].
For typed access to specific subsets use DigestCode, VerKeyCode, etc.
Variants§
Ed25519Seed
Ed25519 256-bit random seed for a private key (A).
Ed25519N
Ed25519 verification key, non-transferable basic derivation (B).
X25519
X25519 public encryption key, may be converted from Ed25519 or Ed25519N (C).
Ed25519
Ed25519 verification key, basic derivation (D).
Blake3_256
BLAKE3 256-bit digest, self-addressing derivation (E).
Blake2b_256
BLAKE2b 256-bit digest, self-addressing derivation (F).
Blake2s_256
BLAKE2s 256-bit digest, self-addressing derivation (G).
SHA3_256
SHA3-256 digest, self-addressing derivation (H).
SHA2_256
SHA2-256 digest, self-addressing derivation (I).
ECDSA256k1Seed
ECDSA secp256k1 256-bit random seed for a private key (J).
Ed448Seed
Ed448 448-bit random seed for a private key (K).
X448
X448 public encryption key, converted from Ed448 (L).
Short
Short 2-byte integer (M).
Big
Big 8-byte integer (N).
X25519Private
X25519 private decryption key/seed, may be converted from Ed25519 (O).
X25519CipherSeed
X25519 sealed box 124-char qb64 cipher of a 44-char qb64 seed (P).
ECDSA256r1Seed
ECDSA secp256r1 256-bit random seed for a private key (Q).
Tall
Tall 5-byte integer (R).
Large
Large 11-byte integer (S).
Great
Great 14-byte integer (T).
Vast
Vast 17-byte integer (U).
Label1
Label1: 1-byte label with lead size 1 (V).
Label2
Label2: 2-byte label with lead size 0 (W).
Tag3
Tag3: 3 Base64-encoded chars for special values (X).
Tag7
Tag7: 7 Base64-encoded chars for special values (Y).
Tag11
Tag11: 11 Base64-encoded chars for special values (Z).
Salt256
Salt/seed/nonce/blind, 256 bits (a).
Salt128
Salt/seed/nonce, 128 bits, or “Huge” number (0A).
Ed25519Sig
Ed25519 signature (0B).
ECDSA256k1Sig
ECDSA secp256k1 signature (0C).
Blake3_512
BLAKE3 512-bit digest, self-addressing derivation (0D).
Blake2b_512
BLAKE2b 512-bit digest, self-addressing derivation (0E).
SHA3_512
SHA3-512 digest, self-addressing derivation (0F).
SHA2_512
SHA2-512 digest, self-addressing derivation (0G).
Long
Long 4-byte integer (0H).
ECDSA256r1Sig
ECDSA secp256r1 signature (0I).
Tag1
Tag1: 1 Base64 char + 1 prepad for special values (0J).
Tag2
Tag2: 2 Base64-encoded chars for special values (0K).
Tag5
Tag5: 5 Base64-encoded chars + 1 prepad for special values (0L).
Tag6
Tag6: 6 Base64-encoded chars for special values (0M).
Tag9
Tag9: 9 Base64-encoded chars + 1 prepad for special values (0N).
Tag10
Tag10: 10 Base64-encoded chars for special values (0O).
GramHeadNeck
GramHeadNeck: 32 Base64 chars for a memogram head with neck (0P).
GramHead
GramHead: 28 Base64 chars for a memogram head only (0Q).
GramHeadAIDNeck
GramHeadAIDNeck: 76 Base64 chars for a memogram head with AID and neck (0R).
GramHeadAID
GramHeadAID: 72 Base64 chars for a memogram head with AID only (0S).
ECDSA256k1N
ECDSA secp256k1 verification key, non-transferable basic derivation (1AAA).
ECDSA256k1
ECDSA secp256k1 public verification or encryption key, basic derivation (1AAB).
Ed448N
Ed448 non-transferable public signing verification key, basic derivation (1AAC).
Ed448
Ed448 public signing verification key, basic derivation (1AAD).
Ed448Sig
Ed448 signature, self-signing derivation (1AAE).
Tag4
Tag4: 4 Base64-encoded chars for special values (1AAF).
DateTime
Base64 custom-encoded 32-char ISO-8601 DateTime (1AAG).
X25519CipherSalt
X25519 sealed box 100-char qb64 cipher of a 24-char qb64 salt (1AAH).
ECDSA256r1N
ECDSA secp256r1 verification key, non-transferable basic derivation (1AAI).
ECDSA256r1
ECDSA secp256r1 verification or encryption key, basic derivation (1AAJ).
Null
Null / None / empty value (1AAK).
No
Boolean false value (1AAL).
Yes
Boolean true value (1AAM).
Tag8
Tag8: 8 Base64-encoded chars for special values (1AAN).
Escape
Escape code for escaping special map fields (1AAO).
Empty
Empty value for Nonce, UUID, or related fields (1AAP).
TBD0S
Testing only: fixed special values with non-empty raw, lead size 0 (1__-).
TBD0
Testing only: fixed with lead size 0 (1___).
TBD1S
Testing only: fixed special values with non-empty raw, lead size 1 (2__-).
TBD1
Testing only: fixed with lead size 1 (2___).
TBD2S
Testing only: fixed special values with non-empty raw, lead size 2 (3__-).
TBD2
Testing only: fixed with lead size 2 (3___).
StrB64_L0
Variable-length Base64-only string, lead size 0 (4A).
StrB64_L1
Variable-length Base64-only string, lead size 1 (5A).
StrB64_L2
Variable-length Base64-only string, lead size 2 (6A).
StrB64Big_L0
Variable-length Base64-only string (big), lead size 0 (7AAA).
StrB64Big_L1
Variable-length Base64-only string (big), lead size 1 (8AAA).
StrB64Big_L2
Variable-length Base64-only string (big), lead size 2 (9AAA).
Bytes_L0
Variable-length byte string, lead size 0 (4B).
Bytes_L1
Variable-length byte string, lead size 1 (5B).
Bytes_L2
Variable-length byte string, lead size 2 (6B).
BytesBig_L0
Variable-length byte string (big), lead size 0 (7AAB).
BytesBig_L1
Variable-length byte string (big), lead size 1 (8AAB).
BytesBig_L2
Variable-length byte string (big), lead size 2 (9AAB).
X25519Cipher_L0
X25519 sealed-box cipher of sniffable plaintext, lead size 0 (4C).
X25519Cipher_L1
X25519 sealed-box cipher of sniffable plaintext, lead size 1 (5C).
X25519Cipher_L2
X25519 sealed-box cipher of sniffable plaintext, lead size 2 (6C).
X25519CipherBig_L0
X25519 sealed-box cipher of sniffable plaintext (big), lead size 0 (7AAC).
X25519CipherBig_L1
X25519 sealed-box cipher of sniffable plaintext (big), lead size 1 (8AAC).
X25519CipherBig_L2
X25519 sealed-box cipher of sniffable plaintext (big), lead size 2 (9AAC).
X25519CipherQB64_L0
X25519 sealed-box cipher of qb64 plaintext, lead size 0 (4D).
X25519CipherQB64_L1
X25519 sealed-box cipher of qb64 plaintext, lead size 1 (5D).
X25519CipherQB64_L2
X25519 sealed-box cipher of qb64 plaintext, lead size 2 (6D).
X25519CipherQB64Big_L0
X25519 sealed-box cipher of qb64 plaintext (big), lead size 0 (7AAD).
X25519CipherQB64Big_L1
X25519 sealed-box cipher of qb64 plaintext (big), lead size 1 (8AAD).
X25519CipherQB64Big_L2
X25519 sealed-box cipher of qb64 plaintext (big), lead size 2 (9AAD).
X25519CipherQB2_L0
X25519 sealed-box cipher of qb2 plaintext, lead size 0 (4E).
X25519CipherQB2_L1
X25519 sealed-box cipher of qb2 plaintext, lead size 1 (5E).
X25519CipherQB2_L2
X25519 sealed-box cipher of qb2 plaintext, lead size 2 (6E).
X25519CipherQB2Big_L0
X25519 sealed-box cipher of qb2 plaintext (big), lead size 0 (7AAE).
X25519CipherQB2Big_L1
X25519 sealed-box cipher of qb2 plaintext (big), lead size 1 (8AAE).
X25519CipherQB2Big_L2
X25519 sealed-box cipher of qb2 plaintext (big), lead size 2 (9AAE).
HPKEBaseCipher_L0
HPKE Base cipher of sniffable plaintext, lead size 0 (4F).
HPKEBaseCipher_L1
HPKE Base cipher of sniffable plaintext, lead size 1 (5F).
HPKEBaseCipher_L2
HPKE Base cipher of sniffable plaintext, lead size 2 (6F).
HPKEBaseCipherBig_L0
HPKE Base cipher of sniffable plaintext (big), lead size 0 (7AAF).
HPKEBaseCipherBig_L1
HPKE Base cipher of sniffable plaintext (big), lead size 1 (8AAF).
HPKEBaseCipherBig_L2
HPKE Base cipher of sniffable plaintext (big), lead size 2 (9AAF).
Decimal_L0
Decimal Base64 float/int string, lead size 0 (4H).
Decimal_L1
Decimal Base64 float/int string, lead size 1 (5H).
Decimal_L2
Decimal Base64 float/int string, lead size 2 (6H).
DecimalBig_L0
Decimal Base64 float/int string (big), lead size 0 (7AAH).
DecimalBig_L1
Decimal Base64 float/int string (big), lead size 1 (8AAH).
DecimalBig_L2
Decimal Base64 float/int string (big), lead size 2 (9AAH).
Implementations§
Source§impl MatterCode
impl MatterCode
Sourcepub fn frame_size(stream: &[u8]) -> Result<usize, MatterBuildError>
pub fn frame_size(stream: &[u8]) -> Result<usize, MatterBuildError>
Full qb64 character size of the Matter primitive at the head of stream,
without decoding the raw body or validating pad/lead bits.
§Errors
MatterBuildError on unknown code, short soft field, non-UTF-8 soft, or size overflow.
Source§impl MatterCode
impl MatterCode
Sourcepub fn from_base64_stream(stream: &[u8]) -> Result<Self, ParsingError>
pub fn from_base64_stream(stream: &[u8]) -> Result<Self, ParsingError>
Parses a MatterCode from a Base64-encoded byte stream.
§Errors
Returns ParsingError if the stream is empty, too short, contains
invalid UTF-8, or does not match a known matter code.
Sourcepub fn from_stream(stream: &[u8]) -> Result<Self, ParsingError>
pub fn from_stream(stream: &[u8]) -> Result<Self, ParsingError>
Parses a MatterCode from a binary (qb2) byte stream.
§Errors
Returns ParsingError if the stream is empty, too short, or does
not match a known matter code.
Sourcepub const fn is_base64_text_code(&self) -> bool
pub const fn is_base64_text_code(&self) -> bool
BextCodex is codex of all variable sized Base64 Text (Bext) derivation codes.
Only provide defined codes.
Undefined are left out so that inclusion(exclusion) via ‘in’ operator works.
Sourcepub const fn is_text_code(&self) -> bool
pub const fn is_text_code(&self) -> bool
TextCodex is codex of all variable sized byte string (Text) derivation codes.
Only provide defined codes.
Undefined are left out so that inclusion(exclusion) via ‘in’ operator works.
Sourcepub const fn is_base_64_decimal(&self) -> bool
pub const fn is_base_64_decimal(&self) -> bool
DecimalCodex is codex of all variable sized Base64 String representation
of decimal numbers both signed and unsigned, float and int.
Only provide defined codes.
Undefined are left out so that inclusion(exclusion) via ‘in’ operator works.
Sourcepub const fn is_digest(&self) -> bool
pub const fn is_digest(&self) -> bool
DigCodex is codex all digest derivation codes. This is needed to ensure
delegated inception using a self-addressing derivation i.e. digest derivation
code.
Only provide defined codes.
Undefined are left out so that inclusion(exclusion) via ‘in’ operator works.
Sourcepub const fn is_nonce(&self) -> bool
pub const fn is_nonce(&self) -> bool
NonceCodex is codex all derivation codes for salty nonces (UUIDs) either
as random numbers or as digests deterministically derived from salty nonces.
Only provide defined codes.
Undefined are left out so that inclusion(exclusion) via “in” operator works.
Sourcepub const fn is_base64_num(&self) -> bool
pub const fn is_base64_num(&self) -> bool
NumCodex is codex of Base64 derivation codes for compactly representing
numbers across a wide rage of sizes.
Only provide defined codes.
Undefined are left out so that inclusion(exclusion) via “in” operator works.
Sourcepub const fn is_base64_tag(&self) -> bool
pub const fn is_base64_tag(&self) -> bool
TagCodex is codex of Base64 derivation codes for compactly representing
various small Base64 tag values as special code soft part values.
Only provide defined codes.
Undefined are left out so that inclusion(exclusion) via “in” operator works.
Sourcepub const fn is_label(&self) -> bool
pub const fn is_label(&self) -> bool
LabelCodex is codex of codes to compactly ser/des labels and string values
in maps or lists.
Only provide defined codes.
Undefined are left out so that inclusion(exclusion) via “in” operator works.
Sourcepub const fn is_prefix_derivation(&self) -> bool
pub const fn is_prefix_derivation(&self) -> bool
PreCodex is codex all identifier prefix derivation codes.
This is needed to verify valid inception events.
Only provide defined codes.
Undefined are left out so that inclusion(exclusion) via “in” operator works.
Sourcepub const fn is_non_transferable(&self) -> bool
pub const fn is_non_transferable(&self) -> bool
NonTransCodex is codex all non-transferable derivation codes
Only provide defined codes.
Undefined are left out so that inclusion(exclusion) via “in” operator works.
Sourcepub const fn is_prefix_non_digestive(&self) -> bool
pub const fn is_prefix_non_digestive(&self) -> bool
PreNonDigCodex is codex all prefixive but non-digestive derivation codes
Only provide defined codes.
Undefined are left out so that inclusion(exclusion) via “in” operator works.
Sourcepub const fn get_sizage(&self) -> Sizage
pub const fn get_sizage(&self) -> Sizage
Returns the Sizage descriptor for this code.
Sourcepub fn promote(&self, size: usize, lead: usize) -> Result<Self, ValidationError>
pub fn promote(&self, size: usize, lead: usize) -> Result<Self, ValidationError>
Promotes this variable-size code to the appropriate variant for the given size and lead.
§Errors
Returns ValidationError if the code cannot be promoted (e.g. fixed-size code,
size exceeds capacity, or invalid lead).
Sourcepub fn raw_size(&self) -> Result<usize, ValidationError>
pub fn raw_size(&self) -> Result<usize, ValidationError>
Returns raw size in bytes not including leader for a given code.
§Errors
Returns ValidationError::InvalidSizingOperation if the code is variable-size.
Sourcepub const fn is_special(&self) -> bool
pub const fn is_special(&self) -> bool
Returns true if this code is a special fixed-size code with soft data.
Trait Implementations§
Source§impl AsRef<str> for MatterCode
impl AsRef<str> for MatterCode
Source§impl CesrCode for MatterCode
impl CesrCode for MatterCode
Source§fn to_matter_code(&self) -> MatterCode
fn to_matter_code(&self) -> MatterCode
MatterCode.Source§fn as_str(&self) -> &'static str
fn as_str(&self) -> &'static str
Source§fn get_sizage(&self) -> Sizage
fn get_sizage(&self) -> Sizage
Sizage descriptor for this code.Source§fn raw_size(&self) -> Result<usize, ValidationError>
fn raw_size(&self) -> Result<usize, ValidationError>
Source§fn placeholder(&self) -> Result<String, ValidationError>
fn placeholder(&self) -> Result<String, ValidationError>
alloc only.DUMMY_CHAR. Read moreSource§impl Clone for MatterCode
impl Clone for MatterCode
Source§fn clone(&self) -> MatterCode
fn clone(&self) -> MatterCode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more