# Struct crypto::SecretKey

> A suite-1 composite private key: `mldsaSeed` (FIPS 204 ξ, 32 B) ‖ `edSK` (32 B).

`zaun_community_protocol::crypto::SecretKey` · Struct

```rust
pub struct SecretKey { … }
```

A suite-1 composite private key: `mldsaSeed` (FIPS 204 ξ, 32 B) ‖ `edSK` (32 B).

Never on the wire. `Debug` is redacted and the bytes are zeroized on drop. Its component
keys are used only inside this composite (RFC 10073 the protocol).

The ML-DSA-65 expanded signing key is derived from the seed once, on first use, and kept
with the key (it is zeroized on drop too): deriving it is about a fifth of the cost of a
signature, and a host signs a session proof for every `session.hello`.

## Methods

### `generate`

```rust
pub fn generate() -> Result<Self, RngError>
```

A fresh key from the OS CSPRNG.

# Errors
`RngError` when `getrandom` fails.

### `from_bytes`

```rust
pub fn from_bytes(bytes: &[u8; 64]) -> Self
```

Wraps the 64-byte encoding. The caller zeroizes its own copy.

### `expose_secret`

```rust
pub const fn expose_secret(&self) -> &[u8; 64]
```

The 64-byte encoding, for sealed storage only.

### `public_key`

```rust
pub fn public_key(&self) -> PublicKey
```

The composite public key: suite `0x01` ‖ `mldsaPK` ‖ `edPK`.

## Trait implementations

`Clone`, `Debug`, `Drop`, `Zeroize`, `ZeroizeOnDrop`

[Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/secret/struct.SecretKey.html)
