pub struct AccessToken {
pub version: u32,
pub package_fingerprint: String,
pub expires_at: u64,
pub secret: SecretValue,
}Expand description
A bearer access token authorizing unattended consumption of one package
(§7.2). Bound to its package by package_fingerprint, time-boxed by
expires_at, and proven by secret (whose BLAKE3 matches the
token_commitment sealed inside the package payload).
Debug is safe: secret is a SecretValue (redacted); the fingerprint
and expiry are not secrets.
Fields§
§version: u32Schema version.
package_fingerprint: StringFull BLAKE3 hex of the package’s sealed bytes — binds this token to exactly one package.
expires_at: u64Expiry (Unix seconds) — equals the package expires_at.
secret: SecretValueThe random token secret (factor 2). Serialized into the token artifact (which IS this credential), never into the package.
Implementations§
Source§impl AccessToken
impl AccessToken
Sourcepub fn to_bytes(&self) -> Result<Vec<u8>, CoreError>
pub fn to_bytes(&self) -> Result<Vec<u8>, CoreError>
Serialize the token to its artifact bytes (JSON). This file IS the bearer credential — deliver it over a channel separate from the package.
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self, CoreError>
pub fn from_bytes(bytes: &[u8]) -> Result<Self, CoreError>
Parse a token artifact produced by AccessToken::to_bytes.