mirror of
https://github.com/moparisthebest/mail
synced 2024-12-23 07:48:48 -05:00
Merge remote-tracking branch 'origin/dev/account-info'
This commit is contained in:
commit
4dac2b63a5
@ -12,6 +12,17 @@ define(function(require) {
|
||||
var AccountCtrl = function($scope) {
|
||||
emailDao = appController._emailDao;
|
||||
|
||||
//
|
||||
// scope variables
|
||||
//
|
||||
|
||||
var fpr = emailDao._crypto.getFingerprint(),
|
||||
keyId = emailDao._crypto.getKeyId();
|
||||
$scope.eMail = emailDao._account.emailAddress;
|
||||
$scope.keyId = keyId.slice(0,4) + ' ' + keyId.slice(4,8) + ' ' + keyId.slice(8,12) + ' ' + keyId.slice(12);
|
||||
$scope.fingerprint = fpr.slice(0,4) + ' ' + fpr.slice(4,8) + ' ' + fpr.slice(8,12) + ' ' + fpr.slice(12,16) + ' ' + fpr.slice(16,20) + ' ' + fpr.slice(20,24) + ' ' + fpr.slice(24,28) + ' ' + fpr.slice(28,32) + ' ' + fpr.slice(32,36) + ' ' + fpr.slice(36);
|
||||
$scope.keysize = emailDao._account.asymKeySize;
|
||||
|
||||
//
|
||||
// scope functions
|
||||
//
|
||||
|
@ -43,6 +43,38 @@ define(function(require) {
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Show a user's fingerprint
|
||||
*/
|
||||
PGP.prototype.getFingerprint = function() {
|
||||
var publicKey, privateKey;
|
||||
|
||||
privateKey = openpgp.keyring.exportPrivateKey(0);
|
||||
if (privateKey && privateKey.keyId) {
|
||||
publicKey = openpgp.keyring.getPublicKeysForKeyId(privateKey.keyId)[0];
|
||||
}
|
||||
|
||||
if (!privateKey || !privateKey.keyId || !privateKey.armored || !publicKey || !publicKey.armored) {
|
||||
console.error('Public key not available!');
|
||||
return '';
|
||||
}
|
||||
|
||||
return util.hexstrdump(publicKey.obj.getFingerprint()).toUpperCase();
|
||||
};
|
||||
|
||||
/**
|
||||
* Show a user's key id
|
||||
*/
|
||||
PGP.prototype.getKeyId = function() {
|
||||
var privateKey = openpgp.keyring.exportPrivateKey(0);
|
||||
if (!privateKey || !privateKey.keyId) {
|
||||
console.error('Public key not available!');
|
||||
return '';
|
||||
}
|
||||
|
||||
return util.hexstrdump(privateKey.keyId).toUpperCase();
|
||||
};
|
||||
|
||||
/**
|
||||
* Import the user's key pair
|
||||
*/
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
// Views
|
||||
@import "views/shared";
|
||||
@import "views/account";
|
||||
@import "views/navigation";
|
||||
@import "views/mail-list";
|
||||
@import "views/read";
|
||||
|
29
src/sass/views/_account.scss
Normal file
29
src/sass/views/_account.scss
Normal file
@ -0,0 +1,29 @@
|
||||
.view-account {
|
||||
padding: 0px;
|
||||
color: $color-grey-dark;
|
||||
|
||||
@include respond-to(mobile) {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
table {
|
||||
margin: 50px auto 100px auto;
|
||||
|
||||
td {
|
||||
padding-top: 15px;
|
||||
|
||||
&:first-child {
|
||||
text-align: right;
|
||||
padding-right: 15px;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
button {
|
||||
border: 0!important;
|
||||
position: absolute;
|
||||
bottom: 15px;
|
||||
right: 15px;
|
||||
}
|
||||
}
|
@ -5,6 +5,28 @@
|
||||
</header>
|
||||
|
||||
<div class="content">
|
||||
<button ng-click="exportKeyFile()" class="btn">Export keypair</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="view-account">
|
||||
<table summary="Kontakt">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Account</td>
|
||||
<td>{{eMail}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>PGP Key ID</td>
|
||||
<td>{{keyId}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>PGP Key Fingerprint</td>
|
||||
<td><span>{{fingerprint}}</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>PGP Key Size</td>
|
||||
<td>{{keysize}} bit</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<button ng-click="exportKeyFile()" class="btn">Export keypair</button>
|
||||
</div><!-- /.view-account -->
|
||||
</div><!-- /.content -->
|
||||
</div><!-- /.lightbox-body -->
|
@ -132,6 +132,20 @@ define(function(require) {
|
||||
});
|
||||
});
|
||||
|
||||
describe('Get KeyId', function() {
|
||||
it('should work', function() {
|
||||
var keyId = pgp.getKeyId();
|
||||
expect(keyId).to.equal('F6F60E9B42CDFF4C');
|
||||
});
|
||||
});
|
||||
|
||||
describe('Get Fingerprint', function() {
|
||||
it('should work', function() {
|
||||
var fingerprint = pgp.getFingerprint();
|
||||
expect(fingerprint).to.equal('5856CEF789C3A307E8A1B976F6F60E9B42CDFF4C');
|
||||
});
|
||||
});
|
||||
|
||||
describe('Encrypt', function() {
|
||||
it('should work', function(done) {
|
||||
pgp.encrypt(message, [pubkey], function(err, ct) {
|
||||
|
Loading…
Reference in New Issue
Block a user