Add uploaded date attribute to PGP key document in MongoDB

This commit is contained in:
Tankred Hase 2017-08-22 11:26:12 +08:00
parent 74063915c7
commit afacbf413f
2 changed files with 4 additions and 0 deletions

View File

@ -72,6 +72,7 @@ class PGP {
fingerprint, fingerprint,
userIds, userIds,
created: primaryKey.created, created: primaryKey.created,
uploaded: new Date(),
algorithm: primaryKey.algorithm, algorithm: primaryKey.algorithm,
keySize: primaryKey.getBitSize(), keySize: primaryKey.getBitSize(),
publicKeyArmored publicKeyArmored

View File

@ -94,6 +94,7 @@ describe('PGP Unit Tests', () => {
expect(params.userIds[0].name).to.equal('safewithme testuser'); expect(params.userIds[0].name).to.equal('safewithme testuser');
expect(params.userIds[0].email).to.equal('safewithme.testuser@gmail.com'); expect(params.userIds[0].email).to.equal('safewithme.testuser@gmail.com');
expect(params.created.getTime()).to.exist; expect(params.created.getTime()).to.exist;
expect(params.uploaded.getTime()).to.exist;
expect(params.algorithm).to.equal('rsa_encrypt_sign'); expect(params.algorithm).to.equal('rsa_encrypt_sign');
expect(params.keySize).to.equal(2048); expect(params.keySize).to.equal(2048);
expect(params.publicKeyArmored).to.equal(key1Armored); expect(params.publicKeyArmored).to.equal(key1Armored);
@ -105,6 +106,7 @@ describe('PGP Unit Tests', () => {
expect(params.fingerprint).to.equal('e3317db04d3958fd5f662c37b8e4105cc9dedc77'); expect(params.fingerprint).to.equal('e3317db04d3958fd5f662c37b8e4105cc9dedc77');
expect(params.userIds.length).to.equal(1); expect(params.userIds.length).to.equal(1);
expect(params.created.getTime()).to.exist; expect(params.created.getTime()).to.exist;
expect(params.uploaded.getTime()).to.exist;
expect(params.algorithm).to.equal('rsa_encrypt_sign'); expect(params.algorithm).to.equal('rsa_encrypt_sign');
expect(params.keySize).to.equal(4096); expect(params.keySize).to.equal(4096);
expect(params.publicKeyArmored).to.equal(pgp.trimKey(key2Armored)); expect(params.publicKeyArmored).to.equal(pgp.trimKey(key2Armored));
@ -116,6 +118,7 @@ describe('PGP Unit Tests', () => {
expect(params.fingerprint).to.equal('04062c70b446e33016e219a74001a127a90de8e1'); expect(params.fingerprint).to.equal('04062c70b446e33016e219a74001a127a90de8e1');
expect(params.userIds.length).to.equal(4); expect(params.userIds.length).to.equal(4);
expect(params.created.getTime()).to.exist; expect(params.created.getTime()).to.exist;
expect(params.uploaded.getTime()).to.exist;
expect(params.algorithm).to.equal('rsa_encrypt_sign'); expect(params.algorithm).to.equal('rsa_encrypt_sign');
expect(params.keySize).to.equal(4096); expect(params.keySize).to.equal(4096);
expect(params.publicKeyArmored).to.equal(pgp.trimKey(key3Armored)); expect(params.publicKeyArmored).to.equal(pgp.trimKey(key3Armored));