pub struct OtsClient { /* private fields */ }Expand description
OTS client.
Implementations§
Source§impl OtsClient
impl OtsClient
Sourcepub fn with_servers(servers: Vec<String>) -> Self
pub fn with_servers(servers: Vec<String>) -> Self
Construct with custom calendar servers.
Sourcepub fn calendar_servers(&self) -> &[String]
pub fn calendar_servers(&self) -> &[String]
Available calendar servers.
Sourcepub async fn stamp(&self, hash: [u8; 32]) -> Result<OtsProof, OtsError>
pub async fn stamp(&self, hash: [u8; 32]) -> Result<OtsProof, OtsError>
Submit a hash for timestamping. Returns a mock proof immediately; real implementation would poll the calendar server until Bitcoin confirmation arrives (typically 1-12 hours).
Sourcepub async fn verify<F>(
&self,
proof: &OtsProof,
bitcoin_block_at_height: F,
) -> Result<OtsVerification, OtsError>
pub async fn verify<F>( &self, proof: &OtsProof, bitcoin_block_at_height: F, ) -> Result<OtsVerification, OtsError>
Verify a proof against Bitcoin block headers.
Caller provides a bitcoin_block_header_hash callback that returns
the block hash at the given height (real impl: query Bitcoin Core
RPC, or use a public blockchain API).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for OtsClient
impl RefUnwindSafe for OtsClient
impl Send for OtsClient
impl Sync for OtsClient
impl Unpin for OtsClient
impl UnsafeUnpin for OtsClient
impl UnwindSafe for OtsClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more