Skip to main content

Class: PolarisSDK

Implements

Constructors

new PolarisSDK()

new PolarisSDK(keyHandler): PolarisSDK

Parameters

keyHandler

KeyHandler

Returns

PolarisSDK

Methods

decrypt()

decrypt(message): Promise<Buffer>

Decrypt data

Parameters

message

Buffer

Encrypted message

Returns

Promise<Buffer>

The decrypted data

Implementation of

PolarisSDKInterface.decrypt


encrypt()

encrypt(data, publicKey): Promise<Buffer>

Encrypt data

Parameters

data

Buffer

Data to encrypt

publicKey

string

Public key used to wrap the encryption key with

Returns

Promise<Buffer>

The encrypted message as buffer

Implementation of

PolarisSDKInterface.encrypt


getPublicKey()

getPublicKey(): Promise<string>

Get the public key of the confgured key service

Returns

Promise<string>

The public key in PEM format

Implementation of

PolarisSDKInterface.getPublicKey


unwrapKey()

unwrapKey(wrappedKey): Promise<Buffer>

Unwrap a symmetric encryption key or IV with the configured private key

Parameters

wrappedKey

Buffer

Returns

Promise<Buffer>

The unwrapped key as Buffer

Implementation of

PolarisSDKInterface.unwrapKey


wrapKey()

wrapKey(key, publicKey): Promise<Buffer>

Wrap a symmetric encryption key or IV with a given public key.

PCKS1 padding is used with a sha256 hash.

Parameters

key

Buffer

The key to wrap as Buffer

publicKey

string

The public key to wrap the key with

Returns

Promise<Buffer>

The wrapped key as Buffer

Implementation of

PolarisSDKInterface.wrapKey