namirasoft-core 1.2.8 → 1.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare class EncryptionOperation {
|
|
2
2
|
private static encrypt;
|
|
3
3
|
private static decrypt;
|
|
4
|
-
static AES256CCMEncrypt(secret: string, message:
|
|
5
|
-
static AES256CCMDecrypt(secret: string, message: string):
|
|
4
|
+
static AES256CCMEncrypt<T>(secret: string, message: T): string;
|
|
5
|
+
static AES256CCMDecrypt<T>(secret: string, message: string): T;
|
|
6
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EncryptionOperation.js","sourceRoot":"","sources":["../src/EncryptionOperation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAEtC,MAAa,mBAAmB;IAEpB,MAAM,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"EncryptionOperation.js","sourceRoot":"","sources":["../src/EncryptionOperation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAEtC,MAAa,mBAAmB;IAEpB,MAAM,CAAC,OAAO,CAAI,SAAiB,EAAE,MAAc,EAAE,OAAU;QAEnE,MAAM,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;QAC/B,MAAM,MAAM,GAAG,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;QAC5D,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACvF,CAAC;IACO,MAAM,CAAC,OAAO,CAAI,SAAiB,EAAE,MAAc,EAAE,OAAe;QAExE,IAAI,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAEhD,MAAM,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;QAC/B,MAAM,QAAQ,GAAG,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;QAEhE,IAAI,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QAC/C,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QACzD,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC5C,CAAC;IACD,MAAM,CAAC,gBAAgB,CAAI,MAAc,EAAE,OAAU;QAEjD,OAAO,mBAAmB,CAAC,OAAO,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACvE,CAAC;IACD,MAAM,CAAC,gBAAgB,CAAI,MAAc,EAAE,OAAe;QAEtD,OAAO,mBAAmB,CAAC,OAAO,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACvE,CAAC;CACJ;AA3BD,kDA2BC"}
|
package/dist/HashOperation.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HashOperation.js","sourceRoot":"","sources":["../src/HashOperation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAEtC,MAAa,aAAa;IAEtB,MAAM,CAAC,YAAY,
|
|
1
|
+
{"version":3,"file":"HashOperation.js","sourceRoot":"","sources":["../src/HashOperation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAEtC,MAAa,aAAa;IAEtB,MAAM,CAAC,YAAY,CAAI,MAAc,EAAE,OAAU;QAE7C,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACjD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;QACrC,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;IACD,MAAM,CAAC,MAAM,CAAI,OAAU;QAEvB,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QACzC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;QACrC,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;CACJ;AAdD,sCAcC"}
|
package/package.json
CHANGED
|
@@ -2,13 +2,13 @@ import * as crypto from 'node:crypto';
|
|
|
2
2
|
|
|
3
3
|
export class EncryptionOperation
|
|
4
4
|
{
|
|
5
|
-
private static encrypt(algorithm: string, secret: string, message:
|
|
5
|
+
private static encrypt<T>(algorithm: string, secret: string, message: T): string
|
|
6
6
|
{
|
|
7
7
|
const iv = Buffer.alloc(16, 0);
|
|
8
8
|
const cipher = crypto.createCipheriv(algorithm, secret, iv);
|
|
9
9
|
return cipher.update(JSON.stringify(message), 'utf8', 'hex') + cipher.final('hex');
|
|
10
10
|
}
|
|
11
|
-
private static decrypt(algorithm: string, secret: string, message: string):
|
|
11
|
+
private static decrypt<T>(algorithm: string, secret: string, message: string): T
|
|
12
12
|
{
|
|
13
13
|
let encryptedText = Buffer.from(message, 'hex');
|
|
14
14
|
|
|
@@ -19,11 +19,11 @@ export class EncryptionOperation
|
|
|
19
19
|
decrypted = Buffer.concat([decrypted, decipher.final()]);
|
|
20
20
|
return JSON.parse(decrypted.toString());
|
|
21
21
|
}
|
|
22
|
-
static AES256CCMEncrypt(secret: string, message:
|
|
22
|
+
static AES256CCMEncrypt<T>(secret: string, message: T): string
|
|
23
23
|
{
|
|
24
24
|
return EncryptionOperation.encrypt("aes-256-ccm", secret, message);
|
|
25
25
|
}
|
|
26
|
-
static AES256CCMDecrypt(secret: string, message: string):
|
|
26
|
+
static AES256CCMDecrypt<T>(secret: string, message: string): T
|
|
27
27
|
{
|
|
28
28
|
return EncryptionOperation.decrypt("aes-256-ccm", secret, message);
|
|
29
29
|
}
|
package/src/HashOperation.ts
CHANGED
|
@@ -2,13 +2,13 @@ import * as crypto from 'node:crypto';
|
|
|
2
2
|
|
|
3
3
|
export class HashOperation
|
|
4
4
|
{
|
|
5
|
-
static sha256Secret(secret: string, message:
|
|
5
|
+
static sha256Secret<T>(secret: string, message: T): string
|
|
6
6
|
{
|
|
7
7
|
const hash = crypto.createHmac('sha256', secret);
|
|
8
8
|
hash.update(JSON.stringify(message));
|
|
9
9
|
return hash.digest('hex');
|
|
10
10
|
}
|
|
11
|
-
static sha256(message:
|
|
11
|
+
static sha256<T>(message: T): string
|
|
12
12
|
{
|
|
13
13
|
const hash = crypto.createHash('sha256');
|
|
14
14
|
hash.update(JSON.stringify(message));
|