mirror of
https://github.com/moparisthebest/mail
synced 2024-11-25 18:32:20 -05:00
bugfix import keypair after new generation
This commit is contained in:
parent
df24d4f7a5
commit
0e17bd4f26
@ -76,20 +76,32 @@ define(function(require) {
|
||||
return;
|
||||
}
|
||||
|
||||
// persist newly generated keypair
|
||||
var newKeypair = {
|
||||
publicKey: {
|
||||
_id: generatedKeypair.keyId,
|
||||
userId: self._account.emailAddress,
|
||||
publicKey: generatedKeypair.publicKeyArmored
|
||||
},
|
||||
privateKey: {
|
||||
_id: generatedKeypair.keyId,
|
||||
userId: self._account.emailAddress,
|
||||
encryptedKey: generatedKeypair.privateKeyArmored
|
||||
// import the new key pair into crypto module
|
||||
self._crypto.importKeys({
|
||||
passphrase: passphrase,
|
||||
privateKeyArmored: generatedKeypair.privateKeyArmored,
|
||||
publicKeyArmored: generatedKeypair.publicKeyArmored
|
||||
}, function(err) {
|
||||
if (err) {
|
||||
callback(err);
|
||||
return;
|
||||
}
|
||||
};
|
||||
self._keychain.putUserKeyPair(newKeypair, callback);
|
||||
|
||||
// persist newly generated keypair
|
||||
var newKeypair = {
|
||||
publicKey: {
|
||||
_id: generatedKeypair.keyId,
|
||||
userId: self._account.emailAddress,
|
||||
publicKey: generatedKeypair.publicKeyArmored
|
||||
},
|
||||
privateKey: {
|
||||
_id: generatedKeypair.keyId,
|
||||
userId: self._account.emailAddress,
|
||||
encryptedKey: generatedKeypair.privateKeyArmored
|
||||
}
|
||||
};
|
||||
self._keychain.putUserKeyPair(newKeypair, callback);
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "Whiteout Mail",
|
||||
"description": "Simple & elegant email client with integrated end-to-end encryption. Keeping your emails safe has never been so easy.",
|
||||
"version": "0.0.5.1",
|
||||
"version": "0.0.6.0",
|
||||
"manifest_version": 2,
|
||||
"offline_enabled": true,
|
||||
"icons": {
|
||||
|
@ -73,12 +73,14 @@ define(function(require) {
|
||||
devicestorageStub.init.yields();
|
||||
keychainStub.getUserKeyPair.yields();
|
||||
pgpStub.generateKeys.yields(null, {});
|
||||
pgpStub.importKeys.yields();
|
||||
keychainStub.putUserKeyPair.yields();
|
||||
|
||||
emailDao.init(account, emaildaoTest.passphrase, function(err) {
|
||||
expect(devicestorageStub.init.calledOnce).to.be.true;
|
||||
expect(keychainStub.getUserKeyPair.calledOnce).to.be.true;
|
||||
expect(pgpStub.generateKeys.calledOnce).to.be.true;
|
||||
expect(pgpStub.importKeys.calledOnce).to.be.true;
|
||||
expect(keychainStub.putUserKeyPair.calledOnce).to.be.true;
|
||||
expect(err).to.not.exist;
|
||||
done();
|
||||
@ -136,12 +138,14 @@ define(function(require) {
|
||||
devicestorageStub.init.yields();
|
||||
keychainStub.getUserKeyPair.yields();
|
||||
pgpStub.generateKeys.yields(null, {});
|
||||
pgpStub.importKeys.yields();
|
||||
keychainStub.putUserKeyPair.yields();
|
||||
|
||||
emailDao.init(account, emaildaoTest.passphrase, function(err) {
|
||||
expect(devicestorageStub.init.calledOnce).to.be.true;
|
||||
expect(keychainStub.getUserKeyPair.calledOnce).to.be.true;
|
||||
expect(pgpStub.generateKeys.calledOnce).to.be.true;
|
||||
expect(pgpStub.importKeys.calledOnce).to.be.true;
|
||||
expect(keychainStub.putUserKeyPair.calledOnce).to.be.true;
|
||||
expect(err).to.not.exist;
|
||||
done();
|
||||
|
Loading…
Reference in New Issue
Block a user