Skip to main content

Artifact

Struct Artifact 

Source
pub struct Artifact {
    pub version: ArtifactVersion,
    pub artifact_id: ArtifactId,
    pub timestamp: DateTime<Utc>,
    pub intent: Intent,
    pub author_pubkey: [u8; 32],
    pub author_signature: [u8; 64],
    pub flags: u8,
    pub reserved_a: u8,
    pub note_hash: [u8; 32],
    pub seal_pubkey: [u8; 32],
    pub seal_signature: [u8; 64],
}
Expand description

Complete artifact structure (supports both v1 and v2)

Fields§

§version: ArtifactVersion§artifact_id: ArtifactId§timestamp: DateTime<Utc>§intent: Intent§author_pubkey: [u8; 32]§author_signature: [u8; 64]§flags: u8§reserved_a: u8§note_hash: [u8; 32]§seal_pubkey: [u8; 32]§seal_signature: [u8; 64]

Implementations§

Source§

impl Artifact

Source

pub fn from_bytes(bytes: &[u8]) -> Result<Self>

Parse artifact from bytes (auto-detects v1 vs v2)

Source

pub fn author_signing_bytes(&self) -> Vec<u8>

Get bytes that were signed by author

Source

pub fn seal_signing_bytes(&self) -> Result<Vec<u8>>

Get bytes that were signed by seal (V2 only). Returns Err if the artifact has no seal (seal_pubkey is all zeros).

Source

pub fn to_bytes(&self) -> Vec<u8>

Serialize artifact to bytes

Source

pub fn write_to<W: Write>(&self, writer: &mut W) -> Result<()>

Write artifact to a writer

Source

pub fn read_from<R: Read>(reader: &mut R) -> Result<Self>

Read artifact from a reader

Source

pub fn author_fingerprint(&self) -> KeyFingerprint

Get author key fingerprint

Source

pub fn seal_fingerprint(&self) -> Option<KeyFingerprint>

Get seal key fingerprint (V2 only)

Source

pub fn is_sealed(&self) -> bool

Check if artifact is sealed

Source

pub fn has_author_signature(&self) -> bool

Check if artifact has author signature

Source

pub fn has_signature(&self) -> bool

Check if artifact has a signature (legacy compatibility)

Source

pub fn has_author_pubkey(&self) -> bool

Check if artifact has an author public key (keyless draft = all zeros)

Source

pub fn has_note_hash(&self) -> bool

Check if note hash is present (V2 only)

Source

pub fn state(&self) -> ArtifactState

Determine artifact state

Source

pub fn with_seal_flag(self) -> Self

Set seal flag (V1 only - returns new artifact with flag set)

Source

pub fn without_seal_flag(self) -> Self

Clear seal flag (V1 only - returns new artifact with flag cleared)

Source

pub fn without_author_signature(self) -> Self

Remove author signature

Source

pub fn without_signature(self) -> Self

Remove signature (legacy compatibility)

Source

pub fn without_seal_signature(self) -> Self

Remove seal signature (V2 only)

Source

pub fn with_seal(self, seal_pubkey: [u8; 32], seal_signature: [u8; 64]) -> Self

Add seal signature (V2 only)

Trait Implementations§

Source§

impl Clone for Artifact

Source§

fn clone(&self) -> Artifact

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Artifact

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V