Skip to content

Polaris SDK enables encrypted interaction with Polaris products

License

Notifications You must be signed in to change notification settings

Fr0ntierX/polaris-sdk

Repository files navigation

Polaris SDK

Fr0ntierX’s Polaris SDK is a TypeScript library designed for encrypting and decrypting communications within Polaris Secure Containers and applications communicating with them.

Overview

Polaris SDK enables data encryption and decryption using an integrated asymmetric encryption scheme based on RSA asymmetric encryption and AES-GCM symmetric encryption. For more details on algorithm implementations, please refer to the Polaris Documentation.

Environments

Polaris SDK functions in both browser context (using the WebCrypto API) and in a Node.js context (using the Node.js Crypto API). This enables both backend servers and browsers to directly communicate with Polaris Secure Containers.

Key Management

Polaris SDK supports various keys via the KeyHandler interface. A KeyHandler is only required to implement the getPublicKey and unwrap methods, that require access to the private key. The rest of the integrated encryption scheme is implemented by the SDK in an unified manner.

We provide an ephemeral key handler as part of the SDK that generates a new key on each initialization. Additional implmenetations for permanent keys are available with the Polaris Proxy.

Installation

The SDK can be installed through any JavaScript package manager.

NPM

npm install @fr0ntier-x/polaris-sdk

Yarn

yarn add @fr0ntier-x/polaris-sdk

Usage

Polaris SDK is designed to be user-friendly. The following example demonstrates how to encrypt and decrypt messages using the SDK and an ephemeral key:

import { EphemeralKeyHandler, PolarisSDK } from "@fr0ntier-x/polaris-sdk";

const polarisSDK = new PolarisSDK(new EphemeralKeyHandler());
const publicKey = await polarisSDK.getPublicKey();

const message = "Hello from Polaris!";

const encryptedMessage = await polarisSDK.encrypt(Buffer.from(message), publicKey);
const decryptedMessage = await polarisSDK.decrypt(encryptedMessage);

console.log(decryptedMessage.toString()); // Hello from Polaris!

Axios Interceptors

If you are using axios for HTTP requests, you can use the request and response interceptors provided by the SDK to automatically encrypt and decrypt the request and response data.

import { createAxiosRequestInterceptor, createAxiosResponseInterceptor } from "@fr0ntier-x/polaris-sdk";

axios.interceptors.request.use(createAxiosRequestInterceptor({ polarisSDK }));
axios.interceptors.response.use(createAxiosResponseInterceptor({ polarisSDK }));

About Polaris

Fr0ntierX’s Polaris Secure Containers encrypt data throughout its lifecycle and isolate sensitive information from cloud providers or unauthorized entities by securing application deployment within a Trusted Execution Environment (TEE). For more information about Polaris Secure Containers, please visit the website.

Documentation

For more information about the Polaris SDK, please visit the Polaris Documentation website.

Support

If you encounter any problmes please refer to the documentation or create an Issue.

License

Polaris SDK is licensed under Apache 2.0. For more details, please refer to the LICENSE.

About

Polaris SDK enables encrypted interaction with Polaris products

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published