oidc-spa 7.1.9 → 7.2.0-rc.1
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/backend.js +235 -352
- package/backend.js.map +1 -1
- package/core/AuthResponse.js +12 -49
- package/core/AuthResponse.js.map +1 -1
- package/core/Oidc.d.ts +1 -2
- package/core/OidcInitializationError.d.ts +2 -2
- package/core/OidcInitializationError.js +230 -297
- package/core/OidcInitializationError.js.map +1 -1
- package/core/OidcMetadata.js +1 -1
- package/core/OidcMetadata.js.map +1 -1
- package/core/StateData.d.ts +5 -5
- package/core/StateData.js +25 -25
- package/core/StateData.js.map +1 -1
- package/core/configId.js +1 -1
- package/core/configId.js.map +1 -1
- package/core/createOidc.d.ts +8 -0
- package/core/createOidc.js +999 -1294
- package/core/createOidc.js.map +1 -1
- package/core/evtIsUserActive.js +26 -27
- package/core/evtIsUserActive.js.map +1 -1
- package/core/handleOidcCallback.js +99 -154
- package/core/handleOidcCallback.js.map +1 -1
- package/core/iframeMessageProtection.d.ts +1 -1
- package/core/iframeMessageProtection.js +43 -108
- package/core/iframeMessageProtection.js.map +1 -1
- package/core/index.d.ts +1 -1
- package/core/index.js +3 -3
- package/core/index.js.map +1 -1
- package/core/initialLocationHref.js +1 -1
- package/core/initialLocationHref.js.map +1 -1
- package/core/isNewBrowserSession.js +8 -8
- package/core/isNewBrowserSession.js.map +1 -1
- package/core/loginOrGoToAuthServer.d.ts +1 -1
- package/core/loginOrGoToAuthServer.js +188 -310
- package/core/loginOrGoToAuthServer.js.map +1 -1
- package/core/loginPropagationToOtherTabs.js +15 -16
- package/core/loginPropagationToOtherTabs.js.map +1 -1
- package/core/loginSilent.d.ts +2 -3
- package/core/loginSilent.js +118 -214
- package/core/loginSilent.js.map +1 -1
- package/core/logoutPropagationToOtherTabs.js +15 -16
- package/core/logoutPropagationToOtherTabs.js.map +1 -1
- package/core/oidcClientTsUserToTokens.d.ts +1 -1
- package/core/oidcClientTsUserToTokens.js +75 -72
- package/core/oidcClientTsUserToTokens.js.map +1 -1
- package/core/ongoingLoginOrRefreshProcesses.js +23 -89
- package/core/ongoingLoginOrRefreshProcesses.js.map +1 -1
- package/core/persistedAuthState.js +13 -13
- package/core/persistedAuthState.js.map +1 -1
- package/entrypoint.js +9 -9
- package/entrypoint.js.map +1 -1
- package/index.d.ts +1 -1
- package/index.js +1 -2
- package/index.js.map +1 -1
- package/keycloak/index.d.ts +3 -0
- package/keycloak/index.js +8 -0
- package/keycloak/index.js.map +1 -0
- package/keycloak/isKeycloak.d.ts +3 -0
- package/keycloak/isKeycloak.js +20 -0
- package/keycloak/isKeycloak.js.map +1 -0
- package/keycloak/keycloak-js/Keycloak.d.ts +284 -0
- package/keycloak/keycloak-js/Keycloak.js +778 -0
- package/keycloak/keycloak-js/Keycloak.js.map +1 -0
- package/keycloak/keycloak-js/index.d.ts +2 -0
- package/keycloak/keycloak-js/index.js +6 -0
- package/keycloak/keycloak-js/index.js.map +1 -0
- package/keycloak/keycloak-js/types.d.ts +361 -0
- package/keycloak/keycloak-js/types.js +3 -0
- package/keycloak/keycloak-js/types.js.map +1 -0
- package/keycloak/keycloakIssuerUriParsed.d.ts +9 -0
- package/keycloak/keycloakIssuerUriParsed.js +19 -0
- package/keycloak/keycloakIssuerUriParsed.js.map +1 -0
- package/keycloak/keycloakUtils.d.ts +37 -0
- package/keycloak/keycloakUtils.js +47 -0
- package/keycloak/keycloakUtils.js.map +1 -0
- package/keycloak-js.d.ts +1 -0
- package/keycloak-js.js +18 -0
- package/keycloak-js.js.map +1 -0
- package/mock/oidc.js +147 -194
- package/mock/oidc.js.map +1 -1
- package/mock/react.js +2 -2
- package/mock/react.js.map +1 -1
- package/package.json +38 -9
- package/react/react.js +133 -244
- package/react/react.js.map +1 -1
- package/src/core/AuthResponse.ts +2 -0
- package/src/core/Oidc.ts +1 -2
- package/src/core/OidcInitializationError.ts +30 -30
- package/src/core/OidcMetadata.ts +1 -1
- package/src/core/StateData.ts +24 -24
- package/src/core/createOidc.ts +24 -31
- package/src/core/handleOidcCallback.ts +44 -23
- package/src/core/iframeMessageProtection.ts +11 -10
- package/src/core/index.ts +1 -1
- package/src/core/loginOrGoToAuthServer.ts +1 -1
- package/src/core/loginSilent.ts +14 -11
- package/src/core/oidcClientTsUserToTokens.ts +1 -1
- package/src/index.ts +1 -7
- package/src/keycloak/index.ts +8 -0
- package/src/keycloak/isKeycloak.ts +23 -0
- package/src/keycloak/keycloak-js/Keycloak.ts +1097 -0
- package/src/keycloak/keycloak-js/index.ts +2 -0
- package/src/keycloak/keycloak-js/types.ts +442 -0
- package/src/keycloak/keycloakIssuerUriParsed.ts +29 -0
- package/src/keycloak/keycloakUtils.ts +90 -0
- package/src/keycloak-js.ts +1 -0
- package/src/react/react.tsx +17 -1
- package/src/tools/decodeJwt.ts +95 -2
- package/src/tools/parseKeycloakIssuerUri.ts +11 -30
- package/src/vendor/frontend/oidc-client-ts.ts +1 -0
- package/src/vendor/frontend/tsafe.ts +1 -0
- package/tools/Deferred.js +13 -35
- package/tools/Deferred.js.map +1 -1
- package/tools/EphemeralSessionStorage.js +46 -48
- package/tools/EphemeralSessionStorage.js.map +1 -1
- package/tools/Evt.js +14 -14
- package/tools/Evt.js.map +1 -1
- package/tools/StatefulEvt.js +5 -5
- package/tools/StatefulEvt.js.map +1 -1
- package/tools/asymmetricEncryption.js +81 -172
- package/tools/asymmetricEncryption.js.map +1 -1
- package/tools/base64.js +2 -2
- package/tools/base64.js.map +1 -1
- package/tools/createObjectThatThrowsIfAccessed.js +13 -61
- package/tools/createObjectThatThrowsIfAccessed.js.map +1 -1
- package/tools/decodeJwt.d.ts +25 -2
- package/tools/decodeJwt.js +61 -3
- package/tools/decodeJwt.js.map +1 -1
- package/tools/generateUrlSafeRandom.js +5 -30
- package/tools/generateUrlSafeRandom.js.map +1 -1
- package/tools/getDownlinkAndRtt.js +8 -30
- package/tools/getDownlinkAndRtt.js.map +1 -1
- package/tools/getIsOnline.js +3 -3
- package/tools/getIsOnline.js.map +1 -1
- package/tools/getIsValidRemoteJson.js +12 -59
- package/tools/getIsValidRemoteJson.js.map +1 -1
- package/tools/getPrUserInteraction.js +4 -4
- package/tools/getPrUserInteraction.js.map +1 -1
- package/tools/getUserEnvironmentInfo.js +17 -12
- package/tools/getUserEnvironmentInfo.js.map +1 -1
- package/tools/haveSharedParentDomain.js +5 -5
- package/tools/haveSharedParentDomain.js.map +1 -1
- package/tools/isDev.js +2 -2
- package/tools/isDev.js.map +1 -1
- package/tools/parseKeycloakIssuerUri.d.ts +2 -0
- package/tools/parseKeycloakIssuerUri.js +11 -42
- package/tools/parseKeycloakIssuerUri.js.map +1 -1
- package/tools/readExpirationTimeInJwt.js +4 -4
- package/tools/readExpirationTimeInJwt.js.map +1 -1
- package/tools/startCountdown.js +17 -65
- package/tools/startCountdown.js.map +1 -1
- package/tools/subscribeToUserInteraction.js +17 -66
- package/tools/subscribeToUserInteraction.js.map +1 -1
- package/tools/toFullyQualifiedUrl.js +7 -7
- package/tools/toFullyQualifiedUrl.js.map +1 -1
- package/tools/toHumanReadableDuration.js +13 -13
- package/tools/toHumanReadableDuration.js.map +1 -1
- package/tools/urlSearchParams.js +28 -50
- package/tools/urlSearchParams.js.map +1 -1
- package/tools/workerTimers.js +10 -10
- package/tools/workerTimers.js.map +1 -1
- package/vendor/frontend/oidc-client-ts.d.ts +1 -0
- package/vendor/frontend/oidc-client-ts.js +3686 -0
- package/vendor/frontend/tsafe.d.ts +1 -0
- package/vendor/frontend/tsafe.js +1 -1
- package/core/trustedFetch.d.ts +0 -2
- package/core/trustedFetch.js +0 -12
- package/core/trustedFetch.js.map +0 -1
- package/src/core/trustedFetch.ts +0 -9
- package/src/vendor/frontend/oidc-client-ts-and-jwt-decode.ts +0 -4
- package/vendor/frontend/oidc-client-ts-and-jwt-decode.d.ts +0 -3
- package/vendor/frontend/oidc-client-ts-and-jwt-decode.js +0 -3
|
@@ -1,181 +1,90 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
3
|
exports.generateKeys = generateKeys;
|
|
40
4
|
exports.asymmetricEncrypt = asymmetricEncrypt;
|
|
41
5
|
exports.asymmetricDecrypt = asymmetricDecrypt;
|
|
42
|
-
|
|
43
|
-
function generateKeys() {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return [4 /*yield*/, crypto.subtle.exportKey("jwk", keyPair.publicKey)];
|
|
55
|
-
case 2:
|
|
56
|
-
publicKeyRaw = _a.sent();
|
|
57
|
-
return [4 /*yield*/, crypto.subtle.exportKey("jwk", keyPair.privateKey)];
|
|
58
|
-
case 3:
|
|
59
|
-
privateKeyRaw = _a.sent();
|
|
60
|
-
return [2 /*return*/, {
|
|
61
|
-
publicKey: btoa(JSON.stringify(publicKeyRaw)),
|
|
62
|
-
privateKey: btoa(JSON.stringify(privateKeyRaw))
|
|
63
|
-
}];
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
});
|
|
6
|
+
const INFO_LABEL = "oidc-spa/tools/asymmetricEncryption";
|
|
7
|
+
async function generateKeys() {
|
|
8
|
+
const keyPair = await crypto.subtle.generateKey({
|
|
9
|
+
name: "ECDH",
|
|
10
|
+
namedCurve: "P-256"
|
|
11
|
+
}, true, ["deriveKey", "deriveBits"]);
|
|
12
|
+
const publicKeyRaw = await crypto.subtle.exportKey("jwk", keyPair.publicKey);
|
|
13
|
+
const privateKeyRaw = await crypto.subtle.exportKey("jwk", keyPair.privateKey);
|
|
14
|
+
return {
|
|
15
|
+
publicKey: btoa(JSON.stringify(publicKeyRaw)),
|
|
16
|
+
privateKey: btoa(JSON.stringify(privateKeyRaw))
|
|
17
|
+
};
|
|
67
18
|
}
|
|
68
|
-
function asymmetricEncrypt(params) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
encodedMessage = new TextEncoder().encode(message);
|
|
108
|
-
return [4 /*yield*/, crypto.subtle.encrypt({
|
|
109
|
-
name: "AES-GCM",
|
|
110
|
-
iv: iv
|
|
111
|
-
}, derivedKey, encodedMessage)];
|
|
112
|
-
case 6:
|
|
113
|
-
ciphertext = _a.sent();
|
|
114
|
-
return [4 /*yield*/, crypto.subtle.exportKey("jwk", ephemeralKeyPair.publicKey)];
|
|
115
|
-
case 7:
|
|
116
|
-
ephemeralPubKeyRaw = _a.sent();
|
|
117
|
-
payload = {
|
|
118
|
-
ephemeralPubKey: ephemeralPubKeyRaw,
|
|
119
|
-
iv: Array.from(iv),
|
|
120
|
-
salt: Array.from(salt),
|
|
121
|
-
ciphertext: Array.from(new Uint8Array(ciphertext))
|
|
122
|
-
};
|
|
123
|
-
return [2 /*return*/, {
|
|
124
|
-
encryptedMessage: btoa(JSON.stringify(payload))
|
|
125
|
-
}];
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
});
|
|
19
|
+
async function asymmetricEncrypt(params) {
|
|
20
|
+
const { publicKey, message } = params;
|
|
21
|
+
const importedPublicKey = await crypto.subtle.importKey("jwk", JSON.parse(atob(publicKey)), {
|
|
22
|
+
name: "ECDH",
|
|
23
|
+
namedCurve: "P-256"
|
|
24
|
+
}, false, []);
|
|
25
|
+
const ephemeralKeyPair = await crypto.subtle.generateKey({
|
|
26
|
+
name: "ECDH",
|
|
27
|
+
namedCurve: "P-256"
|
|
28
|
+
}, true, ["deriveKey", "deriveBits"]);
|
|
29
|
+
const sharedSecret = await crypto.subtle.deriveBits({
|
|
30
|
+
name: "ECDH",
|
|
31
|
+
public: importedPublicKey
|
|
32
|
+
}, ephemeralKeyPair.privateKey, 256);
|
|
33
|
+
const salt = crypto.getRandomValues(new Uint8Array(16));
|
|
34
|
+
const infoBytes = new TextEncoder().encode(INFO_LABEL);
|
|
35
|
+
const hkdfKey = await crypto.subtle.importKey("raw", sharedSecret, "HKDF", false, ["deriveKey"]);
|
|
36
|
+
const derivedKey = await crypto.subtle.deriveKey({
|
|
37
|
+
name: "HKDF",
|
|
38
|
+
hash: "SHA-256",
|
|
39
|
+
salt,
|
|
40
|
+
info: infoBytes
|
|
41
|
+
}, hkdfKey, { name: "AES-GCM", length: 256 }, false, ["encrypt"]);
|
|
42
|
+
const iv = crypto.getRandomValues(new Uint8Array(12));
|
|
43
|
+
const encodedMessage = new TextEncoder().encode(message);
|
|
44
|
+
const ciphertext = await crypto.subtle.encrypt({
|
|
45
|
+
name: "AES-GCM",
|
|
46
|
+
iv
|
|
47
|
+
}, derivedKey, encodedMessage);
|
|
48
|
+
const ephemeralPubKeyRaw = await crypto.subtle.exportKey("jwk", ephemeralKeyPair.publicKey);
|
|
49
|
+
const payload = {
|
|
50
|
+
ephemeralPubKey: ephemeralPubKeyRaw,
|
|
51
|
+
iv: Array.from(iv),
|
|
52
|
+
salt: Array.from(salt),
|
|
53
|
+
ciphertext: Array.from(new Uint8Array(ciphertext))
|
|
54
|
+
};
|
|
55
|
+
return {
|
|
56
|
+
encryptedMessage: btoa(JSON.stringify(payload))
|
|
57
|
+
};
|
|
129
58
|
}
|
|
130
|
-
function asymmetricDecrypt(params) {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
return [4 /*yield*/, crypto.subtle.deriveKey({
|
|
161
|
-
name: "HKDF",
|
|
162
|
-
hash: "SHA-256",
|
|
163
|
-
salt: new Uint8Array(salt),
|
|
164
|
-
info: infoBytes
|
|
165
|
-
}, hkdfKey, { name: "AES-GCM", length: 256 }, false, ["decrypt"])];
|
|
166
|
-
case 5:
|
|
167
|
-
derivedKey = _b.sent();
|
|
168
|
-
return [4 /*yield*/, crypto.subtle.decrypt({
|
|
169
|
-
name: "AES-GCM",
|
|
170
|
-
iv: new Uint8Array(iv)
|
|
171
|
-
}, derivedKey, new Uint8Array(ciphertext))];
|
|
172
|
-
case 6:
|
|
173
|
-
decryptedBuffer = _b.sent();
|
|
174
|
-
return [2 /*return*/, {
|
|
175
|
-
message: new TextDecoder().decode(decryptedBuffer)
|
|
176
|
-
}];
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
});
|
|
59
|
+
async function asymmetricDecrypt(params) {
|
|
60
|
+
const { privateKey, encryptedMessage } = params;
|
|
61
|
+
const { ephemeralPubKey, iv, salt, ciphertext } = JSON.parse(atob(encryptedMessage));
|
|
62
|
+
const importedPrivateKey = await crypto.subtle.importKey("jwk", JSON.parse(atob(privateKey)), {
|
|
63
|
+
name: "ECDH",
|
|
64
|
+
namedCurve: "P-256"
|
|
65
|
+
}, false, ["deriveKey", "deriveBits"]);
|
|
66
|
+
const importedEphemeralPubKey = await crypto.subtle.importKey("jwk", ephemeralPubKey, {
|
|
67
|
+
name: "ECDH",
|
|
68
|
+
namedCurve: "P-256"
|
|
69
|
+
}, false, []);
|
|
70
|
+
const sharedSecret = await crypto.subtle.deriveBits({
|
|
71
|
+
name: "ECDH",
|
|
72
|
+
public: importedEphemeralPubKey
|
|
73
|
+
}, importedPrivateKey, 256);
|
|
74
|
+
const infoBytes = new TextEncoder().encode(INFO_LABEL);
|
|
75
|
+
const hkdfKey = await crypto.subtle.importKey("raw", sharedSecret, "HKDF", false, ["deriveKey"]);
|
|
76
|
+
const derivedKey = await crypto.subtle.deriveKey({
|
|
77
|
+
name: "HKDF",
|
|
78
|
+
hash: "SHA-256",
|
|
79
|
+
salt: new Uint8Array(salt),
|
|
80
|
+
info: infoBytes
|
|
81
|
+
}, hkdfKey, { name: "AES-GCM", length: 256 }, false, ["decrypt"]);
|
|
82
|
+
const decryptedBuffer = await crypto.subtle.decrypt({
|
|
83
|
+
name: "AES-GCM",
|
|
84
|
+
iv: new Uint8Array(iv)
|
|
85
|
+
}, derivedKey, new Uint8Array(ciphertext));
|
|
86
|
+
return {
|
|
87
|
+
message: new TextDecoder().decode(decryptedBuffer)
|
|
88
|
+
};
|
|
180
89
|
}
|
|
181
90
|
//# sourceMappingURL=asymmetricEncryption.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asymmetricEncryption.js","sourceRoot":"","sources":["../src/tools/asymmetricEncryption.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"asymmetricEncryption.js","sourceRoot":"","sources":["../src/tools/asymmetricEncryption.ts"],"names":[],"mappings":";;AAOA,oCAiBC;AAED,8CA6EC;AAED,8CA8EC;AAlLD,MAAM,UAAU,GAAG,qCAAqC,CAAC;AAElD,KAAK,UAAU,YAAY;IAC9B,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,WAAW,CAC3C;QACI,IAAI,EAAE,MAAM;QACZ,UAAU,EAAE,OAAO;KACtB,EACD,IAAI,EACJ,CAAC,WAAW,EAAE,YAAY,CAAC,CAC9B,CAAC;IAEF,MAAM,YAAY,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC7E,MAAM,aAAa,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAE/E,OAAO;QACH,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;QAC7C,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;KAClD,CAAC;AACN,CAAC;AAEM,KAAK,UAAU,iBAAiB,CAAC,MAGvC;IACG,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IAEtC,MAAM,iBAAiB,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,SAAS,CACnD,KAAK,EACL,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAC3B;QACI,IAAI,EAAE,MAAM;QACZ,UAAU,EAAE,OAAO;KACtB,EACD,KAAK,EACL,EAAE,CACL,CAAC;IAEF,MAAM,gBAAgB,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,WAAW,CACp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,CACN,CAAC;IAEF,MAAM,SAAS,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAEvD,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAEjG,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,SAAS,CAC5C;QACI,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,IAAI,UAAU,CAAC,IAAI,CAAC;QAC1B,IAAI,EAAE,SAAS;KAClB,EACD,OAAO,EACP,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,EAChC,KAAK,EACL,CAAC,SAAS,CAAC,CACd,CAAC;IAEF,MAAM,eAAe,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,OAAO,CAC/C;QACI,IAAI,EAAE,SAAS;QACf,EAAE,EAAE,IAAI,UAAU,CAAC,EAAE,CAAC;KACzB,EACD,UAAU,EACV,IAAI,UAAU,CAAC,UAAU,CAAC,CAC7B,CAAC;IAEF,OAAO;QACH,OAAO,EAAE,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,eAAe,CAAC;KACrD,CAAC;AACN,CAAC"}
|
package/tools/base64.js
CHANGED
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.decodeBase64 = decodeBase64;
|
|
4
4
|
exports.encodeBase64 = encodeBase64;
|
|
5
5
|
function decodeBase64(encoded) {
|
|
6
|
-
return new TextDecoder().decode(Uint8Array.from(atob(encoded),
|
|
6
|
+
return new TextDecoder().decode(Uint8Array.from(atob(encoded), c => c.charCodeAt(0)));
|
|
7
7
|
}
|
|
8
8
|
function encodeBase64(decoded) {
|
|
9
|
-
return btoa(new TextEncoder().encode(decoded).reduce(
|
|
9
|
+
return btoa(new TextEncoder().encode(decoded).reduce((acc, c) => acc + String.fromCharCode(c), ""));
|
|
10
10
|
}
|
|
11
11
|
//# sourceMappingURL=base64.js.map
|
package/tools/base64.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base64.js","sourceRoot":"","sources":["../src/tools/base64.ts"],"names":[],"mappings":";;AAAA,oCAEC;AAED,oCAEC;AAND,SAAgB,YAAY,CAAC,OAAe;IACxC,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"base64.js","sourceRoot":"","sources":["../src/tools/base64.ts"],"names":[],"mappings":";;AAAA,oCAEC;AAED,oCAEC;AAND,SAAgB,YAAY,CAAC,OAAe;IACxC,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1F,CAAC;AAED,SAAgB,YAAY,CAAC,OAAe;IACxC,OAAO,IAAI,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AACxG,CAAC"}
|
|
@@ -1,78 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
18
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
19
|
-
if (!m) return o;
|
|
20
|
-
var i = m.call(o), r, ar = [], e;
|
|
21
|
-
try {
|
|
22
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
23
|
-
}
|
|
24
|
-
catch (error) { e = { error: error }; }
|
|
25
|
-
finally {
|
|
26
|
-
try {
|
|
27
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
28
|
-
}
|
|
29
|
-
finally { if (e) throw e.error; }
|
|
30
|
-
}
|
|
31
|
-
return ar;
|
|
32
|
-
};
|
|
33
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
34
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
35
|
-
if (ar || !(i in from)) {
|
|
36
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
37
|
-
ar[i] = from[i];
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
41
|
-
};
|
|
42
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
3
|
exports.AccessError = void 0;
|
|
44
4
|
exports.createObjectThatThrowsIfAccessed = createObjectThatThrowsIfAccessed;
|
|
45
5
|
exports.isObjectThatThrowIfAccessed = isObjectThatThrowIfAccessed;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
var _this = _super.call(this, message) || this;
|
|
52
|
-
Object.setPrototypeOf(_this, _newTarget.prototype);
|
|
53
|
-
return _this;
|
|
6
|
+
const keyIsTrapped = "isTrapped_zSskDe9d";
|
|
7
|
+
class AccessError extends Error {
|
|
8
|
+
constructor(message) {
|
|
9
|
+
super(message);
|
|
10
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
54
11
|
}
|
|
55
|
-
|
|
56
|
-
}(Error));
|
|
12
|
+
}
|
|
57
13
|
exports.AccessError = AccessError;
|
|
58
14
|
function createObjectThatThrowsIfAccessed(params) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
63
|
-
args[_i] = arguments[_i];
|
|
64
|
-
}
|
|
65
|
-
var _a = __read(args, 2), prop = _a[1];
|
|
15
|
+
const { debugMessage = "", isPropertyWhitelisted = () => false } = params ?? {};
|
|
16
|
+
const get = (...args) => {
|
|
17
|
+
const [, prop] = args;
|
|
66
18
|
if (isPropertyWhitelisted(prop)) {
|
|
67
|
-
return Reflect.get
|
|
19
|
+
return Reflect.get(...args);
|
|
68
20
|
}
|
|
69
21
|
if (prop === keyIsTrapped) {
|
|
70
22
|
return true;
|
|
71
23
|
}
|
|
72
|
-
throw new AccessError(
|
|
24
|
+
throw new AccessError(`Cannot access ${String(prop)} yet ${debugMessage}`);
|
|
73
25
|
};
|
|
74
|
-
|
|
75
|
-
get
|
|
26
|
+
const trappedObject = new Proxy({}, {
|
|
27
|
+
get,
|
|
76
28
|
set: get
|
|
77
29
|
});
|
|
78
30
|
return trappedObject;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createObjectThatThrowsIfAccessed.js","sourceRoot":"","sources":["../src/tools/createObjectThatThrowsIfAccessed.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createObjectThatThrowsIfAccessed.js","sourceRoot":"","sources":["../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ecodeOptions {
|
|
2
|
+
header?: boolean;
|
|
3
|
+
}
|
|
4
|
+
export interface JwtHeader {
|
|
5
|
+
typ?: string;
|
|
6
|
+
alg?: string;
|
|
7
|
+
kid?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface JwtPayload {
|
|
10
|
+
iss?: string;
|
|
11
|
+
sub?: string;
|
|
12
|
+
aud?: string[] | string;
|
|
13
|
+
exp?: number;
|
|
14
|
+
nbf?: number;
|
|
15
|
+
iat?: number;
|
|
16
|
+
jti?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare class InvalidTokenError extends Error {
|
|
19
|
+
}
|
|
20
|
+
declare function jwtDecode<T = JwtHeader>(token: string, options: JwtDecodeOptions & {
|
|
21
|
+
header: true;
|
|
22
|
+
}): T;
|
|
23
|
+
declare function jwtDecode<T = JwtPayload>(token: string, options?: JwtDecodeOptions): T;
|
|
24
|
+
export declare const decodeJwt: typeof jwtDecode;
|
|
25
|
+
export {};
|
package/tools/decodeJwt.js
CHANGED
|
@@ -1,6 +1,64 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// Copy pasted jwt-decode v4.0.0
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.decodeJwt = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
exports.decodeJwt = exports.InvalidTokenError = void 0;
|
|
5
|
+
class InvalidTokenError extends Error {
|
|
6
|
+
}
|
|
7
|
+
exports.InvalidTokenError = InvalidTokenError;
|
|
8
|
+
InvalidTokenError.prototype.name = "InvalidTokenError";
|
|
9
|
+
function b64DecodeUnicode(str) {
|
|
10
|
+
return decodeURIComponent(atob(str).replace(/(.)/g, (_m, p) => {
|
|
11
|
+
let code = p.charCodeAt(0).toString(16).toUpperCase();
|
|
12
|
+
if (code.length < 2) {
|
|
13
|
+
code = "0" + code;
|
|
14
|
+
}
|
|
15
|
+
return "%" + code;
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
function base64UrlDecode(str) {
|
|
19
|
+
let output = str.replace(/-/g, "+").replace(/_/g, "/");
|
|
20
|
+
switch (output.length % 4) {
|
|
21
|
+
case 0:
|
|
22
|
+
break;
|
|
23
|
+
case 2:
|
|
24
|
+
output += "==";
|
|
25
|
+
break;
|
|
26
|
+
case 3:
|
|
27
|
+
output += "=";
|
|
28
|
+
break;
|
|
29
|
+
default:
|
|
30
|
+
throw new Error("base64 string is not of the correct length");
|
|
31
|
+
}
|
|
32
|
+
try {
|
|
33
|
+
return b64DecodeUnicode(output);
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
return atob(output);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function jwtDecode(token, options) {
|
|
40
|
+
if (typeof token !== "string") {
|
|
41
|
+
throw new InvalidTokenError("Invalid token specified: must be a string");
|
|
42
|
+
}
|
|
43
|
+
options || (options = {});
|
|
44
|
+
const pos = options.header === true ? 0 : 1;
|
|
45
|
+
const part = token.split(".")[pos];
|
|
46
|
+
if (typeof part !== "string") {
|
|
47
|
+
throw new InvalidTokenError(`Invalid token specified: missing part #${pos + 1}`);
|
|
48
|
+
}
|
|
49
|
+
let decoded;
|
|
50
|
+
try {
|
|
51
|
+
decoded = base64UrlDecode(part);
|
|
52
|
+
}
|
|
53
|
+
catch (e) {
|
|
54
|
+
throw new InvalidTokenError(`Invalid token specified: invalid base64 for part #${pos + 1} (${e.message})`);
|
|
55
|
+
}
|
|
56
|
+
try {
|
|
57
|
+
return JSON.parse(decoded);
|
|
58
|
+
}
|
|
59
|
+
catch (e) {
|
|
60
|
+
throw new InvalidTokenError(`Invalid token specified: invalid json for part #${pos + 1} (${e.message})`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.decodeJwt = jwtDecode;
|
|
6
64
|
//# sourceMappingURL=decodeJwt.js.map
|
package/tools/decodeJwt.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decodeJwt.js","sourceRoot":"","sources":["../src/tools/decodeJwt.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"decodeJwt.js","sourceRoot":"","sources":["../src/tools/decodeJwt.ts"],"names":[],"mappings":";AAAA,gCAAgC;;;AAsBhC,MAAa,iBAAkB,SAAQ,KAAK;CAAG;AAA/C,8CAA+C;AAE/C,iBAAiB,CAAC,SAAS,CAAC,IAAI,GAAG,mBAAmB,CAAC;AAEvD,SAAS,gBAAgB,CAAC,GAAW;IACjC,OAAO,kBAAkB,CACrB,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE;QAChC,IAAI,IAAI,GAAI,CAAY,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;QAClE,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAClB,IAAI,GAAG,GAAG,GAAG,IAAI,CAAC;QACtB,CAAC;QACD,OAAO,GAAG,GAAG,IAAI,CAAC;IACtB,CAAC,CAAC,CACL,CAAC;AACN,CAAC;AAED,SAAS,eAAe,CAAC,GAAW;IAChC,IAAI,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACvD,QAAQ,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,KAAK,CAAC;YACF,MAAM;QACV,KAAK,CAAC;YACF,MAAM,IAAI,IAAI,CAAC;YACf,MAAM;QACV,KAAK,CAAC;YACF,MAAM,IAAI,GAAG,CAAC;YACd,MAAM;QACV;YACI,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IACtE,CAAC;IAED,IAAI,CAAC;QACD,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACX,OAAO,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|
4
|
-
if (!m) return o;
|
|
5
|
-
var i = m.call(o), r, ar = [], e;
|
|
6
|
-
try {
|
|
7
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
8
|
-
}
|
|
9
|
-
catch (error) { e = { error: error }; }
|
|
10
|
-
finally {
|
|
11
|
-
try {
|
|
12
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
13
|
-
}
|
|
14
|
-
finally { if (e) throw e.error; }
|
|
15
|
-
}
|
|
16
|
-
return ar;
|
|
17
|
-
};
|
|
18
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
19
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
20
|
-
if (ar || !(i in from)) {
|
|
21
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
22
|
-
ar[i] = from[i];
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
26
|
-
};
|
|
27
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
3
|
exports.generateUrlSafeRandom = generateUrlSafeRandom;
|
|
29
4
|
function generateUrlSafeRandom(params) {
|
|
30
|
-
|
|
5
|
+
const { length } = params;
|
|
31
6
|
// Compute required byte length before encoding
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
7
|
+
const byteLength = Math.ceil((length * 3) / 4);
|
|
8
|
+
const crypto = window.crypto || window.msCrypto;
|
|
9
|
+
const array = new Uint8Array(byteLength);
|
|
35
10
|
crypto.getRandomValues(array);
|
|
36
11
|
// Encode and apply Base64URL transformations
|
|
37
|
-
|
|
12
|
+
let base64url = btoa(String.fromCharCode(...array))
|
|
38
13
|
.replace(/\+/g, "-") // Base64URL encoding
|
|
39
14
|
.replace(/\//g, "_")
|
|
40
15
|
.replace(/=+$/, ""); // Remove padding
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateUrlSafeRandom.js","sourceRoot":"","sources":["../src/tools/generateUrlSafeRandom.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generateUrlSafeRandom.js","sourceRoot":"","sources":["../src/tools/generateUrlSafeRandom.ts"],"names":[],"mappings":";;AAAA,sDAyBC;AAzBD,SAAgB,qBAAqB,CAAC,MAA0B;IAC5D,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAE1B,+CAA+C;IAC/C,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAE/C,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAK,MAAc,CAAC,QAAQ,CAAC;IACzD,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC;IACzC,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IAE9B,6CAA6C;IAC7C,IAAI,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,GAAG,KAAK,CAAC,CAAC;SAC9C,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,qBAAqB;SACzC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;SACnB,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,iBAAiB;IAE1C,kCAAkC;IAClC,IAAI,SAAS,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC;QAC5B,OAAO,SAAS,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IAC1C,CAAC;SAAM,IAAI,SAAS,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC;QACnC,0DAA0D;QAC1D,OAAO,SAAS,GAAG,qBAAqB,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC;IACpF,CAAC;IAED,OAAO,SAAS,CAAC;AACrB,CAAC"}
|
|
@@ -1,42 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __values = (this && this.__values) || function(o) {
|
|
3
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
4
|
-
if (m) return m.call(o);
|
|
5
|
-
if (o && typeof o.length === "number") return {
|
|
6
|
-
next: function () {
|
|
7
|
-
if (o && i >= o.length) o = void 0;
|
|
8
|
-
return { value: o && o[i++], done: !o };
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
12
|
-
};
|
|
13
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.getDownlinkAndRtt = getDownlinkAndRtt;
|
|
15
|
-
|
|
4
|
+
const tsafe_1 = require("../vendor/frontend/tsafe");
|
|
16
5
|
function getDownlinkAndRtt() {
|
|
17
|
-
var e_1, _a;
|
|
18
6
|
if (!(window.navigator instanceof Object)) {
|
|
19
7
|
return undefined;
|
|
20
8
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
for (var _b = __values(["connection", "mozConnection", "webkitConnection"]), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
24
|
-
var key = _c.value;
|
|
25
|
-
try {
|
|
26
|
-
var _d = navigator[key], downlink = _d.downlink, rtt = _d.rtt;
|
|
27
|
-
(0, tsafe_1.assert)(typeof downlink === "number", "768860");
|
|
28
|
-
(0, tsafe_1.assert)(typeof rtt === "number", "945829");
|
|
29
|
-
return { downlink: downlink, rtt: rtt };
|
|
30
|
-
}
|
|
31
|
-
catch (_e) { }
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
35
|
-
finally {
|
|
9
|
+
const navigator = window.navigator;
|
|
10
|
+
for (const key of ["connection", "mozConnection", "webkitConnection"]) {
|
|
36
11
|
try {
|
|
37
|
-
|
|
12
|
+
const { downlink, rtt } = navigator[key];
|
|
13
|
+
(0, tsafe_1.assert)(typeof downlink === "number", "768860");
|
|
14
|
+
(0, tsafe_1.assert)(typeof rtt === "number", "945829");
|
|
15
|
+
return { downlink, rtt };
|
|
38
16
|
}
|
|
39
|
-
|
|
17
|
+
catch { }
|
|
40
18
|
}
|
|
41
19
|
return undefined;
|
|
42
20
|
}
|