File: keypair_api.rs

package info (click to toggle)
rust-libp2p-identity 0.2.10%2B20250205%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 804 kB
  • sloc: makefile: 8; sh: 1
file content (20 lines) | stat: -rw-r--r-- 432 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use libp2p_identity::Keypair;

#[test]
#[cfg(any(
    feature = "ecdsa",
    feature = "secp256k1",
    feature = "ed25519",
    feature = "rsa"
))]
fn calling_keypair_api() {
    let _ = Keypair::from_protobuf_encoding(&[]);
}

#[allow(dead_code)]
fn using_keypair(kp: Keypair) {
    let _ = kp.to_protobuf_encoding();
    let _ = kp.sign(&[]);
    let _ = kp.public();
    let _: Option<[u8; 32]> = kp.derive_secret(b"foobar");
}