Class: Mailvelope

Mailvelope


new Mailvelope()

Source:

Methods


createDisplayContainer(selector, armored [, keyring], options)

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

Parameters:
Name Type Argument Description
selector CssSelector

target container

armored AsciiArmored

the encrypted mail to display

keyring Keyring <optional>

the keyring to use for this operation

options DisplayContainerOptions
Source:
Returns:
Type
Promise.<DisplayContainer, Error>

createEditorContainer(selector [, keyring], options)

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

Parameters:
Name Type Argument Description
selector CssSelector

target container

keyring Keyring <optional>

the keyring to use for this operation

options EditorContainerOptions
Source:
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(@param, @param, @param)

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

Parameters:
Name Type Description
@param String

selector - the id of target container

@param String

formHtml - the form definition

@param String

signature - the OpenPGP signature

Source:
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)

Creates a Keyring for the given identifier

Parameters:
Name Type Description
identifier String

the identifier of the new keyring

Source:
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 [, keyring], options)

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

Parameters:
Name Type Argument Description
selector CssSelector

target container

keyring Keyring <optional>

the keyring to use for the setup

options SettingsContainerOptions
Source:
Returns:
Type
Promise.<undefined, Error>

getKeyring(identifier)

Retrieves the Keyring for the given identifier

Parameters:
Name Type Description
identifier String

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

Source:
Throws:

error.code = 'NO_KEYRING_FOR_ID'

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

getVersion()

Gives access to the mailvelope extension version

Source:
Returns:
Type
Promise.<String, Error>