Struct ipns_entry::entry::protobuf::IpnsEntry
source · pub struct IpnsEntry {
pub value: Option<Vec<u8>>,
pub signature_v1: Option<Vec<u8>>,
pub validity_type: Option<i32>,
pub validity: Option<Vec<u8>>,
pub sequence: Option<u64>,
pub ttl: Option<u64>,
pub pub_key: Option<Vec<u8>>,
pub signature_v2: Option<Vec<u8>>,
pub data: Option<Vec<u8>>,
}
Fields§
§value: Option<Vec<u8>>
§signature_v1: Option<Vec<u8>>
§validity_type: Option<i32>
§validity: Option<Vec<u8>>
§sequence: Option<u64>
§ttl: Option<u64>
§pub_key: Option<Vec<u8>>
in order for nodes to properly validate a record upon receipt, they need the public key associated with it. For old RSA keys, its easiest if we just send this as part of the record itself. For newer ed25519 keys, the public key can be embedded in the peerID, making this field unnecessary.
signature_v2: Option<Vec<u8>>
§data: Option<Vec<u8>>
Implementations§
source§impl IpnsEntry
impl IpnsEntry
sourcepub fn value(&self) -> &[u8] ⓘ
pub fn value(&self) -> &[u8] ⓘ
Returns the value of value
, or the default value if value
is unset.
sourcepub fn signature_v1(&self) -> &[u8] ⓘ
pub fn signature_v1(&self) -> &[u8] ⓘ
Returns the value of signature_v1
, or the default value if signature_v1
is unset.
sourcepub fn validity_type(&self) -> ValidityType
pub fn validity_type(&self) -> ValidityType
Returns the enum value of validity_type
, or the default if the field is unset or set to an invalid enum value.
sourcepub fn set_validity_type(&mut self, value: ValidityType)
pub fn set_validity_type(&mut self, value: ValidityType)
Sets validity_type
to the provided enum value.
sourcepub fn validity(&self) -> &[u8] ⓘ
pub fn validity(&self) -> &[u8] ⓘ
Returns the value of validity
, or the default value if validity
is unset.
sourcepub fn sequence(&self) -> u64
pub fn sequence(&self) -> u64
Returns the value of sequence
, or the default value if sequence
is unset.
sourcepub fn pub_key(&self) -> &[u8] ⓘ
pub fn pub_key(&self) -> &[u8] ⓘ
Returns the value of pub_key
, or the default value if pub_key
is unset.
sourcepub fn signature_v2(&self) -> &[u8] ⓘ
pub fn signature_v2(&self) -> &[u8] ⓘ
Returns the value of signature_v2
, or the default value if signature_v2
is unset.
source§impl IpnsEntry
impl IpnsEntry
pub fn new(data: Data, signed: Signed) -> Self
pub fn to_bytes(&self) -> Vec<u8> ⓘ
sourcepub fn from_bytes(buf: &[u8]) -> Result<Self, DecodeError>
pub fn from_bytes(buf: &[u8]) -> Result<Self, DecodeError>
Decode protobuf bytes into an IpnsEntry Ensures the bytes are less than or equal to 10 KiB in size.
pub fn get_public_key(&self, peer_id: &PeerId) -> Result<PublicKey, Error>
sourcepub fn decode_data(&self) -> Result<Data, Error>
pub fn decode_data(&self) -> Result<Data, Error>
Get Deserialized IpnsEntry.data as a DAG-CBOR document
sourcepub fn is_valid_for(&self, peer_id: &PeerId) -> Result<bool, Error>
pub fn is_valid_for(&self, peer_id: &PeerId) -> Result<bool, Error>
Confirm values in IpnsEntry protobuf match deserialized ones from IpnsEntry.data:
pub fn signables(&self) -> Result<Signables>
Trait Implementations§
source§impl Message for IpnsEntry
impl Message for IpnsEntry
source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
source§fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>where
B: BufMut,
Self: Sized,
fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>where
B: BufMut,
Self: Sized,
source§fn encode_to_vec(&self) -> Vec<u8, Global> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8, Global> ⓘwhere
Self: Sized,
source§fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>where
B: BufMut,
Self: Sized,
fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>where
B: BufMut,
Self: Sized,
source§fn encode_length_delimited_to_vec(&self) -> Vec<u8, Global> ⓘwhere
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8, Global> ⓘwhere
Self: Sized,
source§fn decode<B>(buf: B) -> Result<Self, DecodeError>where
B: Buf,
Self: Default,
fn decode<B>(buf: B) -> Result<Self, DecodeError>where
B: Buf,
Self: Default,
source§fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>where
B: Buf,
Self: Default,
fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>where
B: Buf,
Self: Default,
source§fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>where
B: Buf,
Self: Sized,
fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>where
B: Buf,
Self: Sized,
self
. Read moresource§fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>where
B: Buf,
Self: Sized,
fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>where
B: Buf,
Self: Sized,
self
. Read more