PGP utility class that is useful for performing basic operations
Kind: global class
- PGPUtil
- new PGPUtil([opts])
- .loadPubKey(content) ⇒
Promise.<openpgp.PublicKey>
- .loadPubKeyFromFile(fpath) ⇒
Promise.<openpgp.PublicKey>
- .loadPrivKey(content, [passphrase]) ⇒
Promise.<openpgp.PrivateKey>
- .loadPrivKeyFromFile(fpath, [passphrase]) ⇒
Promise.<openpgp.PrivateKey>
- .generateKeyPair(opts) ⇒
Promise.<{pubkey: string, privkey: string, revokeCert: string}>
- .exportKeyPair([passphrase]) ⇒
Promise.<{pubkey: ?string, privkey: ?string}>
- .encrypt(message) ⇒
Promise.<string>
- .decrypt(message) ⇒
Promise.<string>
Param | Type | Description |
---|---|---|
[opts] | object |
Default keys used for encryption/decryption |
[opts.pubkey] | openpgp.Key |
Public key |
[opts.privkey] | openpgp.Key |
Private key, should be decrypted for proper usage! |
Kind: instance method of PGPUtil
Param | Type | Description |
---|---|---|
content | string | Buffer |
PGP public key raw content |
Kind: instance method of PGPUtil
Param | Type | Description |
---|---|---|
fpath | fs.PathLike |
PGP public key file path |
Kind: instance method of PGPUtil
Param | Type | Default | Description |
---|---|---|---|
content | string | Buffer |
PGP private key raw content | |
[passphrase] | string | Array.<string> |
null |
Passphrase for decrypting key, if omited the key won't be decrypted, skip it when key is already decrypted |
Kind: instance method of PGPUtil
Param | Type | Default | Description |
---|---|---|---|
fpath | fs.PathLike |
PGP private key file path | |
[passphrase] | string | Array.<string> |
null |
Passphrase for decrypting key, if omited the key won't be decrypted, skip it when key is already decrypted |
Kind: instance method of PGPUtil
Param | Type | Description |
---|---|---|
opts | openpgp.KeyOptions |
Opts related to generating key pair, e.g. algorithm... |
Kind: instance method of PGPUtil
Param | Type | Default | Description |
---|---|---|---|
[passphrase] | string | Array.<string> |
null |
Passphrase used for encrypting private key before exporting it, if omited decrypted key will be exported |
Kind: instance method of PGPUtil
Param | Type | Description |
---|---|---|
message | string |
Plain text that will be encrypted |
Kind: instance method of PGPUtil
Param | Type | Description |
---|---|---|
message | string |
Encrypted raw message |