#[non_exhaustive]pub struct MutablePointer {
pub publisher: PublicKey,
pub alias: String,
pub sequence: u64,
pub manifest: Hash,
pub version: Option<String>,
pub providers: Vec<ProviderLease>,
pub signature: Option<String>,
}Expand description
A signed mutable pointer to an immutable manifest.
Every accepted pointer has a publisher, alias, sequence, and manifest bound by an Ed25519 signature. A resolver accepts only a sequence greater than the currently accepted sequence for that publisher and alias.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.publisher: PublicKeyPublisher identity; this must match the signing key.
alias: StringPublisher-controlled alias.
sequence: u64Monotonically increasing update number.
manifest: HashImmutable manifest identified by this pointer.
version: Option<String>Optional semantic version used for version pinning.
providers: Vec<ProviderLease>Signed provider leases for the manifest.
signature: Option<String>Hex-encoded Ed25519 signature over the pointer without this field.
Implementations§
Source§impl MutablePointer
impl MutablePointer
Sourcepub fn new(
publisher: PublicKey,
alias: impl Into<String>,
manifest: Hash,
sequence: u64,
) -> Result<Self>
pub fn new( publisher: PublicKey, alias: impl Into<String>, manifest: Hash, sequence: u64, ) -> Result<Self>
Create an unsigned pointer without provider leases.
Call Self::sign before registering it with a resolver.
§Errors
Returns an error if the alias, sequence, or provider data is invalid.
Sourcepub fn new_with_providers(
publisher: PublicKey,
alias: impl Into<String>,
manifest: Hash,
sequence: u64,
providers: Vec<ProviderLease>,
) -> Result<Self>
pub fn new_with_providers( publisher: PublicKey, alias: impl Into<String>, manifest: Hash, sequence: u64, providers: Vec<ProviderLease>, ) -> Result<Self>
Create an unsigned pointer with provider leases.
§Errors
Returns an error if the alias, sequence, or provider data is invalid.
Sourcepub fn signed(
publisher: PublicKey,
alias: impl Into<String>,
manifest: Hash,
sequence: u64,
signing_key: &SigningKey,
) -> Result<Self>
pub fn signed( publisher: PublicKey, alias: impl Into<String>, manifest: Hash, sequence: u64, signing_key: &SigningKey, ) -> Result<Self>
Create and sign a pointer with a Dalek signing key.
§Errors
Returns an error if the pointer is invalid or the signer does not match the publisher.
Sourcepub fn signed_with_secret_key(
publisher: PublicKey,
alias: impl Into<String>,
manifest: Hash,
sequence: u64,
secret_key: &SecretKey,
) -> Result<Self>
pub fn signed_with_secret_key( publisher: PublicKey, alias: impl Into<String>, manifest: Hash, sequence: u64, secret_key: &SecretKey, ) -> Result<Self>
Create and sign a pointer with an iroh secret key.
§Errors
Returns an error if the pointer is invalid or the signer does not match the publisher.
Sourcepub fn with_version(self, version: impl Into<String>) -> Self
pub fn with_version(self, version: impl Into<String>) -> Self
Set a semantic version on this pointer.
Sourcepub fn with_provider(self, provider: ProviderLease) -> Self
pub fn with_provider(self, provider: ProviderLease) -> Self
Add a provider lease to this pointer.
Sourcepub fn with_providers(
self,
providers: impl IntoIterator<Item = ProviderLease>,
) -> Self
pub fn with_providers( self, providers: impl IntoIterator<Item = ProviderLease>, ) -> Self
Add several provider leases to this pointer.
Sourcepub const fn manifest_hash(&self) -> Hash
pub const fn manifest_hash(&self) -> Hash
Return the immutable manifest hash targeted by this pointer.
Sourcepub fn unsigned_bytes(&self) -> Result<Vec<u8>>
pub fn unsigned_bytes(&self) -> Result<Vec<u8>>
Serialize the pointer without its signature.
§Errors
Returns an error if the pointer is invalid or cannot be serialized.
Sourcepub fn sign(&mut self, signing_key: &SigningKey) -> Result<()>
pub fn sign(&mut self, signing_key: &SigningKey) -> Result<()>
Sign this pointer with an Ed25519 key.
§Errors
Returns an error if the signer does not match the publisher or the pointer cannot be serialized.
Sourcepub fn verify_signature(&self) -> Result<()>
pub fn verify_signature(&self) -> Result<()>
Verify the pointer’s signature and all provider leases.
§Errors
Returns an error if the signature, pointer, or provider lease is invalid.
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Validate non-cryptographic pointer fields.
§Errors
Returns an error if a pointer field or provider lease is invalid.
Trait Implementations§
Source§impl Clone for MutablePointer
impl Clone for MutablePointer
Source§fn clone(&self) -> MutablePointer
fn clone(&self) -> MutablePointer
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MutablePointer
impl Debug for MutablePointer
Source§impl<'de> Deserialize<'de> for MutablePointer
impl<'de> Deserialize<'de> for MutablePointer
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for MutablePointer
Source§impl PartialEq for MutablePointer
impl PartialEq for MutablePointer
Source§impl Serialize for MutablePointer
impl Serialize for MutablePointer
impl StructuralPartialEq for MutablePointer
Auto Trait Implementations§
impl Freeze for MutablePointer
impl RefUnwindSafe for MutablePointer
impl Send for MutablePointer
impl Sync for MutablePointer
impl Unpin for MutablePointer
impl UnsafeUnpin for MutablePointer
impl UnwindSafe for MutablePointer
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more