pixel-react 1.15.16 → 1.15.18
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/lib/assets/icons/groq.svg.js +1 -1
- package/lib/assets/icons/groq.svg.js.map +1 -1
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/ActiveCell.js +1 -1
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/ActiveCell.js.map +1 -1
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/util.js +1 -1
- package/lib/index.cjs +5582 -23
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.ts +4 -2
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/node_modules/js-beautify/js/src/css/beautifier.js +1 -1
- package/lib/node_modules/js-beautify/js/src/css/options.js +1 -1
- package/lib/node_modules/js-beautify/js/src/html/beautifier.js +1 -1
- package/lib/node_modules/js-beautify/js/src/html/options.js +1 -1
- package/lib/node_modules/jsencrypt/lib/JSEncrypt.js +246 -0
- package/lib/node_modules/jsencrypt/lib/JSEncrypt.js.map +1 -0
- package/lib/node_modules/jsencrypt/lib/JSEncryptRSAKey.js +325 -0
- package/lib/node_modules/jsencrypt/lib/JSEncryptRSAKey.js.map +1 -0
- package/lib/node_modules/jsencrypt/lib/index.js +6 -0
- package/lib/node_modules/jsencrypt/lib/index.js.map +1 -0
- package/lib/node_modules/jsencrypt/lib/lib/asn1js/asn1.js +570 -0
- package/lib/node_modules/jsencrypt/lib/lib/asn1js/asn1.js.map +1 -0
- package/lib/node_modules/jsencrypt/lib/lib/asn1js/base64.js +88 -0
- package/lib/node_modules/jsencrypt/lib/lib/asn1js/base64.js.map +1 -0
- package/lib/node_modules/jsencrypt/lib/lib/asn1js/hex.js +66 -0
- package/lib/node_modules/jsencrypt/lib/lib/asn1js/hex.js.map +1 -0
- package/lib/node_modules/jsencrypt/lib/lib/asn1js/int10.js +87 -0
- package/lib/node_modules/jsencrypt/lib/lib/asn1js/int10.js.map +1 -0
- package/lib/node_modules/jsencrypt/lib/lib/jsbn/base64.js +65 -0
- package/lib/node_modules/jsencrypt/lib/lib/jsbn/base64.js.map +1 -0
- package/lib/node_modules/jsencrypt/lib/lib/jsbn/jsbn.js +1700 -0
- package/lib/node_modules/jsencrypt/lib/lib/jsbn/jsbn.js.map +1 -0
- package/lib/node_modules/jsencrypt/lib/lib/jsbn/prng4.js +48 -0
- package/lib/node_modules/jsencrypt/lib/lib/jsbn/prng4.js.map +1 -0
- package/lib/node_modules/jsencrypt/lib/lib/jsbn/rng.js +77 -0
- package/lib/node_modules/jsencrypt/lib/lib/jsbn/rng.js.map +1 -0
- package/lib/node_modules/jsencrypt/lib/lib/jsbn/rsa.js +415 -0
- package/lib/node_modules/jsencrypt/lib/lib/jsbn/rsa.js.map +1 -0
- package/lib/node_modules/jsencrypt/lib/lib/jsbn/sha256.js +307 -0
- package/lib/node_modules/jsencrypt/lib/lib/jsbn/sha256.js.map +1 -0
- package/lib/node_modules/jsencrypt/lib/lib/jsbn/util.js +61 -0
- package/lib/node_modules/jsencrypt/lib/lib/jsbn/util.js.map +1 -0
- package/lib/node_modules/jsencrypt/lib/lib/jsrsasign/asn1-1.0.js +1559 -0
- package/lib/node_modules/jsencrypt/lib/lib/jsrsasign/asn1-1.0.js.map +1 -0
- package/lib/styles.css +1 -1
- package/lib/styles.css.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils/CopyToClipboard/copyToClipboard.d.ts +1 -0
- package/lib/utils/CopyToClipboard/copyToClipboard.js +12 -0
- package/lib/utils/CopyToClipboard/copyToClipboard.js.map +1 -0
- package/lib/utils/getEncryptedData/getEncryptedData.d.ts +1 -1
- package/lib/utils/getEncryptedData/getEncryptedData.js +8 -17
- package/lib/utils/getEncryptedData/getEncryptedData.js.map +1 -1
- package/package.json +2 -1
package/lib/index.d.ts
CHANGED
|
@@ -4608,7 +4608,7 @@ declare const compareArrays: (arr1: unknown[], arr2: unknown[]) => boolean;
|
|
|
4608
4608
|
type AnyObject = Record<string, unknown>;
|
|
4609
4609
|
declare const compareObjects: (obj1: AnyObject | null, obj2: AnyObject | null) => boolean;
|
|
4610
4610
|
|
|
4611
|
-
declare
|
|
4611
|
+
declare const getEncryptedData: (data: string, publicKey: string) => string | false;
|
|
4612
4612
|
|
|
4613
4613
|
type Callback = (...args: any[]) => void;
|
|
4614
4614
|
interface ThrottledFunction extends Function {
|
|
@@ -5726,5 +5726,7 @@ declare const useDeviceType: () => {
|
|
|
5726
5726
|
isWeb: boolean;
|
|
5727
5727
|
};
|
|
5728
5728
|
|
|
5729
|
-
|
|
5729
|
+
declare const copyToClipboard: (text: string) => boolean;
|
|
5730
|
+
|
|
5731
|
+
export { AADHAAR_REGEX, ALPHABET_ONLY_REGEX, ALPHABET_WITH_SPACES_ONLY_REGEX, ALPHANUMERIC_PARENTHESIS_REGEX, ALPHANUMERIC_REGEX, ALPHANUMERIC_WITH_DOT_REGEX, ALPHANUMERIC_WITH_ROUND_BRACES_REGEX, ALPHA_NUM_EXTENDED_REGEX, ALPHA_NUM_REGEX, Accordion, AddContentButton, AddResourceButton, AiToggle, AllProjectsDropdown, AnimatedSetting, AppHeader, AttachMedia, AttachmentButton, Avatar, BASE64_REGEX, BIG_END_WHITESPACE, BINARY_NUMBER_REGEX, BODY_TAG_TYPE_VALIDATION, BarChart, Card as Box, BrowserTabs, Button, CAMEL_CASE_REGEX, CERTIFICATES_NAME_REGEX, CHECK_CAMEL_CASE, CREDIT_CARD_REGEX, CURRENCY_GENERIC_REGEX, ChatModal, ChatModalAi, Checkbox, Chip, ChipWithCount, ChooseFile, Col, Comments, ConditionalDropdown, ConnectingBranch, Container, ContentCard, CreateVariableSlider, DATE_REGEX, DECIMAL_NUMBER_REGEX, DRIVING_LICENSE_REGEX, DYNAMIC_VALUE_PATTERN_REGEX, DYNAMIC_VALUE_TYPE_REGEX, DYNAMIC_VALUE_WITH_VALID_BRACKETS_REGEX, DYNAMIC_VALUE__PLACEHOLDER_REGEX, DashboardDonutChart, CustomDatePicker as DatePicker, DebugToolsPanel, DonutChart, DownloadClient, DragAndDrop, Drawer, Dropzone, ELEMENTS_TRAILING_SPACE_REGEX, ELEMENTS_WHITE_SPACE_REGEX, EMAIL_REGEX, EMAIL_VALIDATION_REGEX, EXCEL_SPACING_REGEX, EditLabel, EditTextField, Editor, ErrorBoundary, ExcelFile as Excel, ExpandableMenu, FILENAME_VALIDATION_REGEX, FILE_EXTENSION_REGEX, FILE_NAME_REGEX, FieldSet, FileDropzone, FilePreview, ForwardedForms as Form, formatString as FormatString, GSTIN_REGEX, HEXADECIMAL_NUMBER_REGEX, HEX_COLOR_REGEX, HSL_COLOR_REGEX, HTML_ATTRIBUTE_REGEX, HTML_FILE_TYPE_VALIDATION, HTML_TAG_REGEX, HighlightText, HistoryCard, INDIAN_CURRENCY_REGEX, INDIAN_PASSPORT_REGEX, INDIAN_PHONE_REGEX, INDIAN_PIN_CODE_REGEX, INTERNATIONAL_PHONE_REGEX, IPV4_REGEX, IPV6_REGEX, Icon, IconButton, IconRadialChart, IconRadioGroup, Input, InputWithDropdown, JAVASCRIPT_FILE_TYPE_VALIDATION, LINKEDIN_PROFILE_REGEX, LINK_VALIDATION_REGEX, LabelEditTextField, LineChart, LineLoader, Link, MAC_ADDRESS_REGEX, MEMORY_VALIDATION_REGEX, MachineInputField, MediaPreview, MediaViewerModal as MediaViewerModel, MenuOption, MessageBox, MiniModal, MobileSkin, Modal, ModuleChip, MultiRadialChart, MultiSelect, NlpInput as NLPInput, NLP_DESCRIPTION_REGEX, NUMBERS_ONLY_REGEX, NUMBER_REGEX, NoDataContent, OsTree, OtpVerification, OverviewModal, PAN_CARD_REGEX, PARAMETER_ALPHANUMERIC_REGEX, PASSWORD_COMPLEX_REGEX, PASSWORD_SIMPLE_REGEX, PHONE_REGEX, POSTAL_CODE_REGEX, Paper, PhoneInputField, PieChart, PopUpModal, PrePostTable, ProgressBar, Prompt, PromptContainer, RGB_COLOR_REGEX, ROMAN_NUMERALS_REGEX, RadialChart, RadioButton, RadioGroup, Recaptcha, Row, SCRIPT_REGEX, SSN_REGEX, START_END_WHITESPACE_REGEX, STEP_GROUP_NAME_REGEX, ScriptGenerationLoader, ScriptSwitchButton, Search, Select, SequentialConnectingBranch, SessionDropdown, SessionManager, StateDropdown, StatusButton, StatusCard, StatusIndicator, StepLandingTable, StepResultStats, SwitchButton, TIME_REGEX, TWITTER_HANDLE_REGEX, Table, TreeTable as TableTree, TableTreeFn, TableWithAccordion, Tabs, TabsWithSilder, Textarea as TextArea, TextEditor, ThemeProvider, Toaster, Toastify, Toggle, ToggleSwitch, Tooltip, TruncatedTooltip, Typography, UNIT_REGEX, URL_REGEX, USERNAME_REGEX, USERNAME_SPECIAL_REGEX, US_ZIP_CODE_REGEX, UUID_REGEX, VEHICLE_REGISTRATION_REGEX, VariableDropdown, VariableInput, VariableSuggestionInputDropDown, WHITESPACE_REGEX, XML_FILE_TYPE_VALIDATION, addPrePostStepGroup, addStepGroup, autoScrollToTableLastRow, capitalize, checkEmpty, checkMicrophoneAccess, clearStore, compareArrays, compareObjects, convertFormDataToObject, convertToBytes, convertToGB, convertToISO, copyToClipboard, debounce, deleteStoreValue, ffid, findAndInsert, formatDate, formatResponseDate, getEncryptedData, getExtension, getExtensionWithPeriod, getNavigateToKey, getSequentialPayload, getStoreValue, getTopVisibleNodeKey, getTreeDetails, handleTimeZoneChange, handleTreeExpandAllCollapseAll, handleTreeNodeExpandCollapse, handleTreeNodeSect, handleUnCheckAllTreeNodesWithUpdates, hasDuplicateFile, isEmptyObject, isTextTruncated, nlpInputDelay, rearrangeDragItem, saveFileFromBlob, scrollToView, setStoreValue, throttle, toCamelCase, toast, toggleShowHideEntity, truncateText, updateTreeState, useBeforeUnload, useClickOutside, useDeviceType, useFileDropzone, useKeyboardActions, useTheme, useTriggerControl };
|
|
5730
5732
|
export type { RootNode$1 as RootNode, TreeNodeProps };
|
package/lib/index.js
CHANGED
|
@@ -166,4 +166,5 @@ export { default as adapter } from './node_modules/webrtc-adapter/src/js/adapter
|
|
|
166
166
|
export { default as StepResultStats } from './components/StepsLandingTable/Components/StepResultStats.js';
|
|
167
167
|
export { default as ScriptGenerationLoader } from './components/ScriptGenerationLoader/ScriptGenerationLoader.js';
|
|
168
168
|
export { useDeviceType } from './utils/useDeviceType/useDeviceType.js';
|
|
169
|
+
export { copyToClipboard } from './utils/CopyToClipboard/copyToClipboard.js';
|
|
169
170
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exports as beautifier } from '../../../../../_virtual/
|
|
1
|
+
import { __exports as beautifier } from '../../../../../_virtual/beautifier.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 beautifier } from '../../../../../_virtual/
|
|
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';
|
|
@@ -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,uBAAuB,IAAI,QAAQ,CAAC;AAC3E,IAAA,IAAI,CAACC,GAAG,GAAGJ,OAAO,CAACI,GAAG,IAAI,KAAK;AAC/B;AACA,IAAA,IAAI,CAACC,GAAG,GAAGL,OAAO,CAACK,GAAG,IAAI,IAAI;AAClC,EAAA;AACA;AACJ;AACA;AACA;AACA;AACA;AACA;AACIN,EAAAA,SAAS,CAACO,SAAS,CAACC,MAAM,GAAG,UAAUF,GAAG,EAAE;AACxC,IAAA,IAAIA,GAAG,EAAE;AACL,MAAA,IAAI,IAAI,CAACD,GAAG,IAAI,IAAI,CAACC,GAAG,EAAE;AACtBG,QAAAA,OAAO,CAACC,IAAI,CAAC,6CAA6C,CAAC;AAC/D,MAAA;AACA,MAAA,IAAI,CAACJ,GAAG,GAAG,IAAIK,eAAe,CAACL,GAAG,CAAC;IACvC,CAAC,MAC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