Expand description
This crate provides types for nostr protocol handling.
Modules§
Structs§
- Count
Result - The count results
- Delegation
Conditions - Conditions of delegation
- Encrypted
Private Key - This is an encrypted private key (the string inside is the bech32 ncryptsec string)
- Event
Kind Iterator - Iterator over well known
EventKind
s - EventV3
- The main event type
- FeeV1
- Fee
- File
Metadata - NIP-92/94 File Metadata
- Filter
V1 - Filter which specify what events a client is looking for
- Filter
V2 - Filter which specify what events a client is looking for
- Hll8
- HyperLogLog approximate counting mechanism
- Id
- An event identifier, constructed as a SHA256 hash of the event fields according to NIP-01
- IdHex
- An event identifier, constructed as a SHA256 hash of the event fields according to NIP-01, as a hex string
- KeySigner
- Signer with a local private key (and public key)
- Metadata
V1 - Metadata about a user
- Metadata
V2 - Metadata about a user
- Milli
Satoshi - Bitcoin amount measured in millisatoshi
- NAddr
- An ‘naddr’: data to address a possibly parameterized replaceable event (d-tag, kind, author, and relays)
- NEvent
- An ‘nevent’: event id along with some relays in which that event may be found.
- Nip05V1
- The content of a webserver’s /.well-known/nostr.json file used in NIP-05 and NIP-35
This allows lookup and verification of a nostr user via a
user@domain
style identifier. - Nostr
Url - A Nostr URL (starting with ‘nostr:’)
- PayRequest
Data - This is a response from a zapper lnurl
- PreEvent
V3 - Data used to construct an event
- Private
Key - This is a private key which is to be kept secret and is used to prove identity
- Profile
- A person’s profile on nostr which consists of the data needed in order to follow someone.
- Public
Key - This is a public key, which identifies an actor (usually a person) and is shared.
- Public
KeyHex - This is a public key, which identifies an actor (usually a person) and is shared, as a hex string
- Relay
Fees V1 - Relay fees
- Relay
Information Document V1 - Relay information document as described in NIP-11, supplied by a relay
- Relay
Information Document V2 - Relay information document as described in NIP-11, supplied by a relay
- Relay
Limitation V1 - Relay limitations
- Relay
Limitation V2 - Relay limitations
- Relay
List - A relay list, indicating usage for each relay, which can be used to represent the data found in a kind 10002 RelayListMetadata event.
- Relay
Origin - A canonical URL representing just a relay’s origin (without path/query/fragment or username/password)
- Relay
Retention V1 - Relay retention
- Relay
Url - A Url validated as a nostr relay url in canonical form
We don’t serialize/deserialize these directly, see
UncheckedUrl
for that - Relay
Usage Set - The ways that a user uses a Relay
- RumorV3
- A Rumor is an Event without a signature
- Shattered
Content - A sequence of content segments
- Signature
- A Schnorr signature that signs an Event, taken on the Event Id field
- Signature
Hex - A Schnorr signature that signs an Event, taken on the Event Id field, as a hex string
- Simple
Relay List - A list of relays with SimpleRelayUsage
- Simple
Relay Usage - When and how to use a Relay
- Span
- This is like
Range<usize>
, except we impl offset() on it This is like linkify::Span, except we impl offset() on it and don’t need the as_str() or kind() functions. - Subscription
Id - A random client-chosen string used to refer to a subscription
- TagV3
- A tag on an Event
- Unchecked
Url - A string that is supposed to represent a URL but which might be invalid
- Unixtime
- An integer count of the number of seconds from 1st January 1970. This does not count any of the leap seconds that have occurred, it simply presumes UTC never had leap seconds; yet it is well known and well understood.
- Url
- A String representing a valid URL with an authority present including an Internet based host.
- XOnly
Public Key - An x-only public key, used for verification of Taproot signatures and serialized according to BIP-340.
- ZapData
V1 - Data about a Zap
- ZapData
V2 - Data about a Zap
Enums§
- Client
Message - A message from a client to a relay
- Content
Encryption Algorithm - Content Encryption Algorithm
- Content
Segment - A segment of content
- Error
- Errors that can occur in the nostr-proto crate
- Event
Delegation - Delegation information for an Event
- Event
Kind - A kind of Event
- Event
Kind OrRange - Either an EventKind or a range (a vector of length 2 with start and end)
- Event
Reference - A reference to another event, either by
Id
(often coming from an ‘e’ tag), or byNAddr
(often coming from an ‘a’ tag). - Identity
- All states that your identity can be in
- KeySecurity
- This indicates the security of the key by keeping track of whether the secret key material was handled carefully. If the secret is exposed in any way, or leaked and the memory not zeroed, the key security drops to Weak.
- Nostr
Bech32 - A bech32 sequence representing a nostr object (or set of objects)
- Parsed
Tag - This parses known simple tags in a uniform way.
- Relay
List Usage - Relay Usage
- Relay
Message - A message from a relay to a client
- Relay
Usage - A way that a user uses a Relay
- Why
- The reason why a relay issued an OK or CLOSED message
Traits§
- Exportable
Signer - Any
Signer
that allows the secret to be exported (with interior mutability or no mutability necessary) - Lockable
Signer - Any
Signer
that can be locked and unlocked with a passphrase - MutExportable
Signer - Any
Signer
that allows the secret to be exported, but requires Self to be mutable to do so. - Signer
- Signer operations
- Signer
Ext - Extended Signer operations
Functions§
- add_
addr_ to_ tags - Add an ‘a’ addr tag to a set of tags if it doesn’t already exist
- add_
event_ to_ tags - Add an ‘e’ id tag to a set of tags if it doesn’t already exist
- add_
pubkey_ to_ tags - Add a ‘p’ pubkey tag to a set of tags if it doesn’t already exist
- add_
subject_ to_ tags_ if_ missing - Add an ‘subject’ tag to a set of tags if it doesn’t already exist
- find_
nostr_ bech32_ pos - Returns start and end position of next valid NostrBech32
- find_
nostr_ url_ pos - Returns start and end position of next valid NostrUrl
Type Aliases§
- Event
- The main event type
- Fee
- Fee
- Filter
- The main filter type
- Metadata
- Metadata about a user
- Nip05
- The content of a webserver’s /.well-known/nostr.json file used in NIP-05 and NIP-35
This allows lookup and verification of a nostr user via a
user@domain
style identifier. - PreEvent
- Data used to construct an event
- Relay
Fees - Relay fees
- Relay
Information Document - Relay information document as described in NIP-11, supplied by a relay
- Relay
Limitation - Relay limitations
- Relay
Retention - Relay retention
- Rumor
- A Rumor is an Event without a signature
- Tag
- A tag on an Event
- ZapData
- Data about a Zap