8 unstable releases (3 breaking)

0.4.0 Mar 11, 2023
0.3.0 Jan 23, 2023
0.2.0 Jan 16, 2023
0.1.4 Jan 16, 2023
0.1.3 Dec 29, 2022

#2237 in Cryptography

Download history 18/week @ 2024-09-24

95 downloads per month
Used in gossip-relay-picker

MIT license

200KB
4.5K SLoC

nostr-types

Crates.io MIT licensed Stable Docs Master Docs

nostr-types is a crate defining types useful for the nostr protocol.

We wrap all basic types. An i64 may or may not be a Unixtime. A &str might be a hex encoded private key, or it might be somebody's name. By using types for everything, common mistakes can be avoided.

We have extensive serde implementations for all types which are not simple to serialize such as Tag.

Private keys remember if you've seen them or imported them and set themselves to Weak if you have. Generated private keys start out as Medium. We don't support Strong yet which will require a hardware token. (Note: there are ways to leak a private key without it knowing, so if it says Medium that is the maximum security, not a guaranteed level of security). Private keys can be imported and exported in a password-keyed encrypted form without weakening their security.

Progress

Basic functionality is coded for the following NIPs. Be aware that we only provide types, so a lot of NIP content is not applicable.

  • NIP-01
  • NIP-02
  • NIP-03 - OpenTimestamps are low priority
  • NIP-04 - Will not support. Do not recommend.
  • NIP-05
  • NIP-06 - Not interesting to me, not being a bitcoiner; low priority
  • NIP-07 - n/a
  • NIP-08 - TBD
  • NIP-09 - mostly n/a but supported where applicable
  • NIP-10 - mostly n/a but supported where applicable
  • NIP-11
  • NIP-12 - TBD
  • NIP-13 - TBD
  • NIP-14
  • NIP-15 - n/a
  • NIP-16
  • NIP-19 - supported for keys only
  • NIP-20 - mostly n/a but supported where applicable
  • NIP-22 - n/a
  • NIP-25 - mostly n/a but supported where applicable
  • NIP-26 - TBD, can be done manually currently.
  • NIP-28 - Partially. EventKind recognizes, them but content handling not there.
  • NIP-35 - n/a
  • NIP-36 - mostly n/a but supported where applicable
  • NIP-40 - mostly n/a but supported where applicable

License

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, shall be licensed as above, without any additional terms or conditions.

Dependencies

~15–31MB
~508K SLoC