pixel-react 1.15.21 → 1.15.22

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.
Files changed (46) hide show
  1. package/lib/components/MultiSelect/MultiSelect.js +9 -10
  2. package/lib/components/MultiSelect/MultiSelect.js.map +1 -1
  3. package/lib/components/SessionDropdown/SessionDropdown.js +4 -2
  4. package/lib/components/SessionDropdown/SessionDropdown.js.map +1 -1
  5. package/lib/index.cjs +5581 -32
  6. package/lib/index.cjs.map +1 -1
  7. package/lib/index.d.ts +1 -1
  8. package/lib/node_modules/js-beautify/js/src/css/beautifier.js +1 -1
  9. package/lib/node_modules/js-beautify/js/src/css/options.js +1 -1
  10. package/lib/node_modules/js-beautify/js/src/html/beautifier.js +1 -1
  11. package/lib/node_modules/js-beautify/js/src/html/options.js +1 -1
  12. package/lib/node_modules/js-beautify/js/src/javascript/beautifier.js +1 -1
  13. package/lib/node_modules/jsencrypt/lib/JSEncrypt.js +246 -0
  14. package/lib/node_modules/jsencrypt/lib/JSEncrypt.js.map +1 -0
  15. package/lib/node_modules/jsencrypt/lib/JSEncryptRSAKey.js +325 -0
  16. package/lib/node_modules/jsencrypt/lib/JSEncryptRSAKey.js.map +1 -0
  17. package/lib/node_modules/jsencrypt/lib/index.js +6 -0
  18. package/lib/node_modules/jsencrypt/lib/index.js.map +1 -0
  19. package/lib/node_modules/jsencrypt/lib/lib/asn1js/asn1.js +570 -0
  20. package/lib/node_modules/jsencrypt/lib/lib/asn1js/asn1.js.map +1 -0
  21. package/lib/node_modules/jsencrypt/lib/lib/asn1js/base64.js +88 -0
  22. package/lib/node_modules/jsencrypt/lib/lib/asn1js/base64.js.map +1 -0
  23. package/lib/node_modules/jsencrypt/lib/lib/asn1js/hex.js +66 -0
  24. package/lib/node_modules/jsencrypt/lib/lib/asn1js/hex.js.map +1 -0
  25. package/lib/node_modules/jsencrypt/lib/lib/asn1js/int10.js +87 -0
  26. package/lib/node_modules/jsencrypt/lib/lib/asn1js/int10.js.map +1 -0
  27. package/lib/node_modules/jsencrypt/lib/lib/jsbn/base64.js +65 -0
  28. package/lib/node_modules/jsencrypt/lib/lib/jsbn/base64.js.map +1 -0
  29. package/lib/node_modules/jsencrypt/lib/lib/jsbn/jsbn.js +1700 -0
  30. package/lib/node_modules/jsencrypt/lib/lib/jsbn/jsbn.js.map +1 -0
  31. package/lib/node_modules/jsencrypt/lib/lib/jsbn/prng4.js +48 -0
  32. package/lib/node_modules/jsencrypt/lib/lib/jsbn/prng4.js.map +1 -0
  33. package/lib/node_modules/jsencrypt/lib/lib/jsbn/rng.js +77 -0
  34. package/lib/node_modules/jsencrypt/lib/lib/jsbn/rng.js.map +1 -0
  35. package/lib/node_modules/jsencrypt/lib/lib/jsbn/rsa.js +415 -0
  36. package/lib/node_modules/jsencrypt/lib/lib/jsbn/rsa.js.map +1 -0
  37. package/lib/node_modules/jsencrypt/lib/lib/jsbn/sha256.js +307 -0
  38. package/lib/node_modules/jsencrypt/lib/lib/jsbn/sha256.js.map +1 -0
  39. package/lib/node_modules/jsencrypt/lib/lib/jsbn/util.js +61 -0
  40. package/lib/node_modules/jsencrypt/lib/lib/jsbn/util.js.map +1 -0
  41. package/lib/node_modules/jsencrypt/lib/lib/jsrsasign/asn1-1.0.js +1559 -0
  42. package/lib/node_modules/jsencrypt/lib/lib/jsrsasign/asn1-1.0.js.map +1 -0
  43. package/lib/utils/getEncryptedData/getEncryptedData.d.ts +1 -1
  44. package/lib/utils/getEncryptedData/getEncryptedData.js +8 -17
  45. package/lib/utils/getEncryptedData/getEncryptedData.js.map +1 -1
  46. package/package.json +2 -1
package/lib/index.d.ts CHANGED
@@ -4619,7 +4619,7 @@ declare const compareArrays: (arr1: unknown[], arr2: unknown[]) => boolean;
4619
4619
  type AnyObject = Record<string, unknown>;
4620
4620
  declare const compareObjects: (obj1: AnyObject | null, obj2: AnyObject | null) => boolean;
4621
4621
 
4622
- declare function getEncryptedData(data: string, base64PublicKey: string): Promise<string>;
4622
+ declare const getEncryptedData: (data: string, publicKey: string) => string | false;
4623
4623
 
4624
4624
  type Callback = (...args: any[]) => void;
