mirror of
https://github.com/moparisthebest/mail
synced 2024-11-26 19:02:20 -05:00
set correct user id format when generating keys
This commit is contained in:
parent
0e17bd4f26
commit
39e2e418e4
@ -15,7 +15,7 @@ define(function(require) {
|
|||||||
* Generate a key pair for the user
|
* Generate a key pair for the user
|
||||||
*/
|
*/
|
||||||
PGP.prototype.generateKeys = function(options, callback) {
|
PGP.prototype.generateKeys = function(options, callback) {
|
||||||
var keys;
|
var keys, userId;
|
||||||
|
|
||||||
if (!util.emailRegEx.test(options.emailAddress) || !options.keySize || typeof options.passphrase !== 'string') {
|
if (!util.emailRegEx.test(options.emailAddress) || !options.keySize || typeof options.passphrase !== 'string') {
|
||||||
callback({
|
callback({
|
||||||
@ -26,7 +26,8 @@ define(function(require) {
|
|||||||
|
|
||||||
// generate keypair (keytype 1=RSA)
|
// generate keypair (keytype 1=RSA)
|
||||||
try {
|
try {
|
||||||
keys = openpgp.generate_key_pair(1, options.keySize, options.emailAddress, options.passphrase);
|
userId = 'Whiteout User <' + options.emailAddress + '>';
|
||||||
|
keys = openpgp.generate_key_pair(1, options.keySize, userId, options.passphrase);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
callback({
|
callback({
|
||||||
errMsg: 'Keygeneration failed!',
|
errMsg: 'Keygeneration failed!',
|
||||||
@ -56,6 +57,8 @@ define(function(require) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// clear any keypair already in the keychain
|
||||||
|
openpgp.keyring.init();
|
||||||
// unlock and import private key
|
// unlock and import private key
|
||||||
if (!openpgp.keyring.importPrivateKey(options.privateKeyArmored, options.passphrase)) {
|
if (!openpgp.keyring.importPrivateKey(options.privateKeyArmored, options.passphrase)) {
|
||||||
openpgp.keyring.init();
|
openpgp.keyring.init();
|
||||||
|
Loading…
Reference in New Issue
Block a user