Skip to content

Commit

Permalink
v2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanbekhen committed Jan 23, 2021
1 parent f90e7f6 commit 0c09944
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ryanbekhen/cryptkhen",
"version": "2.0.7",
"version": "2.1.0",
"description": "Simple security signature",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
6 changes: 3 additions & 3 deletions src/core/cryptkhen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ import { RSAEncryption } from './rsaEncryption';

export class Cryptkhen {
generateKeypair(modulusLength?: ModulusLength, passphrase?: string): KeyPairSyncResult<string, string> {
const _passphrase = passphrase == undefined ? '' : passphrase;
const _passphrase = passphrase === undefined ? '' : passphrase;
const signatureRSA: SignatureRSA = new SignatureRSA(_passphrase, modulusLength);
return signatureRSA.generateKeyPair();
}

encrypt(plainText: any, pem: any, passphrase?: string) {
const _passphrase = passphrase == undefined ? '' : passphrase;
const _passphrase = passphrase === undefined ? '' : passphrase;
return RSAEncryption.encrypt(plainText, pem, _passphrase);
}

decrypt(cipher: any, pem: any, passphrase?: string) {
const _passphrase = passphrase == undefined ? '' : passphrase;
const _passphrase = passphrase === undefined ? '' : passphrase;
return RSAEncryption.decrypt(cipher, pem, _passphrase);
}
}
4 changes: 2 additions & 2 deletions src/core/rsaEncryption.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class RSAEncryption {
cipher = privateEncrypt(
{
key: pem,
passphrase: passphrase,
passphrase,
},
buffer,
);
Expand All @@ -32,7 +32,7 @@ export class RSAEncryption {
plainText = privateDecrypt(
{
key: pem,
passphrase: passphrase,
passphrase,
},
buffer,
);
Expand Down
2 changes: 1 addition & 1 deletion src/core/signatureRSA.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class SignatureRSA {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
passphrase: passphrase,
passphrase,
};
}

Expand Down

0 comments on commit 0c09944

Please sign in to comment.