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
//! Envelope encryption for secrets at rest.
//!
//! A private key must never sit in cleartext in the **replicated** control plane
//! (cluster-managed cert keys live in the Raft KV, readable by every node's local
//! state). The [`KeyEnvelope`] trait wraps such material with a key-encryption
//! key (KEK) so the stored blob is opaque; the default is a machine-local KEK and
//! a Vault (Transit) backend is available. The concrete backends pull crypto /
//! HTTP deps, so they live in a native crate — this module is just the pluggable
//! seam, kept dependency-free so `boatramp-core` stays wasm-clean.
use async_trait;
/// A wrap/unwrap failure (bad key, tampered/foreign blob, or a KMS round-trip
/// error). Carries a human-readable reason only — never key material.
;
/// Pluggable envelope encryption for secrets at rest. Implementations wrap
/// plaintext under a KEK they hold (machine-local key file, Vault Transit, an
/// HSM) and reverse it. `wrap` output is opaque and self-describing (a backend
/// tags its own format) so `unwrap` fail-closes on a foreign or tampered blob.
/// Async so a remote KMS (an HTTP round-trip) fits the same seam as local AEAD.