@gibme/crypto-browser 7.0.4 → 20.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,43 +1,7 @@
1
- /**
2
- * @ignore
3
- */
4
- export interface ModuleResult<Type> {
5
- error: boolean;
6
- result: Type;
7
- error_message?: string;
8
- }
9
- /**
10
- * The type of the underlying cryptographic library
11
- */
12
- export declare enum LibraryType {
13
- UNKNOWN = 0,
14
- NODE = 1,
15
- WASM = 2,
16
- JS = 3
17
- }
18
- /**
19
- * The type of the mnemonic phrase language
20
- *
21
- * Note: You will want to call the module `languages()` to get
22
- * the list of languages supported by the underlying cryptographic
23
- * module before attempting to use a particular language
24
- */
25
- export declare enum Language {
26
- CHINESE_SIMPLIFIED = 0,
27
- CHINESE_TRADITIONAL = 1,
28
- CZECH = 2,
29
- ENGLISH = 3,
30
- FRENCH = 4,
31
- ITALIAN = 5,
32
- JAPANESE = 6,
33
- KOREAN = 7,
34
- PORTUGUESE = 8,
35
- SPANISH = 9
36
- }
37
1
  /**
38
2
  * Represents a Bulletproof proof
39
3
  */
40
- export interface crypto_bulletproof_t {
4
+ export type crypto_bulletproof_t = {
41
5
  A: string;
42
6
  S: string;
43
7
  T1: string;
@@ -49,11 +13,11 @@ export interface crypto_bulletproof_t {
49
13
  g: string;
50
14
  h: string;
51
15
  t: string;
52
- }
16
+ };
53
17
  /**
54
18
  * Represents a Bulletproof+ proof
55
19
  */
56
- export interface crypto_bulletproof_plus_t {
20
+ export type crypto_bulletproof_plus_t = {
57
21
  A: string;
58
22
  A1: string;
59
23
  B: string;
@@ -62,26 +26,26 @@ export interface crypto_bulletproof_plus_t {
62
26
  d1: string;
63
27
  L: string[];
64
28
  R: string[];
65
- }
29
+ };
66
30
  /**
67
31
  * Represents a Borromean signature
68
32
  */
69
- export interface crypto_borromean_signature_t {
33
+ export type crypto_borromean_signature_t = {
70
34
  signatures: string[];
71
- }
35
+ };
72
36
  /**
73
37
  * Represents a CLSAG signature
74
38
  */
75
- export interface crypto_clsag_signature_t {
39
+ export type crypto_clsag_signature_t = {
76
40
  scalars: string[];
77
41
  challenge: string;
78
42
  commitment_image?: string;
79
43
  pseudo_commitment?: string;
80
- }
44
+ };
81
45
  /**
82
46
  * Represents a Triptych signature
83
47
  */
84
- export interface crypto_triptych_signature_t {
48
+ export type crypto_triptych_signature_t = {
85
49
  commitment_image: string;
86
50
  pseudo_commitment: string;
87
51
  A: string;
@@ -94,11 +58,11 @@ export interface crypto_triptych_signature_t {
94
58
  zA: string;
95
59
  zC: string;
96
60
  z: string;
97
- }
61
+ };
98
62
  /**
99
63
  * Represents cryptographic entropy
100
64
  */
101
- export interface crypto_entropy_t {
65
+ export type crypto_entropy_t = {
102
66
  /**
103
67
  * The raw entropy encoded as a hexadecimal string
104
68
  */
@@ -111,11 +75,11 @@ export interface crypto_entropy_t {
111
75
  * The mnemonic phrase that represents the `entropy`
112
76
  */
113
77
  mnemonic_phrase: string;
114
- }
78
+ };
115
79
  /**
116
80
  * Represents a public/secret key pair
117
81
  */
118
- export interface key_pair_t {
82
+ export type key_pair_t = {
119
83
  /**
120
84
  * The public key
121
85
  */
@@ -128,152 +92,4 @@ export interface key_pair_t {
128
92
  * The ED25519 private key per RFC-8032 (only returned when generating child keys)
129
93
  */
130
94
  private_key?: string;
131
- }
132
- /**
133
- * Contains types used when interacting with our underlying cryptographic library
134
- */
135
- export declare namespace Library {
136
- /**
137
- * Defines the structure for when we interact with the generation of ring
138
- * signatures using our underlying cryptographic library
139
- */
140
- interface GenerateRingSignature<SignatureType = any> {
141
- message_digest?: string;
142
- secret_ephemeral?: string;
143
- public_keys?: string[];
144
- input_blinding_factor?: string;
145
- public_commitments?: string[];
146
- pseudo_blinding_factor?: string;
147
- pseudo_commitment?: string;
148
- real_output_index?: number;
149
- key_image?: string;
150
- signature?: SignatureType;
151
- h?: string[];
152
- mu_P?: string;
153
- xpow?: string;
154
- }
155
- /**
156
- * Defines the structure for when we interact with the AES methods
157
- * in our underlying cryptographic library
158
- */
159
- interface AES {
160
- input: string;
161
- password: string;
162
- iterations?: number;
163
- }
164
- /**
165
- * Defines the structure for when we interact with the checking of ring
166
- * signatures using our underlying cryptographic library
167
- */
168
- interface CheckRingSignature<SignatureType> {
169
- message_digest: string;
170
- key_image: string;
171
- public_keys: string[];
172
- signature: SignatureType;
173
- commitments?: string[];
174
- }
175
- /**
176
- * Defines the Call types going into our underlying cryptographic library
177
- */
178
- namespace CallTypes {
179
- type WithArguments = (input: string) => Promise<string>;
180
- type WithoutArguments = () => Promise<string>;
181
- type Signature = WithArguments | WithoutArguments;
182
- }
183
- }
184
- /**
185
- * Defines the interface uses with our underlying cryptographic library
186
- * or an externally provided library
187
- */
188
- export interface ICryptoLibrary {
189
- random_entropy: Library.CallTypes.WithoutArguments;
190
- random_hash: Library.CallTypes.WithoutArguments;
191
- random_hashes: Library.CallTypes.WithArguments;
192
- random_scalar: Library.CallTypes.WithoutArguments;
193
- random_scalars: Library.CallTypes.WithArguments;
194
- random_point: Library.CallTypes.WithoutArguments;
195
- random_points: Library.CallTypes.WithArguments;
196
- sha3: Library.CallTypes.WithArguments;
197
- sha3_slow: Library.CallTypes.WithArguments;
198
- argon2i: Library.CallTypes.WithArguments;
199
- argon2d: Library.CallTypes.WithArguments;
200
- argon2id: Library.CallTypes.WithArguments;
201
- entropy_recover: Library.CallTypes.WithArguments;
202
- generate_derivation: Library.CallTypes.WithArguments;
203
- generate_derivation_scalar: Library.CallTypes.WithArguments;
204
- derive_public_key: Library.CallTypes.WithArguments;
205
- derive_secret_key: Library.CallTypes.WithArguments;
206
- generate_key_image: Library.CallTypes.WithArguments;
207
- generate_key_image_v2: Library.CallTypes.WithArguments;
208
- generate_keys: Library.CallTypes.WithoutArguments;
209
- underive_public_key: Library.CallTypes.WithArguments;
210
- secret_key_to_public_key: Library.CallTypes.WithArguments;
211
- hash_to_point: Library.CallTypes.WithArguments;
212
- hash_to_scalar: Library.CallTypes.WithArguments;
213
- scalar_reduce: Library.CallTypes.WithArguments;
214
- tree_depth: Library.CallTypes.WithArguments;
215
- root_hash: Library.CallTypes.WithArguments;
216
- root_hash_from_branch: Library.CallTypes.WithArguments;
217
- tree_branch: Library.CallTypes.WithArguments;
218
- generate_signature: Library.CallTypes.WithArguments;
219
- prepare_signature: Library.CallTypes.WithArguments;
220
- complete_signature: Library.CallTypes.WithArguments;
221
- check_signature: Library.CallTypes.WithArguments;
222
- generate_borromean_signature: Library.CallTypes.WithArguments;
223
- prepare_borromean_signature: Library.CallTypes.WithArguments;
224
- complete_borromean_signature: Library.CallTypes.WithArguments;
225
- check_borromean_signature: Library.CallTypes.WithArguments;
226
- generate_clsag_signature: Library.CallTypes.WithArguments;
227
- prepare_clsag_signature: Library.CallTypes.WithArguments;
228
- complete_clsag_signature: Library.CallTypes.WithArguments;
229
- check_clsag_signature: Library.CallTypes.WithArguments;
230
- generate_triptych_signature: Library.CallTypes.WithArguments;
231
- prepare_triptych_signature: Library.CallTypes.WithArguments;
232
- complete_triptych_signature: Library.CallTypes.WithArguments;
233
- check_triptych_signature: Library.CallTypes.WithArguments;
234
- generate_bulletproof: Library.CallTypes.WithArguments;
235
- check_bulletproof: Library.CallTypes.WithArguments;
236
- check_bulletproof_batch: Library.CallTypes.WithArguments;
237
- generate_bulletproof_plus: Library.CallTypes.WithArguments;
238
- check_bulletproof_plus: Library.CallTypes.WithArguments;
239
- check_bulletproof_plus_batch: Library.CallTypes.WithArguments;
240
- check_commitment_parity: Library.CallTypes.WithArguments;
241
- generate_amount_mask: Library.CallTypes.WithArguments;
242
- generate_commitment_blinding_factor: Library.CallTypes.WithArguments;
243
- generate_pedersen_commitment: Library.CallTypes.WithArguments;
244
- generate_pseudo_commitments: Library.CallTypes.WithArguments;
245
- toggle_masked_amount: Library.CallTypes.WithArguments;
246
- base58_address_decode: Library.CallTypes.WithArguments;
247
- cn_base58_address_decode: Library.CallTypes.WithArguments;
248
- generate_outputs_proof: Library.CallTypes.WithArguments;
249
- check_outputs_proof: Library.CallTypes.WithArguments;
250
- base58_encode: Library.CallTypes.WithArguments;
251
- base58_encode_check: Library.CallTypes.WithArguments;
252
- base58_decode: Library.CallTypes.WithArguments;
253
- base58_decode_check: Library.CallTypes.WithArguments;
254
- cn_base58_encode: Library.CallTypes.WithArguments;
255
- cn_base58_encode_check: Library.CallTypes.WithArguments;
256
- cn_base58_decode: Library.CallTypes.WithArguments;
257
- cn_base58_decode_check: Library.CallTypes.WithArguments;
258
- check_scalar: Library.CallTypes.WithArguments;
259
- check_point: Library.CallTypes.WithArguments;
260
- generate_keys_m: Library.CallTypes.WithArguments;
261
- mnemonics_encode: Library.CallTypes.WithArguments;
262
- mnemonics_decode: Library.CallTypes.WithArguments;
263
- mnemonics_calculate_checksum_index: Library.CallTypes.WithArguments;
264
- mnemonics_word_index: Library.CallTypes.WithArguments;
265
- word_list: Library.CallTypes.WithoutArguments;
266
- word_list_trimmed: Library.CallTypes.WithoutArguments;
267
- calculate_base2_exponent: Library.CallTypes.WithArguments;
268
- aes_encrypt: Library.CallTypes.WithArguments;
269
- aes_decrypt: Library.CallTypes.WithArguments;
270
- generate_seed: Library.CallTypes.WithArguments;
271
- generate_child_key: Library.CallTypes.WithArguments;
272
- private_key_to_keys: Library.CallTypes.WithArguments;
273
- [key: string]: Library.CallTypes.Signature;
274
- }
275
- /** @ignore */
276
- export interface ModuleSettings {
277
- library?: ICryptoLibrary;
278
- type: LibraryType;
279
- }
95
+ };
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright (c) 2020, Brandon Lehmann
2
+ // Copyright (c) 2020-2025, Brandon Lehmann
3
3
  //
4
4
  // Redistribution and use in source and binary forms, with or without modification, are
5
5
  // permitted provided that the following conditions are met:
@@ -25,35 +25,4 @@
25
25
  // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
26
26
  // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
27
  Object.defineProperty(exports, "__esModule", { value: true });
28
- exports.Language = exports.LibraryType = void 0;
29
- /**
30
- * The type of the underlying cryptographic library
31
- */
32
- var LibraryType;
33
- (function (LibraryType) {
34
- LibraryType[LibraryType["UNKNOWN"] = 0] = "UNKNOWN";
35
- LibraryType[LibraryType["NODE"] = 1] = "NODE";
36
- LibraryType[LibraryType["WASM"] = 2] = "WASM";
37
- LibraryType[LibraryType["JS"] = 3] = "JS";
38
- })(LibraryType || (exports.LibraryType = LibraryType = {}));
39
- /**
40
- * The type of the mnemonic phrase language
41
- *
42
- * Note: You will want to call the module `languages()` to get
43
- * the list of languages supported by the underlying cryptographic
44
- * module before attempting to use a particular language
45
- */
46
- var Language;
47
- (function (Language) {
48
- Language[Language["CHINESE_SIMPLIFIED"] = 0] = "CHINESE_SIMPLIFIED";
49
- Language[Language["CHINESE_TRADITIONAL"] = 1] = "CHINESE_TRADITIONAL";
50
- Language[Language["CZECH"] = 2] = "CZECH";
51
- Language[Language["ENGLISH"] = 3] = "ENGLISH";
52
- Language[Language["FRENCH"] = 4] = "FRENCH";
53
- Language[Language["ITALIAN"] = 5] = "ITALIAN";
54
- Language[Language["JAPANESE"] = 6] = "JAPANESE";
55
- Language[Language["KOREAN"] = 7] = "KOREAN";
56
- Language[Language["PORTUGUESE"] = 8] = "PORTUGUESE";
57
- Language[Language["SPANISH"] = 9] = "SPANISH";
58
- })(Language || (exports.Language = Language = {}));
59
28
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../types/types.ts"],"names":[],"mappings":";AAAA,sCAAsC;AACtC,EAAE;AACF,uFAAuF;AACvF,4DAA4D;AAC5D,EAAE;AACF,yFAAyF;AACzF,8CAA8C;AAC9C,EAAE;AACF,yFAAyF;AACzF,kFAAkF;AAClF,+CAA+C;AAC/C,EAAE;AACF,uFAAuF;AACvF,qFAAqF;AACrF,+BAA+B;AAC/B,EAAE;AACF,sFAAsF;AACtF,0FAA0F;AAC1F,yFAAyF;AACzF,uFAAuF;AACvF,+EAA+E;AAC/E,0FAA0F;AAC1F,oFAAoF;AACpF,0FAA0F;AAC1F,+EAA+E;;;AAW/E;;GAEG;AACH,IAAY,WAKX;AALD,WAAY,WAAW;IACnB,mDAAO,CAAA;IACP,6CAAI,CAAA;IACJ,6CAAI,CAAA;IACJ,yCAAE,CAAA;AACN,CAAC,EALW,WAAW,2BAAX,WAAW,QAKtB;AAED;;;;;;GAMG;AACH,IAAY,QAWX;AAXD,WAAY,QAAQ;IAChB,mEAAkB,CAAA;IAClB,qEAAmB,CAAA;IACnB,yCAAK,CAAA;IACL,6CAAO,CAAA;IACP,2CAAM,CAAA;IACN,6CAAO,CAAA;IACP,+CAAQ,CAAA;IACR,2CAAM,CAAA;IACN,mDAAU,CAAA;IACV,6CAAO,CAAA;AACX,CAAC,EAXW,QAAQ,wBAAR,QAAQ,QAWnB"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../types/types.ts"],"names":[],"mappings":";AAAA,2CAA2C;AAC3C,EAAE;AACF,uFAAuF;AACvF,4DAA4D;AAC5D,EAAE;AACF,yFAAyF;AACzF,8CAA8C;AAC9C,EAAE;AACF,yFAAyF;AACzF,kFAAkF;AAClF,+CAA+C;AAC/C,EAAE;AACF,uFAAuF;AACvF,qFAAqF;AACrF,+BAA+B;AAC/B,EAAE;AACF,sFAAsF;AACtF,0FAA0F;AAC1F,yFAAyF;AACzF,uFAAuF;AACvF,+EAA+E;AAC/E,0FAA0F;AAC1F,oFAAoF;AACpF,0FAA0F;AAC1F,+EAA+E"}
@@ -1,13 +1,14 @@
1
- interface IUint256 {
2
- value: bigint;
3
- toString(littleEndian?: boolean): string;
1
+ export declare function uint256(value: number | bigint): uint256.uint256;
2
+ export declare namespace uint256 {
3
+ type uint256 = {
4
+ value: bigint;
5
+ toString(littleEndian?: boolean): string;
6
+ };
7
+ /**
8
+ * Loads a uint256 from a hexadecimal string value
9
+ * @param value
10
+ * @param littleEndian
11
+ */
12
+ const from: (value: string, littleEndian?: boolean) => uint256;
4
13
  }
5
- interface IUint256Interface {
6
- (value: number | bigint): IUint256;
7
- }
8
- interface IUint256Static extends IUint256Interface {
9
- from(value: string, littleEndian?: boolean): IUint256;
10
- }
11
- /** @ignore */
12
- export declare const uint256: IUint256Static;
13
- export {};
14
+ export default uint256;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright (c) 2020, Brandon Lehmann
2
+ // Copyright (c) 2020-2025, Brandon Lehmann
3
3
  //
4
4
  // Redistribution and use in source and binary forms, with or without modification, are
5
5
  // permitted provided that the following conditions are met:
@@ -25,15 +25,8 @@
25
25
  // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
26
26
  // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
27
  Object.defineProperty(exports, "__esModule", { value: true });
28
- exports.uint256 = void 0;
29
- /**
30
- * A very simple uint256 type for the expressed purpose of working
31
- * with our underlying cryptographic library
32
- *
33
- * @param value
34
- * @ignore
35
- */
36
- const library = (value) => {
28
+ exports.uint256 = uint256;
29
+ function uint256(value) {
37
30
  value = typeof value === 'number' ? BigInt(value) : value;
38
31
  return {
39
32
  value,
@@ -47,24 +40,23 @@ const library = (value) => {
47
40
  return hex;
48
41
  }
49
42
  };
50
- };
51
- /**
52
- * Loads a uint256 from a hexadecimal string value
53
- *
54
- * @param value
55
- * @param littleEndian
56
- * @ignore
57
- */
58
- library.from = (value, littleEndian = true) => {
59
- if (!/^[0-9a-f]+$/i.test(value))
60
- throw new Error('Not a hexadecimal string');
61
- const hex_bytes = value.match(/.{1,2}/g) || [];
62
- if (hex_bytes.length !== 32)
63
- throw new Error('Invalid hexadecimal length');
64
- const array = Uint8Array.from(hex_bytes.map(byte => `0x${byte}`));
65
- const int = new DataView(array.buffer).getBigUint64(0, littleEndian);
66
- return library(int);
67
- };
68
- /** @ignore */
69
- exports.uint256 = library;
43
+ }
44
+ (function (uint256) {
45
+ /**
46
+ * Loads a uint256 from a hexadecimal string value
47
+ * @param value
48
+ * @param littleEndian
49
+ */
50
+ uint256.from = (value, littleEndian = true) => {
51
+ if (!/^[0-9a-f]+$/i.test(value))
52
+ throw new Error('Not a hexadecimal string');
53
+ const hex_bytes = value.match(/.{1,2}/g) || [];
54
+ if (hex_bytes.length !== 32)
55
+ throw new Error('Invalid hexadecimal length');
56
+ const array = Uint8Array.from(hex_bytes.map(byte => `0x${byte}`));
57
+ const int = new DataView(array.buffer).getBigUint64(0, littleEndian);
58
+ return uint256(int);
59
+ };
60
+ })(uint256 || (exports.uint256 = uint256 = {}));
61
+ exports.default = uint256;
70
62
  //# sourceMappingURL=uint64.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"uint64.js","sourceRoot":"","sources":["../../../types/uint64.ts"],"names":[],"mappings":";AAAA,sCAAsC;AACtC,EAAE;AACF,uFAAuF;AACvF,4DAA4D;AAC5D,EAAE;AACF,yFAAyF;AACzF,8CAA8C;AAC9C,EAAE;AACF,yFAAyF;AACzF,kFAAkF;AAClF,+CAA+C;AAC/C,EAAE;AACF,uFAAuF;AACvF,qFAAqF;AACrF,+BAA+B;AAC/B,EAAE;AACF,sFAAsF;AACtF,0FAA0F;AAC1F,yFAAyF;AACzF,uFAAuF;AACvF,+EAA+E;AAC/E,0FAA0F;AAC1F,oFAAoF;AACpF,0FAA0F;AAC1F,+EAA+E;;;AAe/E;;;;;;GAMG;AACH,MAAM,OAAO,GAAsB,CAAC,KAAsB,EAAY,EAAE;IACpE,KAAK,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAE1D,OAAO;QACH,KAAK;QACL,QAAQ,EAAE,CAAC,YAAY,GAAG,IAAI,EAAU,EAAE;YACtC,MAAM,MAAM,GAAG,IAAI,WAAW,CAAC,EAAE,C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AC,CAAC;QAE7E,MAAM,SAAS,GAAa,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;QAEzD,IAAI,SAAS,CAAC,MAAM,KAAK,EAAE;YAAE,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAE3E,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,IAAI,EAAE,CAAQ,CAAC,CAAC;QAEzE,MAAM,GAAG,GAAG,IAAI,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;QAErE,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC;IACxB,CAAC,CAAC;AACN,CAAC,EAxBgB,OAAO,uBAAP,OAAO,QAwBvB;AAED,kBAAe,OAAO,CAAC"}
package/package.json CHANGED
@@ -1,9 +1,20 @@
1
1
  {
2
2
  "name": "@gibme/crypto-browser",
3
- "version": "7.0.4",
3
+ "version": "20.0.0",
4
4
  "description": "Web Browser Lazy-Loading Advanced Cryptographic Functions provided by @gibme/crypto",
5
5
  "main": "dist/browser/src/index.js",
6
6
  "types": "dist/browser/src/index.d.ts",
7
+ "exports": {
8
+ ".": "./dist/browser/src/index.js",
9
+ "./lite": "./dist/types/lite.js"
10
+ },
11
+ "typesVersions": {
12
+ "*": {
13
+ "lite": [
14
+ "./dist/types/lite.d.ts"
15
+ ]
16
+ }
17
+ },
7
18
  "files": [
8
19
  "dist/*"
9
20
  ],
@@ -25,7 +36,7 @@
25
36
  "url": "https://github.com/gibme-npm/crypto/issues"
26
37
  },
27
38
  "engines": {
28
- "node": ">=18"
39
+ "node": ">=20"
29
40
  },
30
41
  "engineStrict": true,
31
42
  "author": {
@@ -45,10 +56,10 @@
45
56
  }
46
57
  },
47
58
  "devDependencies": {
48
- "@gibme/auto-pack": "^0.4.3",
49
- "@types/node": "^22.4.0",
59
+ "@gibme/auto-pack": "^20.0.0",
60
+ "@types/node": "^24.3.0",
50
61
  "ts-node": "^10.9.2",
51
- "typescript": "^5.5.4"
62
+ "typescript": "^5.9.2"
52
63
  },
53
64
  "dependencies": {
54
65
  "buffer": "^6.0.3"
@@ -1,43 +0,0 @@
1
- import { Language, LibraryType } from './types';
2
- /**
3
- * Constructs a Module Result
4
- *
5
- * Note: This is typically only used by external cryptographic library calls
6
- * so that it mimics our underlying library call results
7
- *
8
- * The string returned should always be a raw type, whether it be
9
- * a string, a number, or an object as expected by the module.
10
- *
11
- * If you are using external libraries for the underlying cryptographic library,
12
- * it is highly recommended that you read the source code of this module
13
- * to make sure that you are returning a result of the proper structure.
14
- *
15
- * This method will `JSON.stringify()` whatever result you supply so that our
16
- * module understands it within it's private `execute()` method
17
- *
18
- * @param error
19
- * @param result
20
- * @param error_message
21
- */
22
- export declare const make_module_result: <ResultType = string>(error: boolean, result: ResultType, error_message?: string) => string;
23
- /**
24
- * Tests if the supplied string is of hexadecimal form
25
- *
26
- * @param value
27
- * @ignore
28
- */
29
- export declare const is_hex: (value: string) => boolean;
30
- /**
31
- * Returns the library name from the specified library type
32
- *
33
- * @param type
34
- * @ignore
35
- */
36
- export declare const LibraryTypeName: (type: LibraryType) => string;
37
- /**
38
- * Returns the common language name for the specified language
39
- *
40
- * @param language
41
- * @ignore
42
- */
43
- export declare const LanguageName: (language: Language) => string;
@@ -1,123 +0,0 @@
1
- "use strict";
2
- // Copyright (c) 2020, Brandon Lehmann
3
- //
4
- // Redistribution and use in source and binary forms, with or without modification, are
5
- // permitted provided that the following conditions are met:
6
- //
7
- // 1. Redistributions of source code must retain the above copyright notice, this list of
8
- // conditions and the following disclaimer.
9
- //
10
- // 2. Redistributions in binary form must reproduce the above copyright notice, this list
11
- // of conditions and the following disclaimer in the documentation and/or other
12
- // materials provided with the distribution.
13
- //
14
- // 3. Neither the name of the copyright holder nor the names of its contributors may be
15
- // used to endorse or promote products derived from this software without specific
16
- // prior written permission.
17
- //
18
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
19
- // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
20
- // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
21
- // THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22
- // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23
- // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24
- // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
25
- // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
26
- // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
- Object.defineProperty(exports, "__esModule", { value: true });
28
- exports.LanguageName = exports.LibraryTypeName = exports.is_hex = exports.make_module_result = void 0;
29
- const types_1 = require("./types");
30
- /**
31
- * Constructs a Module Result
32
- *
33
- * Note: This is typically only used by external cryptographic library calls
34
- * so that it mimics our underlying library call results
35
- *
36
- * The string returned should always be a raw type, whether it be
37
- * a string, a number, or an object as expected by the module.
38
- *
39
- * If you are using external libraries for the underlying cryptographic library,
40
- * it is highly recommended that you read the source code of this module
41
- * to make sure that you are returning a result of the proper structure.
42
- *
43
- * This method will `JSON.stringify()` whatever result you supply so that our
44
- * module understands it within it's private `execute()` method
45
- *
46
- * @param error
47
- * @param result
48
- * @param error_message
49
- */
50
- const make_module_result = (error, result, error_message) => {
51
- const output = {
52
- error,
53
- result
54
- };
55
- if (error_message) {
56
- output.error_message = error_message;
57
- }
58
- return JSON.stringify(output);
59
- };
60
- exports.make_module_result = make_module_result;
61
- /**
62
- * Tests if the supplied string is of hexadecimal form
63
- *
64
- * @param value
65
- * @ignore
66
- */
67
- const is_hex = (value) => {
68
- return /^[0-9a-f]+$/i.test(value);
69
- };
70
- exports.is_hex = is_hex;
71
- /**
72
- * Returns the library name from the specified library type
73
- *
74
- * @param type
75
- * @ignore
76
- */
77
- const LibraryTypeName = (type) => {
78
- switch (type) {
79
- case types_1.LibraryType.NODE:
80
- return 'Node C++ Addon';
81
- case types_1.LibraryType.WASM:
82
- return 'WASM.js Library';
83
- case types_1.LibraryType.JS:
84
- return 'Javascript asm.js (slow)';
85
- default:
86
- return 'unknown';
87
- }
88
- };
89
- exports.LibraryTypeName = LibraryTypeName;
90
- /**
91
- * Returns the common language name for the specified language
92
- *
93
- * @param language
94
- * @ignore
95
- */
96
- const LanguageName = (language) => {
97
- switch (language) {
98
- case types_1.Language.CHINESE_SIMPLIFIED:
99
- return 'Chinese (simplified)';
100
- case types_1.Language.CHINESE_TRADITIONAL:
101
- return 'Chinese (traditional)';
102
- case types_1.Language.CZECH:
103
- return 'Czech';
104
- case types_1.Language.ENGLISH:
105
- return 'English';
106
- case types_1.Language.FRENCH:
107
- return 'French';
108
- case types_1.Language.ITALIAN:
109
- return 'Italian';
110
- case types_1.Language.JAPANESE:
111
- return 'Japanese';
112
- case types_1.Language.KOREAN:
113
- return 'Korean';
114
- case types_1.Language.PORTUGUESE:
115
- return 'Portuguese';
116
- case types_1.Language.SPANISH:
117
- return 'Spanish';
118
- default:
119
- return 'Unknown';
120
- }
121
- };
122
- exports.LanguageName = LanguageName;
123
- //# sourceMappingURL=helpers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../types/helpers.ts"],"names":[],"mappings":";AAAA,sCAAsC;AACtC,EAAE;AACF,uFAAuF;AACvF,4DAA4D;AAC5D,EAAE;AACF,yFAAyF;AACzF,8CAA8C;AAC9C,EAAE;AACF,yFAAyF;AAC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