confidential

Instantiates the Panda-Confidential API.

confidential[ randomBytes ]api

nametypedescription

randomBytes

Function

Optional. Provides a custom implementation for randomBytes.

Warning Effective encryption requires a robust implementation of pseudo-randomness. Replace randomBytes with caution.

api

Object

An instance of the Confidential API.

Panda-Confidential reduces the risk of unexpected changes by third parties by exporting only a single function that creates a new instance of the library. Presuming all access to Confidential is done this way (and not, for example, subsequently exporting individual functions), any changes will be contained to the scope of the importing module.

Example

import {confidential} from "panda-confidential"

# Instantiate Panda-Confidential
{encrypt, decrypt, SymmetricKey} = confidential()