# Struct ids::InviteSecret

> An invitation secret: 32 random bytes, shown once. Never logged: `Debug` is redacted and it has no `Display`. Zeroized on drop.

`zaun_community_protocol::ids::InviteSecret` · Struct

```rust
pub struct InviteSecret(…)
```

An invitation secret: 32 random bytes, shown once. Never logged: `Debug` is redacted and
it has no `Display`. Zeroized on drop.

## Methods

### `from_bytes`

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

Wraps raw bytes.

### `random`

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

A fresh secret.

# Errors
`RngError` when the CSPRNG fails.

### `expose`

```rust
pub const fn expose(&self) -> &[u8; 32]
```

The raw bytes (for hashing before storage; hosts store only a hash).

### `expose_b64`

```rust
pub fn expose_b64(&self) -> String
```

Base64url, for the one place it is shown: the invitation link.

### `from_b64`

```rust
pub fn from_b64(text: &str) -> Result<Self, B64Error>
```

Strict base64url.

# Errors
A non-canonical encoding or a wrong length.

## Trait implementations

`Clone`, `Debug`, `Deserialize<'de>`, `Drop`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Zeroize`

[Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/ids/struct.InviteSecret.html)
