pub struct Record { /* private fields */ }Implementations§
Source§impl Record
impl Record
Sourcepub fn new(
keypair: &Keypair,
value: impl AsRef<[u8]>,
eol: DateTime<Utc>,
seq: u64,
ttl: Duration,
) -> Result<Self, Error>
pub fn new( keypair: &Keypair, value: impl AsRef<[u8]>, eol: DateTime<Utc>, seq: u64, ttl: Duration, ) -> Result<Self, Error>
Creates and signs an IPNS record pointing at value, valid until the absolute eol
(End-Of-Life) timestamp. ttl is a caching hint for resolvers.
Sourcepub fn new_with_metadata(
keypair: &Keypair,
value: impl AsRef<[u8]>,
eol: DateTime<Utc>,
seq: u64,
ttl: Duration,
metadata: BTreeMap<String, Ipld>,
) -> Result<Self, Error>
pub fn new_with_metadata( keypair: &Keypair, value: impl AsRef<[u8]>, eol: DateTime<Utc>, seq: u64, ttl: Duration, metadata: BTreeMap<String, Ipld>, ) -> Result<Self, Error>
Like Record::new but attaches additional dag-cbor metadata keys to the record. Keys
must not collide with the reserved fields (Value, Validity, ValidityType, Sequence,
TTL).
pub fn decode(data: impl AsRef<[u8]>) -> Result<Self, Error>
pub fn encode(&self) -> Result<Vec<u8>, Error>
Source§impl Record
impl Record
pub fn sequence(&self) -> u64
pub fn validity_type(&self) -> ValidityType
pub fn validity(&self) -> Result<DateTime<FixedOffset>, Error>
pub fn ttl(&self) -> u64
Sourcepub fn has_signature_v1(&self) -> bool
pub fn has_signature_v1(&self) -> bool
Whether the record carries a (legacy) V1 signature.
Sourcepub fn has_signature_v2(&self) -> bool
pub fn has_signature_v2(&self) -> bool
Whether the record carries a V2 signature.
pub fn data(&self) -> Result<Data, Error>
pub fn verify_signature(&self, peer_id: PeerId) -> Result<(), Error>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Record
impl RefUnwindSafe for Record
impl Send for Record
impl Sync for Record
impl Unpin for Record
impl UnsafeUnpin for Record
impl UnwindSafe for Record
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