@gibme/crypto-browser 7.0.2

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.
@@ -0,0 +1,70 @@
1
+ import { CryptoModule, ICryptoLibrary } from '../../types';
2
+ export * from '../../types';
3
+ declare global {
4
+ interface Window {
5
+ CryptoModule?: ICryptoLibrary;
6
+ }
7
+ }
8
+ export default class Crypto extends CryptoModule {
9
+ /**
10
+ * We cannot create a new instance using this method as we need to await the
11
+ * loading of an underlying module, hence, we need to await the static
12
+ * init() method on this class to receive an instance of the class
13
+ *
14
+ * @protected
15
+ */
16
+ protected constructor();
17
+ /**
18
+ * Initializes a new instance of this class after attempting to load
19
+ * the underlying cryptographic library in the order the fastest
20
+ * running library to the slowest
21
+ */
22
+ static init(externalLibrary?: Partial<ICryptoLibrary>): Promise<Crypto>;
23
+ /**
24
+ * Forces the library to use the Javascript ASM.js underlying
25
+ * cryptographic library if it can
26
+ */
27
+ static force_js_library(): Promise<boolean>;
28
+ /**
29
+ * Forces the library to use the WASM underlying cryptographic
30
+ * library if it can
31
+ */
32
+ static force_wasm_library(): Promise<boolean>;
33
+ /**
34
+ * Attempts to load a script from a URL
35
+ *
36
+ * @param url
37
+ * @private
38
+ */
39
+ private static load;
40
+ /**
41
+ * Attempts to initialize the underlying cryptographic library from an url
42
+ *
43
+ * @param url
44
+ * @param type
45
+ * @private
46
+ */
47
+ private static load_library;
48
+ /**
49
+ * Attempts to load the Javascript ASM.js module as the underlying
50
+ * cryptographic library
51
+ *
52
+ * @private
53
+ */
54
+ private static load_js_library;
55
+ /**
56
+ * Attempts to load the WASM module as the underlying cryptographic
57
+ * library
58
+ *
59
+ * @private
60
+ */
61
+ private static load_wasm_library;
62
+ /**
63
+ * Checks if the URL exists
64
+ *
65
+ * @param url
66
+ * @private
67
+ */
68
+ private static url_exists;
69
+ }
70
+ export { Crypto };
@@ -0,0 +1,177 @@
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
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
28
+ if (k2 === undefined) k2 = k;
29
+ var desc = Object.getOwnPropertyDescriptor(m, k);
30
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
31
+ desc = { enumerable: true, get: function() { return m[k]; } };
32
+ }
33
+ Object.defineProperty(o, k2, desc);
34
+ }) : (function(o, m, k, k2) {
35
+ if (k2 === undefined) k2 = k;
36
+ o[k2] = m[k];
37
+ }));
38
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
39
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
40
+ };
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ exports.Crypto = void 0;
43
+ const types_1 = require("../../types");
44
+ const version_1 = require("./version");
45
+ __exportStar(require("../../types"), exports);
46
+ class Crypto extends types_1.CryptoModule {
47
+ /**
48
+ * We cannot create a new instance using this method as we need to await the
49
+ * loading of an underlying module, hence, we need to await the static
50
+ * init() method on this class to receive an instance of the class
51
+ *
52
+ * @protected
53
+ */
54
+ // eslint-disable-next-line no-useless-constructor
55
+ constructor() {
56
+ super();
57
+ }
58
+ /**
59
+ * Initializes a new instance of this class after attempting to load
60
+ * the underlying cryptographic library in the order the fastest
61
+ * running library to the slowest
62
+ */
63
+ static async init(externalLibrary = {}) {
64
+ this.external_library = externalLibrary;
65
+ if (!this.runtime_configuration.library) {
66
+ if (await this.load_wasm_library()) {
67
+ return new Crypto();
68
+ }
69
+ if (await this.load_js_library()) {
70
+ return new Crypto();
71
+ }
72
+ throw new Error('Could not initialize an underlying library');
73
+ }
74
+ return new Crypto();
75
+ }
76
+ /**
77
+ * Forces the library to use the Javascript ASM.js underlying
78
+ * cryptographic library if it can
79
+ */
80
+ static async force_js_library() {
81
+ return this.load_js_library();
82
+ }
83
+ /**
84
+ * Forces the library to use the WASM underlying cryptographic
85
+ * library if it can
86
+ */
87
+ static async force_wasm_library() {
88
+ return this.load_wasm_library();
89
+ }
90
+ /**
91
+ * Attempts to load a script from a URL
92
+ *
93
+ * @param url
94
+ * @private
95
+ */
96
+ static async load(url) {
97
+ if (!await Crypto.url_exists(url)) {
98
+ return false;
99
+ }
100
+ return new Promise((resolve, reject) => {
101
+ const elem = document.createElement('script');
102
+ elem.src = url;
103
+ elem.defer = true;
104
+ elem.async = false;
105
+ elem.crossOrigin = 'anonymous';
106
+ elem.referrerPolicy = 'no-referrer';
107
+ elem.addEventListener('load', () => resolve(true));
108
+ elem.addEventListener('error', () => function (event) {
109
+ return reject(new Error(event.message));
110
+ });
111
+ document.head.appendChild(elem);
112
+ });
113
+ }
114
+ /**
115
+ * Attempts to initialize the underlying cryptographic library from an url
116
+ *
117
+ * @param url
118
+ * @param type
119
+ * @private
120
+ */
121
+ static async load_library(url, type) {
122
+ if (!await this.load(url)) {
123
+ return false;
124
+ }
125
+ if (!window.CryptoModule) {
126
+ return false;
127
+ }
128
+ const module = await (new window.CryptoModule());
129
+ if (Object.getOwnPropertyNames(module).length === 0 || typeof module.sha3 === 'undefined') {
130
+ return false;
131
+ }
132
+ types_1.CryptoModule.runtime_configuration = {
133
+ type,
134
+ library: module
135
+ };
136
+ return true;
137
+ }
138
+ /**
139
+ * Attempts to load the Javascript ASM.js module as the underlying
140
+ * cryptographic library
141
+ *
142
+ * @private
143
+ */
144
+ static async load_js_library() {
145
+ if (await this.load_library(`https://cdn.jsdelivr.net/npm/@gibme/crypto@${version_1.version}/dist/crypto-module.js`, types_1.LibraryType.JS)) {
146
+ return true;
147
+ }
148
+ // this is a fallback
149
+ return this.load_library('https://testmodule.pages.dev/crypto-module.js', types_1.LibraryType.JS);
150
+ }
151
+ /**
152
+ * Attempts to load the WASM module as the underlying cryptographic
153
+ * library
154
+ *
155
+ * @private
156
+ */
157
+ static async load_wasm_library() {
158
+ if (await this.load_library(`https://cdn.jsdelivr.net/npm/@gibme/crypto@${version_1.version}/dist/crypto-module-wasm.js`, types_1.LibraryType.WASM)) {
159
+ return true;
160
+ }
161
+ // this is a fallback
162
+ return this.load_library('https://testmodule.pages.dev/crypto-module-wasm.js', types_1.LibraryType.WASM);
163
+ }
164
+ /**
165
+ * Checks if the URL exists
166
+ *
167
+ * @param url
168
+ * @private
169
+ */
170
+ static async url_exists(url) {
171
+ const response = await fetch(url, { method: 'HEAD' });
172
+ return response.ok;
173
+ }
174
+ }
175
+ exports.default = Crypto;
176
+ exports.Crypto = Crypto;
177
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.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,uCAAwE;AACxE,uCAAoC;AACpC,8CAA4B;AAQ5B,MAAqB,MAAO,SAAQ,oBAAY;IAC5C;;;;;;OAMG;IACH,kDAAkD;IAClD;QACI,KAAK,EAAE,CAAC;IACZ,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAE,kBAA2C,EAAE;QACnE,IAAI,CAAC,gBAAgB,GAAG,eAAe,CAAC;QAExC,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC,OAAO,EAAE,CAAC;YACtC,IAAI,MAAM,IAAI,CAAC,iBAAiB,EAAE,EAAE,CAAC;gBACjC,OAAO,IAAI,MAAM,EAAE,CAAC;YACxB,CAAC;YAED,IAAI,MAAM,IAAI,CAAC,eAAe,EAAE,EAAE,CAAC;gBAC/B,OAAO,IAAI,MAAM,EAAE,CAAC;YACxB,CAAC;YAED,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;QAClE,CAAC;QAED,OAAO,IAAI,MAAM,EAAE,CAAC;IACxB,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,K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CAAC,CAAC;QAEtD,OAAO,QAAQ,CAAC,EAAE,CAAC;IACvB,CAAC;CACJ;AAzJD,yBAyJC;AAEQ,wBAAM"}
@@ -0,0 +1 @@
1
+ export declare const version = "7.0.2";
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.version = void 0;
4
+ // this file is updated via the package prepare script
5
+ exports.version = '7.0.2';
6
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../../src/version.ts"],"names":[],"mappings":";;;AAAA,sDAAsD;AACzC,QAAA,OAAO,GAAG,OAAO,CAAC"}
@@ -0,0 +1,43 @@
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;
@@ -0,0 +1,123 @@
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
@@ -0,0 +1 @@
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;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,mCAA8D;AAE9D;;;;;;;;;;;;;;;;;;;GAmBG;AACI,MAAM,kBAAkB,GAAG,CAC9B,KAAc,EACd,MAAkB,EAClB,aAAsB,EAChB,EAAE;IACR,MAAM,MAAM,GAA6B;QACrC,KAAK;QACL,MAAM;KACT,CAAC;IAEF,IAAI,aAAa,EAAE,CAAC;QAChB,MAAM,CAAC,aAAa,GAAG,aAAa,CAAC;IACzC,CAAC;IAED,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;AAClC,CAAC,CAAC;AAfW,QAAA,kBAAkB,sBAe7B;AAEF;;;;;GAKG;AACI,MAAM,MAAM,GAAG,CAAC,KAAa,EAAW,EAAE;IAC7C,OAAO,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACtC,CAAC,CAAC;AAFW,QAAA,MAAM,UAEjB;AAEF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