From 62327a8f3e06846eccee1a738eb8229501e3f37c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eray=20Ayd=C4=B1n?= Date: Tue, 3 Mar 2026 21:01:37 +0300 Subject: [PATCH] docs: add sealed results usage example to readme Replace brief description with a code example. --- readme.md | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index 0a6703f3..c6c9fde1 100644 --- a/readme.md +++ b/readme.md @@ -164,9 +164,26 @@ To learn more, see [example/validateWebhookSignature.mjs](example/validateWebhoo ### Sealed results -Customers on the Enterprise plan can enable [Sealed results](https://dev.fingerprint.com/docs/sealed-client-results) to receive the full device intelligence result on the client and unseal it on the server. This SDK provides utility methods for decoding sealed results. +This SDK provides utility methods for decoding [sealed results](https://docs.fingerprint.com/docs/sealed-client-results). +Use below code to unseal results: -To learn more, see [example/unsealResult.mjs](https://github.com/fingerprintjs/node-sdk/tree/main/example/unsealResult.mjs) or the [API Reference](https://fingerprintjs.github.io/node-sdk/functions/unsealEventsResponse.html). +```typescript +import { unsealEventsResponse, DecryptionAlgorithm } from '@fingerprint/node-sdk' + +const sealedData = process.env.BASE64_SEALED_RESULT +const decryptionKey = process.env.BASE64_KEY + +const unsealedData = await unsealEventsResponse(Buffer.from(sealedData, 'base64'), [ + { + key: Buffer.from(decryptionKey, 'base64'), + algorithm: DecryptionAlgorithm.Aes256Gcm, + }, +]) + +console.log(JSON.stringify(unsealedData, null, 2)) +``` + +To learn more, refer to example located in [example/unsealResult.mjs](./example/unsealResult.mjs). ### Deleting visitor data