Mailvelope

new Mailvelope()

Methods

createDisplayContainer(selector, armored, keyringopt, options) → {Promise.<DisplayContainer, Error>}

Creates an iframe to display the decrypted content of the encrypted mail.
The iframe will be injected into the container identified by selector.

Parameters:
NameTypeAttributesDescription
selectorCssSelector

target container

armoredAsciiArmored

the encrypted mail to display

keyringKeyring<optional>

the keyring to use for this operation

optionsDisplayContainerOptions
Returns:
Type: 
Promise.<DisplayContainer, Error>

createEditorContainer(selector, keyringopt, options) → {Promise.<Editor, Error>}

Creates an iframe with an editor for a new encrypted mail.
The iframe will be injected into the container identified by selector.

Parameters:
NameTypeAttributesDescription
selectorCssSelector

target container

keyringKeyring<optional>

the keyring to use for this operation

optionsEditorContainerOptions
Throws:

error.code = 'WRONG_ARMORED_TYPE' - parameters of type AsciiArmored do not have the correct armor type

error.code = 'INVALID_OPTIONS' - invalid combination of options parameter

Type
Error
Returns:
Type: 
Promise.<Editor, Error>
Example
mailvelope.createEditorContainer('#editor-element', keyring).then(function(editor) {
    // register event handler for mail client send button
    $('#mailer-send').click(function() {
        // encrypt current content of editor for array of recipients
        editor.encrypt(['info@mailvelope.com', 'abc@web.de']).then(function(armored) {
          console.log('encrypted message', armored);
        });
    });
});

createEncryptedFormContainer(selector, formHtml, signature) → {Promise.<Object, Error>}

Creates an iframe to display an encrypted form
The iframe will be injected into the container identified by selector.

Parameters:
NameTypeDescription
selectorCssSelector

target container

formHtmlString

the form definition

signatureAsciiArmored

the OpenPGP signature over the form definition

Throws:

error.code = 'INVALID_FORM' the form definition is not valid

Type
Error
Returns:

an object that includes armoredData

Type: 
Promise.<Object, Error>

createKeyring(identifier) → {Promise.<Keyring, Error>}

Creates a Keyring for the given identifier

Parameters:
NameTypeDescription
identifierString

the identifier of the new keyring

Throws:

error.code = 'KEYRING_ALREADY_EXISTS'

Type
Error
Returns:
Type: 
Promise.<Keyring, Error>
Example
mailvelope.createKeyring('Account-ID-4711').then(function(keyring) {
    // continue to display the settings container and start the setup wizard
    mailvelope.createSettingsContainer('#mailvelope-settings', keyring);
});

createSettingsContainer(selector, keyringopt, options) → {Promise.<undefined, Error>}

Creates an iframe to display the keyring settings.
The iframe will be injected into the container identified by selector.

Parameters:
NameTypeAttributesDescription
selectorCssSelector

target container

keyringKeyring<optional>

the keyring to use for the setup

optionsSettingsContainerOptions
Deprecated
  • since v6.1.0 - use keyring.openSettings() instead
Returns:
Type: 
Promise.<undefined, Error>

getKeyring(identifier) → {Promise.<Keyring, Error>}

Retrieves the Keyring for the given identifier

Parameters:
NameTypeDescription
identifierString

the identifier of the keyring, if empty the main keyring is returned

Throws:

error.code = 'NO_KEYRING_FOR_ID'

Type
Error
Returns:
Type: 
Promise.<Keyring, Error>

getVersion() → {Promise.<String, Error>}

Gives access to the mailvelope extension version

Returns:
Type: 
Promise.<String, Error>