Class: AsyncProxy

async_proxy~ AsyncProxy

new AsyncProxy(path)

Initializes a new proxy and loads the web worker
Parameters:
Name Type Description
path String The path to the worker or 'openpgp.worker.js' by default
Source:

Methods

decryptAndVerifyMessage(privateKey, publicKeys, message, callback)

Decrypts message and verifies signatures
Parameters:
Name Type Description
privateKey module:key~Key private key with decrypted secret key data
publicKeys Array.<module:key~Key> public keys to verify signatures
message module:message~Message the message object with signed and encrypted data
callback function receives decrypted message as as native JavaScript string with verified signatures or null if no literal data found
Source:

decryptKey(privateKey, password, callback)

Decrypts secret part of all secret key packets of key.
Parameters:
Name Type Description
privateKey module:key~Key private key with encrypted secret key data
password String password to unlock the key
callback function receives decrypted key
Source:

decryptKeyPacket(privateKey, keyIds, password, callback)

Decrypts secret part of key packets matching array of keyids.
Parameters:
Name Type Description
privateKey module:key~Key private key with encrypted secret key data
keyIds Array.<module:type/keyid>
password String password to unlock the key
callback function receives decrypted key
Source:

decryptMessage(privateKey, message, callback)

Decrypts message
Parameters:
Name Type Description
privateKey module:key~Key private key with decrypted secret key data
message module:message~Message the message object with the encrypted data
callback function receives decrypted message as as native JavaScript string or null if no literal data found
Source:

encryptMessage(keys, text, callback)

Encrypts message text with keys
Parameters:
Name Type Description
keys Array.<module:key~Key> array of keys, used to encrypt the message
text String message as native JavaScript string
callback function receives encrypted ASCII armored message
Source:

generateKeyPair(keyType, numBits, userId, passphrase, callback)

Generates a new OpenPGP key pair. Currently only supports RSA keys. Primary and subkey will be of same type.
Parameters:
Name Type Description
keyType module:enums.publicKey to indicate what type of key to make. RSA is 1. See http://tools.ietf.org/html/rfc4880#section-9.1
numBits Integer number of bits for the key creation. (should be 1024+, generally)
userId String assumes already in form of "User Name "
passphrase String The passphrase used to encrypt the resulting private key
callback function receives object with key and public and private armored texts
Source:

getRandomBuffer(size) → {Uint8Array}

Get Uint8Array with random numbers
Parameters:
Name Type Description
size Integer Length of buffer
Source:
Returns:
Type
Uint8Array

onMessage()

Message handling
Source:

seedRandom(size)

Send message to worker with random data
Parameters:
Name Type Description
size Integer Number of bytes to send
Source:

signAndEncryptMessage(publicKeys, privateKey, text, callback)

Signs message text and encrypts it
Parameters:
Name Type Description
publicKeys Array.<module:key~Key> array of keys, used to encrypt the message
privateKey module:key~Key private key with decrypted secret key data for signing
text String message as native JavaScript string
callback function receives encrypted ASCII armored message
Source:

signClearMessage(privateKeys, text, callback)

Signs a cleartext message
Parameters:
Name Type Description
privateKeys Array.<module:key~Key> private key with decrypted secret key data to sign cleartext
text String cleartext
callback function receives ASCII armored message
Source:

terminate()

Terminates the worker
Source:

verifyClearSignedMessage(publicKeys, message, callback)

Verifies signatures of cleartext signed message
Parameters:
Name Type Description
publicKeys Array.<module:key~Key> public keys to verify signatures
message module:cleartext~CleartextMessage cleartext message object with signatures
callback function receives cleartext with status of verified signatures
Source: