pair

Generates a new set of keys, returned as a pair object with four properties:

Property

Description

pub

Public key for verifying signatures (ECDSA).

priv

Private key for signing (ECDSA).

epub

Public key for creating shared secrets (ECDH).

epriv

Private key for encrypting and decrypting (ECDH).

The signing keys and encryption keys are separate, so pub can be shared to let others verify your signatures, and epub to let them encrypt data for you with secret(). Keep priv and epriv private.

Parameter

Description

callback

Optional function that receives the pair. Leave it out to await it.

Examples

// With await.
const pair = await holster.SEA.pair()
const signed = await holster.SEA.sign("hello", pair)
const enc = await holster.SEA.encrypt("hello", pair)

// With a callback.
holster.SEA.pair(pair => console.log(pair.pub))

You don't need to create a pair for a user account: user.create() does that, and the logged in user's keys are in user.is.