Represents two asymmetric cryptography keypairs
- a signing keypair
- an encryption keypair
base64url encoded identity string to represent the public sides
can optionally be initialized without the private halves of the pairs
Kind: global class
- Keypair
- new Keypair(opt)
- instance
- .getId() ⇒
string - .sign(data)
- .verify(signature, data)
- .encrypt(recipientIds, data) ⇒
Buffer - .decrypt(sourceId, cipher) ⇒
Buffer - .getBundle(passphrase, hint)
- .getId() ⇒
- static
keypair constructor (you probably want one of the static functions above)
| Param | Type | Description |
|---|---|---|
| opt | object |
|
| opt.pubkeys | string |
the keypair identity string |
| [opt.signPriv] | Buffer |
private signature key |
| [opt.encPriv] | Buffer |
private encryption key |
get the keypair identifier string
Kind: instance method of Keypair
sign some arbitrary data with the signing private key
Kind: instance method of Keypair
| Param | Type | Description |
|---|---|---|
| data | Buffer |
the data to sign |
verify data that was signed with our private signing key
Kind: instance method of Keypair
| Param | Type |
|---|---|
| signature | Buffer |
| data | Buffer |
encrypt arbitrary data to be readale by potentially multiple recipients
Kind: instance method of Keypair
| Param | Type | Description |
|---|---|---|
| recipientIds | array.<string> |
multiple recipient identifier strings |
| data | Buffer |
the data to encrypt |
attempt to decrypt the cipher buffer (assuming it was targeting us)
Kind: instance method of Keypair
Returns: Buffer - - the decrypted data
| Param | Type | Description |
|---|---|---|
| sourceId | string |
identifier string of who encrypted this data |
| cipher | Buffer |
the encrypted data |
generate an encrypted persistence bundle
Kind: instance method of Keypair
| Param | Type | Description |
|---|---|---|
| passphrase | string |
the encryption passphrase |
| hint | string |
additional info / description for the bundle |
derive the pairs from a 32 byte seed buffer
Kind: static method of Keypair
| Param | Type | Description |
|---|---|---|
| seed | Buffer |
the seed buffer |
initialize the pairs from an encrypted persistence bundle
Kind: static method of Keypair
| Param | Type | Description |
|---|---|---|
| bundle | object |
persistence info |
| passphrase | string |
decryption passphrase |