pair
Generates a new set of keys, returned as a pair object with four properties:
Property | Description |
|---|---|
| Public key for verifying signatures (ECDSA). |
| Private key for signing (ECDSA). |
| Public key for creating shared secrets (ECDH). |
| 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 |
|---|---|
| Optional function that receives the pair. Leave it out to |
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.