Skip to content

Latest commit

 

History

History
102 lines (71 loc) · 4.52 KB

DEFINITIONS.md

File metadata and controls

102 lines (71 loc) · 4.52 KB

PGPUtil

PGP utility class that is useful for performing basic operations

Kind: global class

new PGPUtil([opts])

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!

pgpUtil.loadPubKey(content) ⇒ Promise.<openpgp.PublicKey>

Kind: instance method of PGPUtil

Param Type Description
content string | Buffer PGP public key raw content

pgpUtil.loadPubKeyFromFile(fpath) ⇒ Promise.<openpgp.PublicKey>

Kind: instance method of PGPUtil

Param Type Description
fpath fs.PathLike PGP public key file path

pgpUtil.loadPrivKey(content, [passphrase]) ⇒ Promise.<openpgp.PrivateKey>

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

pgpUtil.loadPrivKeyFromFile(fpath, [passphrase]) ⇒ Promise.<openpgp.PrivateKey>

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

pgpUtil.generateKeyPair(opts) ⇒ Promise.<{pubkey: string, privkey: string, revokeCert: string}>

Kind: instance method of PGPUtil

Param Type Description
opts openpgp.KeyOptions Opts related to generating key pair, e.g. algorithm...

pgpUtil.exportKeyPair([passphrase]) ⇒ Promise.<{pubkey: ?string, privkey: ?string}>

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

pgpUtil.encrypt(message) ⇒ Promise.<string>

Kind: instance method of PGPUtil

Param Type Description
message string Plain text that will be encrypted

pgpUtil.decrypt(message) ⇒ Promise.<string>

Kind: instance method of PGPUtil

Param Type Description
message string Encrypted raw message