2.6 KiB
2.6 KiB
Capability: crypto-noble-defaults
ADDED Requirements
AEAD façade
- REQ-NOBLE-010: Exports
aeadEncrypt(algo: AeadAlgorithm, key: Uint8Array, plaintext: Uint8Array, options: AeadEncryptOptions, opts?: { engine?: AeadEngine }): Uint8Array. - REQ-NOBLE-011: Exports
aeadDecrypt(algo: AeadAlgorithm, key: Uint8Array, ciphertext: Uint8Array, options: AeadDecryptOptions, opts?: { engine?: AeadEngine }): Uint8Array. - REQ-NOBLE-012:
AeadEncryptOptions = { nonce: Uint8Array; aad?: Uint8Array }.AeadDecryptOptionsis the same shape. - REQ-NOBLE-013: Default engine is noble:
@noble/ciphersAES-256-GCM and ChaCha20-Poly1305;@noble/ciphersXChaCha20-Poly1305. - REQ-NOBLE-014: Key must be 32 bytes; throws
CryptoError("CRYPTO.KEY.INVALID_LENGTH")otherwise. - REQ-NOBLE-015: Nonce must be 12 bytes for AES-256-GCM and ChaCha20-Poly1305, 24 bytes for XChaCha20-Poly1305; throws
CryptoError("CRYPTO.AEAD.INVALID_NONCE")otherwise. - REQ-NOBLE-016: Exports
AEAD_KEY_LENGTH = 32,AEAD_NONCE_LENGTH = 12,AEAD_XCHACHA_NONCE_LENGTH = 24.
Sign façade
- REQ-NOBLE-020: Exports
ed25519namespace:{ generateKeypair(opts?), sign(secretKey, message), verify(publicKey, signature, message) }. - REQ-NOBLE-021: Exports
ecdsaP256namespace: same shape ased25519. - REQ-NOBLE-022: All functions accept
{ engine?: SignEngine }as a trailing options arg. - REQ-NOBLE-023: Noble defaults:
@noble/curvesed25519 and P-256. - REQ-NOBLE-024:
verifyalways returnsboolean, never throws on a bad signature. - REQ-NOBLE-025:
ecdsaP256.generateKeypairretries untilnoble.utils.isValidSecretKey(secretKey)is true.
Agree façade
- REQ-NOBLE-030: Exports
x25519namespace:{ generateKeypair(opts?), agree(mySecret, theirPublic) }. - REQ-NOBLE-031: Accepts
{ engine?: AgreeEngine }. - REQ-NOBLE-032: Noble default:
@noble/curvesx25519.
Sealed-box façade
- REQ-NOBLE-040: Exports
sealedBoxnamespace:{ seal(recipientPublic, plaintext, opts?), open(recipientSecret, recipientPublic, ciphertext, opts?) }. - REQ-NOBLE-041: Noble default: X25519 key agreement + XChaCha20-Poly1305 encryption (crypto_box_seal semantics).
Auth-box façade
- REQ-NOBLE-050: Exports
authBoxnamespace:{ seal(senderSecret, recipientPublic, plaintext, nonce, opts?), open(senderPublic, recipientSecret, ciphertext, nonce, opts?) }. - REQ-NOBLE-051: Noble default: X25519 key agreement + XChaCha20-Poly1305 (crypto_box semantics).
Constants
- REQ-NOBLE-060: Exports
ED25519_SECRET_KEY_LENGTH = 32,ED25519_PUBLIC_KEY_LENGTH = 32,ED25519_SIGNATURE_LENGTH = 64,X25519_KEY_LENGTH = 32,ECDSA_P256_SIGNATURE_LENGTH = 64.