pub struct Sdk { /* private fields */ }Expand description
SDK for interacting with Universal Timestamping protocol.
Implementations§
Source§impl Sdk
impl Sdk
Sourcepub async fn stamp_files<D>(
&self,
files: &[PathBuf],
) -> Result<Vec<DetachedTimestamp>>
pub async fn stamp_files<D>( &self, files: &[PathBuf], ) -> Result<Vec<DetachedTimestamp>>
Creates a timestamp for the given files.
Sourcepub async fn stamp_digest<D>(
&self,
digests: &[Output<D>],
) -> Result<Vec<DetachedTimestamp>>
pub async fn stamp_digest<D>( &self, digests: &[Output<D>], ) -> Result<Vec<DetachedTimestamp>>
Creates a timestamp for the given digests.
Sourcepub async fn stamp_files_in<A, D>(
&self,
files: &[PathBuf],
allocator: A,
) -> Result<Vec<DetachedTimestamp<A>, A>>
pub async fn stamp_files_in<A, D>( &self, files: &[PathBuf], allocator: A, ) -> Result<Vec<DetachedTimestamp<A>, A>>
Creates a timestamp for the given files in the provided allocator.
§Note
This uses the allocator_api2 crate for allocator api.
Sourcepub async fn stamp_digests_in<A, D>(
&self,
digests: &[Output<D>],
allocator: A,
) -> Result<Vec<DetachedTimestamp<A>, A>>
pub async fn stamp_digests_in<A, D>( &self, digests: &[Output<D>], allocator: A, ) -> Result<Vec<DetachedTimestamp<A>, A>>
Creates a timestamp for the given digests in the provided allocator.
§Note
This uses the allocator_api2 crate for allocator api.
Source§impl Sdk
impl Sdk
Sourcepub async fn upgrade<A: Allocator + Clone>(
&self,
stamp: &mut DetachedTimestamp<A>,
) -> Result<BTreeMap<String, UpgradeResult>>
pub async fn upgrade<A: Allocator + Clone>( &self, stamp: &mut DetachedTimestamp<A>, ) -> Result<BTreeMap<String, UpgradeResult>>
Upgrades all pending attestations in the given detached timestamp.
Source§impl Sdk
impl Sdk
Sourcepub async fn verify(
&self,
file: impl AsRef<Path>,
timestamp: &DetachedTimestamp,
) -> Result<Vec<AttestationStatus>>
pub async fn verify( &self, file: impl AsRef<Path>, timestamp: &DetachedTimestamp, ) -> Result<Vec<AttestationStatus>>
Verifies the given file against the given detached timestamp, returning a list of attestation statuses.
Sourcepub async fn verify_in<A: Allocator + Clone>(
&self,
file: impl AsRef<Path>,
timestamp: &DetachedTimestamp<A>,
allocator: A,
) -> Result<Vec<AttestationStatus<A>, A>>
pub async fn verify_in<A: Allocator + Clone>( &self, file: impl AsRef<Path>, timestamp: &DetachedTimestamp<A>, allocator: A, ) -> Result<Vec<AttestationStatus<A>, A>>
Verifies the given file against the given detached timestamp, returning a list of attestation statuses.
This is the same as verify, but allows specifying a custom allocator for the attestation statuses.
§Note
This uses the allocator_api2 crate for allocator api.
Sourcepub async fn verify_digest<D: Digest>(
&self,
file: impl AsRef<Path>,
expected: &[u8],
) -> Result<()>
pub async fn verify_digest<D: Digest>( &self, file: impl AsRef<Path>, expected: &[u8], ) -> Result<()>
Verifies the digest of the given file against the expected digest.
Sourcepub fn aggregate_verify_results(
&self,
results: &[AttestationStatus],
) -> VerifyStatus
pub fn aggregate_verify_results( &self, results: &[AttestationStatus], ) -> VerifyStatus
Aggregate the individual attestation statuses into an overall verification status for the timestamp.
The earliest valid attestation timestamp is used as the timestamp for the overall status, if there is at least one valid attestation.
The logic is as follows:
- If there is at least one VALID attestation:
- If there are also INVALID or UNKNOWN attestations, the overall status is PARTIAL_VALID
- Otherwise, the overall status is VALID
- If there are no VALID attestations, but at least one PENDING attestation, the overall status is PENDING
- If there are no VALID attestations, but at least one UNKNOWN attestation, the overall status is UNKNOWN
- If there are no VALID or PENDING attestations, the overall status is INVALID
Source§impl Sdk
impl Sdk
Sourcepub fn try_builder_from_calendars(
calendars: impl IntoIterator<Item = Url>,
) -> Result<SdkBuilder, BuilderError>
pub fn try_builder_from_calendars( calendars: impl IntoIterator<Item = Url>, ) -> Result<SdkBuilder, BuilderError>
Create a new SDK builder with given calendars and default settings.