# Struct crypto::voice::SenderKey

> An SFrame base key (32 bytes). Zeroized on drop, never printed, never on the wire unwrapped.

`zaun_community_protocol::crypto::voice::SenderKey` · Struct

```rust
pub struct SenderKey(…)
```

An SFrame base key (32 bytes). Zeroized on drop, never printed, never on the wire unwrapped.

## Methods

### `generate`

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

A fresh base key from the OS CSPRNG.

# Errors
`VoiceError::Rng` when the CSPRNG fails.

### `from_bytes`

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

Wraps raw bytes. Tests only; real keys come from `Self::generate` or `Self::unwrap`.

### `wrap_for`

```rust
pub fn wrap_for(&self, ctx: &WrapContext, recipient: &SignedKeyPackage) -> Result<WrappedKey, VoiceError>
```

Wraps this key to `recipient`'s verified key package.

# Errors
`VoiceError::Mismatch` when the package is for another community or channel,
`VoiceError::Rng`, or `VoiceError::Unwrap` if HPKE fails.

### `unwrap`

```rust
pub fn unwrap(identity: &VoiceIdentity, ctx: &WrapContext, own: &SignedKeyPackage, wrapped: &WrappedKey) -> Result<Self, VoiceError>
```

Opens a key wrapped to `own` (this participant's package) with `identity`.

The caller must already have checked the wrapped key against a verified
`SignedSenderKeys` (`SignedSenderKeys::entry_for`); `super::GroupKeys` does both.

# Errors
`VoiceError::Unwrap` when the key was not made for this package and context.

## Trait implementations

`Debug`

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