RFC 9530 HTTP Digest Fields parsing, SHA-256 generation, verification, negotiation, and audit toolkit
let body = @base64.str2bytes("{\"hello\": \"world\"}\n")
let field = @digest.content_digest_sha256(body)
let result = @digest.verify_digest_field(
@digest.Content,
field,
body,
@digest.VerificationPolicy::default(),
)
println(result.decision.to_string()) // verifiedmoon update
moon test --target js
moon run cmd/main --target js
moon run examples/bench --target jspub(all) struct AuditEntry {
record_id : String
target : IntegrityTarget
field_value : String?
body : Bytes
} derive(Eq, Debug)pub(all) struct AuditFinding {
record_id : String
target : IntegrityTarget
decision : VerificationDecision
algorithm : String
code : String
} derive(Eq, Debug)pub(all) struct AuditReport {
findings : Array[AuditFinding]
verified : Int
mismatch : Int
invalid : Int
missing : Int
blocked : Int
too_large : Int
} derive(Eq, Debug)pub(all) struct Verification {
target : IntegrityTarget
decision : VerificationDecision
algorithm : String
code : String
checked : Int
ignored : Int
} derive(Eq, Debug)fn negotiate_digest_algorithm(preferences : PreferenceField, supported : Array[String]) -> NegotiationResultfn verify_digest(target : IntegrityTarget, field : DigestField, body : Bytes, policy : VerificationPolicy) -> Verificationfn verify_digest_field(target : IntegrityTarget, field_value : String, body : Bytes, policy : VerificationPolicy) -> VerificationInstall
Download zipRFC 9530 HTTP Digest Fields parsing, SHA-256 generation, verification, negotiation, and audit toolkit