Skip to main content

Module proof_json

Module proof_json 

Source
Expand description

Data Integrity proofs and key formats for the language SDKs, as JSON.

The Python reference’s vouch.crypto primitives (data_integrity, data_integrity_hybrid, multikey, ed25519_check, mldsa_check), once, with the reference’s behavior: the same checks in the same order, the same answer (a verdict, or a refusal with the reference’s text). The language SDKs keep only key objects and the Ed25519 / ML-DSA / SLH-DSA signing calls; the signing input, the proof shape, the proofValue encodings, the strict key and signature rules and every verification run here.

These are the primitives: a proof is checked against the key the caller names, with no issuer binding. The verifier’s decision (crate::decision) adds the binding.

One entry, rules_json, {"op": ...} in, JSON out; bytes are standard base64. A refusal is an Err: CoreError::Crypto for a key or signature the strict Ed25519 rules refuse (the reference’s WeakKeyError), CoreError::Json for anything else (ValueError).

Constants§

ED25519_SIGNATURE_SIZE
MAX_BASE58_ENCODE_BYTES
The cryptosuites a proof set can carry, in the order they are written. The most bytes base58Encode writes (an SLH-DSA signature is 7,856).
MLDSA44_PUBLIC_KEY_SIZE
MLDSA44_SIGNATURE_SIZE
PROOF_SET_SUITES
SLHDSA128_PUBLIC_KEY_SIZE
SLHDSA128_SIGNATURE_SIZE

Functions§

attach
Attach a signature to an unsigned proof of its cryptosuite: base58btc for Ed25519, base64url for ML-DSA-44 and SLH-DSA-SHA2-128s.
decode_eddsa_proof_value
The 64-byte Ed25519 signature in an eddsa-jcs-2022 proofValue: base58btc (“z”), exactly 64 bytes, and a signature the strict rules accept.
decode_mldsa44_proof_value
decode_slhdsa128_proof_value
ed25519_public_key_problem
Why the strict rules refuse an Ed25519 public key, or None: not 32 bytes, y >= p, a point of small order, or not a point on the curve.
ed25519_signature_problem
Why the strict rules refuse a 64-byte Ed25519 signature, or None: R not canonical or of small order, or S not below the group order L.
hash_data
The 64-byte Data Integrity signing input of document under the unsigned proof (its proofValue, if any, left out).
legacy_digest
The pre-alignment signing input (one SHA-256 over the document with the unsigned proof attached).
multikey_decode
A public-key Multikey’s algorithm and raw key, with the reference’s refusals: only a public-key codec, the algorithm’s exact length, a strict Ed25519 key, an SLH-DSA key in base64url (“u”) and the others in base58btc (“z”).
multikey_encode
A raw public key as a Multikey (no strict checks, as the reference).
paired_methods
The (ML-DSA-44, SLH-DSA) verificationMethods that pair with an Ed25519 one: the #key-2 and #key-3 slots of the same DID.
proof_suites
The suites of a document’s proof as a verifier counts them: one eddsa-jcs-2022 proof object is that suite; a proof set (exactly one eddsa-jcs-2022 proof, at least one post-quantum proof, at most one of each) is its members’ suites in PROOF_SET_SUITES order; else none.
rules_json
The proof rules, {"op": ...} in (bytes in standard base64):
rules_json_text
rules_json on a request text that may hold a secret key: the text and every string of the parsed request are wiped once the rule has run.
secret_multikey_decode
Read a secretKeyMultibase value: its algorithm and raw secret key, with the reference’s refusals (a public key, an unknown codec, a wrong size).
secret_multikey_encode
A secret key as a secretKeyMultibase value: the private-key multicodec and the key, base58btc (“z”) for Ed25519 (the 32-byte seed) and ML-DSA-44 (the 2560-byte packed key), base64url (“u”) for SLH-DSA-SHA2-128s.
unsecured_document
The document with no proof member.
verify_dual
Verify a proof set of exactly the Ed25519 and the ML-DSA-44 proof.
verify_eddsa
Verify the single eddsa-jcs-2022 proof of document with public_key. Ok(false) is a signature that does not verify; Err is a malformed proof or a key or signature the strict rules refuse. The pre-alignment signing input is accepted too.
verify_proof_set
Verify a proof set: the Ed25519 proof and every post-quantum proof must verify, and a post-quantum proof whose key is not given fails the set.