Skip to content
TypeWire

@tahanabavi/typefetch-encryption

documents v0.0.0

Field-level request/response encryption middleware for TypeFetch contracts (AES, DES, RSA, Base64, custom).

Options

OptionDefaultMeaning
keyProviderReturns the symmetric key or RSA key pair. Sync or async.
customHandlersYour own encrypt/decrypt for method: "Custom".
failClosedtrueThrow when encryption fails rather than sending plaintext.

failClosed defaults to true on purpose: a middleware that silently falls back to plaintext when a key is missing is a middleware that will one day ship an SSN in the clear.

Methods

methodKey materialNotes
"AES"symmetricDefault choice.
"DES"symmetricLegacy interop only — do not pick it for new work.
"RSA"rsaPublic key encrypts, private key decrypts. Small payloads only.
"Base64"noneEncoding, not encryption. Obfuscation at best.
"Custom"whatever you useRequires customHandlers.

method can differ per direction: method: { request: "RSA", response: "AES" }.