Files
suaveplan/packages/foundation/bitpacker/bitpacker-crypto/src/index.ts
2026-05-27 23:47:53 +01:00

92 lines
2.6 KiB
TypeScript

/**
* `@suaveplan/bitpacker-crypto` — bit-packer-aware crypto primitives.
*
* Public surface (consumer-driven design — see SUPERSEDED.md and the
* `bitpacker-crypto-rewrite` openspec change):
*
* - **Checksums** (existing, kept verbatim): crc32, adler32, xxhash32
* - **HashAlgorithmRegistry** (pluggable extension point — sha256/xxhash32/crc32 default)
* - **EnvelopeSchema** (typed `[magic][formatVersion][body]` envelope)
* - **SignedBitSchema** (Authority+DomainTag-bound single-signer)
* - **MultiSignedBitSchema** (N-of-N co-signed)
* - **HashChainSchema** (append-only signed chain)
* - **EncryptedBitSchema** (niche AEAD-only — small payloads, NOT chunked-file)
* - **SchemaFingerprint** (canonical-hash schema agreement)
*
* The upstream `bitpacker/src/crypto/` provider/registry abstraction is
* intentionally *not* ported; see `SUPERSEDED.md` for the per-symbol map.
*/
// Checksums
export {
adler32,
appendAdler32,
appendCrc32,
crc32,
verifyAndStripAdler32,
verifyAndStripCrc32,
} from "./crc32.js";
// Encrypted (niche AEAD)
export {
defineEncryptedBitSchema,
ENCRYPTED_ALG_TAGS,
ENCRYPTED_VERSION_V1,
type EncryptedAlgorithmTag,
type EncryptedBitSchema,
type EncryptedBitSchemaOptions,
} from "./encrypted/encrypted-bitschema.js";
// Envelope
export {
type BodyCodec,
defineEnvelopeSchema,
type EnvelopeSchema,
type EnvelopeSchemaOptions,
type ParsedEnvelope,
rawBytesCodec,
} from "./envelope/envelope-schema.js";
// Schema fingerprint
export {
assertSchemaFingerprint,
canonicalize as canonicalizeSchema,
schemaFingerprint,
} from "./fingerprint/schema-fingerprint.js";
// Pluggable hash registry
export {
createHashRegistry,
defaultHashRegistry,
type HashAlgorithm,
type HashAlgorithmRegistry,
} from "./hash-registry/hash-registry.js";
// Hashchain
export {
type ChainVerifyResult,
defineHashChainSchema,
type HashChainEntry,
type HashChainSchema,
type HashChainSchemaOptions,
} from "./hashchain/hashchain-schema.js";
// Multi-signed
export {
defineMultiSignedBitSchema,
type MultiSignedBitSchema,
type MultiSignedBitSchemaOptions,
type MultiVerifyResult,
} from "./multisigned/multisigned-bitschema.js";
// Signed
export {
DEFAULT_SIGN_SLOT,
DEFAULT_SIGNATURE_LENGTH,
defineSignedBitSchema,
type SignedBitSchema,
type SignedBitSchemaOptions,
} from "./signed/signed-bitschema.js";
export {
appendXxhash32,
calculateXxhash32,
packXxhash32,
unpackXxhash32,
verifyAndStripXxhash32,
verifyXxhash32,
} from "./xxhash32.js";