Skip to content

Commit 155e7be

Browse files
committed
refactor: remove unused properties from key generation and test cases
1 parent 6322ffd commit 155e7be

3 files changed

Lines changed: 4 additions & 9 deletions

File tree

src/services/crypto.service.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,9 @@ export class CryptoService {
1818
return CryptoService.instance.encryptText(hashObj.hash);
1919
},
2020
async generateKeys(password: Password): Promise<Keys> {
21-
const { privateKeyArmoredEncrypted, publicKeyArmored, revocationCertificate } =
21+
const { privateKeyArmoredEncrypted, publicKeyArmored } =
2222
await KeysService.instance.generateNewKeysWithEncrypted(password);
2323
const keys: Keys = {
24-
privateKeyEncrypted: privateKeyArmoredEncrypted,
25-
publicKey: publicKeyArmored,
26-
revocationCertificate: revocationCertificate,
2724
ecc: {
2825
privateKeyEncrypted: privateKeyArmoredEncrypted,
2926
publicKey: publicKeyArmored,

test/services/crypto.service.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,6 @@ describe('Crypto service', () => {
8787
.mockResolvedValue(keysReturned);
8888

8989
const expectedKeys: Keys = {
90-
privateKeyEncrypted: keysReturned.privateKeyArmoredEncrypted,
91-
publicKey: keysReturned.publicKeyArmored,
92-
revocationCertificate: keysReturned.revocationCertificate,
9390
ecc: {
9491
privateKeyEncrypted: keysReturned.privateKeyArmoredEncrypted,
9592
publicKey: keysReturned.publicKeyArmored,

test/services/keys.service.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,17 @@ describe('Keys service', () => {
2828
});
2929

3030
test('when new encryption keys are needed, then they are generated using the cryptography library', async () => {
31-
interface KeyPair {
31+
interface PgpGenerationKeys {
3232
privateKey: openpgp.PrivateKey;
3333
publicKey: openpgp.PublicKey;
34+
revocationCertificate: string;
3435
}
3536

3637
const pgpKeys = {
3738
privateKey: crypto.randomBytes(16).toString('hex'),
3839
publicKey: crypto.randomBytes(16).toString('hex'),
3940
revocationCertificate: crypto.randomBytes(16).toString('hex'),
40-
} as unknown as KeyPair & { revocationCertificate: string };
41+
} as unknown as PgpGenerationKeys;
4142

4243
const pgpKeysWithEncrypted = {
4344
privateKeyArmored: pgpKeys.privateKey,

0 commit comments

Comments
 (0)