Expand description
Cryptographic and authorization primitives for QHermes delegation chains.
§Layers
Crypto — key derivation and ML-DSA-65 signing/verification
Policy — permission encoding, scope subset enforcement, caveat evaluation
Delegation — credential issuance and chain verification
Wire — credential chain serialization and deserialization§Permission format
[res_len: u8][resource bytes][verb_len: u8][verb bytes]§Wire format
[version: u8 = 0x01][count: u32 LE][credentials...]
[issuer_pk: PK_SIZE][signature: SIG_SIZE][payload_len: u32 LE][payload bytes]§Timestamps
All Timestamp values are seconds since the Unix epoch. Passing
milliseconds or nanoseconds produces incorrect caveat evaluation.
§Domain separation
IdentityIsland::derive folds deployment and context into the HKDF
info parameter. Different deployment values yield independent key material
even when sharing the same master.
Structs§
- Bounded
Caveats - Validated sequence of fixed-size caveat records.
- Bounded
Scope - Validated, non-empty TLV sequence of permissions.
- Credential
- One link in a serialized credential chain as it appears on the wire.
- Delegation
Manifest - Parameters for issuing a credential in a delegation chain.
- Depth
- Sequential position of a credential within its delegation chain. The first credential issued by the root has depth 1.
- Identity
Island - ML-DSA-65 identity deterministically derived from a master seed via HKDF-SHA3-512.
- Public
Key - Reference to a
PK_SIZE-byte ML-DSA-65 public key. - Scope
Iter - Signature
- Reference to a
SIG_SIZE-byte ML-DSA-65 signature. - Timestamp
- Timestamp in seconds since the Unix epoch.
Enums§
- Kernel
Error - Errors returned by QHermes kernel operations.
- Role
- Role encoded in a credential payload.
Constants§
- CAVEAT_
SIZE - Byte length of one serialized caveat record: 1-byte tag + 8-byte timestamp.
- CREDENTIAL_
FIXED_ SIZE - Fixed bytes per credential record, excluding the payload:
PK_SIZE + SIG_SIZE + 4 (payload_len field). - MAX_
CAVEATS - Maximum number of caveats in a credential.
- MAX_
DEPTH - Maximum depth of a delegation chain. Longer chains are rejected at issuance, verification, and deserialization.
- MAX_
PAYLOAD_ SIZE - Maximum byte length of a payload, assuming all permissions at maximum TLV size and all caveat slots occupied.
- MAX_
SCOPE_ PERMS - Maximum number of permissions in a credential scope.
- PERM_
TLV_ MAX - Maximum byte length of the TLV encoding of one permission:
1 (res_len) + RESOURCE_LEN + 1 (verb_len) + VERB_LEN. - PK_SIZE
- Byte length of an ML-DSA-65 public key (verifying key).
- RESOURCE_
LEN - Maximum byte length of the resource field in a permission.
Fits a
u8-typed TLV length prefix. - SEED_
SIZE - Byte length of the HKDF seed and derived key material.
- SIG_
SIZE - Byte length of an ML-DSA-65 signature.
- VERB_
LEN - Maximum byte length of the verb field in a permission.
Fits a
u8-typed TLV length prefix.
Traits§
- Identity
Signer - Signing interface for any ML-DSA-65 identity: in-memory keys, HSM, TPM, or enclave.
Functions§
- enforce_
scope_ subset - Checks that every permission in
childis covered by at least one permission inparent. - evaluate_
caveats - Evaluates all caveats in
caveatsagainstnow. - issue_
credential - Serializes
manifestintopayload_outand signs it intosig_out. - not_
after - Constructs a not-after caveat record.
- not_
before - Constructs a not-before caveat record.
- perm_
tlv - Encodes a
(resource, verb)permission intooutusing TLV format. - read_
credential_ chain - Deserializes
wireintochain. All slices point intowire. Returns the credential count. - verify_
delegation - Verifies a credential chain rooted at
root_pkagainsttimestamp. - verify_
signature - Verifies an ML-DSA-65 signature over
payloadunderpk. - write_
credential_ chain - Serializes
chainintoout. Returns bytes written, orWireTruncatedifoutis too small.