1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
// SPDX-License-Identifier: Apache-2.0
//! # multi-key
//!
//! Self-describing cryptographic key implementation supporting multiple key types
//! and formats including public keys, private keys, encrypted keys, and threshold keys.
//!
//! ## Overview
//!
//! This crate provides multikey functionality for creating and managing self-describing
//! cryptographic keys with support for:
//! - Ed25519, Secp256k1, and BLS12-381 key schemes
//! - Public and private key pairs
//! - Key encryption and decryption
//! - Threshold key sharing (Shamir Secret Sharing)
//! - SSH key format conversion
//! - Nonce generation
//!
//! ## Quick Start
//!
//! ### Generating a Key Pair
//!
//! ```rust
//! use multi_key::Builder;
//! use multi_codec::Codec;
//!
//! let mut rng = rand::rng();
//! let multikey = Builder::new_from_random_bytes(Codec::Ed25519Priv, &mut rng)
//! .unwrap()
//! .try_build()
//! .unwrap();
//! ```
//!
//! ### Encoding and Decoding
//!
//! ```rust
//! use multi_key::{Builder, Multikey};
//! use multi_codec::Codec;
//!
//! let mut rng = rand::rng();
//! let mk1 = Builder::new_from_random_bytes(Codec::Ed25519Priv, &mut rng)
//! .unwrap()
//! .try_build()
//! .unwrap();
//!
//! // Encode to bytes
//! let bytes: Vec<u8> = mk1.clone().into();
//!
//! // Decode from bytes
//! let mk2 = Multikey::try_from(bytes.as_ref()).unwrap();
//! assert_eq!(mk1, mk2);
//! ```
//!
//! ## Features
//!
//! - **`serde`** (default): Enables serde serialization
//! - **`wasm`**: Enables WebAssembly support with getrandom/js
//!
//! ## Security
//!
//! - Private keys are automatically zeroized on drop
//! - Debug output redacts sensitive key material
//! - Thread-safe for concurrent operations
//!
//! ## Supported Key Types
//!
//! See [`KEY_CODECS`] for the complete list of supported key algorithms.
/// Errors produced by this library
pub use Error;
/// Multikey attribute IDs
pub use AttrId;
/// Cipher function builder
/// Key derivation function builder
/// Key views
pub use ;
pub use ;
/// Key splitting / recombination (verifiable threshold shares)
/// Multikey type and functions
pub use ;
/// Nonce type
pub use ;
// Re-export EncodingInfo for consumers of Nonce who need the encoding() method
pub use EncodingInfo;
/// Type-safe wrappers for key components
pub use ;
/// Serde serialization
/// Commonly used items
///
/// ```
/// use multi_key::prelude::*;
///
/// let mut rng = rand::rng();
/// let mk = Builder::new_from_random_bytes(Codec::Ed25519Priv, &mut rng)
/// .unwrap()
/// .try_build()
/// .unwrap();
/// ```