@sigmacomputing/node-embed-sdk
v0.3.0
Published
Node.js SDK for Sigma Computing with encryption/decryption utilities
Maintainers
Readme
Sigma Node.js Embed SDK
This package provides Node.js utilities for working with Sigma Computing's Embed API.
Getting Started
To use the node-embed-sdk in your project, you can install it using your node package manager.
Using npm:
npm install @sigmacomputing/node-embed-sdkyarn:
yarn add @sigmacomputing/node-embed-sdkpnpm:
pnpm add @sigmacomputing/node-embed-sdkFeatures
Token Encryption and Decryption
The SDK provides utilities for encrypting and decrypting OAuth tokens using AES-256-GCM encryption.
See our documentation on embedding with JWTS for more information.
Sigma expects you to encrypt OAuth tokens using the same embed secret used to sign the embed.
Example Usage
Asynchronous
import { encrypt, decrypt } from "@sigmacomputing/node-embed-sdk/promises";
// Encrypt an OAuth token
const encryptedToken = await encrypt("your-embed-secret", "your-oauth-token");
// Decrypt an encrypted token
const decryptedToken = await decrypt("your-embed-secret", encryptedToken);Synchronous
import { encrypt, decrypt } from "@sigmacomputing/node-embed-sdk";
// Encrypt an OAuth token
const encryptedToken = encrypt("your-embed-secret", "your-oauth-token");
// Decrypt an encrypted token
const decryptedToken = decrypt("your-embed-secret", encryptedToken);