Skip to main content

What it does

This function decrypts a sensitive field encrypted by encryptTinSensitiveField; the caller must supply the same TIN, field type, nonce, ciphertext, and signature.

How the flow works

1

Caller invokes the function

The caller supplies the encrypted field and the same authorization inputs used during encryption.
2

Validation

The SDK derives the field-scoped AES-GCM key from the exact TIN, field type, and signature.
3

Main work

WebCrypto authenticates and decrypts the ciphertext with the supplied nonce.
4

Result

The plaintext field is returned locally.

Signature

bigint | number | string
required
TIN key input.
string
required
Field namespace used during encryption.
Uint8Array
required
Encryption nonce.
Uint8Array
required
Encrypted field value.
Uint8Array | string
required
Same authorization material used for encryption.

Result and errors

Returns plaintext or propagates WebCrypto authentication/decryption failure.
Source: tins.ts:1381-1403