Skip to main content

Interface: PolarisSDKInterface

Methods

decrypt()

decrypt(message): Promise<Buffer>

Decrypt data

Parameters

message

Buffer

Encrypted message

Returns

Promise<Buffer>

The decrypted data


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


getPublicKey()

getPublicKey(): Promise<string>

Get the public key of the confgured key service

Returns

Promise<string>

The public key in PEM format


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


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