pub struct DiscoveryRecordV1 {
pub v: u8,
pub username: Username,
pub address: Address,
pub pubkey: Vec<u8>,
pub nostr_author: Vec<u8>,
pub issued_at_ms: i64,
pub sig: Vec<u8>,
}Expand description
A signed claim that a username points at an address.
Serialized as JSON inside a sealed relay record. The byte-level contract is
Self::signing_payload, not this struct’s JSON: two implementations must
agree on the signed bytes, and may disagree on JSON key order.
Fields§
§v: u8Format version. Always DISCOVERY_VERSION in this build.
username: UsernameThe claimed name, in normalized form.
Typed, so a record naming an unnormalized username fails to deserialize rather than being compared against a queried name it can never equal.
address: AddressThe address the claim points at.
pubkey: Vec<u8>The Ed25519 identity key. derive_address(pubkey) must equal address.
The x-only Nostr key this record is valid when published under.
See the module docs: this is what stops a third party from keeping a retracted claim alive.
issued_at_ms: i64Signing time, in milliseconds since the Unix epoch.
Advisory only. See verify_discovery_record.
sig: Vec<u8>Ed25519 signature by pubkey over Self::signing_payload.
Implementations§
Source§impl DiscoveryRecordV1
impl DiscoveryRecordV1
Sourcepub fn signing_payload(
username: &Username,
address: &Address,
pubkey: &[u8],
nostr_author: &[u8],
issued_at_ms: i64,
) -> Result<Vec<u8>>
pub fn signing_payload( username: &Username, address: &Address, pubkey: &[u8], nostr_author: &[u8], issued_at_ms: i64, ) -> Result<Vec<u8>>
Builds the payload the signature is taken over.
domain ‖ u32be‖bytes over
[v, username, address, pubkey, nostr_author, issued_at_ms], in that
fixed order. issued_at_ms is encoded as its 8-byte big-endian form,
not as a decimal string, so two implementations cannot disagree about
leading zeroes or a sign.
Sourcepub fn unsigned(
username: Username,
address: Address,
pubkey: Vec<u8>,
nostr_author: Vec<u8>,
issued_at_ms: i64,
) -> Self
pub fn unsigned( username: Username, address: Address, pubkey: Vec<u8>, nostr_author: Vec<u8>, issued_at_ms: i64, ) -> Self
Builds an unsigned record, ready for Self::sign_with.
Trait Implementations§
Source§impl Clone for DiscoveryRecordV1
impl Clone for DiscoveryRecordV1
Source§impl Debug for DiscoveryRecordV1
impl Debug for DiscoveryRecordV1
Source§impl<'de> Deserialize<'de> for DiscoveryRecordV1
impl<'de> Deserialize<'de> for DiscoveryRecordV1
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 DiscoveryRecordV1
Source§impl PartialEq for DiscoveryRecordV1
impl PartialEq for DiscoveryRecordV1
Source§impl Serialize for DiscoveryRecordV1
impl Serialize for DiscoveryRecordV1
impl StructuralPartialEq for DiscoveryRecordV1
Auto Trait Implementations§
impl Freeze for DiscoveryRecordV1
impl RefUnwindSafe for DiscoveryRecordV1
impl Send for DiscoveryRecordV1
impl Sync for DiscoveryRecordV1
impl Unpin for DiscoveryRecordV1
impl UnsafeUnpin for DiscoveryRecordV1
impl UnwindSafe for DiscoveryRecordV1
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Declassify for T
impl<T> Declassify for T
type Declassified = T
fn declassify(self) -> T
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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