4 releases (2 breaking)

Uses old Rust 2015

0.3.1-deprecated Feb 26, 2018
0.3.0 Feb 21, 2018
0.2.0 Jan 9, 2018
0.1.0 Dec 18, 2017

#17 in #duniter

AGPL-3.0

23KB
377 lines

Deprecated

This crate is now deprecated. You should use duniter-crypto instead.


lib.rs:

Provide wrappers around public keys, private keys and signatures.

  • Keys can be converted to/from Base58 string format.
  • Signatures can be converted to/from Base64 string format.

Usage

use duniter_keys::{Signature, PublicKey, PrivateKey, KeyPair};
use duniter_keys::ed25519::KeyPairFromSaltedPasswordGenerator;

let generator = KeyPairFromSaltedPasswordGenerator::with_default_parameters();

let keypair = generator.generate(
    b"password",
    b"salt"
);

let message = "Hello, world!";

let signature = keypair.sign(&message.as_bytes());

assert!(keypair.pubkey.verify(&message.as_bytes(), &signature));

Format

  • Base58 use the following alphabet : 123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz
  • Base64 use the following alphabet : ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ with = as padding character.

Dependencies

~4MB
~58K SLoC