mirror of
https://github.com/luxfi/pqsafe.git
synced 2026-10-30 15:21:41 +00:00
Drop three recipient types in favour of manifest.RecipientRef:
- EnvelopeIDRecipient (the "minimal" intermediate)
- RecipientRefView (existed only to avoid importing manifest, but
open.go already imports manifest, so the indirection earned nothing)
- the two adapter funcs (fromRecipients, fromManifestRecipients) and
the manifestRecipientsView wrapper that fed them
Compute → ID. IDInput.Recipients is now []manifest.RecipientRef directly,
so Seal builds the slice once and reuses it for both ID() and
mf.Recipients (was being built twice).
Also drop two unused domain-separation constants from pkg/envelope —
pkg/ctx is the single canonical home for those.
Net: 75 lines removed. Same security properties, same tests pass.
31 lines
1.3 KiB
Go
31 lines
1.3 KiB
Go
// Copyright (C) 2025-2026, Lux Industries Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
// Package envelope implements the PQSAFE-IL5-HYBRID-v1 file envelope:
|
|
// a ciphertext-only directory or single-file container with a signed
|
|
// CBOR/COSE manifest, X-Wing recipient capsules, and chunked AEAD
|
|
// payload. The paper at luxfi/papers/pqsafe-il5 is the authoritative
|
|
// specification; this package implements it.
|
|
//
|
|
// One way only. There is exactly one Envelope construction and one
|
|
// inversion. No alternate suites within v1. New primitives become a new
|
|
// profile identifier (v2), not parameters inside v1.
|
|
package envelope
|
|
|
|
// Profile is the canonical profile identifier carried by every manifest.
|
|
// Verifiers route by Profile; a v1 verifier MUST refuse a v2 envelope.
|
|
const Profile = "PQSAFE-IL5-HYBRID-v1"
|
|
|
|
// Version is the manifest schema version. Bumped on backward-incompatible
|
|
// manifest changes within the same Profile.
|
|
const Version uint32 = 1
|
|
|
|
// ChunkSize is the bulk AEAD chunk size (64 KiB). Chunks are encrypted
|
|
// with sequence-numbered nonces; the DEK is rotated every 2^32 chunks
|
|
// (256 TiB) via HKDF re-key chained from the manifest's ratchet seed.
|
|
const ChunkSize = 64 * 1024
|
|
|
|
// MaxChunksPerDEK is the rotation boundary; one DEK protects at most
|
|
// 2^32 chunks before HKDF re-keys.
|
|
const MaxChunksPerDEK uint64 = 1 << 32
|