@leapdev/auth-agent 2.2.13-beta.0 → 2.2.13-beta.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/src/lib/config.js CHANGED
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.init = void 0;
4
- const lodash_1 = require("lodash");
1
+ import { forEach, has, isArray } from 'lodash';
5
2
  const DEFAULT_CONFIG = {
6
3
  autoLogin: true,
7
4
  autoLogout: true,
@@ -13,16 +10,15 @@ const DEFAULT_CONFIG = {
13
10
  initToken: null,
14
11
  };
15
12
  const requiredParams = ['authHost', 'clientId', 'scopes'];
16
- const init = (options) => {
17
- (0, lodash_1.forEach)(requiredParams, (p) => {
18
- if (!(0, lodash_1.has)(options, p)) {
13
+ export const init = (options) => {
14
+ forEach(requiredParams, (p) => {
15
+ if (!has(options, p)) {
19
16
  throw Error('Missing config parameter : ' + p);
20
17
  }
21
18
  });
22
- if (!(0, lodash_1.isArray)(options.scopes)) {
19
+ if (!isArray(options.scopes)) {
23
20
  throw Error('Scopes must be an array with string values');
24
21
  }
25
22
  const config = Object.assign(Object.assign({}, DEFAULT_CONFIG), options);
26
23
  return config;
27
24
  };
28
- exports.init = init;
@@ -1,44 +1,40 @@
1
- "use strict";
2
1
  var _IdleTimer_timeoutInMinutes, _IdleTimer_timer, _IdleTimer_onTimeout, _IdleTimer_cleanUpTracker, _IdleTimer_clearTimeout, _IdleTimer_resetTimer;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.IdleTimer = void 0;
5
- const tslib_1 = require("tslib");
6
- class IdleTimer {
2
+ import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
3
+ export class IdleTimer {
7
4
  constructor(params) {
8
5
  _IdleTimer_timeoutInMinutes.set(this, void 0);
9
6
  _IdleTimer_timer.set(this, void 0);
10
7
  _IdleTimer_onTimeout.set(this, void 0);
11
8
  this.tracker = () => {
12
- window.addEventListener('onload', tslib_1.__classPrivateFieldGet(this, _IdleTimer_resetTimer, "f"), true);
13
- window.addEventListener('mousemove', tslib_1.__classPrivateFieldGet(this, _IdleTimer_resetTimer, "f"), true);
14
- window.addEventListener('onmousedown', tslib_1.__classPrivateFieldGet(this, _IdleTimer_resetTimer, "f"), true);
15
- window.addEventListener('onscroll', tslib_1.__classPrivateFieldGet(this, _IdleTimer_resetTimer, "f"), true);
16
- window.addEventListener('onkeypress', tslib_1.__classPrivateFieldGet(this, _IdleTimer_resetTimer, "f"), true);
9
+ window.addEventListener('onload', __classPrivateFieldGet(this, _IdleTimer_resetTimer, "f"), true);
10
+ window.addEventListener('mousemove', __classPrivateFieldGet(this, _IdleTimer_resetTimer, "f"), true);
11
+ window.addEventListener('onmousedown', __classPrivateFieldGet(this, _IdleTimer_resetTimer, "f"), true);
12
+ window.addEventListener('onscroll', __classPrivateFieldGet(this, _IdleTimer_resetTimer, "f"), true);
13
+ window.addEventListener('onkeypress', __classPrivateFieldGet(this, _IdleTimer_resetTimer, "f"), true);
17
14
  };
18
15
  _IdleTimer_cleanUpTracker.set(this, () => {
19
- window.removeEventListener('onload', tslib_1.__classPrivateFieldGet(this, _IdleTimer_resetTimer, "f"), true);
20
- window.removeEventListener('mousemove', tslib_1.__classPrivateFieldGet(this, _IdleTimer_resetTimer, "f"), true);
21
- window.removeEventListener('onmousedown', tslib_1.__classPrivateFieldGet(this, _IdleTimer_resetTimer, "f"), true);
22
- window.removeEventListener('onscroll', tslib_1.__classPrivateFieldGet(this, _IdleTimer_resetTimer, "f"), true);
23
- window.removeEventListener('onkeypress', tslib_1.__classPrivateFieldGet(this, _IdleTimer_resetTimer, "f"), true);
16
+ window.removeEventListener('onload', __classPrivateFieldGet(this, _IdleTimer_resetTimer, "f"), true);
17
+ window.removeEventListener('mousemove', __classPrivateFieldGet(this, _IdleTimer_resetTimer, "f"), true);
18
+ window.removeEventListener('onmousedown', __classPrivateFieldGet(this, _IdleTimer_resetTimer, "f"), true);
19
+ window.removeEventListener('onscroll', __classPrivateFieldGet(this, _IdleTimer_resetTimer, "f"), true);
20
+ window.removeEventListener('onkeypress', __classPrivateFieldGet(this, _IdleTimer_resetTimer, "f"), true);
24
21
  });
25
22
  _IdleTimer_clearTimeout.set(this, () => {
26
- if (tslib_1.__classPrivateFieldGet(this, _IdleTimer_timer, "f")) {
27
- clearTimeout(tslib_1.__classPrivateFieldGet(this, _IdleTimer_timer, "f"));
23
+ if (__classPrivateFieldGet(this, _IdleTimer_timer, "f")) {
24
+ clearTimeout(__classPrivateFieldGet(this, _IdleTimer_timer, "f"));
28
25
  }
29
26
  });
30
27
  _IdleTimer_resetTimer.set(this, () => {
31
- tslib_1.__classPrivateFieldGet(this, _IdleTimer_clearTimeout, "f").call(this);
32
- tslib_1.__classPrivateFieldSet(this, _IdleTimer_timer, setTimeout(() => {
33
- tslib_1.__classPrivateFieldGet(this, _IdleTimer_clearTimeout, "f").call(this);
34
- tslib_1.__classPrivateFieldGet(this, _IdleTimer_cleanUpTracker, "f").call(this);
35
- tslib_1.__classPrivateFieldGet(this, _IdleTimer_onTimeout, "f").call(this);
36
- }, tslib_1.__classPrivateFieldGet(this, _IdleTimer_timeoutInMinutes, "f") * 60 * 1000), "f");
28
+ __classPrivateFieldGet(this, _IdleTimer_clearTimeout, "f").call(this);
29
+ __classPrivateFieldSet(this, _IdleTimer_timer, setTimeout(() => {
30
+ __classPrivateFieldGet(this, _IdleTimer_clearTimeout, "f").call(this);
31
+ __classPrivateFieldGet(this, _IdleTimer_cleanUpTracker, "f").call(this);
32
+ __classPrivateFieldGet(this, _IdleTimer_onTimeout, "f").call(this);
33
+ }, __classPrivateFieldGet(this, _IdleTimer_timeoutInMinutes, "f") * 60 * 1000), "f");
37
34
  });
38
35
  const { timeoutInMinutes, onTimeout: onTimeout } = params;
39
- tslib_1.__classPrivateFieldSet(this, _IdleTimer_timeoutInMinutes, timeoutInMinutes, "f");
40
- tslib_1.__classPrivateFieldSet(this, _IdleTimer_onTimeout, onTimeout, "f");
36
+ __classPrivateFieldSet(this, _IdleTimer_timeoutInMinutes, timeoutInMinutes, "f");
37
+ __classPrivateFieldSet(this, _IdleTimer_onTimeout, onTimeout, "f");
41
38
  }
42
39
  }
43
- exports.IdleTimer = IdleTimer;
44
40
  _IdleTimer_timeoutInMinutes = new WeakMap(), _IdleTimer_timer = new WeakMap(), _IdleTimer_onTimeout = new WeakMap(), _IdleTimer_cleanUpTracker = new WeakMap(), _IdleTimer_clearTimeout = new WeakMap(), _IdleTimer_resetTimer = new WeakMap();
@@ -1,57 +1,54 @@
1
- "use strict";
2
1
  var _Notification_pubnubKeys, _Notification_pubnub, _Notification_eventListeners, _Notification_uniqueSessionTriggerHook, _Notification_initFirmChannel, _Notification_initUserChannel, _Notification_initUniqueSessionChannel;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.Notification = void 0;
5
- const tslib_1 = require("tslib");
6
- const uuid_1 = require("uuid");
7
- const pubnub_1 = require("pubnub");
8
- const auth_agent_1 = require("./auth-agent");
9
- const lodash_1 = require("lodash");
2
+ import { __awaiter, __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
3
+ import { v4 as uuidv4 } from 'uuid';
4
+ import Pubnub from "pubnub";
5
+ import { AuthAgent } from './auth-agent';
6
+ import { isFunction } from 'lodash';
10
7
  const EMPTY_GUID = '00000000-0000-0000-0000-000000000000';
11
8
  const USER_ACTION = {
12
9
  USERNAME_CHANGED: '1',
13
10
  PASSWORD_CHANGED: '2',
14
11
  USER_DISABLED: '3',
15
12
  };
16
- class Notification {
13
+ export class Notification {
17
14
  constructor() {
18
15
  _Notification_pubnubKeys.set(this, void 0);
19
16
  _Notification_pubnub.set(this, void 0);
20
17
  _Notification_eventListeners.set(this, []);
21
18
  _Notification_uniqueSessionTriggerHook.set(this, undefined);
22
- this.init = (params) => tslib_1.__awaiter(this, void 0, void 0, function* () {
19
+ this.init = (params) => __awaiter(this, void 0, void 0, function* () {
23
20
  const { authHost, clientId, firmId, userId, uniqueSession, hooks } = params;
24
21
  if (!!hooks && hooks.uniqueSessionTrigger) {
25
- tslib_1.__classPrivateFieldSet(this, _Notification_uniqueSessionTriggerHook, hooks.uniqueSessionTrigger, "f");
22
+ __classPrivateFieldSet(this, _Notification_uniqueSessionTriggerHook, hooks.uniqueSessionTrigger, "f");
26
23
  }
27
24
  ;
28
- tslib_1.__classPrivateFieldGet(this, _Notification_initFirmChannel, "f").call(this, firmId, userId);
29
- tslib_1.__classPrivateFieldGet(this, _Notification_initUserChannel, "f").call(this, userId);
25
+ __classPrivateFieldGet(this, _Notification_initFirmChannel, "f").call(this, firmId, userId);
26
+ __classPrivateFieldGet(this, _Notification_initUserChannel, "f").call(this, userId);
30
27
  if (uniqueSession) {
31
- yield tslib_1.__classPrivateFieldGet(this, _Notification_initUniqueSessionChannel, "f").call(this, { authHost, clientId });
28
+ yield __classPrivateFieldGet(this, _Notification_initUniqueSessionChannel, "f").call(this, { authHost, clientId });
32
29
  }
33
30
  });
34
31
  this.destroy = () => {
35
- if (tslib_1.__classPrivateFieldGet(this, _Notification_pubnub, "f")) {
36
- tslib_1.__classPrivateFieldGet(this, _Notification_pubnub, "f").unsubscribeAll();
37
- tslib_1.__classPrivateFieldSet(this, _Notification_eventListeners, [], "f");
32
+ if (__classPrivateFieldGet(this, _Notification_pubnub, "f")) {
33
+ __classPrivateFieldGet(this, _Notification_pubnub, "f").unsubscribeAll();
34
+ __classPrivateFieldSet(this, _Notification_eventListeners, [], "f");
38
35
  }
39
36
  };
40
37
  this.registerEventListenerForUserChannel = (params) => {
41
38
  const { topic, messageType, callback } = params;
42
- if (!(0, lodash_1.isFunction)(callback)) {
39
+ if (!isFunction(callback)) {
43
40
  throw Error(`Registering Event Listener ${topic} ${messageType}: callback needs to be a function`);
44
41
  }
45
- tslib_1.__classPrivateFieldGet(this, _Notification_eventListeners, "f").push({ topic, messageType, callback });
42
+ __classPrivateFieldGet(this, _Notification_eventListeners, "f").push({ topic, messageType, callback });
46
43
  };
47
44
  this.setUniqueSessionTriggerHook = (hook) => {
48
- tslib_1.__classPrivateFieldSet(this, _Notification_uniqueSessionTriggerHook, hook, "f");
45
+ __classPrivateFieldSet(this, _Notification_uniqueSessionTriggerHook, hook, "f");
49
46
  };
50
47
  _Notification_initFirmChannel.set(this, (firmId, userId) => {
51
- tslib_1.__classPrivateFieldGet(this, _Notification_pubnub, "f").addListener({
48
+ __classPrivateFieldGet(this, _Notification_pubnub, "f").addListener({
52
49
  presence: (presenceEvent) => {
53
50
  const { action, uuid } = presenceEvent;
54
- if (uuid === tslib_1.__classPrivateFieldGet(this, _Notification_pubnubKeys, "f").uuid) {
51
+ if (uuid === __classPrivateFieldGet(this, _Notification_pubnubKeys, "f").uuid) {
55
52
  return;
56
53
  }
57
54
  if (action === 'leave' || action === 'timeout') {
@@ -65,50 +62,50 @@ class Notification {
65
62
  if (userIdFromPresence === userId &&
66
63
  instanceGuidFromPresence === EMPTY_GUID &&
67
64
  isUserActionRequiredLogout) {
68
- auth_agent_1.AuthAgent.logout(true);
65
+ AuthAgent.logout(true);
69
66
  }
70
67
  }
71
68
  },
72
69
  });
73
- tslib_1.__classPrivateFieldGet(this, _Notification_pubnub, "f").subscribe({
70
+ __classPrivateFieldGet(this, _Notification_pubnub, "f").subscribe({
74
71
  channels: [firmId],
75
72
  withPresence: true,
76
73
  });
77
74
  });
78
75
  _Notification_initUserChannel.set(this, (userId) => {
79
- tslib_1.__classPrivateFieldGet(this, _Notification_pubnub, "f").addListener({
76
+ __classPrivateFieldGet(this, _Notification_pubnub, "f").addListener({
80
77
  message: (data) => {
81
78
  const { content } = data.message;
82
79
  if (content && content.topic && content.messageType && content.data) {
83
- for (const eventListener of tslib_1.__classPrivateFieldGet(this, _Notification_eventListeners, "f")) {
80
+ for (const eventListener of __classPrivateFieldGet(this, _Notification_eventListeners, "f")) {
84
81
  if (eventListener.topic === content.topic &&
85
82
  eventListener.messageType === content.messageType &&
86
83
  eventListener.callback &&
87
- (0, lodash_1.isFunction)(eventListener.callback)) {
84
+ isFunction(eventListener.callback)) {
88
85
  return eventListener.callback(content.data);
89
86
  }
90
87
  }
91
88
  }
92
89
  },
93
90
  });
94
- tslib_1.__classPrivateFieldGet(this, _Notification_pubnub, "f").subscribe({
91
+ __classPrivateFieldGet(this, _Notification_pubnub, "f").subscribe({
95
92
  channels: [`user_${userId}`],
96
93
  withPresence: false,
97
94
  });
98
95
  });
99
- _Notification_initUniqueSessionChannel.set(this, (params) => tslib_1.__awaiter(this, void 0, void 0, function* () {
100
- const decodedToken = yield auth_agent_1.AuthAgent.getDecodedAccessToken();
96
+ _Notification_initUniqueSessionChannel.set(this, (params) => __awaiter(this, void 0, void 0, function* () {
97
+ const decodedToken = yield AuthAgent.getDecodedAccessToken();
101
98
  const { authHost: myAuthHost, clientId: myClientId } = params;
102
99
  const { userId: myUserId, sessionId: mySessionId, impersonatorId: myImpersonatorId, } = decodedToken;
103
100
  if (!decodedToken) {
104
101
  return;
105
102
  }
106
103
  const channel = `auth-session-${myUserId}`;
107
- tslib_1.__classPrivateFieldGet(this, _Notification_pubnub, "f").addListener({
108
- message: (data) => tslib_1.__awaiter(this, void 0, void 0, function* () {
109
- const decodedToken = yield auth_agent_1.AuthAgent.getDecodedAccessToken();
104
+ __classPrivateFieldGet(this, _Notification_pubnub, "f").addListener({
105
+ message: (data) => __awaiter(this, void 0, void 0, function* () {
106
+ const decodedToken = yield AuthAgent.getDecodedAccessToken();
110
107
  if (!decodedToken) {
111
- auth_agent_1.AuthAgent.logout(true);
108
+ AuthAgent.logout(true);
112
109
  }
113
110
  const { sessionId: mySessionId, impersonatorId: myImpersonatorId, userId: myUserId, } = decodedToken;
114
111
  const myAgentId = localStorage.getItem('leap-auth-agent-id');
@@ -123,11 +120,11 @@ class Notification {
123
120
  console.log('user ' + impersonatorId + ' impersonating user ' + myUserId);
124
121
  }
125
122
  else {
126
- if (!!tslib_1.__classPrivateFieldGet(this, _Notification_uniqueSessionTriggerHook, "f") && (0, lodash_1.isFunction)(tslib_1.__classPrivateFieldGet(this, _Notification_uniqueSessionTriggerHook, "f"))) {
127
- tslib_1.__classPrivateFieldGet(this, _Notification_uniqueSessionTriggerHook, "f").call(this);
123
+ if (!!__classPrivateFieldGet(this, _Notification_uniqueSessionTriggerHook, "f") && isFunction(__classPrivateFieldGet(this, _Notification_uniqueSessionTriggerHook, "f"))) {
124
+ __classPrivateFieldGet(this, _Notification_uniqueSessionTriggerHook, "f").call(this);
128
125
  }
129
126
  else {
130
- auth_agent_1.AuthAgent.logout(true);
127
+ AuthAgent.logout(true);
131
128
  }
132
129
  }
133
130
  }
@@ -135,16 +132,16 @@ class Notification {
135
132
  }
136
133
  }),
137
134
  });
138
- tslib_1.__classPrivateFieldGet(this, _Notification_pubnub, "f").subscribe({
135
+ __classPrivateFieldGet(this, _Notification_pubnub, "f").subscribe({
139
136
  channels: [channel],
140
137
  withPresence: true,
141
138
  });
142
139
  let agentId = localStorage.getItem('leap-auth-agent-id');
143
140
  if (!agentId) {
144
- agentId = (0, uuid_1.v4)();
141
+ agentId = uuidv4();
145
142
  localStorage.setItem('leap-auth-agent-id', agentId);
146
143
  }
147
- tslib_1.__classPrivateFieldGet(this, _Notification_pubnub, "f").publish({
144
+ __classPrivateFieldGet(this, _Notification_pubnub, "f").publish({
148
145
  message: {
149
146
  authHost: myAuthHost,
150
147
  clientId: myClientId,
@@ -159,13 +156,12 @@ class Notification {
159
156
  }
160
157
  });
161
158
  }));
162
- tslib_1.__classPrivateFieldSet(this, _Notification_pubnubKeys, {
159
+ __classPrivateFieldSet(this, _Notification_pubnubKeys, {
163
160
  publishKey: 'pub-13f5288e-cd88-4ef9-9e68-0c11cd03ddb8',
164
161
  subscribeKey: 'sub-a456f002-0095-11e2-9638-9581afc33ebf',
165
- uuid: (0, uuid_1.v4)(),
162
+ uuid: uuidv4(),
166
163
  }, "f");
167
- tslib_1.__classPrivateFieldSet(this, _Notification_pubnub, new pubnub_1.default(tslib_1.__classPrivateFieldGet(this, _Notification_pubnubKeys, "f")), "f");
164
+ __classPrivateFieldSet(this, _Notification_pubnub, new Pubnub(__classPrivateFieldGet(this, _Notification_pubnubKeys, "f")), "f");
168
165
  }
169
166
  }
170
- exports.Notification = Notification;
171
167
  _Notification_pubnubKeys = new WeakMap(), _Notification_pubnub = new WeakMap(), _Notification_eventListeners = new WeakMap(), _Notification_uniqueSessionTriggerHook = new WeakMap(), _Notification_initFirmChannel = new WeakMap(), _Notification_initUserChannel = new WeakMap(), _Notification_initUniqueSessionChannel = new WeakMap();
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getRedirectUri = void 0;
4
- const getRedirectUri = (origin, decodedToken, redirectionConfig) => {
1
+ export const getRedirectUri = (origin, decodedToken, redirectionConfig) => {
5
2
  let result;
6
3
  let redirection;
7
4
  let redirectUrl;
@@ -39,7 +36,6 @@ const getRedirectUri = (origin, decodedToken, redirectionConfig) => {
39
36
  }
40
37
  return result;
41
38
  };
42
- exports.getRedirectUri = getRedirectUri;
43
39
  const containsKeys = (obj1, obj2) => {
44
40
  let result = true;
45
41
  Object.keys(obj2).forEach((key) => {
package/src/lib/types.js CHANGED
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HookName = void 0;
4
- var HookName;
1
+ export var HookName;
5
2
  (function (HookName) {
6
3
  HookName["afterLogin"] = "afterLogin";
7
4
  HookName["beforeLogout"] = "beforeLogout";
8
5
  HookName["uniqueSessionTrigger"] = "uniqueSessionTrigger";
9
6
  HookName["afterRefreshToken"] = "afterRefreshToken";
10
- })(HookName = exports.HookName || (exports.HookName = {}));
7
+ })(HookName || (HookName = {}));
package/src/lib/utils.js CHANGED
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createRandomString = exports.getCrypto = exports.createCodeChallenge = exports.getQueryParameter = exports.deleteQueryParameter = void 0;
4
- const tslib_1 = require("tslib");
5
- const deleteQueryParameter = (windowLocation, name, value) => {
1
+ import { __awaiter } from "tslib";
2
+ export const deleteQueryParameter = (windowLocation, name, value) => {
6
3
  const nameValue = name + '=' + value;
7
4
  let toReplace = nameValue;
8
5
  if (windowLocation.indexOf('?' + nameValue) >= 0) {
@@ -18,16 +15,14 @@ const deleteQueryParameter = (windowLocation, name, value) => {
18
15
  }
19
16
  return windowLocation.replace(toReplace, '');
20
17
  };
21
- exports.deleteQueryParameter = deleteQueryParameter;
22
- const getQueryParameter = (name) => {
18
+ export const getQueryParameter = (name) => {
23
19
  const paramsForSearch = parseParams(window.location.search.substring(1));
24
20
  if (paramsForSearch[name]) {
25
21
  return paramsForSearch[name];
26
22
  }
27
23
  return undefined;
28
24
  };
29
- exports.getQueryParameter = getQueryParameter;
30
- const createCodeChallenge = (verifier) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
25
+ export const createCodeChallenge = (verifier) => __awaiter(void 0, void 0, void 0, function* () {
31
26
  if (getCryptoSubtle()) {
32
27
  const code_challengeBuffer = yield sha256(verifier);
33
28
  const code_challenge = bufferToBase64UrlEncoded(code_challengeBuffer);
@@ -37,20 +32,17 @@ const createCodeChallenge = (verifier) => tslib_1.__awaiter(void 0, void 0, void
37
32
  return { code_challenge: verifier, code_challenge_method: undefined };
38
33
  }
39
34
  });
40
- exports.createCodeChallenge = createCodeChallenge;
41
- const getCrypto = () => {
35
+ export const getCrypto = () => {
42
36
  return (window.crypto || window.msCrypto);
43
37
  };
44
- exports.getCrypto = getCrypto;
45
- const createRandomString = (size) => {
38
+ export const createRandomString = (size) => {
46
39
  const charset = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
47
40
  let random = '';
48
- const randomValues = Array.from((0, exports.getCrypto)().getRandomValues(new Uint8Array(size)));
41
+ const randomValues = Array.from(getCrypto().getRandomValues(new Uint8Array(size)));
49
42
  randomValues.forEach(v => (random += charset[v % charset.length]));
50
43
  return random;
51
44
  };
52
- exports.createRandomString = createRandomString;
53
- const sha256 = (s) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
45
+ const sha256 = (s) => __awaiter(void 0, void 0, void 0, function* () {
54
46
  const digestOp = getCryptoSubtle().digest({ name: 'SHA-256' }, new TextEncoder().encode(s));
55
47
  if (window.msCrypto) {
56
48
  return new Promise((res, rej) => {
@@ -68,7 +60,7 @@ const sha256 = (s) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
68
60
  return yield digestOp;
69
61
  });
70
62
  const getCryptoSubtle = () => {
71
- const crypto = (0, exports.getCrypto)();
63
+ const crypto = getCrypto();
72
64
  return crypto.subtle || crypto.webkitSubtle;
73
65
  };
74
66
  const bufferToBase64UrlEncoded = (input) => {