xypriss-security 2.1.4 → 2.1.5
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.
- package/dist/src/core/Hash.d.ts.map +1 -1
- package/dist/src/core/Hash.js.map +1 -1
- package/dist/src/core/Random.d.ts +1 -2
- package/dist/src/core/Random.d.ts.map +1 -1
- package/dist/src/core/Random.js +1 -2
- package/dist/src/core/Random.js.map +1 -1
- package/dist/src/core/XyPrissSecurity.d.ts +15 -0
- package/dist/src/core/XyPrissSecurity.d.ts.map +1 -1
- package/dist/src/core/XyPrissSecurity.js +16 -1
- package/dist/src/core/XyPrissSecurity.js.map +1 -1
- package/dist/src/core/keys.d.ts +48 -0
- package/dist/src/core/keys.d.ts.map +1 -1
- package/dist/src/core/keys.js +50 -1
- package/dist/src/core/keys.js.map +1 -1
- package/dist/src/utils/index.d.ts +2 -72
- package/dist/src/utils/index.d.ts.map +1 -1
- package/dist/src/utils/index.js +1 -71
- package/dist/src/utils/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Hash.d.ts","sourceRoot":"","sources":["../../../src/core/Hash.ts"],"names":[],"mappings":"AAAA;;8EAE8E;AAG9E,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEtD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"Hash.d.ts","sourceRoot":"","sources":["../../../src/core/Hash.ts"],"names":[],"mappings":"AAAA;;8EAE8E;AAG9E,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEtD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;;;GAIG;AACH,qBAAa,IAAI;IACf;;;;;;OAMG;WACW,MAAM,CAClB,KAAK,EAAE,MAAM,GAAG,UAAU,EAC1B,OAAO,GAAE,WAAgB,GACxB,MAAM,GAAG,YAAY;IA4CxB;;;;;;OAMG;WACW,IAAI,CAChB,QAAQ,EAAE,MAAM,EAChB,MAAM,GAAE,MAAM,GAAG,OAAgB,GAChC,MAAM;IAaT;;;;;;;OAOG;WACW,IAAI,CAChB,GAAG,EAAE,MAAM,GAAG,UAAU,EACxB,IAAI,EAAE,MAAM,GAAG,UAAU,EACzB,IAAI,GAAE,MAAiB,GACtB,MAAM;IAMT;;OAEG;WACW,gBAAgB,CAC5B,IAAI,EAAE,aAAa,GAAG,MAAM,EAC5B,GAAG,EAAE,MAAM,GAAG,UAAU,EACxB,IAAI,EAAE,MAAM,GAAG,UAAU,GACxB,MAAM;CAGV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Hash.js","sourceRoot":"","sources":["../../../src/core/Hash.ts"],"names":[],"mappings":";AAAA;;8EAE8E;;;AAE9E,qCAAkC;AAElC,qCAAkC;AAClC,iDAA8C;
|
|
1
|
+
{"version":3,"file":"Hash.js","sourceRoot":"","sources":["../../../src/core/Hash.ts"],"names":[],"mappings":";AAAA;;8EAE8E;;;AAE9E,qCAAkC;AAElC,qCAAkC;AAClC,iDAA8C;AAE9C;;;;GAIG;AACH,MAAa,IAAI;IACf;;;;;;OAMG;IACI,MAAM,CAAC,MAAM,CAClB,KAA0B,EAC1B,UAAuB,EAAE;QAEzB,MAAM,IAAI,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,QAAQ,EAAE,IAAI,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAC;QACvE,IAAI,SAAiB,CAAC;QAEtB,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;YACtB,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI;gBACvB,CAAC,CAAC,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ;oBAChC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;oBAC3B,CAAC,CAAC,OAAO,CAAC,IAAI;gBAChB,CAAC,CAAC,eAAM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AAG,CAAC,QAAQ,CAAC,QAAQ,CAAQ,CAAC;YACvC;gBACE,OAAO,SAAS,CAAC;QACrB,CAAC;IACH,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,IAAI,CAChB,QAAgB,EAChB,SAA2B,MAAM;QAEjC,IAAI,MAAM,KAAK,OAAO;YAAE,OAAO,QAAQ,CAAC;QAExC,oCAAoC;QACpC,MAAM,MAAM,GAAG,eAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACvC,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QACvC,OAAO,GAAG;aACP,QAAQ,CAAC,QAAQ,CAAC;aAClB,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;aACnB,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;aACnB,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACvB,CAAC;IAED;;;;;;;OAOG;IACI,MAAM,CAAC,IAAI,CAChB,GAAwB,EACxB,IAAyB,EACzB,OAAe,QAAQ;QAEvB,MAAM,GAAG,GAAG,eAAM,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QACzC,IAAI,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;QACnD,OAAO,GAAG,CAAC;IACb,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,gBAAgB,CAC5B,IAA4B,EAC5B,GAAwB,EACxB,IAAyB;QAEzB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACpC,CAAC;CACF;AA1GD,oBA0GC"}
|
|
@@ -4,13 +4,12 @@
|
|
|
4
4
|
import { Bridge } from "./bridge";
|
|
5
5
|
import { SecureBuffer } from "./SecureBuffer";
|
|
6
6
|
import { SecureTokenOptions } from "../types";
|
|
7
|
-
import { Keys } from "./keys";
|
|
8
7
|
/**
|
|
9
8
|
* ### Random Class
|
|
10
9
|
*
|
|
11
10
|
* Cryptographically secure random number and token generation.
|
|
12
11
|
*/
|
|
13
|
-
export declare class Random
|
|
12
|
+
export declare class Random {
|
|
14
13
|
/**
|
|
15
14
|
* Generates a readable secure random token with specified constraints.
|
|
16
15
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Random.d.ts","sourceRoot":"","sources":["../../../src/core/Random.ts"],"names":[],"mappings":"AAAA;;8EAE8E;AAE9E,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"Random.d.ts","sourceRoot":"","sources":["../../../src/core/Random.ts"],"names":[],"mappings":"AAAA;;8EAE8E;AAE9E,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAI9C;;;;GAIG;AACH,qBAAa,MAAM;IACjB;;;;;;OAMG;WACW,aAAa,CACzB,MAAM,GAAE,MAAW,EACnB,OAAO,GAAE,kBAAuB,GAC/B,YAAY;IA2Bf;;OAEG;WACW,WAAW,CAAC,MAAM,GAAE,MAAU,GAAG,MAAM;IAMrD;;OAEG;WACW,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAI/C;;;;;OAKG;WACW,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY;IAK1D;;;;;;OAMG;WACW,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM;IAUzD;;OAEG;WACW,KAAK,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,OAAO,MAAM,CAAC,cAAc,CAAC;IAIrE;;OAEG;WACW,GAAG,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,OAAO,MAAM,CAAC,WAAW,CAAC;IAIhE;;OAEG;WACW,mBAAmB,CAC/B,GAAG,IAAI,EAAE,UAAU,CAAC,OAAO,MAAM,CAAC,aAAa,CAAC;CAInD"}
|
package/dist/src/core/Random.js
CHANGED
|
@@ -7,13 +7,12 @@ exports.Random = void 0;
|
|
|
7
7
|
const bridge_1 = require("./bridge");
|
|
8
8
|
const SecureBuffer_1 = require("./SecureBuffer");
|
|
9
9
|
const utils_1 = require("../utils");
|
|
10
|
-
const keys_1 = require("./keys");
|
|
11
10
|
/**
|
|
12
11
|
* ### Random Class
|
|
13
12
|
*
|
|
14
13
|
* Cryptographically secure random number and token generation.
|
|
15
14
|
*/
|
|
16
|
-
class Random
|
|
15
|
+
class Random {
|
|
17
16
|
/**
|
|
18
17
|
* Generates a readable secure random token with specified constraints.
|
|
19
18
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Random.js","sourceRoot":"","sources":["../../../src/core/Random.ts"],"names":[],"mappings":";AAAA;;8EAE8E;;;AAE9E,qCAAkC;AAClC,iDAA8C;AAE9C,oCAA0C;
|
|
1
|
+
{"version":3,"file":"Random.js","sourceRoot":"","sources":["../../../src/core/Random.ts"],"names":[],"mappings":";AAAA;;8EAE8E;;;AAE9E,qCAAkC;AAClC,iDAA8C;AAE9C,oCAA0C;AAG1C;;;;GAIG;AACH,MAAa,MAAM;IACjB;;;;;;OAMG;IACI,MAAM,CAAC,aAAa,CACzB,SAAiB,EAAE,EACnB,UAA8B,EAAE;QAEhC,IAAI,OAAO,GAAG,EAAE,CAAC;QAEjB,iCAAiC;QACjC,IACE,OAAO,CAAC,gBAAgB,KAAK,KAAK;YAClC,OAAO,CAAC,gBAAgB,KAAK,KAAK;YAClC,OAAO,CAAC,cAAc,KAAK,KAAK;YAChC,OAAO,CAAC,cAAc,KAAK,KAAK,EAChC,CAAC;YACD,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AAI,GAAG,KAAK,SAAS,EAAE,CAAC;YACtB,OAAO,eAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QACvC,CAAC;QACD,MAAM,GAAG,GAAG,QAAQ,CAAC;QACrB,MAAM,KAAK,GAAG,GAAG,GAAG,GAAG,CAAC;QACxB,IAAI,KAAK,IAAI,CAAC;YAAE,OAAO,GAAG,CAAC;QAC3B,OAAO,GAAG,GAAG,eAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IAC1C,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,KAAK,CAAC,GAAG,IAA8C;QACnE,OAAO,eAAM,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,CAAC;IACxC,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,GAAG,CAAC,GAAG,IAA2C;QAC9D,OAAO,eAAM,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,CAAC;IACrC,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,mBAAmB,CAC/B,GAAG,IAA6C;QAEhD,OAAO,MAAM,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,CAAC;IACvC,CAAC;CACF;AAxGD,wBAwGC"}
|
|
@@ -36,4 +36,19 @@ export declare class XyPrissSecurity {
|
|
|
36
36
|
*/
|
|
37
37
|
static isValidByteLength(str: string, expectedLength: number): boolean;
|
|
38
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Verifies if a string has exactly the expected byte length (UTF-8).
|
|
41
|
+
*
|
|
42
|
+
* @param str - The string to check.
|
|
43
|
+
* @param length - The expected number of bytes.
|
|
44
|
+
* @returns True if the byte length matches, false otherwise.
|
|
45
|
+
*/
|
|
46
|
+
export declare const isValidByteLength: typeof XyPrissSecurity.isValidByteLength;
|
|
47
|
+
/**
|
|
48
|
+
* Returns the actual byte length of a string (UTF-8).
|
|
49
|
+
*
|
|
50
|
+
* @param str - The string to measure.
|
|
51
|
+
* @returns The number of bytes.
|
|
52
|
+
*/
|
|
53
|
+
export declare const getByteLength: typeof XyPrissSecurity.getByteLength;
|
|
39
54
|
//# sourceMappingURL=XyPrissSecurity.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"XyPrissSecurity.d.ts","sourceRoot":"","sources":["../../../src/core/XyPrissSecurity.ts"],"names":[],"mappings":"AAAA;;8EAE8E;AAG9E,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC;;;;GAIG;AACH,qBAAa,eAAe;IAC1B;;;;;OAKG;WACW,cAAc,CAAC,OAAO,GAAE,aAAkB,GAAG,MAAM;IAyBjE;;OAEG;WACW,qBAAqB,IAAI,OAAO;IAI9C;;;;;;OAMG;WACW,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAIhD;;;;;;OAMG;WACW,iBAAiB,CAC7B,GAAG,EAAE,MAAM,EACX,cAAc,EAAE,MAAM,GACrB,OAAO;CAGX"}
|
|
1
|
+
{"version":3,"file":"XyPrissSecurity.d.ts","sourceRoot":"","sources":["../../../src/core/XyPrissSecurity.ts"],"names":[],"mappings":"AAAA;;8EAE8E;AAG9E,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC;;;;GAIG;AACH,qBAAa,eAAe;IAC1B;;;;;OAKG;WACW,cAAc,CAAC,OAAO,GAAE,aAAkB,GAAG,MAAM;IAyBjE;;OAEG;WACW,qBAAqB,IAAI,OAAO;IAI9C;;;;;;OAMG;WACW,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAIhD;;;;;;OAMG;WACW,iBAAiB,CAC7B,GAAG,EAAE,MAAM,EACX,cAAc,EAAE,MAAM,GACrB,OAAO;CAGX;AAGD;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,0CAAoC,CAAC;AAEnE;;;;;GAKG;AACH,eAAO,MAAM,aAAa,sCAAgC,CAAC"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* XyPriss Security Core - Main Class
|
|
4
4
|
****************************************************************************/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.XyPrissSecurity = void 0;
|
|
6
|
+
exports.getByteLength = exports.isValidByteLength = exports.XyPrissSecurity = void 0;
|
|
7
7
|
const bridge_1 = require("./bridge");
|
|
8
8
|
/**
|
|
9
9
|
* ### XyPrissSecurity Main Class
|
|
@@ -61,4 +61,19 @@ class XyPrissSecurity {
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
exports.XyPrissSecurity = XyPrissSecurity;
|
|
64
|
+
/**
|
|
65
|
+
* Verifies if a string has exactly the expected byte length (UTF-8).
|
|
66
|
+
*
|
|
67
|
+
* @param str - The string to check.
|
|
68
|
+
* @param length - The expected number of bytes.
|
|
69
|
+
* @returns True if the byte length matches, false otherwise.
|
|
70
|
+
*/
|
|
71
|
+
exports.isValidByteLength = XyPrissSecurity.isValidByteLength;
|
|
72
|
+
/**
|
|
73
|
+
* Returns the actual byte length of a string (UTF-8).
|
|
74
|
+
*
|
|
75
|
+
* @param str - The string to measure.
|
|
76
|
+
* @returns The number of bytes.
|
|
77
|
+
*/
|
|
78
|
+
exports.getByteLength = XyPrissSecurity.getByteLength;
|
|
64
79
|
//# sourceMappingURL=XyPrissSecurity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"XyPrissSecurity.js","sourceRoot":"","sources":["../../../src/core/XyPrissSecurity.ts"],"names":[],"mappings":";AAAA;;8EAE8E;;;AAE9E,qCAAkC;AAGlC;;;;GAIG;AACH,MAAa,eAAe;IAC1B;;;;;OAKG;IACI,MAAM,CAAC,cAAc,CAAC,UAAyB,EAAE;QACtD,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,IAAI,CAAC;QACtC,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,GAAG,CAAC;QAC3C,MAAM,YAAY,GAAG,OAAO,CAAC,gBAAgB,IAAI,EAAE,CAAC;QACpD,MAAM,gBAAgB,GAAG,OAAO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AAEnE;;;;;GAKG;AACU,QAAA,aAAa,GAAG,eAAe,CAAC,aAAa,CAAC"}
|
package/dist/src/core/keys.d.ts
CHANGED
|
@@ -51,4 +51,52 @@ export declare class Keys {
|
|
|
51
51
|
*/
|
|
52
52
|
static rsaDecrypt(privateKey: string, encryptedHex: string): Promise<string>;
|
|
53
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Generates a high-entropy 4096-bit RSA key pair.
|
|
56
|
+
*
|
|
57
|
+
* @returns A promise resolving to an object containing PEM-encoded publicKey and privateKey.
|
|
58
|
+
*/
|
|
59
|
+
export declare const generateRSAKeyPair: typeof Keys.generateRSAKeyPair;
|
|
60
|
+
/**
|
|
61
|
+
* Signs data using RSA-PSS with SHA-256.
|
|
62
|
+
*
|
|
63
|
+
* @param privateKey - The PEM-encoded RSA private key.
|
|
64
|
+
* @param data - The data string to sign.
|
|
65
|
+
* @returns A promise resolving to the hex-encoded signature.
|
|
66
|
+
*/
|
|
67
|
+
export declare const rsaSign: typeof Keys.rsaSign;
|
|
68
|
+
/**
|
|
69
|
+
* Verifies an RSA-PSS signature.
|
|
70
|
+
*
|
|
71
|
+
* @param publicKey - The PEM-encoded RSA public key.
|
|
72
|
+
* @param data - The original data string that was signed.
|
|
73
|
+
* @param signature - The hex-encoded signature to verify.
|
|
74
|
+
* @returns A promise resolving to true if valid, false otherwise.
|
|
75
|
+
*/
|
|
76
|
+
export declare const rsaVerify: typeof Keys.rsaVerify;
|
|
77
|
+
/**
|
|
78
|
+
* Encrypts data using RSA-OAEP with SHA-256.
|
|
79
|
+
*
|
|
80
|
+
* @param publicKey - The PEM-encoded RSA public key.
|
|
81
|
+
* @param data - The plaintext data string to encrypt.
|
|
82
|
+
* @returns A promise resolving to the hex-encoded ciphertext.
|
|
83
|
+
*/
|
|
84
|
+
export declare const rsaEncrypt: typeof Keys.rsaEncrypt;
|
|
85
|
+
/**
|
|
86
|
+
* Decrypts data using RSA-OAEP with SHA-256.
|
|
87
|
+
*
|
|
88
|
+
* @param privateKey - The PEM-encoded RSA private key.
|
|
89
|
+
* @param encryptedHex - The hex-encoded ciphertext to decrypt.
|
|
90
|
+
* @returns A promise resolving to the decrypted plaintext string.
|
|
91
|
+
*/
|
|
92
|
+
export declare const rsaDecrypt: typeof Keys.rsaDecrypt;
|
|
93
|
+
/**
|
|
94
|
+
* Derives a cryptographically strong key from an input secret.
|
|
95
|
+
* Supports multiple algorithms including Argon2id, PBKDF2, and HKDF.
|
|
96
|
+
*
|
|
97
|
+
* @param input - The base secret or password.
|
|
98
|
+
* @param options - Configuration for the derivation process.
|
|
99
|
+
* @returns A promise resolving to the derived key.
|
|
100
|
+
*/
|
|
101
|
+
export declare const deriveKey: typeof Keys.deriveKey;
|
|
54
102
|
//# sourceMappingURL=keys.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../../../src/core/keys.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAKhD,qBAAa,IAAI;IACf;;;;;;;OAOG;WACiB,SAAS,CAC3B,KAAK,EAAE,MAAM,GAAG,UAAU,EAC1B,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,MAAM,CAAC;IAyClB;;;OAGG;WACiB,kBAAkB,IAAI,OAAO,CAAC;QAChD,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;IAIF;;;;;OAKG;WACiB,OAAO,CACzB,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,MAAM,CAAC;IAIlB;;;;;;OAMG;WACiB,SAAS,CAC3B,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,OAAO,CAAC;IAInB;;;;;OAKG;WACiB,UAAU,CAC5B,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,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UAAU,wBAAkB,CAAC;AAE1C;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,wBAAkB,CAAC;AAE1C;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS,uBAAiB,CAAC"}
|
package/dist/src/core/keys.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* High-performance Go-backed operations
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.Keys = void 0;
|
|
7
|
+
exports.deriveKey = exports.rsaDecrypt = exports.rsaEncrypt = exports.rsaVerify = exports.rsaSign = exports.generateRSAKeyPair = exports.Keys = void 0;
|
|
8
8
|
const Password_1 = require("./Password");
|
|
9
9
|
const bridge_1 = require("./bridge");
|
|
10
10
|
const Random_1 = require("./Random");
|
|
@@ -84,4 +84,53 @@ class Keys {
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
exports.Keys = Keys;
|
|
87
|
+
// =================================== UTILES ==========================
|
|
88
|
+
/**
|
|
89
|
+
* Generates a high-entropy 4096-bit RSA key pair.
|
|
90
|
+
*
|
|
91
|
+
* @returns A promise resolving to an object containing PEM-encoded publicKey and privateKey.
|
|
92
|
+
*/
|
|
93
|
+
exports.generateRSAKeyPair = Keys.generateRSAKeyPair;
|
|
94
|
+
/**
|
|
95
|
+
* Signs data using RSA-PSS with SHA-256.
|
|
96
|
+
*
|
|
97
|
+
* @param privateKey - The PEM-encoded RSA private key.
|
|
98
|
+
* @param data - The data string to sign.
|
|
99
|
+
* @returns A promise resolving to the hex-encoded signature.
|
|
100
|
+
*/
|
|
101
|
+
exports.rsaSign = Keys.rsaSign;
|
|
102
|
+
/**
|
|
103
|
+
* Verifies an RSA-PSS signature.
|
|
104
|
+
*
|
|
105
|
+
* @param publicKey - The PEM-encoded RSA public key.
|
|
106
|
+
* @param data - The original data string that was signed.
|
|
107
|
+
* @param signature - The hex-encoded signature to verify.
|
|
108
|
+
* @returns A promise resolving to true if valid, false otherwise.
|
|
109
|
+
*/
|
|
110
|
+
exports.rsaVerify = Keys.rsaVerify;
|
|
111
|
+
/**
|
|
112
|
+
* Encrypts data using RSA-OAEP with SHA-256.
|
|
113
|
+
*
|
|
114
|
+
* @param publicKey - The PEM-encoded RSA public key.
|
|
115
|
+
* @param data - The plaintext data string to encrypt.
|
|
116
|
+
* @returns A promise resolving to the hex-encoded ciphertext.
|
|
117
|
+
*/
|
|
118
|
+
exports.rsaEncrypt = Keys.rsaEncrypt;
|
|
119
|
+
/**
|
|
120
|
+
* Decrypts data using RSA-OAEP with SHA-256.
|
|
121
|
+
*
|
|
122
|
+
* @param privateKey - The PEM-encoded RSA private key.
|
|
123
|
+
* @param encryptedHex - The hex-encoded ciphertext to decrypt.
|
|
124
|
+
* @returns A promise resolving to the decrypted plaintext string.
|
|
125
|
+
*/
|
|
126
|
+
exports.rsaDecrypt = Keys.rsaDecrypt;
|
|
127
|
+
/**
|
|
128
|
+
* Derives a cryptographically strong key from an input secret.
|
|
129
|
+
* Supports multiple algorithms including Argon2id, PBKDF2, and HKDF.
|
|
130
|
+
*
|
|
131
|
+
* @param input - The base secret or password.
|
|
132
|
+
* @param options - Configuration for the derivation process.
|
|
133
|
+
* @returns A promise resolving to the derived key.
|
|
134
|
+
*/
|
|
135
|
+
exports.deriveKey = Keys.deriveKey;
|
|
87
136
|
//# sourceMappingURL=keys.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keys.js","sourceRoot":"","sources":["../../../src/core/keys.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,yCAAsC;AACtC,qCAAkC;AAClC,qCAAkC;AAElC,MAAa,IAAI;IACf;;;;;;;OAOG;IACI,MAAM,CAAC,KAAK,CAAC,SAAS,CAC3B,KAA0B,EAC1B,UAAgC,EAAE;QAElC,MAAM,IAAI,GAAG,CAAC,OAAO,CAAC,SAAS,IAAI,UAAU,CAAC,CAAC,WAAW,EAAE,CAAC;QAC7D,MAAM,QAAQ,GACZ,O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AC,kBAAkB,CAAC;AAE1D;;;;;;GAMG;AACU,QAAA,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;AAEpC;;;;;;;GAOG;AACU,QAAA,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;AAExC;;;;;;GAMG;AACU,QAAA,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;AAE1C;;;;;;GAMG;AACU,QAAA,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;AAE1C;;;;;;;GAOG;AACU,QAAA,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC"}
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* @license Nehonix Open Source License (NOSL)
|
|
6
6
|
****************************************************************************/
|
|
7
7
|
export * from "./encoding";
|
|
8
|
-
import { Keys, XyPrissSecurity } from "../core";
|
|
9
8
|
/**
|
|
10
9
|
* High-performance cryptographic hashing utility.
|
|
11
10
|
* Leverages the Go-backed core engine for extreme throughput and security.
|
|
@@ -16,7 +15,7 @@ import { Keys, XyPrissSecurity } from "../core";
|
|
|
16
15
|
* @example
|
|
17
16
|
* const hash = Utils.hash("sensitive data");
|
|
18
17
|
*/
|
|
19
|
-
export declare const hash: (data: string | Uint8Array, options?: any) => string | import("
|
|
18
|
+
export declare const hash: (data: string | Uint8Array, options?: any) => string | import("..").SecureBuffer;
|
|
20
19
|
/**
|
|
21
20
|
* Generates cryptographically secure random bytes.
|
|
22
21
|
* Utilizing Go's native `crypto/rand` module, it ensures true randomness
|
|
@@ -27,7 +26,7 @@ export declare const hash: (data: string | Uint8Array, options?: any) => string
|
|
|
27
26
|
* @example
|
|
28
27
|
* const salt = Utils.getRandomBytes(16)
|
|
29
28
|
*/
|
|
30
|
-
export declare const getRandomBytes: (length: number) => import("
|
|
29
|
+
export declare const getRandomBytes: (length: number) => import("..").SecureBuffer;
|
|
31
30
|
/**
|
|
32
31
|
* Military-grade string encryption utilizing AES-256-GCM or ChaCha20-Poly1305.
|
|
33
32
|
* Designed for maximum performance with atomic Go FFI calls.
|
|
@@ -49,73 +48,4 @@ export declare const encrypt: (data: string, key: string, algo?: string) => stri
|
|
|
49
48
|
* @throws {Error} If authentication fails or format is corrupted.
|
|
50
49
|
*/
|
|
51
50
|
export declare const decrypt: (encrypted: string, key: string, algo?: string) => string;
|
|
52
|
-
export declare const Utils: {
|
|
53
|
-
hash: (data: string | Uint8Array, options?: any) => string | import("../core").SecureBuffer;
|
|
54
|
-
getRandomBytes: (length: number) => import("../core").SecureBuffer;
|
|
55
|
-
encrypt: (data: string, key: string, algo?: string) => string;
|
|
56
|
-
decrypt: (encrypted: string, key: string, algo?: string) => string;
|
|
57
|
-
};
|
|
58
|
-
/**
|
|
59
|
-
* Generates a high-entropy 4096-bit RSA key pair.
|
|
60
|
-
*
|
|
61
|
-
* @returns A promise resolving to an object containing PEM-encoded publicKey and privateKey.
|
|
62
|
-
*/
|
|
63
|
-
export declare const generateRSAKeyPair: typeof Keys.generateRSAKeyPair;
|
|
64
|
-
/**
|
|
65
|
-
* Signs data using RSA-PSS with SHA-256.
|
|
66
|
-
*
|
|
67
|
-
* @param privateKey - The PEM-encoded RSA private key.
|
|
68
|
-
* @param data - The data string to sign.
|
|
69
|
-
* @returns A promise resolving to the hex-encoded signature.
|
|
70
|
-
*/
|
|
71
|
-
export declare const rsaSign: typeof Keys.rsaSign;
|
|
72
|
-
/**
|
|
73
|
-
* Verifies an RSA-PSS signature.
|
|
74
|
-
*
|
|
75
|
-
* @param publicKey - The PEM-encoded RSA public key.
|
|
76
|
-
* @param data - The original data string that was signed.
|
|
77
|
-
* @param signature - The hex-encoded signature to verify.
|
|
78
|
-
* @returns A promise resolving to true if valid, false otherwise.
|
|
79
|
-
*/
|
|
80
|
-
export declare const rsaVerify: typeof Keys.rsaVerify;
|
|
81
|
-
/**
|
|
82
|
-
* Encrypts data using RSA-OAEP with SHA-256.
|
|
83
|
-
*
|
|
84
|
-
* @param publicKey - The PEM-encoded RSA public key.
|
|
85
|
-
* @param data - The plaintext data string to encrypt.
|
|
86
|
-
* @returns A promise resolving to the hex-encoded ciphertext.
|
|
87
|
-
*/
|
|
88
|
-
export declare const rsaEncrypt: typeof Keys.rsaEncrypt;
|
|
89
|
-
/**
|
|
90
|
-
* Decrypts data using RSA-OAEP with SHA-256.
|
|
91
|
-
*
|
|
92
|
-
* @param privateKey - The PEM-encoded RSA private key.
|
|
93
|
-
* @param encryptedHex - The hex-encoded ciphertext to decrypt.
|
|
94
|
-
* @returns A promise resolving to the decrypted plaintext string.
|
|
95
|
-
*/
|
|
96
|
-
export declare const rsaDecrypt: typeof Keys.rsaDecrypt;
|
|
97
|
-
/**
|
|
98
|
-
* Derives a cryptographically strong key from an input secret.
|
|
99
|
-
* Supports multiple algorithms including Argon2id, PBKDF2, and HKDF.
|
|
100
|
-
*
|
|
101
|
-
* @param input - The base secret or password.
|
|
102
|
-
* @param options - Configuration for the derivation process.
|
|
103
|
-
* @returns A promise resolving to the derived key.
|
|
104
|
-
*/
|
|
105
|
-
export declare const deriveKey: typeof Keys.deriveKey;
|
|
106
|
-
/**
|
|
107
|
-
* Verifies if a string has exactly the expected byte length (UTF-8).
|
|
108
|
-
*
|
|
109
|
-
* @param str - The string to check.
|
|
110
|
-
* @param length - The expected number of bytes.
|
|
111
|
-
* @returns True if the byte length matches, false otherwise.
|
|
112
|
-
*/
|
|
113
|
-
export declare const isValidByteLength: typeof XyPrissSecurity.isValidByteLength;
|
|
114
|
-
/**
|
|
115
|
-
* Returns the actual byte length of a string (UTF-8).
|
|
116
|
-
*
|
|
117
|
-
* @param str - The string to measure.
|
|
118
|
-
* @returns The number of bytes.
|
|
119
|
-
*/
|
|
120
|
-
export declare const getByteLength: typeof XyPrissSecurity.getByteLength;
|
|
121
51
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;8EAK8E;AAE9E,cAAc,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;8EAK8E;AAE9E,cAAc,YAAY,CAAC;AAO3B;;;;;;;;;GASG;AACH,eAAO,MAAM,IAAI,GAAI,MAAM,MAAM,GAAG,UAAU,EAAE,UAAU,GAAG,uCACjC,CAAC;AAE7B;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,GAAI,QAAQ,MAAM,8BAE5C,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,OAAO,GAAI,MAAM,MAAM,EAAE,KAAK,MAAM,EAAE,OAAM,MAAc,WACtC,CAAC;AAElC;;;;;;;;GAQG;AACH,eAAO,MAAM,OAAO,GAAI,WAAW,MAAM,EAAE,KAAK,MAAM,EAAE,OAAM,MAAc,WACtC,CAAC"}
|
package/dist/src/utils/index.js
CHANGED
|
@@ -20,9 +20,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
20
20
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
21
|
};
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
exports.
|
|
23
|
+
exports.decrypt = exports.encrypt = exports.getRandomBytes = exports.hash = void 0;
|
|
24
24
|
__exportStar(require("./encoding"), exports);
|
|
25
|
-
const core_1 = require("../core");
|
|
26
25
|
const Hash_1 = require("../core/Hash");
|
|
27
26
|
const Random_1 = require("../core/Random");
|
|
28
27
|
const bridge_1 = require("../core/bridge");
|
|
@@ -75,73 +74,4 @@ exports.encrypt = encrypt;
|
|
|
75
74
|
*/
|
|
76
75
|
const decrypt = (encrypted, key, algo = "aes") => bridge_1.Bridge.decrypt(encrypted, key, algo);
|
|
77
76
|
exports.decrypt = decrypt;
|
|
78
|
-
exports.Utils = {
|
|
79
|
-
hash: exports.hash,
|
|
80
|
-
getRandomBytes: exports.getRandomBytes,
|
|
81
|
-
encrypt: exports.encrypt,
|
|
82
|
-
decrypt: exports.decrypt,
|
|
83
|
-
};
|
|
84
|
-
/**
|
|
85
|
-
* Generates a high-entropy 4096-bit RSA key pair.
|
|
86
|
-
*
|
|
87
|
-
* @returns A promise resolving to an object containing PEM-encoded publicKey and privateKey.
|
|
88
|
-
*/
|
|
89
|
-
exports.generateRSAKeyPair = core_1.Keys.generateRSAKeyPair;
|
|
90
|
-
/**
|
|
91
|
-
* Signs data using RSA-PSS with SHA-256.
|
|
92
|
-
*
|
|
93
|
-
* @param privateKey - The PEM-encoded RSA private key.
|
|
94
|
-
* @param data - The data string to sign.
|
|
95
|
-
* @returns A promise resolving to the hex-encoded signature.
|
|
96
|
-
*/
|
|
97
|
-
exports.rsaSign = core_1.Keys.rsaSign;
|
|
98
|
-
/**
|
|
99
|
-
* Verifies an RSA-PSS signature.
|
|
100
|
-
*
|
|
101
|
-
* @param publicKey - The PEM-encoded RSA public key.
|
|
102
|
-
* @param data - The original data string that was signed.
|
|
103
|
-
* @param signature - The hex-encoded signature to verify.
|
|
104
|
-
* @returns A promise resolving to true if valid, false otherwise.
|
|
105
|
-
*/
|
|
106
|
-
exports.rsaVerify = core_1.Keys.rsaVerify;
|
|
107
|
-
/**
|
|
108
|
-
* Encrypts data using RSA-OAEP with SHA-256.
|
|
109
|
-
*
|
|
110
|
-
* @param publicKey - The PEM-encoded RSA public key.
|
|
111
|
-
* @param data - The plaintext data string to encrypt.
|
|
112
|
-
* @returns A promise resolving to the hex-encoded ciphertext.
|
|
113
|
-
*/
|
|
114
|
-
exports.rsaEncrypt = core_1.Keys.rsaEncrypt;
|
|
115
|
-
/**
|
|
116
|
-
* Decrypts data using RSA-OAEP with SHA-256.
|
|
117
|
-
*
|
|
118
|
-
* @param privateKey - The PEM-encoded RSA private key.
|
|
119
|
-
* @param encryptedHex - The hex-encoded ciphertext to decrypt.
|
|
120
|
-
* @returns A promise resolving to the decrypted plaintext string.
|
|
121
|
-
*/
|
|
122
|
-
exports.rsaDecrypt = core_1.Keys.rsaDecrypt;
|
|
123
|
-
/**
|
|
124
|
-
* Derives a cryptographically strong key from an input secret.
|
|
125
|
-
* Supports multiple algorithms including Argon2id, PBKDF2, and HKDF.
|
|
126
|
-
*
|
|
127
|
-
* @param input - The base secret or password.
|
|
128
|
-
* @param options - Configuration for the derivation process.
|
|
129
|
-
* @returns A promise resolving to the derived key.
|
|
130
|
-
*/
|
|
131
|
-
exports.deriveKey = core_1.Keys.deriveKey;
|
|
132
|
-
/**
|
|
133
|
-
* Verifies if a string has exactly the expected byte length (UTF-8).
|
|
134
|
-
*
|
|
135
|
-
* @param str - The string to check.
|
|
136
|
-
* @param length - The expected number of bytes.
|
|
137
|
-
* @returns True if the byte length matches, false otherwise.
|
|
138
|
-
*/
|
|
139
|
-
exports.isValidByteLength = core_1.XyPrissSecurity.isValidByteLength;
|
|
140
|
-
/**
|
|
141
|
-
* Returns the actual byte length of a string (UTF-8).
|
|
142
|
-
*
|
|
143
|
-
* @param str - The string to measure.
|
|
144
|
-
* @returns The number of bytes.
|
|
145
|
-
*/
|
|
146
|
-
exports.getByteLength = core_1.XyPrissSecurity.getByteLength;
|
|
147
77
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":";AAAA;;;;;8EAK8E;;;;;;;;;;;;;;;;;AAE9E,6CAA2B;AAE3B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":";AAAA;;;;;8EAK8E;;;;;;;;;;;;;;;;;AAE9E,6CAA2B;AAE3B,uCAAoC;AACpC,2CAAwC;AAExC,2CAAwC;AAExC;;;;;;;;;GASG;AACI,MAAM,IAAI,GAAG,CAAC,IAAyB,EAAE,OAAa,EAAE,EAAE,CAC/D,WAAI,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AADhB,QAAA,IAAI,QACY;AAE7B;;;;;;;;;GASG;AACI,MAAM,cAAc,GAAG,CAAC,MAAc,EAAE,EAAE;IAC/C,OAAO,eAAM,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;AACvC,CAAC,CAAC;AAFW,QAAA,cAAc,kBAEzB;AAEF;;;;;;;;;GASG;AACI,MAAM,OAAO,GAAG,CAAC,IAAY,EAAE,GAAW,EAAE,OAAe,KAAK,EAAE,EAAE,CACzE,eAAM,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;AADrB,QAAA,OAAO,WACc;AAElC;;;;;;;;GAQG;AACI,MAAM,OAAO,GAAG,CAAC,SAAiB,EAAE,GAAW,EAAE,OAAe,KAAK,EAAE,EAAE,CAC9E,eAAM,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;AAD1B,QAAA,OAAO,WACmB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xypriss-security",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.5",
|
|
4
4
|
"description": "Advanced High-Performance Security Framework powered by a Go Core. Military-grade encryption, post-quantum resilience, and fortified data structures.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "NEHONIX",
|