4625
4625
  interface ThrottledFunction extends Function {
@@ -1,4 +1,4 @@
1
- import { __exports as beautifier } from '../../../../../_virtual/beautifier2.js';
1
+ import { __exports as beautifier } from '../../../../../_virtual/beautifier3.js';
2
2
  import { __require as requireOptions } from './options.js';
3
3
  import { __require as requireOutput } from '../core/output.js';
4
4
  import { __require as requireInputscanner } from '../core/inputscanner.js';
@@ -1,4 +1,4 @@
1
- import { __exports as options } from '../../../../../_virtual/options.js';
1
+ import { __exports as options } from '../../../../../_virtual/options2.js';
2
2
  import { __require as requireOptions$1 } from '../core/options.js';
3
3
 
4
4
  /*jshint node:true */
@@ -1,4 +1,4 @@
1
- import { __exports as beautifier } from '../../../../../_virtual/beautifier.js';
1
+ import { __exports as beautifier } from '../../../../../_virtual/beautifier2.js';
2
2
  import { __require as requireOptions } from './options.js';
3
3
  import { __require as requireOutput } from '../core/output.js';
4
4
  import { __require as requireTokenizer } from './tokenizer.js';
@@ -1,4 +1,4 @@
1
- import { __exports as options } from '../../../../../_virtual/options2.js';
1
+ import { __exports as options } from '../../../../../_virtual/options.js';
2
2
  import { __require as requireOptions$1 } from '../core/options.js';
3
3
 
4
4
  /*jshint node:true */
@@ -1,4 +1,4 @@
1
- import { __exports as beautifier } from '../../../../../_virtual/beautifier3.js';
1
+ import { __exports as beautifier } from '../../../../../_virtual/beautifier.js';
2
2
  import { __require as requireOutput } from '../core/output.js';
3
3
  import { __require as requireToken } from '../core/token.js';
4
4
  import { __require as requireAcorn } from './acorn.js';
@@ -0,0 +1,246 @@
1
+ import { b64tohex, hex2b64 } from './lib/jsbn/base64.js';
2
+ import { JSEncryptRSAKey } from './JSEncryptRSAKey.js';
3
+ import { oaep_pad } from './lib/jsbn/rsa.js';
4
+ import { rstr2hex, rstr_sha256 } from './lib/jsbn/sha256.js';
5
+
6
+ var _a;
7
+ var version = typeof process !== "undefined" ? (_a = process.env) === null || _a === void 0 ? void 0 : _a.npm_package_version : undefined;
8
+ /**
9
+ *
10
+ * @param {Object} [options = {}] - An object to customize JSEncrypt behaviour
11
+ * possible parameters are:
12
+ * - key {JSEncryptRSAKey} default: null
13
+ * - default_key_size {number} default: 1024 the key size in bit
14
+ * - default_public_exponent {string} default: '010001' the hexadecimal representation of the public exponent
15
+ * - log {boolean} default: false whether log warn/error or not
16
+ * @constructor
17
+ */
18
+ var JSEncrypt = /** @class */function () {
19
+ function JSEncrypt(options) {
20
+ if (options === void 0) {
21
+ options = {};
22
+ }
23
+ this.default_key_size = options.default_key_size ? parseInt(options.default_key_size, 10) : 1024;
24
+ this.default_public_exponent = options.default_public_exponent || "010001"; // 65537 default openssl public exponent for rsa key type
25
+ this.log = options.log || false;
26
+ // The private and public key.
27
+ this.key = options.key || null;
28
+ }
29
+ /**
30
+ * Method to set the rsa key parameter (one method is enough to set both the public
31
+ * and the private key, since the private key contains the public key paramenters)
32
+ * Log a warning if logs are enabled
33
+ * @param {Object|string} key the pem encoded string or an object (with or without header/footer)
34
+ * @public
35
+ */
36
+ JSEncrypt.prototype.setKey = function (key) {
37
+ if (key) {
38
+ if (this.log && this.key) {
39
+ console.warn("A key was already set, overriding existing.");
40
+ }
41
+ this.key = new JSEncryptRSAKey(key);
42
+ } else if (!this.key && this.log) {
43
+ console.error("A key was not set.");
44
+ }
45
+ };
46
+ /**
47
+ * Proxy method for setKey, for api compatibility
48
+ * @see setKey
49
+ * @public
50
+ */
51
+ JSEncrypt.prototype.setPrivateKey = function (privkey) {
52
+ // Create the key.
53
+ this.setKey(privkey);
54
+ };
55
+ /**
56
+ * Proxy method for setKey, for api compatibility
57
+ * @see setKey
58
+ * @public
59
+ */
60
+ JSEncrypt.prototype.setPublicKey = function (pubkey) {
61
+ // Sets the public key.
62
+ this.setKey(pubkey);
63
+ };
64
+ /**
65
+ * Proxy method for RSAKey object's decrypt, decrypt the string using the private
66
+ * components of the rsa key object. Note that if the object was not set will be created
67
+ * on the fly (by the getKey method) using the parameters passed in the JSEncrypt constructor
68
+ * @param {string} str base64 encoded crypted string to decrypt
69
+ * @return {string} the decrypted string
70
+ * @public
71
+ */
72
+ JSEncrypt.prototype.decrypt = function (str) {
73
+ // Return the decrypted string.
74
+ try {
75
+ return this.getKey().decrypt(b64tohex(str));
76
+ } catch (ex) {
77
+ return false;
78
+ }
79
+ };
80
+ /**
81
+ * Proxy method for RSAKey object's encrypt, encrypt the string using the public
82
+ * components of the rsa key object. Note that if the object was not set will be created
83
+ * on the fly (by the getKey method) using the parameters passed in the JSEncrypt constructor
84
+ * @param {string} str the string to encrypt
85
+ * @return {string} the encrypted string encoded in base64
86
+ * @public
87
+ */
88
+ JSEncrypt.prototype.encrypt = function (str) {
89
+ // Return the encrypted string.
90
+ try {
91
+ return hex2b64(this.getKey().encrypt(str));
92
+ } catch (ex) {
93
+ return false;
94
+ }
95
+ };
96
+ /**
97
+ * Proxy method for RSAKey object's encrypt with padding: RSA_PKCS1_OAEP_PADDING and oaepHash: sha256,
98
+ * encrypt the string using the public
99
+ * components of the rsa key object. Note that if the object was not set will be created
100
+ * on the fly (by the getKey method) using the parameters passed in the JSEncrypt constructor
101
+ * @param {string} str the string to encrypt
102
+ * @return {string} the encrypted string encoded in base64
103
+ * @public
104
+ */
105
+ JSEncrypt.prototype.encryptOAEP = function (str) {
106
+ // Return the encrypted string.
107
+ try {
108
+ return hex2b64(this.getKey().encrypt(str, oaep_pad));
109
+ } catch (ex) {
110
+ return false;
111
+ }
112
+ };
113
+ /**
114
+ * Proxy method for RSAKey object's sign.
115
+ * @param {string} str the string to sign
116
+ * @param {function} digestMethod hash method
117
+ * @param {string} digestName the name of the hash algorithm
118
+ * @return {string} the signature encoded in base64
119
+ * @public
120
+ */
121
+ JSEncrypt.prototype.sign = function (str, digestMethod, digestName) {
122
+ if (digestMethod === void 0) {
123
+ digestMethod = function (raw) {
124
+ return raw;
125
+ };
126
+ }
127
+ if (digestName === void 0) {
128
+ digestName = "";
129
+ }
130
+ // return the RSA signature of 'str' in 'hex' format.
131
+ try {
132
+ return hex2b64(this.getKey().sign(str, digestMethod, digestName));
133
+ } catch (ex) {
134
+ return false;
135
+ }
136
+ };
137
+ /**
138
+ * Signs a string using the SHA-256 hash algorithm.
139
+ * @param str the string to sign
140
+ * @returns the base64 encoded signature or false on failure
141
+ */
142
+ JSEncrypt.prototype.signSha256 = function (str) {
143
+ return this.sign(str, function (text) {
144
+ return rstr2hex(rstr_sha256(text));
145
+ }, "sha256");
146
+ };
147
+ /**
148
+ * Proxy method for RSAKey object's verify.
149
+ * @param {string} str the string to verify
150
+ * @param {string} signature the signature encoded in base64 to compare the string to
151
+ * @param {function} digestMethod hash method
152
+ * @return {boolean} whether the data and signature match
153
+ * @public
154
+ */
155
+ JSEncrypt.prototype.verify = function (str, signature, digestMethod) {
156
+ if (digestMethod === void 0) {
157
+ digestMethod = function (raw) {
158
+ return raw;
159
+ };
160
+ }
161
+ // Return the decrypted 'digest' of the signature.
162
+ try {
163
+ return this.getKey().verify(str, b64tohex(signature), digestMethod);
164
+ } catch (ex) {
165
+ return false;
166
+ }
167
+ };
168
+ /**
169
+ * Verifies a string using the SHA-256 hash algorithm.
170
+ * @param str the string to verify
171
+ * @param signature the base64 encoded signature to compare against
172
+ * @returns whether the signature is valid
173
+ */
174
+ JSEncrypt.prototype.verifySha256 = function (str, signature) {
175
+ return this.verify(str, signature, function (text) {
176
+ return rstr2hex(rstr_sha256(text));
177
+ });
178
+ };
179
+ /**
180
+ * Getter for the current JSEncryptRSAKey object. If it doesn't exists a new object
181
+ * will be created and returned
182
+ * @param {callback} [cb] the callback to be called if we want the key to be generated
183
+ * in an async fashion
184
+ * @returns {JSEncryptRSAKey} the JSEncryptRSAKey object
185
+ * @public
186
+ */
187
+ JSEncrypt.prototype.getKey = function (cb) {
188
+ // Only create new if it does not exist.
189
+ if (!this.key) {
190
+ // Get a new private key.
191
+ this.key = new JSEncryptRSAKey();
192
+ if (cb && {}.toString.call(cb) === "[object Function]") {
193
+ this.key.generateAsync(this.default_key_size, this.default_public_exponent, cb);
194
+ return;
195
+ }
196
+ // Generate the key.
197
+ this.key.generate(this.default_key_size, this.default_public_exponent);
198
+ }
199
+ return this.key;
200
+ };
201
+ /**
202
+ * Returns the pem encoded representation of the private key
203
+ * If the key doesn't exists a new key will be created
204
+ * @returns {string} pem encoded representation of the private key WITH header and footer
205
+ * @public
206
+ */
207
+ JSEncrypt.prototype.getPrivateKey = function () {
208
+ // Return the private representation of this key.
209
+ return this.getKey().getPrivateKey();
210
+ };
211
+ /**
212
+ * Returns the pem encoded representation of the private key
213
+ * If the key doesn't exists a new key will be created
214
+ * @returns {string} pem encoded representation of the private key WITHOUT header and footer
215
+ * @public
216
+ */
217
+ JSEncrypt.prototype.getPrivateKeyB64 = function () {
218
+ // Return the private representation of this key.
219
+ return this.getKey().getPrivateBaseKeyB64();
220
+ };
221
+ /**
222
+ * Returns the pem encoded representation of the public key
223
+ * If the key doesn't exists a new key will be created
224
+ * @returns {string} pem encoded representation of the public key WITH header and footer
225
+ * @public
226
+ */
227
+ JSEncrypt.prototype.getPublicKey = function () {
228
+ // Return the private representation of this key.
229
+ return this.getKey().getPublicKey();
230
+ };
231
+ /**
232
+ * Returns the pem encoded representation of the public key
233
+ * If the key doesn't exists a new key will be created
234
+ * @returns {string} pem encoded representation of the public key WITHOUT header and footer
235
+ * @public
236
+ */
237
+ JSEncrypt.prototype.getPublicKeyB64 = function () {
238
+ // Return the private representation of this key.
239
+ return this.getKey().getPublicBaseKeyB64();
240
+ };
241
+ JSEncrypt.version = version;
242
+ return JSEncrypt;
243
+ }();
244
+
245
+ export { JSEncrypt };
246
+ //# sourceMappingURL=JSEncrypt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JSEncrypt.js","sources":["../../../../node_modules/jsencrypt/lib/JSEncrypt.js"],"sourcesContent":["var _a;\nimport { b64tohex, hex2b64 } from \"./lib/jsbn/base64\";\nimport { JSEncryptRSAKey } from \"./JSEncryptRSAKey\";\nimport { oaep_pad } from './lib/jsbn/rsa';\nimport { rstr_sha256, rstr2hex } from './lib/jsbn/sha256';\nvar version = typeof process !== \"undefined\" ? (_a = process.env) === null || _a === void 0 ? void 0 : _a.npm_package_version : undefined;\n/**\n *\n * @param {Object} [options = {}] - An object to customize JSEncrypt behaviour\n * possible parameters are:\n * - key {JSEncryptRSAKey} default: null\n * - default_key_size {number} default: 1024 the key size in bit\n * - default_public_exponent {string} default: '010001' the hexadecimal representation of the public exponent\n * - log {boolean} default: false whether log warn/error or not\n * @constructor\n */\nvar JSEncrypt = /** @class */ (function () {\n function JSEncrypt(options) {\n if (options === void 0) { options = {}; }\n this.default_key_size = options.default_key_size\n ? parseInt(options.default_key_size, 10)\n : 1024;\n this.default_public_exponent = options.default_public_exponent || \"010001\"; // 65537 default openssl public exponent for rsa key type\n this.log = options.log || false;\n // The private and public key.\n this.key = options.key || null;\n }\n /**\n * Method to set the rsa key parameter (one method is enough to set both the public\n * and the private key, since the private key contains the public key paramenters)\n * Log a warning if logs are enabled\n * @param {Object|string} key the pem encoded string or an object (with or without header/footer)\n * @public\n */\n JSEncrypt.prototype.setKey = function (key) {\n if (key) {\n if (this.log && this.key) {\n console.warn(\"A key was already set, overriding existing.\");\n }\n this.key = new JSEncryptRSAKey(key);\n }\n else if (!this.key && this.log) {\n console.error(\"A key was not set.\");\n }\n };\n /**\n * Proxy method for setKey, for api compatibility\n * @see setKey\n * @public\n */\n JSEncrypt.prototype.setPrivateKey = function (privkey) {\n // Create the key.\n this.setKey(privkey);\n };\n /**\n * Proxy method for setKey, for api compatibility\n * @see setKey\n * @public\n */\n JSEncrypt.prototype.setPublicKey = function (pubkey) {\n // Sets the public key.\n this.setKey(pubkey);\n };\n /**\n * Proxy method for RSAKey object's decrypt, decrypt the string using the private\n * components of the rsa key object. Note that if the object was not set will be created\n * on the fly (by the getKey method) using the parameters passed in the JSEncrypt constructor\n * @param {string} str base64 encoded crypted string to decrypt\n * @return {string} the decrypted string\n * @public\n */\n JSEncrypt.prototype.decrypt = function (str) {\n // Return the decrypted string.\n try {\n return this.getKey().decrypt(b64tohex(str));\n }\n catch (ex) {\n return false;\n }\n };\n /**\n * Proxy method for RSAKey object's encrypt, encrypt the string using the public\n * components of the rsa key object. Note that if the object was not set will be created\n * on the fly (by the getKey method) using the parameters passed in the JSEncrypt constructor\n * @param {string} str the string to encrypt\n * @return {string} the encrypted string encoded in base64\n * @public\n */\n JSEncrypt.prototype.encrypt = function (str) {\n // Return the encrypted string.\n try {\n return hex2b64(this.getKey().encrypt(str));\n }\n catch (ex) {\n return false;\n }\n };\n /**\n * Proxy method for RSAKey object's encrypt with padding: RSA_PKCS1_OAEP_PADDING and oaepHash: sha256,\n * encrypt the string using the public\n * components of the rsa key object. Note that if the object was not set will be created\n * on the fly (by the getKey method) using the parameters passed in the JSEncrypt constructor\n * @param {string} str the string to encrypt\n * @return {string} the encrypted string encoded in base64\n * @public\n */\n JSEncrypt.prototype.encryptOAEP = function (str) {\n // Return the encrypted string.\n try {\n return hex2b64(this.getKey().encrypt(str, oaep_pad));\n }\n catch (ex) {\n return false;\n }\n };\n /**\n * Proxy method for RSAKey object's sign.\n * @param {string} str the string to sign\n * @param {function} digestMethod hash method\n * @param {string} digestName the name of the hash algorithm\n * @return {string} the signature encoded in base64\n * @public\n */\n JSEncrypt.prototype.sign = function (str, digestMethod, digestName) {\n if (digestMethod === void 0) { digestMethod = function (raw) { return raw; }; }\n if (digestName === void 0) { digestName = \"\"; }\n // return the RSA signature of 'str' in 'hex' format.\n try {\n return hex2b64(this.getKey().sign(str, digestMethod, digestName));\n }\n catch (ex) {\n return false;\n }\n };\n /**\n * Signs a string using the SHA-256 hash algorithm.\n * @param str the string to sign\n * @returns the base64 encoded signature or false on failure\n */\n JSEncrypt.prototype.signSha256 = function (str) {\n return this.sign(str, function (text) {\n return rstr2hex(rstr_sha256(text));\n }, \"sha256\");\n };\n /**\n * Proxy method for RSAKey object's verify.\n * @param {string} str the string to verify\n * @param {string} signature the signature encoded in base64 to compare the string to\n * @param {function} digestMethod hash method\n * @return {boolean} whether the data and signature match\n * @public\n */\n JSEncrypt.prototype.verify = function (str, signature, digestMethod) {\n if (digestMethod === void 0) { digestMethod = function (raw) { return raw; }; }\n // Return the decrypted 'digest' of the signature.\n try {\n return this.getKey().verify(str, b64tohex(signature), digestMethod);\n }\n catch (ex) {\n return false;\n }\n };\n /**\n * Verifies a string using the SHA-256 hash algorithm.\n * @param str the string to verify\n * @param signature the base64 encoded signature to compare against\n * @returns whether the signature is valid\n */\n JSEncrypt.prototype.verifySha256 = function (str, signature) {\n return this.verify(str, signature, function (text) {\n return rstr2hex(rstr_sha256(text));\n });\n };\n /**\n * Getter for the current JSEncryptRSAKey object. If it doesn't exists a new object\n * will be created and returned\n * @param {callback} [cb] the callback to be called if we want the key to be generated\n * in an async fashion\n * @returns {JSEncryptRSAKey} the JSEncryptRSAKey object\n * @public\n */\n JSEncrypt.prototype.getKey = function (cb) {\n // Only create new if it does not exist.\n if (!this.key) {\n // Get a new private key.\n this.key = new JSEncryptRSAKey();\n if (cb && {}.toString.call(cb) === \"[object Function]\") {\n this.key.generateAsync(this.default_key_size, this.default_public_exponent, cb);\n return;\n }\n // Generate the key.\n this.key.generate(this.default_key_size, this.default_public_exponent);\n }\n return this.key;\n };\n /**\n * Returns the pem encoded representation of the private key\n * If the key doesn't exists a new key will be created\n * @returns {string} pem encoded representation of the private key WITH header and footer\n * @public\n */\n JSEncrypt.prototype.getPrivateKey = function () {\n // Return the private representation of this key.\n return this.getKey().getPrivateKey();\n };\n /**\n * Returns the pem encoded representation of the private key\n * If the key doesn't exists a new key will be created\n * @returns {string} pem encoded representation of the private key WITHOUT header and footer\n * @public\n */\n JSEncrypt.prototype.getPrivateKeyB64 = function () {\n // Return the private representation of this key.\n return this.getKey().getPrivateBaseKeyB64();\n };\n /**\n * Returns the pem encoded representation of the public key\n * If the key doesn't exists a new key will be created\n * @returns {string} pem encoded representation of the public key WITH header and footer\n * @public\n */\n JSEncrypt.prototype.getPublicKey = function () {\n // Return the private representation of this key.\n return this.getKey().getPublicKey();\n };\n /**\n * Returns the pem encoded representation of the public key\n * If the key doesn't exists a new key will be created\n * @returns {string} pem encoded representation of the public key WITHOUT header and footer\n * @public\n */\n JSEncrypt.prototype.getPublicKeyB64 = function () {\n // Return the private representation of this key.\n return this.getKey().getPublicBaseKeyB64();\n };\n JSEncrypt.version = version;\n return JSEncrypt;\n}());\nexport { JSEncrypt };\n"],"names":["_a","version","process","env","npm_package_version","undefined","JSEncrypt","options","default_key_size","parseInt","default_public_exponent","log","key","prototype","setKey","console","warn","JSEncryptRSAKey","error","setPrivateKey","privkey","setPublicKey","pubkey","decrypt","str","getKey","b64tohex","ex","encrypt","hex2b64","encryptOAEP","oaep_pad","sign","digestMethod","digestName","raw","signSha256","text","rstr2hex","rstr_sha256","verify","signature","verifySha256","cb","toString","call","generateAsync","generate","getPrivateKey","getPrivateKeyB64","getPrivateBaseKeyB64","getPublicKey","getPublicKeyB64","getPublicBaseKeyB64"],"mappings":";;;;;AAAA,IAAIA,EAAE;AAKN,IAAIC,OAAO,GAAG,OAAOC,OAAO,KAAK,WAAW,GAAG,CAACF,EAAE,GAAGE,OAAO,CAACC,GAAG,MAAM,IAAI,IAAIH,EAAE,KAAK,MAAM,GAAG,MAAM,GAAGA,EAAE,CAACI,mBAAmB,GAAGC,SAAS;AACzI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIC,SAAS,gBAAkB,YAAY;EACvC,SAASA,SAASA,CAACC,OAAO,EAAE;AACxB,IAAA,IAAIA,OAAO,KAAK,MAAM,EAAE;MAAEA,OAAO,GAAG,EAAE;AAAE,IAAA;AACxC,IAAA,IAAI,CAACC,gBAAgB,GAAGD,OAAO,CAACC,gBAAgB,GAC1CC,QAAQ,CAACF,OAAO,CAACC,gBAAgB,EAAE,EAAE,CAAC,GACtC,IAAI;IACV,IAAI,CAACE,uBAAuB,GAAGH,OAAO,CAACG,uBAAu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ignoreList":[0]}
@@ -0,0 +1,325 @@
1
+ import { hex2b64 } from './lib/jsbn/base64.js';
2
+ import { Hex } from './lib/asn1js/hex.js';
3
+ import { Base64 } from './lib/asn1js/base64.js';
4
+ import { ASN1 } from './lib/asn1js/asn1.js';
5
+ import { RSAKey } from './lib/jsbn/rsa.js';
6
+ import { parseBigInt } from './lib/jsbn/jsbn.js';
7
+ import { KJUR } from './lib/jsrsasign/asn1-1.0.js';
8
+
9
+ var __extends = window && window.__extends || function () {
10
+ var extendStatics = function (d, b) {
11
+ extendStatics = Object.setPrototypeOf || {
12
+ __proto__: []
13
+ } instanceof Array && function (d, b) {
14
+ d.__proto__ = b;
15
+ } || function (d, b) {
16
+ for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
17
+ };
18
+ return extendStatics(d, b);
19
+ };
20
+ return function (d, b) {
21
+ if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
22
+ extendStatics(d, b);
23
+ function __() {
24
+ this.constructor = d;
25
+ }
26
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
27
+ };
28
+ }();
29
+ /**
30
+ * Create a new JSEncryptRSAKey that extends Tom Wu's RSA key object.
31
+ * This object is just a decorator for parsing the key parameter
32
+ * @param {string|Object} key - The key in string format, or an object containing
33
+ * the parameters needed to build a RSAKey object.
34
+ * @constructor
35
+ */
36
+ var JSEncryptRSAKey = /** @class */function (_super) {
37
+ __extends(JSEncryptRSAKey, _super);
38
+ function JSEncryptRSAKey(key) {
39
+ var _this = _super.call(this) || this;
40
+ // Call the super constructor.
41
+ // RSAKey.call(this);
42
+ // If a key key was provided.
43
+ if (key) {
44
+ // If this is a string...
45
+ if (typeof key === "string") {
46
+ _this.parseKey(key);
47
+ } else if (JSEncryptRSAKey.hasPrivateKeyProperty(key) || JSEncryptRSAKey.hasPublicKeyProperty(key)) {
48
+ // Set the values for the key.
49
+ _this.parsePropertiesFrom(key);
50
+ }
51
+ }
52
+ return _this;
53
+ }
54
+ /**
55
+ * Method to parse a pem encoded string containing both a public or private key.
56
+ * The method will translate the pem encoded string in a der encoded string and
57
+ * will parse private key and public key parameters. This method accepts public key
58
+ * in the rsaencryption pkcs #1 format (oid: 1.2.840.113549.1.1.1).
59
+ *
60
+ * @todo Check how many rsa formats use the same format of pkcs #1.
61
+ *
62
+ * The format is defined as:
63
+ * PublicKeyInfo ::= SEQUENCE {
64
+ * algorithm AlgorithmIdentifier,
65
+ * PublicKey BIT STRING
66
+ * }
67
+ * Where AlgorithmIdentifier is:
68
+ * AlgorithmIdentifier ::= SEQUENCE {
69
+ * algorithm OBJECT IDENTIFIER, the OID of the enc algorithm
70
+ * parameters ANY DEFINED BY algorithm OPTIONAL (NULL for PKCS #1)
71
+ * }
72
+ * and PublicKey is a SEQUENCE encapsulated in a BIT STRING
73
+ * RSAPublicKey ::= SEQUENCE {
74
+ * modulus INTEGER, -- n
75
+ * publicExponent INTEGER -- e
76
+ * }
77
+ * it's possible to examine the structure of the keys obtained from openssl using
78
+ * an asn.1 dumper as the one used here to parse the components: http://lapo.it/asn1js/
79
+ * @argument {string} pem the pem encoded string, can include the BEGIN/END header/footer
80
+ * @private
81
+ */
82
+ JSEncryptRSAKey.prototype.parseKey = function (pem) {
83
+ try {
84
+ var modulus = 0;
85
+ var public_exponent = 0;
86
+ var reHex = /^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/;
87
+ var der = reHex.test(pem) ? Hex.decode(pem) : Base64.unarmor(pem);
88
+ var asn1 = ASN1.decode(der);
89
+ // Fixes a bug with OpenSSL 1.0+ private keys
90
+ if (asn1.sub.length === 3) {
91
+ asn1 = asn1.sub[2].sub[0];
92
+ }
93
+ if (asn1.sub.length === 9) {
94
+ // Parse the private key.
95
+ modulus = asn1.sub[1].getHexStringValue(); // bigint
96
+ this.n = parseBigInt(modulus, 16);
97
+ public_exponent = asn1.sub[2].getHexStringValue(); // int
98
+ this.e = parseInt(public_exponent, 16);
99
+ var private_exponent = asn1.sub[3].getHexStringValue(); // bigint
100
+ this.d = parseBigInt(private_exponent, 16);
101
+ var prime1 = asn1.sub[4].getHexStringValue(); // bigint
102
+ this.p = parseBigInt(prime1, 16);
103
+ var prime2 = asn1.sub[5].getHexStringValue(); // bigint
104
+ this.q = parseBigInt(prime2, 16);
105
+ var exponent1 = asn1.sub[6].getHexStringValue(); // bigint
106
+ this.dmp1 = parseBigInt(exponent1, 16);
107
+ var exponent2 = asn1.sub[7].getHexStringValue(); // bigint
108
+ this.dmq1 = parseBigInt(exponent2, 16);
109
+ var coefficient = asn1.sub[8].getHexStringValue(); // bigint
110
+ this.coeff = parseBigInt(coefficient, 16);
111
+ } else if (asn1.sub.length === 2) {
112
+ if (asn1.sub[0].sub) {
113
+ // Parse ASN.1 SubjectPublicKeyInfo type as defined by X.509
114
+ var bit_string = asn1.sub[1];
115
+ var sequence = bit_string.sub[0];
116
+ modulus = sequence.sub[0].getHexStringValue();
117
+ this.n = parseBigInt(modulus, 16);
118
+ public_exponent = sequence.sub[1].getHexStringValue();
119
+ this.e = parseInt(public_exponent, 16);
120
+ } else {
121
+ // Parse ASN.1 RSAPublicKey type as defined by PKCS #1
122
+ modulus = asn1.sub[0].getHexStringValue();
123
+ this.n = parseBigInt(modulus, 16);
124
+ public_exponent = asn1.sub[1].getHexStringValue();
125
+ this.e = parseInt(public_exponent, 16);
126
+ }
127
+ } else {
128
+ return false;
129
+ }
130
+ return true;
131
+ } catch (ex) {
132
+ return false;
133
+ }
134
+ };
135
+ /**
136
+ * Translate rsa parameters in a hex encoded string representing the rsa key.
137
+ *
138
+ * The translation follow the ASN.1 notation :
139
+ * RSAPrivateKey ::= SEQUENCE {
140
+ * version Version,
141
+ * modulus INTEGER, -- n
142
+ * publicExponent INTEGER, -- e
143
+ * privateExponent INTEGER, -- d
144
+ * prime1 INTEGER, -- p
145
+ * prime2 INTEGER, -- q
146
+ * exponent1 INTEGER, -- d mod (p1)
147
+ * exponent2 INTEGER, -- d mod (q-1)
148
+ * coefficient INTEGER, -- (inverse of q) mod p
149
+ * }
150
+ * @returns {string} DER Encoded String representing the rsa private key
151
+ * @private
152
+ */
153
+ JSEncryptRSAKey.prototype.getPrivateBaseKey = function () {
154
+ var options = {
155
+ array: [new KJUR.asn1.DERInteger({
156
+ int: 0
157
+ }), new KJUR.asn1.DERInteger({
158
+ bigint: this.n
159
+ }), new KJUR.asn1.DERInteger({
160
+ int: this.e
161
+ }), new KJUR.asn1.DERInteger({
162
+ bigint: this.d
163
+ }), new KJUR.asn1.DERInteger({
164
+ bigint: this.p
165
+ }), new KJUR.asn1.DERInteger({
166
+ bigint: this.q
167
+ }), new KJUR.asn1.DERInteger({
168
+ bigint: this.dmp1
169
+ }), new KJUR.asn1.DERInteger({
170
+ bigint: this.dmq1
171
+ }), new KJUR.asn1.DERInteger({
172
+ bigint: this.coeff
173
+ })]
174
+ };
175
+ var seq = new KJUR.asn1.DERSequence(options);
176
+ return seq.getEncodedHex();
177
+ };
178
+ /**
179
+ * base64 (pem) encoded version of the DER encoded representation
180
+ * @returns {string} pem encoded representation without header and footer
181
+ * @public
182
+ */
183
+ JSEncryptRSAKey.prototype.getPrivateBaseKeyB64 = function () {
184
+ return hex2b64(this.getPrivateBaseKey());
185
+ };
186
+ /**
187
+ * Translate rsa parameters in a hex encoded string representing the rsa public key.
188
+ * The representation follow the ASN.1 notation :
189
+ * PublicKeyInfo ::= SEQUENCE {
190
+ * algorithm AlgorithmIdentifier,
191
+ * PublicKey BIT STRING
192
+ * }
193
+ * Where AlgorithmIdentifier is:
194
+ * AlgorithmIdentifier ::= SEQUENCE {
195
+ * algorithm OBJECT IDENTIFIER, the OID of the enc algorithm
196
+ * parameters ANY DEFINED BY algorithm OPTIONAL (NULL for PKCS #1)
197
+ * }
198
+ * and PublicKey is a SEQUENCE encapsulated in a BIT STRING
199
+ * RSAPublicKey ::= SEQUENCE {
200
+ * modulus INTEGER, -- n
201
+ * publicExponent INTEGER -- e
202
+ * }
203
+ * @returns {string} DER Encoded String representing the rsa public key
204
+ * @private
205
+ */
206
+ JSEncryptRSAKey.prototype.getPublicBaseKey = function () {
207
+ var first_sequence = new KJUR.asn1.DERSequence({
208
+ array: [new KJUR.asn1.DERObjectIdentifier({
209
+ oid: "1.2.840.113549.1.1.1"
210
+ }),
211
+ // RSA Encryption pkcs #1 oid
212
+ new KJUR.asn1.DERNull()]
213
+ });
214
+ var second_sequence = new KJUR.asn1.DERSequence({
215
+ array: [new KJUR.asn1.DERInteger({
216
+ bigint: this.n
217
+ }), new KJUR.asn1.DERInteger({
218
+ int: this.e
219
+ })]
220
+ });
221
+ var bit_string = new KJUR.asn1.DERBitString({
222
+ hex: "00" + second_sequence.getEncodedHex()
223
+ });
224
+ var seq = new KJUR.asn1.DERSequence({
225
+ array: [first_sequence, bit_string]
226
+ });
227
+ return seq.getEncodedHex();
228
+ };
229
+ /**
230
+ * base64 (pem) encoded version of the DER encoded representation
231
+ * @returns {string} pem encoded representation without header and footer
232
+ * @public
233
+ */
234
+ JSEncryptRSAKey.prototype.getPublicBaseKeyB64 = function () {
235
+ return hex2b64(this.getPublicBaseKey());
236
+ };
237
+ /**
238
+ * wrap the string in block of width chars. The default value for rsa keys is 64
239
+ * characters.
240
+ * @param {string} str the pem encoded string without header and footer
241
+ * @param {Number} [width=64] - the length the string has to be wrapped at
242
+ * @returns {string}
243
+ * @private
244
+ */
245
+ JSEncryptRSAKey.wordwrap = function (str, width) {
246
+ width = width || 64;
247
+ if (!str) {
248
+ return str;
249
+ }
250
+ var regex = "(.{1," + width + "})( +|$\n?)|(.{1," + width + "})";
251
+ return str.match(RegExp(regex, "g")).join("\n");
252
+ };
253
+ /**
254
+ * Retrieve the pem encoded private key
255
+ * @returns {string} the pem encoded private key with header/footer
256
+ * @public
257
+ */
258
+ JSEncryptRSAKey.prototype.getPrivateKey = function () {
259
+ var key = "-----BEGIN RSA PRIVATE KEY-----\n";
260
+ key += JSEncryptRSAKey.wordwrap(this.getPrivateBaseKeyB64()) + "\n";
261
+ key += "-----END RSA PRIVATE KEY-----";
262
+ return key;
263
+ };
264
+ /**
265
+ * Retrieve the pem encoded public key
266
+ * @returns {string} the pem encoded public key with header/footer
267
+ * @public
268
+ */
269
+ JSEncryptRSAKey.prototype.getPublicKey = function () {
270
+ var key = "-----BEGIN PUBLIC KEY-----\n";
271
+ key += JSEncryptRSAKey.wordwrap(this.getPublicBaseKeyB64()) + "\n";
272
+ key += "-----END PUBLIC KEY-----";
273
+ return key;
274
+ };
275
+ /**
276
+ * Check if the object contains the necessary parameters to populate the rsa modulus
277
+ * and public exponent parameters.
278
+ * @param {Object} [obj={}] - An object that may contain the two public key
279
+ * parameters
280
+ * @returns {boolean} true if the object contains both the modulus and the public exponent
281
+ * properties (n and e)
282
+ * @todo check for types of n and e. N should be a parseable bigInt object, E should
283
+ * be a parseable integer number
284
+ * @private
285
+ */
286
+ JSEncryptRSAKey.hasPublicKeyProperty = function (obj) {
287
+ obj = obj || {};
288
+ return obj.hasOwnProperty("n") && obj.hasOwnProperty("e");
289
+ };
290
+ /**
291
+ * Check if the object contains ALL the parameters of an RSA key.
292
+ * @param {Object} [obj={}] - An object that may contain nine rsa key
293
+ * parameters
294
+ * @returns {boolean} true if the object contains all the parameters needed
295
+ * @todo check for types of the parameters all the parameters but the public exponent
296
+ * should be parseable bigint objects, the public exponent should be a parseable integer number
297
+ * @private
298
+ */
299
+ JSEncryptRSAKey.hasPrivateKeyProperty = function (obj) {
300
+ obj = obj || {};
301
+ return obj.hasOwnProperty("n") && obj.hasOwnProperty("e") && obj.hasOwnProperty("d") && obj.hasOwnProperty("p") && obj.hasOwnProperty("q") && obj.hasOwnProperty("dmp1") && obj.hasOwnProperty("dmq1") && obj.hasOwnProperty("coeff");
302
+ };
303
+ /**
304
+ * Parse the properties of obj in the current rsa object. Obj should AT LEAST
305
+ * include the modulus and public exponent (n, e) parameters.
306
+ * @param {Object} obj - the object containing rsa parameters
307
+ * @private
308
+ */
309
+ JSEncryptRSAKey.prototype.parsePropertiesFrom = function (obj) {
310
+ this.n = obj.n;
311
+ this.e = obj.e;
312
+ if (obj.hasOwnProperty("d")) {
313
+ this.d = obj.d;
314
+ this.p = obj.p;
315
+ this.q = obj.q;
316
+ this.dmp1 = obj.dmp1;
317
+ this.dmq1 = obj.dmq1;
318
+ this.coeff = obj.coeff;
319
+ }
320
+ };
321
+ return JSEncryptRSAKey;
322
+ }(RSAKey);
323
+
324
+ export { JSEncryptRSAKey };
325
+ //# sourceMappingURL=JSEncryptRSAKey.js.map