javascriptopenpgpopenpgp.js

How do we set 'expiration time', when we create new key with OpenPGP?


In OpenPGP.js we have a function Key.prototype.getExpirationTime, which "returns the expiration time of the primary key or null if key does not expire": https://github.com/openpgpjs/openpgpjs/blob/master/src/key.js#L472

But how do we set this expiration time, when we create new key? I do not see in this function https://github.com/openpgpjs/openpgpjs/blob/master/src/key.js#L938 or in documentation for it https://openpgpjs.org/openpgpjs/doc/module-key.html parameters for 'expiration time'


Solution

  • In OpenPGP.js this not implemented yet, see : https://github.com/openpgpjs/openpgpjs/issues/511#issuecomment-272376745

    For now the simplest solution I see is to use kbpgp.js for key generation, like this: https://ageyev.github.io/crypto/openpgp/ It needs more time for key generation than OpenPGP.js, but works.