<!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">()</span><span class="type-signature"></span></h2> <div class="class-description"><p>Abstract 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">()</span><span class="type-signature"></span></h4> <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.11.0/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.11.0/src/key/key.js#L48">line 48</a> </li></ul></dd> </dl> </div> <h3 class="subsection-title">Methods</h3> <h4 class="name" id="applyRevocationCertificate"><span class="type-signature">(async) </span>applyRevocationCertificate<span class="signature">(revocationCertificate, date<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>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>date</code></td> <td class="type"> <span class="param-type">Date</span> </td> <td class="attributes"> <optional><br> </td> <td class="description last"><p>Date to verify the 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.11.0/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.11.0/src/key/key.js#L593">line 593</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>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="clone"><span class="type-signature"></span>clone<span class="signature">(clonePrivateParams<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. The copy is shallow, as it references the same packet objects as the original. However, if the top-level API is used, the two key instances are effectively independent.</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>clonePrivateParams</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>Only relevant for private keys: whether the secret key paramenters should be deeply copied. This is needed if e.g. <code>encrypt()</code> is to be called either on the clone or the original 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.11.0/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.11.0/src/key/key.js#L175">line 175</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.11.0/src/packet/public_key.js">packet/public_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.11.0/src/packet/public_key.js#L256">line 256</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.11.0/src/packet/public_key.js">packet/public_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.11.0/src/packet/public_key.js#L184">line 184</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="getEncryptionKey"><span class="type-signature">(async) </span>getEncryptionKey<span class="signature">(keyID<span class="signature-attributes">opt</span>, 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>|Subkey)>}</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"> <optional><br> </td> <td class="description last"><p>key ID of a specific key to retrieve</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 fiven date date to to check key validity instead of the current date</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>filter keys for the given 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.11.0/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.11.0/src/key/key.js#L313">line 313</a> </li></ul></dd> </dl> <h5>Throws:</h5> <div class="param-desc"> <p>if no valid encryption key was found</p> </div> <h5>Returns:</h5> <div class="param-desc"> <p>encryption key</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Promise.<(<a href="Key.html">Key</a>|Subkey)></span> </dd> </dl> <h4 class="name" id="getExpirationTime"><span class="type-signature">(async) </span>getExpirationTime<span class="signature">(userID<span class="signature-attributes">opt</span>, config<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Promise.<(Date|Infinity|null)>}</span></h4> <div class="description"> <p>Returns the expiration date of the primary key, considering self-certifications and direct-key signatures. Returns <code>Infinity</code> if the key doesn't expire, or <code>null</code> if the key is revoked or 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>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 consider instead of the primary user</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.11.0/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.11.0/src/key/key.js#L406">line 406</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 and returns the fingerprint of the key, as a string</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.11.0/src/packet/public_key.js">packet/public_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.11.0/src/packet/public_key.js#L240">line 240</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>Return 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.11.0/src/packet/public_key.js">packet/public_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.11.0/src/packet/public_key.js#L192">line 192</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>The 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.11.0/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.11.0/src/key/key.js#L227">line 227</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 class="signature-attributes">opt</span>)</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 no keyID is given, 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>Attributes</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~KeyID</span> </td> <td class="attributes"> <optional><br> </td> <td class="default"> null </td> <td class="description last"><p>key ID to look for</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.11.0/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.11.0/src/key/key.js#L215">line 215</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>array of keys</p> </div> <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.11.0/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.11.0/src/key/key.js#L444">line 444</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.11.0/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.11.0/src/key/key.js#L575">line 575</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<span class="signature-attributes">opt</span>, 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>|Subkey)>}</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>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"><a href="module-type_keyid-KeyID.html">module:type/keyid~KeyID</a></span> </td> <td class="attributes"> <optional><br> </td> <td class="default"> null </td> <td class="description last"><p>key ID of a specific key to retrieve</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="default"> </td> <td class="description last"><p>use the fiven date date to to check key validity instead of the current date</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="default"> </td> <td class="description last"><p>filter keys for the given 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="default"> </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.11.0/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.11.0/src/key/key.js#L259">line 259</a> </li></ul></dd> </dl> <h5>Throws:</h5> <div class="param-desc"> <p>if no valid signing key was found</p> </div> <h5>Returns:</h5> <div class="param-desc"> <p>signing key</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Promise.<(<a href="Key.html">Key</a>|Subkey)></span> </dd> </dl> <h4 class="name" id="getSubkeys"><span class="type-signature"></span>getSubkeys<span class="signature">(keyID<span class="signature-attributes">opt</span>)</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 no keyID is given, returns all subkeys.</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>keyID</code></td> <td class="type"> <span class="param-type">type/keyID</span> </td> <td class="attributes"> <optional><br> </td> <td class="default"> null </td> <td class="description last"><p>key ID to look for</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.11.0/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.11.0/src/key/key.js#L202">line 202</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>array of subkeys</p> </div> <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.11.0/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.11.0/src/key/key.js#L235">line 235</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.11.0/src/packet/public_key.js">packet/public_key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.11.0/src/packet/public_key.js#L248">line 248</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="isRevoked"><span class="type-signature">(async) </span>isRevoked<span class="signature">(signature, key,, date<span class="signature-attributes">opt</span>, 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"> <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>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.11.0/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.11.0/src/key/key.js#L361">line 361</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="packetListToStructure"><span class="type-signature"></span>packetListToStructure<span class="signature">(packetlist, disallowedPackets)</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> <tr> <td class="name"><code>disallowedPackets</code></td> <td class="type"> <span class="param-type">Set.<enums.packet></span> </td> <td class="description last"><p>disallowed packet tags</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.11.0/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.11.0/src/key/key.js#L54">line 54</a> </li></ul></dd> </dl> <h4 class="name" id="signAllUsers"><span class="type-signature">(async) </span>signAllUsers<span class="signature">(privateKeys, date<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 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="PrivateKey.html">PrivateKey</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 signing, 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.11.0/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.11.0/src/key/key.js#L638">line 638</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>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="PrivateKey.html">PrivateKey</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.11.0/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.11.0/src/key/key.js#L622">line 622</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>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.11.0/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.11.0/src/key/key.js#L160">line 160</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="update"><span class="type-signature">(async) </span>update<span class="signature">(sourceKey, date<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>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 source key is a private key and the destination key is public, a private key is returned.</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>sourceKey</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>date</code></td> <td class="type"> <span class="param-type">Date</span> </td> <td class="attributes"> <optional><br> </td> <td class="description last"><p>Date to verify validity of signatures and keys</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.11.0/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.11.0/src/key/key.js#L500">line 500</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>updated 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="verifyAllUsers"><span class="type-signature">(async) </span>verifyAllUsers<span class="signature">(verificationKeys<span class="signature-attributes">opt</span>, date<span class="signature-attributes">opt</span>, 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|null)}>>}</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>verificationKeys</code></td> <td class="type"> <span class="param-type">Array.<<a href="PublicKey.html">PublicKey</a>></span> </td> <td class="attributes"> <optional><br> </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>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.11.0/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.11.0/src/key/key.js#L685">line 685</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>List of userID, signer's keyID and validity of signature. Signature validity is null if the verification keys do not correspond to the certificate.</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|null)}>></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.11.0/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.11.0/src/key/key.js#L376">line 376</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">(verificationKeys<span class="signature-attributes">opt</span>, 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|null)}>>}</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>verificationKeys</code></td> <td class="type"> <span class="param-type">Array.<<a href="PublicKey.html">PublicKey</a>></span> </td> <td class="attributes"> <optional><br> </td> <td class="description last"><p>array of keys to verify certificate signatures, instead of the primary key</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.11.0/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.11.0/src/key/key.js#L661">line 661</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>List of signer's keyID and validity of signature. Signature validity is null if the verification keys do not correspond to the certificate.</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|null)}>></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.11.0/src/key/key.js">key/key.js</a>, <a href="https://github.com/openpgpjs/openpgpjs/blob/v5.11.0/src/key/key.js#L245">line 245</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#aes">aes</a></li><li><a href="global.html#armor">armor</a></li><li><a href="global.html#createCleartextMessage">createCleartextMessage</a></li><li><a href="global.html#createKey">createKey</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#formatObject">formatObject</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#readPrivateKey">readPrivateKey</a></li><li><a href="global.html#readPrivateKeys">readPrivateKeys</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><li><a href="global.html#wrapKeyObject">wrapKeyObject</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><li><a href="module-type_x25519x448_symkey.html">type/x25519x448_symkey</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-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="PrivateKey.html">PrivateKey</a></li><li><a href="PublicKey.html">PublicKey</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>