Rename openpgp api: generateKeyPair --> generateKey
This commit is contained in:
parent
735ec3df74
commit
f72b4522ad
|
@ -83,12 +83,12 @@ export function getWorker() {
|
||||||
* { key:Key, privateKeyArmored:String, publicKeyArmored:String }
|
* { key:Key, privateKeyArmored:String, publicKeyArmored:String }
|
||||||
* @static
|
* @static
|
||||||
*/
|
*/
|
||||||
export function generateKeyPair({ userIds=[], passphrase, numBits=2048, unlocked=false } = {}) {
|
export function generateKey({ userIds=[], passphrase, numBits=2048, unlocked=false } = {}) {
|
||||||
userIds = userIds.map(id => id.name + ' <' + id.email + '>'); // format user ids for internal use
|
userIds = userIds.map(id => id.name + ' <' + id.email + '>'); // format user ids for internal use
|
||||||
const options = { userIds, passphrase, numBits, unlocked };
|
const options = { userIds, passphrase, numBits, unlocked };
|
||||||
|
|
||||||
if (!util.getWebCrypto() && asyncProxy) { // use web worker if web crypto apis are not supported
|
if (!util.getWebCrypto() && asyncProxy) { // use web worker if web crypto apis are not supported
|
||||||
return asyncProxy.generateKeyPair(options);
|
return asyncProxy.generateKey(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
return key.generate(options).then(newKey => ({
|
return key.generate(options).then(newKey => ({
|
||||||
|
@ -106,7 +106,7 @@ export function generateKeyPair({ userIds=[], passphrase, numBits=2048, unlocked
|
||||||
}
|
}
|
||||||
// fall back to js keygen in a worker
|
// fall back to js keygen in a worker
|
||||||
console.log('Error generating keypair using native WebCrypto... falling back back to js!');
|
console.log('Error generating keypair using native WebCrypto... falling back back to js!');
|
||||||
return asyncProxy.generateKeyPair(options);
|
return asyncProxy.generateKey(options);
|
||||||
|
|
||||||
}).catch(onError.bind(null, 'Error generating keypair!'));
|
}).catch(onError.bind(null, 'Error generating keypair!'));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user