Constructor
new Editor(editorId)
Parameters:
| Name | Type | Description |
|---|---|---|
editorId | String | the internal id of the editor |
- Source
Methods
createDraft() → {Promise.<AsciiArmored, Error>}
Encrypt and sign the content of the editor with the default key of the user.
To be used to save drafts. To restore drafts use the options.armoredDraft parameter of the createEditorContainer method.
- Source
Throws:
error.code = 'ENCRYPT_IN_PROGRESS'
error.code = 'NO_KEY_FOR_ENCRYPTION'
error.code = 'ENCRYPT_QUOTA_SIZE'- Type
- Error
Returns:
- Type:
- Promise.<AsciiArmored, Error>
encrypt(recipients) → {Promise.<AsciiArmored, Error>}
Requests the encryption of the editor content for the given recipients.
Parameters:
| Name | Type | Description |
|---|---|---|
recipients | Array.<String> | list of email addresses for public key lookup and encryption |
- Source
Throws:
error.code = 'ENCRYPT_IN_PROGRESS'
error.code = 'NO_KEY_FOR_RECIPIENT'
error.code = 'ENCRYPT_QUOTA_SIZE'- Type
- Error
Returns:
- Type:
- Promise.<AsciiArmored, Error>
Example
editor.encrypt(['abc@web.de', 'info@com']).then(function (armoredMessage) {
console.log('encrypt', armoredMessage); // prints: "-----BEGIN PGP MESSAGE..."
});