Constructor
new CleartextMessage(text, signature)
Parameters:
Name | Type | Description |
---|---|---|
text |
String | The cleartext of the signed message |
signature |
Signature | The detached signature or an empty signature for unsigned messages |
- Source:
Classes
Methods
armor(configopt) → {String|ReadableStream.<String>}
Returns ASCII armored text of cleartext signed message
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
config |
Object |
<optional> |
Full configuration, defaults to openpgp.config |
- Source:
Returns:
ASCII armor.
- Type
- String | ReadableStream.<String>
getSigningKeyIDs() → {Array.<module:type/keyid~KeyID>}
Returns the key IDs of the keys that signed the cleartext message
- Source:
Returns:
Array of keyID objects.
- Type
- Array.<module:type/keyid~KeyID>
getText() → {String}
Get cleartext
- Source:
Returns:
Cleartext of message.
- Type
- String
(async) sign(signingKeys, recipientKeys, signatureopt, signingKeyIDsopt, dateopt, signingKeyIDsopt, recipientUserIDsopt, notationsopt, configopt) → {Promise.<CleartextMessage>}
Sign the cleartext message
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
signingKeys |
Array.<Key> | private keys with decrypted secret key data for signing |
||
recipientKeys |
Array.<Key> | recipient keys to get the signing preferences from |
||
signature |
Signature |
<optional> |
null | Any existing detached signature |
signingKeyIDs |
Array.<module:type/keyid~KeyID> |
<optional> |
Array of key IDs to use for signing. Each signingKeyIDs[i] corresponds to privateKeys[i] |
|
date |
Date |
<optional> |
The creation time of the signature that should be created |
|
signingKeyIDs |
Array |
<optional> |
User IDs to sign with, e.g. [{ name:'Steve Sender', email:'steve@openpgp.org' }] |
|
recipientUserIDs |
Array |
<optional> |
User IDs associated with |
|
notations |
Array |
<optional> |
Notation Data to add to the signatures, e.g. [{ name: 'test@example.org', value: new TextEncoder().encode('test'), humanReadable: true, critical: false }] |
|
config |
Object |
<optional> |
Full configuration, defaults to openpgp.config |
- Source:
Returns:
New cleartext message with signed content.
- Type
- Promise.<CleartextMessage>
(async) verify(keys, dateopt, configopt) → {Promise.<Array.<{keyID: module:type/keyid~KeyID, signature: Promise.<Signature>, verified: Promise.<true>}>>}
Verify signatures of cleartext signed message
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
keys |
Array.<Key> | Array of keys to verify signatures |
|
date |
Date |
<optional> |
Verify the signature against the given date, i.e. check signature creation time < date < expiration time |
config |
Object |
<optional> |
Full configuration, defaults to openpgp.config |
- Source:
Returns:
List of signer's keyID and validity of signature.
- Type
- Promise.<Array.<{keyID: module:type/keyid~KeyID, signature: Promise.<Signature>, verified: Promise.<true>}>>