Recent notes

9 months ago
#openpgpjs / https://github.com/openpgpjs / version 2.0

Load public key

> var pubkey = "-----BEGIN PGP PUBLIC KEY BLOCK----- ... "
> openpgp.key.readArmored(pubkey)

Get all primary keys

> openpgp.key.readArmored(pubkey).keys

Get expiration time of primary key

> openpgp.key.readArmored(pubkey).keys[0].getExpirationTime()

Get all sub keys

> openpgp.key.readArmored(pubkey).keys[0].subKeys

Get expiration time of a sub key

> openpgp.key.readArmored(pubkey).keys[0].subKeys[0].getExpirationTime()

Check if primary key is valid

> openpgp.key.readArmored(pubkey).keys[0].verifyPrimaryKey()

Check if sub key is valid

> openpgp.key.readArmored(pubkey).keys[0].subKeys[0].verify(openpgp.key.readArmored(pubkey).keys[0].primaryKey)

Key status

> openpgp.enums.keyStatus

Object {invalid: 0, expired: 1, revoked: 2, valid: 3, no_self_cert: 4}