Module ssb_common::keys [] [src]

Operations for dealing with the public and secret keys used in ssb.

The PublicKey, SecretKey and Signature types abstract over the (potentially multiple) cryptographic primitives supported by ssb. These types should be used when dealing with keys in application logic.

Aside from providing these types, this module also implements the encoding used in ssb to store and transmit keys.

Structs

PublicKey

An ssb public key. This type abstracts over the fact that ssb can support multiple cryptographic primitives.

PublicKeyParseError

The error when failing to parse a PublicKey from a string.

SecretKey

An ssb secret key. This type abstracts over the fact that ssb can support multiple cryptographic primitives.

SecretKeyParseError

The error when failing to parse a PublicKey from a string.

Signature

An ssb signature. This type abstracts over the fact that ssb can support multiple cryptographic primitives.

Functions

encodes_public_key

Check whether a given string is the encoding of a PublicKey.

encodes_secret_key

Check whether a given string is the encoding of a SecretKey.

gen_keypair

Randomly generate a secret key and a corresponding public key. This function does not specifiy which cryptographic primitive it will use and should be preferred over those that do.

gen_keypair_ed25519

Randomly generate a secret key and a corresponding public key, using the ed25519 cryptographic primitive.

keypair_from_seed_ed25519

Randomly generate a secret key and a corresponding public key from a seed, using the ed25519 cryptographic primitive.