pub struct LawPackage {
pub name: String,
pub condition_text: String,
pub consequence_text: String,
pub author: String,
pub licence: String,
pub kind: LawKind,
pub asserted_at: Instant,
pub signature: Option<[u8; 64]>,
pub version: Option<String>,
}Expand description
A signed law package — a law declaration with provenance and cryptographic signature (T72, W10).
Fields§
§name: StringThe law’s name (matches LawDecl.name).
condition_text: StringThe law’s condition (canonical text form).
consequence_text: StringThe law’s consequence (canonical text form).
Who authored the law (DID or IRI).
licence: StringUnder what licence the law may be used (IRI).
kind: LawKindWhether the law is physical or fictional.
asserted_at: InstantWhen the law was authored.
signature: Option<[u8; 64]>Optional Ed25519 signature over the canonical encoding.
version: Option<String>Optional version tag for law evolution.
Implementations§
Source§impl LawPackage
impl LawPackage
Sourcepub fn new(
name: &str,
condition: &str,
consequence: &str,
author: &str,
licence: &str,
kind: LawKind,
asserted_at: Instant,
) -> Self
pub fn new( name: &str, condition: &str, consequence: &str, author: &str, licence: &str, kind: LawKind, asserted_at: Instant, ) -> Self
Create a new unsigned law package.
Sourcepub fn with_signature(self, sig: [u8; 64]) -> Self
pub fn with_signature(self, sig: [u8; 64]) -> Self
Attach a signature to the law package.
Sourcepub fn with_version(self, version: &str) -> Self
pub fn with_version(self, version: &str) -> Self
Attach a version tag.
Sourcepub fn canonical_bytes(&self) -> Vec<u8> ⓘ
pub fn canonical_bytes(&self) -> Vec<u8> ⓘ
Canonical encoding for signing — the bytes that the signature covers. This is a deterministic encoding of the law’s content (name + condition + consequence + author + licence + kind + asserted_at).