<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Class: Key</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <div id="main"> <h1 class="page-title">Class: Key</h1> <section> <header> <h2><span class="attribs"><span class="type-signature"></span></span>Key<span class="signature">(packetlist)</span><span class="type-signature"></span></h2> <div class="class-description"><p>Class that represents an OpenPGP key. Must contain a primary key. Can contain additional subkeys, signatures, user ids, user attributes.</p></div> </header> <article> <div class="container-overview"> <h2>Constructor</h2> <h4 class="name" id="Key"><span class="type-signature"></span>new Key<span class="signature">(packetlist)</span><span class="type-signature"></span></h4> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>packetlist</code></td> <td class="type"> <span class="param-type"><a href="PacketList.html">PacketList</a></span> </td> <td class="description last"><p>The packets that form this key</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js#L48">line 48</a> </li></ul></dd> </dl> </div> <h3 class="subsection-title">Methods</h3> <h4 class="name" id="addSubkey"><span class="type-signature">(async) </span>addSubkey<span class="signature">()</span><span class="type-signature"> → {Promise.<<a href="Key.html">Key</a>>}</span></h4> <div class="description"> <p>Generates a new OpenPGP subkey, and returns a clone of the Key object with the new subkey added. Supports RSA and ECC keys. Defaults to the algorithm and bit size/curve of the primary key. DSA primary keys default to RSA subkeys.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>options.type</code></td> <td class="type"> <span class="param-type">ecc</span> | <span class="param-type">rsa</span> </td> <td class="description last"><p>The subkey algorithm: ECC or RSA</p></td> </tr> <tr> <td class="name"><code>options.curve</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last"><p>(optional) Elliptic curve for ECC keys</p></td> </tr> <tr> <td class="name"><code>options.rsaBits</code></td> <td class="type"> <span class="param-type">Integer</span> </td> <td class="description last"><p>(optional) Number of bits for RSA subkeys</p></td> </tr> <tr> <td class="name"><code>options.keyExpirationTime</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="description last"><p>(optional) Number of seconds from the key creation time after which the key expires</p></td> </tr> <tr> <td class="name"><code>options.date</code></td> <td class="type"> <span class="param-type">Date</span> </td> <td class="description last"><p>(optional) Override the creation date of the key and the key signatures</p></td> </tr> <tr> <td class="name"><code>options.sign</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="description last"><p>(optional) Indicates whether the subkey should sign rather than encrypt. Defaults to false</p></td> </tr> <tr> <td class="name"><code>options.config</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"><p>(optional) custom configuration settings to overwrite those in <a href="module-config.html">config</a></p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js#L878">line 878</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">Promise.<<a href="Key.html">Key</a>></span> </dd> </dl> <h4 class="name" id="applyRevocationCertificate"><span class="type-signature">(async) </span>applyRevocationCertificate<span class="signature">(revocationCertificate, config<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Promise.<<a href="Key.html">Key</a>>}</span></h4> <div class="description"> <p>Applies a revocation certificate to a key This adds the first signature packet in the armored text to the key, if it is a valid revocation signature.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>revocationCertificate</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> </td> <td class="description last"><p>armored revocation certificate</p></td> </tr> <tr> <td class="name"><code>config</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> <optional><br> </td> <td class="description last"><p>Full configuration, defaults to openpgp.config</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js#L756">line 756</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>New revoked key.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Promise.<<a href="Key.html">Key</a>></span> </dd> </dl> <h4 class="name" id="armor"><span class="type-signature"></span>armor<span class="signature">(config<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {ReadableStream.<String>}</span></h4> <div class="description"> <p>Returns ASCII armored text of key</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>config</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> <optional><br> </td> <td class="description last"><p>Full configuration, defaults to openpgp.config</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js#L296">line 296</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>ASCII armor.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">ReadableStream.<String></span> </dd> </dl> <h4 class="name" id="clearPrivateParams"><span class="type-signature"></span>clearPrivateParams<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> <p>Clear private key parameters</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js#L488">line 488</a> </li></ul></dd> </dl> <h4 class="name" id="clone"><span class="type-signature">(async) </span>clone<span class="signature">(deep<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Promise.<<a href="Key.html">Key</a>>}</span></h4> <div class="description"> <p>Clones the key object</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>deep</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="attributes"> <optional><br> </td> <td class="default"> false </td> <td class="description last"><p>Whether to return a deep clone</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js#L166">line 166</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Clone of the key.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Promise.<<a href="Key.html">Key</a>></span> </dd> </dl> <h4 class="name" id="getAlgorithmInfo"><span class="type-signature"></span>getAlgorithmInfo<span class="signature">()</span><span class="type-signature"> → {Object}</span></h4> <div class="description"> <p>Returns algorithm information</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/packet/public_key.js">packet/public_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/packet/public_key.js#L230">line 230</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>An object of the form {algorithm: String, bits:int, curve:String}.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Object</span> </dd> </dl> <h4 class="name" id="getAlgorithmInfo"><span class="type-signature"></span>getAlgorithmInfo<span class="signature">()</span><span class="type-signature"> → {Object}</span></h4> <div class="description"> <p>Returns algorithm information</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/packet/public_key.js">packet/public_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/packet/public_key.js#L230">line 230</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>An object of the form {algorithm: String, bits:int, curve:String}.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Object</span> </dd> </dl> <h4 class="name" id="getCreationTime"><span class="type-signature"></span>getCreationTime<span class="signature">()</span><span class="type-signature"> → {Date}</span></h4> <div class="description"> <p>Returns the creation time of the key</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/packet/public_key.js">packet/public_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/packet/public_key.js#L172">line 172</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">Date</span> </dd> </dl> <h4 class="name" id="getCreationTime"><span class="type-signature"></span>getCreationTime<span class="signature">()</span><span class="type-signature"> → {Date}</span></h4> <div class="description"> <p>Returns the creation time of the key</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/packet/public_key.js">packet/public_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/packet/public_key.js#L172">line 172</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">Date</span> </dd> </dl> <h4 class="name" id="getDecryptionKeys"><span class="type-signature">(async) </span>getDecryptionKeys<span class="signature">(keyID,, date,, userID,, config<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Promise.<Array.<(<a href="Key.html">Key</a>|SubKey)>>}</span></h4> <div class="description"> <p>Returns all keys that are available for decryption, matching the keyID when given This is useful to retrieve keys for session key decryption</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>keyID,</code></td> <td class="type"> <span class="param-type"><a href="module-type_keyid-KeyID.html">module:type/keyid~KeyID</a></span> </td> <td class="attributes"> </td> <td class="description last"><p>optional</p></td> </tr> <tr> <td class="name"><code>date,</code></td> <td class="type"> <span class="param-type">Date</span> </td> <td class="attributes"> </td> <td class="description last"><p>optional</p></td> </tr> <tr> <td class="name"><code>userID,</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> </td> <td class="description last"><p>optional</p></td> </tr> <tr> <td class="name"><code>config</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> <optional><br> </td> <td class="description last"><p>Full configuration, defaults to openpgp.config</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js#L409">line 409</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Array of decryption keys.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Promise.<Array.<(<a href="Key.html">Key</a>|SubKey)>></span> </dd> </dl> <h4 class="name" id="getEncryptionKey"><span class="type-signature">(async) </span>getEncryptionKey<span class="signature">(keyID,, date,, userID,, config<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Promise.<(<a href="Key.html">Key</a>|SubKey|null)>}</span></h4> <div class="description"> <p>Returns last created key or key by given keyID that is available for encryption or decryption</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>keyID,</code></td> <td class="type"> <span class="param-type"><a href="module-type_keyid-KeyID.html">module:type/keyid~KeyID</a></span> </td> <td class="attributes"> </td> <td class="description last"><p>optional</p></td> </tr> <tr> <td class="name"><code>date,</code></td> <td class="type"> <span class="param-type">Date</span> </td> <td class="attributes"> </td> <td class="description last"><p>optional</p></td> </tr> <tr> <td class="name"><code>userID,</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> </td> <td class="description last"><p>optional</p></td> </tr> <tr> <td class="name"><code>config</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> <optional><br> </td> <td class="description last"><p>Full configuration, defaults to openpgp.config</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js#L363">line 363</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Key or null if no encryption key has been found.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Promise.<(<a href="Key.html">Key</a>|SubKey|null)></span> </dd> </dl> <h4 class="name" id="getExpirationTime"><span class="type-signature">(async) </span>getExpirationTime<span class="signature">(capabilities,, keyID,, userID,, config<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Promise.<(Date|Infinity|null)>}</span></h4> <div class="description"> <p>Returns the latest date when the key can be used for encrypting, signing, or both, depending on the <code>capabilities</code> paramater. When <code>capabilities</code> is null, defaults to returning the expiry date of the primary key. Returns null if <code>capabilities</code> is passed and the key does not have the specified capabilities or is revoked or invalid. Returns Infinity if the key doesn't expire.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>capabilities,</code></td> <td class="type"> <span class="param-type"><a href="global.html#encrypt">encrypt</a></span> | <span class="param-type"><a href="global.html#sign">sign</a></span> | <span class="param-type">encrypt_sign</span> </td> <td class="attributes"> </td> <td class="description last"><p>optional</p></td> </tr> <tr> <td class="name"><code>keyID,</code></td> <td class="type"> <span class="param-type"><a href="module-type_keyid-KeyID.html">module:type/keyid~KeyID</a></span> </td> <td class="attributes"> </td> <td class="description last"><p>optional</p></td> </tr> <tr> <td class="name"><code>userID,</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> </td> <td class="description last"><p>optional user ID</p></td> </tr> <tr> <td class="name"><code>config</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> <optional><br> </td> <td class="description last"><p>Full configuration, defaults to openpgp.config</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js#L552">line 552</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">Promise.<(Date|Infinity|null)></span> </dd> </dl> <h4 class="name" id="getFingerprint"><span class="type-signature"></span>getFingerprint<span class="signature">()</span><span class="type-signature"> → {String}</span></h4> <div class="description"> <p>Calculates the fingerprint of the key</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/packet/public_key.js">packet/public_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/packet/public_key.js#L214">line 214</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>A string containing the fingerprint in lowercase hex.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">String</span> </dd> </dl> <h4 class="name" id="getFingerprint"><span class="type-signature"></span>getFingerprint<span class="signature">()</span><span class="type-signature"> → {String}</span></h4> <div class="description"> <p>Calculates the fingerprint of the key</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/packet/public_key.js">packet/public_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/packet/public_key.js#L214">line 214</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>A string containing the fingerprint in lowercase hex.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">String</span> </dd> </dl> <h4 class="name" id="getKeyID"><span class="type-signature"></span>getKeyID<span class="signature">()</span><span class="type-signature"> → {<a href="module-type_keyid-KeyID.html">module:type/keyid~KeyID</a>}</span></h4> <div class="description"> <p>Calculates the key id of the key</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/packet/public_key.js">packet/public_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/packet/public_key.js#L180">line 180</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>A 8 byte key id.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="module-type_keyid-KeyID.html">module:type/keyid~KeyID</a></span> </dd> </dl> <h4 class="name" id="getKeyID"><span class="type-signature"></span>getKeyID<span class="signature">()</span><span class="type-signature"> → {<a href="module-type_keyid-KeyID.html">module:type/keyid~KeyID</a>}</span></h4> <div class="description"> <p>Calculates the key id of the key</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/packet/public_key.js">packet/public_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/packet/public_key.js#L180">line 180</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>A 8 byte key id.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="module-type_keyid-KeyID.html">module:type/keyid~KeyID</a></span> </dd> </dl> <h4 class="name" id="getKeyIDs"><span class="type-signature"></span>getKeyIDs<span class="signature">()</span><span class="type-signature"> → {Array.<<a href="module-type_keyid-KeyID.html">module:type/keyid~KeyID</a>>}</span></h4> <div class="description"> <p>Returns key IDs of all keys</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js#L221">line 221</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">Array.<<a href="module-type_keyid-KeyID.html">module:type/keyid~KeyID</a>></span> </dd> </dl> <h4 class="name" id="getKeys"><span class="type-signature"></span>getKeys<span class="signature">(keyID)</span><span class="type-signature"> → {Array.<(<a href="Key.html">Key</a>|SubKey)>}</span></h4> <div class="description"> <p>Returns an array containing all public or private keys matching keyID. If keyID is not present, returns all keys starting with the primary key.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>keyID</code></td> <td class="type"> <span class="param-type">type/keyid</span> </td> <td class="default"> null </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js#L209">line 209</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">Array.<(<a href="Key.html">Key</a>|SubKey)></span> </dd> </dl> <h4 class="name" id="getPrimaryUser"><span class="type-signature">(async) </span>getPrimaryUser<span class="signature">(date<span class="signature-attributes">opt</span>, userID<span class="signature-attributes">opt</span>, config<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Promise.<{user: User, selfCertification: <a href="SignaturePacket.html">SignaturePacket</a>}>}</span></h4> <div class="description"> <p>Returns primary user and most significant (latest valid) self signature</p> <ul> <li>if multiple primary users exist, returns the one with the latest self signature</li> <li>otherwise, returns the user with the latest self signature</li> </ul> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>date</code></td> <td class="type"> <span class="param-type">Date</span> </td> <td class="attributes"> <optional><br> </td> <td class="description last"><p>Use the given date for verification instead of the current time</p></td> </tr> <tr> <td class="name"><code>userID</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> <optional><br> </td> <td class="description last"><p>User ID to get instead of the primary user, if it exists</p></td> </tr> <tr> <td class="name"><code>config</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> <optional><br> </td> <td class="description last"><p>Full configuration, defaults to openpgp.config</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js#L590">line 590</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>The primary user and the self signature</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Promise.<{user: User, selfCertification: <a href="SignaturePacket.html">SignaturePacket</a>}></span> </dd> </dl> <h4 class="name" id="getRevocationCertificate"><span class="type-signature">(async) </span>getRevocationCertificate<span class="signature">(date, config<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Promise.<String>}</span></h4> <div class="description"> <p>Get revocation certificate from a revoked key. (To get a revocation certificate for an unrevoked key, call revoke() first.)</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>date</code></td> <td class="type"> <span class="param-type">Date</span> </td> <td class="attributes"> </td> <td class="description last"><p>Use the given date instead of the current time</p></td> </tr> <tr> <td class="name"><code>config</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> <optional><br> </td> <td class="description last"><p>Full configuration, defaults to openpgp.config</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js#L739">line 739</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Armored revocation certificate.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Promise.<String></span> </dd> </dl> <h4 class="name" id="getSigningKey"><span class="type-signature">(async) </span>getSigningKey<span class="signature">(keyID,, date<span class="signature-attributes">opt</span>, userID,, config<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Promise.<(<a href="Key.html">Key</a>|SubKey|null)>}</span></h4> <div class="description"> <p>Returns last created key or key by given keyID that is available for signing and verification</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>keyID,</code></td> <td class="type"> <span class="param-type"><a href="module-type_keyid-KeyID.html">module:type/keyid~KeyID</a></span> </td> <td class="attributes"> </td> <td class="description last"><p>optional</p></td> </tr> <tr> <td class="name"><code>date</code></td> <td class="type"> <span class="param-type">Date</span> </td> <td class="attributes"> <optional><br> </td> <td class="description last"><p>Use the given date for verification instead of the current time</p></td> </tr> <tr> <td class="name"><code>userID,</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> </td> <td class="description last"><p>optional user ID</p></td> </tr> <tr> <td class="name"><code>config</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> <optional><br> </td> <td class="description last"><p>Full configuration, defaults to openpgp.config</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js#L310">line 310</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Key or null if no signing key has been found.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Promise.<(<a href="Key.html">Key</a>|SubKey|null)></span> </dd> </dl> <h4 class="name" id="getSubkeys"><span class="type-signature"></span>getSubkeys<span class="signature">(keyID)</span><span class="type-signature"> → {Array.<SubKey>}</span></h4> <div class="description"> <p>Returns an array containing all public or private subkeys matching keyID; If keyID is not present, returns all subkeys.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>keyID</code></td> <td class="type"> <span class="param-type">type/keyid</span> </td> <td class="default"> null </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js#L193">line 193</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">Array.<SubKey></span> </dd> </dl> <h4 class="name" id="getUserIDs"><span class="type-signature"></span>getUserIDs<span class="signature">()</span><span class="type-signature"> → {Array.<string>}</span></h4> <div class="description"> <p>Returns userIDs</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js#L229">line 229</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Array of userIDs.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Array.<string></span> </dd> </dl> <h4 class="name" id="hasSameFingerprintAs"><span class="type-signature"></span>hasSameFingerprintAs<span class="signature">()</span><span class="type-signature"> → {Boolean}</span></h4> <div class="description"> <p>Calculates whether two keys have the same fingerprint without actually calculating the fingerprint</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/packet/public_key.js">packet/public_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/packet/public_key.js#L222">line 222</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Whether the two keys have the same version and public key data.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Boolean</span> </dd> </dl> <h4 class="name" id="hasSameFingerprintAs"><span class="type-signature"></span>hasSameFingerprintAs<span class="signature">()</span><span class="type-signature"> → {Boolean}</span></h4> <div class="description"> <p>Calculates whether two keys have the same fingerprint without actually calculating the fingerprint</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/packet/public_key.js">packet/public_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/packet/public_key.js#L222">line 222</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Whether the two keys have the same version and public key data.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Boolean</span> </dd> </dl> <h4 class="name" id="isDecrypted"><span class="type-signature"></span>isDecrypted<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> <p>Returns true if the primary key or any subkey is decrypted. A dummy key is considered encrypted.</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js#L438">line 438</a> </li></ul></dd> </dl> <h4 class="name" id="isPrivate"><span class="type-signature"></span>isPrivate<span class="signature">()</span><span class="type-signature"> → {Boolean}</span></h4> <div class="description"> <p>Returns true if this is a private key</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js#L247">line 247</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">Boolean</span> </dd> </dl> <h4 class="name" id="isPublic"><span class="type-signature"></span>isPublic<span class="signature">()</span><span class="type-signature"> → {Boolean}</span></h4> <div class="description"> <p>Returns true if this is a public key</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js#L239">line 239</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">Boolean</span> </dd> </dl> <h4 class="name" id="isRevoked"><span class="type-signature">(async) </span>isRevoked<span class="signature">(signature, key,, date, config<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Promise.<Boolean>}</span></h4> <div class="description"> <p>Checks if a signature on a key is revoked</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>signature</code></td> <td class="type"> <span class="param-type"><a href="SignaturePacket.html">SignaturePacket</a></span> </td> <td class="attributes"> </td> <td class="description last"><p>The signature to verify</p></td> </tr> <tr> <td class="name"><code>key,</code></td> <td class="type"> <span class="param-type"><a href="PublicSubkeyPacket.html">PublicSubkeyPacket</a></span> | <span class="param-type"><a href="SecretSubkeyPacket.html">SecretSubkeyPacket</a></span> | <span class="param-type"><a href="PublicKeyPacket.html">PublicKeyPacket</a></span> | <span class="param-type"><a href="SecretKeyPacket.html">SecretKeyPacket</a></span> </td> <td class="attributes"> </td> <td class="description last"><p>optional The key to verify the signature</p></td> </tr> <tr> <td class="name"><code>date</code></td> <td class="type"> <span class="param-type">Date</span> </td> <td class="attributes"> </td> <td class="description last"><p>Use the given date instead of the current time</p></td> </tr> <tr> <td class="name"><code>config</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> <optional><br> </td> <td class="description last"><p>Full configuration, defaults to openpgp.config</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js#L511">line 511</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>True if the certificate is revoked.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Promise.<Boolean></span> </dd> </dl> <h4 class="name" id="packetlist2structure"><span class="type-signature"></span>packetlist2structure<span class="signature">(packetlist)</span><span class="type-signature"></span></h4> <div class="description"> <p>Transforms packetlist to structured key data</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>packetlist</code></td> <td class="type"> <span class="param-type"><a href="PacketList.html">PacketList</a></span> </td> <td class="description last"><p>The packets that form a key</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js#L72">line 72</a> </li></ul></dd> </dl> <h4 class="name" id="revoke"><span class="type-signature">(async) </span>revoke<span class="signature">(reasonForRevocation, date, config<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Promise.<<a href="Key.html">Key</a>>}</span></h4> <div class="description"> <p>Revokes the key</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>reasonForRevocation</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> </td> <td class="description last"><p>optional, object indicating the reason for revocation</p> <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>flag</code></td> <td class="type"> <span class="param-type"><a href="module-enums.html#.reasonForRevocation">module:enums.reasonForRevocation</a></span> </td> <td class="description last"><p>optional, flag indicating the reason for revocation</p></td> </tr> <tr> <td class="name"><code>string</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last"><p>optional, string explaining the reason for revocation</p></td> </tr> </tbody> </table> </td> </tr> <tr> <td class="name"><code>date</code></td> <td class="type"> <span class="param-type">Date</span> </td> <td class="attributes"> </td> <td class="description last"><p>optional, override the creationtime of the revocation signature</p></td> </tr> <tr> <td class="name"><code>config</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> <optional><br> </td> <td class="description last"><p>Full configuration, defaults to openpgp.config</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js#L710">line 710</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>New key with revocation signature.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Promise.<<a href="Key.html">Key</a>></span> </dd> </dl> <h4 class="name" id="signAllUsers"><span class="type-signature">(async) </span>signAllUsers<span class="signature">(privateKeys, config<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Promise.<<a href="Key.html">Key</a>>}</span></h4> <div class="description"> <p>Signs all users of key</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>privateKeys</code></td> <td class="type"> <span class="param-type">Array.<<a href="Key.html">Key</a>></span> </td> <td class="attributes"> </td> <td class="description last"><p>decrypted private keys for signing</p></td> </tr> <tr> <td class="name"><code>config</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> <optional><br> </td> <td class="description last"><p>Full configuration, defaults to openpgp.config</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js#L804">line 804</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>New public key with new certificate signature.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Promise.<<a href="Key.html">Key</a>></span> </dd> </dl> <h4 class="name" id="signPrimaryUser"><span class="type-signature">(async) </span>signPrimaryUser<span class="signature">(privateKeys, date<span class="signature-attributes">opt</span>, userID<span class="signature-attributes">opt</span>, config<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Promise.<<a href="Key.html">Key</a>>}</span></h4> <div class="description"> <p>Signs primary user of key</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>privateKeys</code></td> <td class="type"> <span class="param-type">Array.<<a href="Key.html">Key</a>></span> </td> <td class="attributes"> </td> <td class="description last"><p>decrypted private keys for signing</p></td> </tr> <tr> <td class="name"><code>date</code></td> <td class="type"> <span class="param-type">Date</span> </td> <td class="attributes"> <optional><br> </td> <td class="description last"><p>Use the given date for verification instead of the current time</p></td> </tr> <tr> <td class="name"><code>userID</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> <optional><br> </td> <td class="description last"><p>User ID to get instead of the primary user, if it exists</p></td> </tr> <tr> <td class="name"><code>config</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> <optional><br> </td> <td class="description last"><p>Full configuration, defaults to openpgp.config</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js#L789">line 789</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>New public key with new certificate signature.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Promise.<<a href="Key.html">Key</a>></span> </dd> </dl> <h4 class="name" id="toPacketlist"><span class="type-signature"></span>toPacketlist<span class="signature">()</span><span class="type-signature"> → {<a href="PacketList.html">PacketList</a>}</span></h4> <div class="description"> <p>Transforms structured key data to packetlist</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js#L150">line 150</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>The packets that form a key.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="PacketList.html">PacketList</a></span> </dd> </dl> <h4 class="name" id="toPublic"><span class="type-signature"></span>toPublic<span class="signature">(config<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {<a href="Key.html">Key</a>}</span></h4> <div class="description"> <p>Returns key as public key (shallow copy)</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>config</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> <optional><br> </td> <td class="description last"><p>Full configuration, defaults to openpgp.config</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js#L256">line 256</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>New public Key.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="Key.html">Key</a></span> </dd> </dl> <h4 class="name" id="update"><span class="type-signature">(async) </span>update<span class="signature">(key, config<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Promise.<undefined>}</span></h4> <div class="description"> <p>Update key with new components from specified key with same key ID: users, subkeys, certificates are merged into the destination key, duplicates and expired signatures are ignored.</p> <p>If the specified key is a private key and the destination key is public, the destination key is transformed to a private key.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>key</code></td> <td class="type"> <span class="param-type"><a href="Key.html">Key</a></span> </td> <td class="attributes"> </td> <td class="description last"><p>Source key to merge</p></td> </tr> <tr> <td class="name"><code>config</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> <optional><br> </td> <td class="description last"><p>Full configuration, defaults to openpgp.config</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js#L645">line 645</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">Promise.<undefined></span> </dd> </dl> <h4 class="name" id="validate"><span class="type-signature">(async) </span>validate<span class="signature">(config<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4> <div class="description"> <p>Check whether the private and public primary key parameters correspond Together with verification of binding signatures, this guarantees key integrity In case of gnu-dummy primary key, it is enough to validate any signing subkeys otherwise all encryption subkeys are validated If only gnu-dummy keys are found, we cannot properly validate so we throw an error</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>config</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> <optional><br> </td> <td class="description last"><p>Full configuration, defaults to openpgp.config</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js#L452">line 452</a> </li></ul></dd> </dl> <h5>Throws:</h5> <dl> <dt> <div class="param-desc"> <p>if validation was not successful and the key cannot be trusted</p> </div> </dt> <dd></dd> <dt> <dl> <dt> Type </dt> <dd> <span class="param-type">Error</span> </dd> </dl> </dt> <dd></dd> </dl> <h4 class="name" id="verifyAllUsers"><span class="type-signature">(async) </span>verifyAllUsers<span class="signature">(keys, config<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Promise.<Array.<{userID: String, keyID: <a href="module-type_keyid-KeyID.html">module:type/keyid~KeyID</a>, valid: Boolean}>>}</span></h4> <div class="description"> <p>Verifies all users of key</p> <ul> <li>if no arguments are given, verifies the self certificates;</li> <li>otherwise, verifies all certificates signed with given keys.</li> </ul> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>keys</code></td> <td class="type"> <span class="param-type">Array.<<a href="Key.html">Key</a>></span> </td> <td class="attributes"> </td> <td class="description last"><p>array of keys to verify certificate signatures</p></td> </tr> <tr> <td class="name"><code>config</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> <optional><br> </td> <td class="description last"><p>Full configuration, defaults to openpgp.config</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js#L848">line 848</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>List of userID, signer's keyID and validity of signature</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Promise.<Array.<{userID: String, keyID: <a href="module-type_keyid-KeyID.html">module:type/keyid~KeyID</a>, valid: Boolean}>></span> </dd> </dl> <h4 class="name" id="verifyPrimaryKey"><span class="type-signature">(async) </span>verifyPrimaryKey<span class="signature">(date<span class="signature-attributes">opt</span>, userID<span class="signature-attributes">opt</span>, config<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4> <div class="description"> <p>Verify primary key. Checks for revocation signatures, expiration time and valid self signature. Throws if the primary key is invalid.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>date</code></td> <td class="type"> <span class="param-type">Date</span> </td> <td class="attributes"> <optional><br> </td> <td class="description last"><p>Use the given date for verification instead of the current time</p></td> </tr> <tr> <td class="name"><code>userID</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> <optional><br> </td> <td class="description last"><p>User ID</p></td> </tr> <tr> <td class="name"><code>config</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> <optional><br> </td> <td class="description last"><p>Full configuration, defaults to openpgp.config</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js#L526">line 526</a> </li></ul></dd> </dl> <h5>Throws:</h5> <dl> <dt> <div class="param-desc"> <p>If key verification failed</p> </div> </dt> <dd></dd> <dt> <dl> <dt> Type </dt> <dd> <span class="param-type">Error</span> </dd> </dl> </dt> <dd></dd> </dl> <h4 class="name" id="verifyPrimaryUser"><span class="type-signature">(async) </span>verifyPrimaryUser<span class="signature">(keys, date<span class="signature-attributes">opt</span>, userID<span class="signature-attributes">opt</span>, config<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Promise.<Array.<{keyID: <a href="module-type_keyid-KeyID.html">module:type/keyid~KeyID</a>, valid: Boolean}>>}</span></h4> <div class="description"> <p>Verifies primary user of key</p> <ul> <li>if no arguments are given, verifies the self certificates;</li> <li>otherwise, verifies all certificates signed with given keys.</li> </ul> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>keys</code></td> <td class="type"> <span class="param-type">Array.<<a href="Key.html">Key</a>></span> </td> <td class="attributes"> </td> <td class="description last"><p>array of keys to verify certificate signatures</p></td> </tr> <tr> <td class="name"><code>date</code></td> <td class="type"> <span class="param-type">Date</span> </td> <td class="attributes"> <optional><br> </td> <td class="description last"><p>Use the given date for verification instead of the current time</p></td> </tr> <tr> <td class="name"><code>userID</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> <optional><br> </td> <td class="description last"><p>User ID to get instead of the primary user, if it exists</p></td> </tr> <tr> <td class="name"><code>config</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> <optional><br> </td> <td class="description last"><p>Full configuration, defaults to openpgp.config</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js#L827">line 827</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>List of signer's keyID and validity of signature</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Promise.<Array.<{keyID: <a href="module-type_keyid-KeyID.html">module:type/keyid~KeyID</a>, valid: Boolean}>></span> </dd> </dl> <h4 class="name" id="write"><span class="type-signature"></span>write<span class="signature">()</span><span class="type-signature"> → {Uint8Array}</span></h4> <div class="description"> <p>Returns binary encoded key</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.0.0-2/src/key/key.js#L287">line 287</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Binary key.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Uint8Array</span> </dd> </dl> </article> </section> </div> <nav> <h2><a href="index.html">Home</a></h2><h3>Functions</h3><ul><li><a href="global.html#armor">armor</a></li><li><a href="global.html#createCleartextMessage">createCleartextMessage</a></li><li><a href="global.html#createMessage">createMessage</a></li><li><a href="global.html#decrypt">decrypt</a></li><li><a href="global.html#decryptKey">decryptKey</a></li><li><a href="global.html#decryptSessionKeys">decryptSessionKeys</a></li><li><a href="global.html#encrypt">encrypt</a></li><li><a href="global.html#encryptKey">encryptKey</a></li><li><a href="global.html#encryptSessionKey">encryptSessionKey</a></li><li><a href="global.html#generateKey">generateKey</a></li><li><a href="global.html#generateSessionKey">generateSessionKey</a></li><li><a href="global.html#newPacketFromTag">newPacketFromTag</a></li><li><a href="global.html#readCleartextMessage">readCleartextMessage</a></li><li><a href="global.html#readKey">readKey</a></li><li><a href="global.html#readKeys">readKeys</a></li><li><a href="global.html#readMessage">readMessage</a></li><li><a href="global.html#readSignature">readSignature</a></li><li><a href="global.html#reformatKey">reformatKey</a></li><li><a href="global.html#revokeKey">revokeKey</a></li><li><a href="global.html#sign">sign</a></li><li><a href="global.html#unarmor">unarmor</a></li><li><a href="global.html#verify">verify</a></li></ul><h3>Modules</h3><ul><li><a href="module-config.html">config</a></li><li><a href="module-enums.html">enums</a></li></ul><h3>Classes</h3><ul><li><a href="AEADEncryptedDataPacket.html">AEADEncryptedDataPacket</a></li><li><a href="CleartextMessage.html">CleartextMessage</a></li><li><a href="CompressedDataPacket.html">CompressedDataPacket</a></li><li><a href="Key.html">Key</a></li><li><a href="LiteralDataPacket.html">LiteralDataPacket</a></li><li><a href="MarkerPacket.html">MarkerPacket</a></li><li><a href="Message.html">Message</a></li><li><a href="module-crypto_random-RandomBuffer.html">RandomBuffer</a></li><li><a href="module-key_SubKey-SubKey.html">SubKey</a></li><li><a href="module-key_User-User.html">User</a></li><li><a href="module-type_kdf_params-KDFParams.html">KDFParams</a></li><li><a href="module-type_keyid-KeyID.html">KeyID</a></li><li><a href="module-type_s2k-S2K.html">S2K</a></li><li><a href="OnePassSignaturePacket.html">OnePassSignaturePacket</a></li><li><a href="PacketList.html">PacketList</a></li><li><a href="PublicKeyEncryptedSessionKeyPacket.html">PublicKeyEncryptedSessionKeyPacket</a></li><li><a href="PublicKeyPacket.html">PublicKeyPacket</a></li><li><a href="PublicSubkeyPacket.html">PublicSubkeyPacket</a></li><li><a href="SecretKeyPacket.html">SecretKeyPacket</a></li><li><a href="SecretSubkeyPacket.html">SecretSubkeyPacket</a></li><li><a href="Signature.html">Signature</a></li><li><a href="SignaturePacket.html">SignaturePacket</a></li><li><a href="SymEncryptedIntegrityProtectedDataPacket.html">SymEncryptedIntegrityProtectedDataPacket</a></li><li><a href="SymEncryptedSessionKeyPacket.html">SymEncryptedSessionKeyPacket</a></li><li><a href="SymmetricallyEncryptedDataPacket.html">SymmetricallyEncryptedDataPacket</a></li><li><a href="TrustPacket.html">TrustPacket</a></li><li><a href="UserAttributePacket.html">UserAttributePacket</a></li><li><a href="UserIDPacket.html">UserIDPacket</a></li></ul> </nav> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.4</a> </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>