isa-auth 0.0.0-stage → 0.2.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.
- package/.agents/skills/isa-auth-guide/SKILL.md +154 -0
- package/LICENSE +21 -0
- package/README.md +295 -2
- package/dist/index.d.mts +1838 -0
- package/dist/index.d.ts +1838 -0
- package/dist/index.js +4449 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +4446 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +74 -4
- package/skills/isa-auth-guide/SKILL.md +167 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,4449 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
8
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
|
+
};
|
|
10
|
+
var __export = (target, all) => {
|
|
11
|
+
for (var name in all)
|
|
12
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
13
|
+
};
|
|
14
|
+
var __copyProps = (to, from, except, desc) => {
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from))
|
|
17
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
18
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
28
|
+
mod
|
|
29
|
+
));
|
|
30
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
31
|
+
|
|
32
|
+
// ../core/dist/console/error.js
|
|
33
|
+
var require_error = __commonJS({
|
|
34
|
+
"../core/dist/console/error.js"(exports2) {
|
|
35
|
+
"use strict";
|
|
36
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
37
|
+
function _export(target, all) {
|
|
38
|
+
for (var name in all) Object.defineProperty(target, name, { enumerable: true, get: Object.getOwnPropertyDescriptor(all, name).get });
|
|
39
|
+
}
|
|
40
|
+
_export(exports2, { get authError() {
|
|
41
|
+
return authError;
|
|
42
|
+
}, get storeError() {
|
|
43
|
+
return storeError;
|
|
44
|
+
} });
|
|
45
|
+
function storeError(type, id) {
|
|
46
|
+
const _error = (msg) => error(`(store)::${msg}`);
|
|
47
|
+
switch (type) {
|
|
48
|
+
case "require":
|
|
49
|
+
return _error(`require ${id}.`);
|
|
50
|
+
case "wrong":
|
|
51
|
+
return _error(`wrong ${id}.`);
|
|
52
|
+
default:
|
|
53
|
+
return _error(`test ${id}.`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function error(msg) {
|
|
57
|
+
console.error(`**ISA-Auth(err)::${msg}`);
|
|
58
|
+
}
|
|
59
|
+
function authError(type, id) {
|
|
60
|
+
const _error = (msg) => error(`(auth)::${msg}`);
|
|
61
|
+
switch (type) {
|
|
62
|
+
case "unauthorized":
|
|
63
|
+
return _error(`unauthorized ${id}.`);
|
|
64
|
+
case "forbidden":
|
|
65
|
+
return _error(`forbidden ${id}.`);
|
|
66
|
+
default:
|
|
67
|
+
return _error(`unknown ${id}.`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
// ../core/dist/store/store.js
|
|
74
|
+
var require_store = __commonJS({
|
|
75
|
+
"../core/dist/store/store.js"(exports2) {
|
|
76
|
+
"use strict";
|
|
77
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
78
|
+
function _export(target, all) {
|
|
79
|
+
for (var name in all) Object.defineProperty(target, name, { enumerable: true, get: Object.getOwnPropertyDescriptor(all, name).get });
|
|
80
|
+
}
|
|
81
|
+
_export(exports2, { get batch() {
|
|
82
|
+
return batch2;
|
|
83
|
+
}, get clearState() {
|
|
84
|
+
return clearState;
|
|
85
|
+
}, get deleteState() {
|
|
86
|
+
return deleteState;
|
|
87
|
+
}, get getState() {
|
|
88
|
+
return getState;
|
|
89
|
+
}, get hasState() {
|
|
90
|
+
return hasState;
|
|
91
|
+
}, get initState() {
|
|
92
|
+
return initState;
|
|
93
|
+
}, get resetAllState() {
|
|
94
|
+
return resetAllState;
|
|
95
|
+
}, get setState() {
|
|
96
|
+
return setState;
|
|
97
|
+
}, get subscribe() {
|
|
98
|
+
return subscribe;
|
|
99
|
+
}, get subscribeSelector() {
|
|
100
|
+
return subscribeSelector2;
|
|
101
|
+
} });
|
|
102
|
+
var _isautil = require("isa-util");
|
|
103
|
+
var _error = require_error();
|
|
104
|
+
var store = /* @__PURE__ */ new Map();
|
|
105
|
+
var listeners = /* @__PURE__ */ new Map();
|
|
106
|
+
var isBatching = false;
|
|
107
|
+
var pendingNotifications = /* @__PURE__ */ new Set();
|
|
108
|
+
var defaultEquality = (a, b) => Object.is(a, b);
|
|
109
|
+
function initState(id, value) {
|
|
110
|
+
if ((0, _isautil.isUndefined)(value) || (0, _isautil.isFalsy)(id)) return (0, _error.storeError)("wrong", id);
|
|
111
|
+
store.set(id, value);
|
|
112
|
+
if (!listeners.has(id)) {
|
|
113
|
+
listeners.set(id, /* @__PURE__ */ new Set());
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
function getState(id) {
|
|
117
|
+
const state = store.get(id);
|
|
118
|
+
if ((0, _isautil.isUndefined)(state)) {
|
|
119
|
+
return void 0;
|
|
120
|
+
}
|
|
121
|
+
return state;
|
|
122
|
+
}
|
|
123
|
+
function setState(id, value, forceNotify = false) {
|
|
124
|
+
const previousState = store.get(id);
|
|
125
|
+
if ((0, _isautil.isUndefined)(value)) return (0, _error.storeError)("wrong", id);
|
|
126
|
+
if (!forceNotify && defaultEquality(previousState, value)) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
store.set(id, value);
|
|
130
|
+
if (isBatching) {
|
|
131
|
+
pendingNotifications.add(id);
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
notifyListeners(id, value, previousState);
|
|
135
|
+
}
|
|
136
|
+
function notifyListeners(id, current, previous) {
|
|
137
|
+
const idListeners = listeners.get(id);
|
|
138
|
+
if (!idListeners || idListeners.size === 0) return;
|
|
139
|
+
const snapshot = Array.from(idListeners);
|
|
140
|
+
for (const listener of snapshot) {
|
|
141
|
+
try {
|
|
142
|
+
listener(current, previous);
|
|
143
|
+
} catch (err) {
|
|
144
|
+
console.error(`[ISA-AUTH Store] Error in listener for state "${id}":`, err);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
function clearState(id) {
|
|
149
|
+
if (!store.has(id)) return (0, _error.storeError)("wrong", id);
|
|
150
|
+
setState(id, null);
|
|
151
|
+
}
|
|
152
|
+
function deleteState(id) {
|
|
153
|
+
if (!store.has(id)) return (0, _error.storeError)("wrong", id);
|
|
154
|
+
store.delete(id);
|
|
155
|
+
listeners.delete(id);
|
|
156
|
+
}
|
|
157
|
+
function hasState(id) {
|
|
158
|
+
return store.has(id);
|
|
159
|
+
}
|
|
160
|
+
function subscribe(id, listener) {
|
|
161
|
+
if (!store.has(id)) {
|
|
162
|
+
store.set(id, null);
|
|
163
|
+
listeners.set(id, /* @__PURE__ */ new Set());
|
|
164
|
+
}
|
|
165
|
+
var _listeners_get;
|
|
166
|
+
const idListeners = (_listeners_get = listeners.get(id)) !== null && _listeners_get !== void 0 ? _listeners_get : /* @__PURE__ */ new Set();
|
|
167
|
+
idListeners.add(listener);
|
|
168
|
+
listeners.set(id, idListeners);
|
|
169
|
+
try {
|
|
170
|
+
listener(getState(id));
|
|
171
|
+
} catch (err) {
|
|
172
|
+
console.error(`[ISA-AUTH Store] Error in initial subscriber call for "${id}":`, err);
|
|
173
|
+
}
|
|
174
|
+
return () => {
|
|
175
|
+
idListeners.delete(listener);
|
|
176
|
+
if (idListeners.size === 0) {
|
|
177
|
+
listeners.delete(id);
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
function subscribeSelector2(id, selector, listener, equalityFn = defaultEquality) {
|
|
182
|
+
let prevSlice = selector(getState(id));
|
|
183
|
+
return subscribe(id, (currentState) => {
|
|
184
|
+
const nextSlice = selector(currentState);
|
|
185
|
+
if (!equalityFn(prevSlice, nextSlice)) {
|
|
186
|
+
const oldSlice = prevSlice;
|
|
187
|
+
prevSlice = nextSlice;
|
|
188
|
+
listener(nextSlice, oldSlice);
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
function batch2(fn) {
|
|
193
|
+
const wasBatching = isBatching;
|
|
194
|
+
isBatching = true;
|
|
195
|
+
try {
|
|
196
|
+
fn();
|
|
197
|
+
} finally {
|
|
198
|
+
if (!wasBatching) {
|
|
199
|
+
isBatching = false;
|
|
200
|
+
const ids = Array.from(pendingNotifications);
|
|
201
|
+
pendingNotifications.clear();
|
|
202
|
+
for (const id of ids) {
|
|
203
|
+
notifyListeners(id, store.get(id), void 0);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
function resetAllState() {
|
|
209
|
+
store.clear();
|
|
210
|
+
listeners.clear();
|
|
211
|
+
pendingNotifications.clear();
|
|
212
|
+
isBatching = false;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
// ../core/dist/value.js
|
|
218
|
+
var require_value = __commonJS({
|
|
219
|
+
"../core/dist/value.js"(exports2) {
|
|
220
|
+
"use strict";
|
|
221
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
222
|
+
function _export(target, all) {
|
|
223
|
+
for (var name in all) Object.defineProperty(target, name, { enumerable: true, get: Object.getOwnPropertyDescriptor(all, name).get });
|
|
224
|
+
}
|
|
225
|
+
_export(exports2, { get AUTH_EVENT() {
|
|
226
|
+
return AUTH_EVENT;
|
|
227
|
+
}, get AUTH_INFO_KEY() {
|
|
228
|
+
return AUTH_INFO_KEY;
|
|
229
|
+
}, get AUTH_KEY() {
|
|
230
|
+
return AUTH_KEY;
|
|
231
|
+
}, get REFRESH_KEY() {
|
|
232
|
+
return REFRESH_KEY;
|
|
233
|
+
}, get TOKEN_KEY() {
|
|
234
|
+
return TOKEN_KEY;
|
|
235
|
+
} });
|
|
236
|
+
var AUTH_KEY = "isa-auth";
|
|
237
|
+
var TOKEN_KEY = "isa-token";
|
|
238
|
+
var REFRESH_KEY = "isa-refresh-token";
|
|
239
|
+
var AUTH_EVENT = "isa-auth-change";
|
|
240
|
+
var AUTH_INFO_KEY = "isa-auth-info";
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
// ../core/dist/store/storageAdapter.js
|
|
245
|
+
var require_storageAdapter = __commonJS({
|
|
246
|
+
"../core/dist/store/storageAdapter.js"(exports2) {
|
|
247
|
+
"use strict";
|
|
248
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
249
|
+
function _export(target, all) {
|
|
250
|
+
for (var name in all) Object.defineProperty(target, name, { enumerable: true, get: Object.getOwnPropertyDescriptor(all, name).get });
|
|
251
|
+
}
|
|
252
|
+
_export(exports2, { get CookieSessionStorageAdapter() {
|
|
253
|
+
return CookieSessionStorageAdapter2;
|
|
254
|
+
}, get LocalStorageAdapter() {
|
|
255
|
+
return LocalStorageAdapter2;
|
|
256
|
+
}, get MemoryStorageAdapter() {
|
|
257
|
+
return MemoryStorageAdapter2;
|
|
258
|
+
}, get SessionStorageAdapter() {
|
|
259
|
+
return SessionStorageAdapter2;
|
|
260
|
+
} });
|
|
261
|
+
function _define_property(obj, key, value) {
|
|
262
|
+
if (key in obj) {
|
|
263
|
+
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
264
|
+
} else {
|
|
265
|
+
obj[key] = value;
|
|
266
|
+
}
|
|
267
|
+
return obj;
|
|
268
|
+
}
|
|
269
|
+
var MemoryStorageAdapter2 = class {
|
|
270
|
+
getItem(key) {
|
|
271
|
+
var _this_cache_get;
|
|
272
|
+
return (_this_cache_get = this.cache.get(key)) !== null && _this_cache_get !== void 0 ? _this_cache_get : null;
|
|
273
|
+
}
|
|
274
|
+
setItem(key, value) {
|
|
275
|
+
this.cache.set(key, value);
|
|
276
|
+
}
|
|
277
|
+
removeItem(key) {
|
|
278
|
+
this.cache.delete(key);
|
|
279
|
+
}
|
|
280
|
+
clear() {
|
|
281
|
+
this.cache.clear();
|
|
282
|
+
}
|
|
283
|
+
keys() {
|
|
284
|
+
return Array.from(this.cache.keys());
|
|
285
|
+
}
|
|
286
|
+
constructor() {
|
|
287
|
+
_define_property(this, "cache", /* @__PURE__ */ new Map());
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
var LocalStorageAdapter2 = class {
|
|
291
|
+
getItem(key) {
|
|
292
|
+
if (typeof window === "undefined" || !window.localStorage) return null;
|
|
293
|
+
try {
|
|
294
|
+
return window.localStorage.getItem(key);
|
|
295
|
+
} catch {
|
|
296
|
+
return null;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
setItem(key, value) {
|
|
300
|
+
if (typeof window === "undefined" || !window.localStorage) return;
|
|
301
|
+
try {
|
|
302
|
+
window.localStorage.setItem(key, value);
|
|
303
|
+
} catch (e) {
|
|
304
|
+
console.warn("[ISA-AUTH] Failed to write to localStorage", e);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
removeItem(key) {
|
|
308
|
+
if (typeof window === "undefined" || !window.localStorage) return;
|
|
309
|
+
try {
|
|
310
|
+
window.localStorage.removeItem(key);
|
|
311
|
+
} catch (e) {
|
|
312
|
+
console.warn("[ISA-AUTH] Failed to remove from localStorage", e);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
clear() {
|
|
316
|
+
if (typeof window === "undefined" || !window.localStorage) return;
|
|
317
|
+
try {
|
|
318
|
+
window.localStorage.clear();
|
|
319
|
+
} catch (e) {
|
|
320
|
+
console.warn("[ISA-AUTH] Failed to clear localStorage", e);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
keys() {
|
|
324
|
+
if (typeof window === "undefined" || !window.localStorage) return [];
|
|
325
|
+
try {
|
|
326
|
+
return Object.keys(window.localStorage);
|
|
327
|
+
} catch {
|
|
328
|
+
return [];
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
};
|
|
332
|
+
var SessionStorageAdapter2 = class {
|
|
333
|
+
getItem(key) {
|
|
334
|
+
if (typeof window === "undefined" || !window.sessionStorage) return null;
|
|
335
|
+
try {
|
|
336
|
+
return window.sessionStorage.getItem(key);
|
|
337
|
+
} catch {
|
|
338
|
+
return null;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
setItem(key, value) {
|
|
342
|
+
if (typeof window === "undefined" || !window.sessionStorage) return;
|
|
343
|
+
try {
|
|
344
|
+
window.sessionStorage.setItem(key, value);
|
|
345
|
+
} catch (e) {
|
|
346
|
+
console.warn("[ISA-AUTH] Failed to write to sessionStorage", e);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
removeItem(key) {
|
|
350
|
+
if (typeof window === "undefined" || !window.sessionStorage) return;
|
|
351
|
+
try {
|
|
352
|
+
window.sessionStorage.removeItem(key);
|
|
353
|
+
} catch (e) {
|
|
354
|
+
console.warn("[ISA-AUTH] Failed to remove from sessionStorage", e);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
clear() {
|
|
358
|
+
if (typeof window === "undefined" || !window.sessionStorage) return;
|
|
359
|
+
try {
|
|
360
|
+
window.sessionStorage.clear();
|
|
361
|
+
} catch (e) {
|
|
362
|
+
console.warn("[ISA-AUTH] Failed to clear sessionStorage", e);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
keys() {
|
|
366
|
+
if (typeof window === "undefined" || !window.sessionStorage) return [];
|
|
367
|
+
try {
|
|
368
|
+
return Object.keys(window.sessionStorage);
|
|
369
|
+
} catch {
|
|
370
|
+
return [];
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
};
|
|
374
|
+
var CookieSessionStorageAdapter2 = class {
|
|
375
|
+
getItem(key) {
|
|
376
|
+
if (key.includes("token") || key.includes("refresh")) {
|
|
377
|
+
return null;
|
|
378
|
+
}
|
|
379
|
+
var _this_memoryCache_get;
|
|
380
|
+
return (_this_memoryCache_get = this.memoryCache.get(key)) !== null && _this_memoryCache_get !== void 0 ? _this_memoryCache_get : null;
|
|
381
|
+
}
|
|
382
|
+
setItem(key, value) {
|
|
383
|
+
if (key.includes("token") || key.includes("refresh")) {
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
if (this.persistUserInfo) {
|
|
387
|
+
this.memoryCache.set(key, value);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
removeItem(key) {
|
|
391
|
+
this.memoryCache.delete(key);
|
|
392
|
+
}
|
|
393
|
+
clear() {
|
|
394
|
+
this.memoryCache.clear();
|
|
395
|
+
}
|
|
396
|
+
keys() {
|
|
397
|
+
return Array.from(this.memoryCache.keys());
|
|
398
|
+
}
|
|
399
|
+
constructor(options = {}) {
|
|
400
|
+
_define_property(this, "memoryCache", /* @__PURE__ */ new Map());
|
|
401
|
+
_define_property(this, "persistUserInfo", void 0);
|
|
402
|
+
var _options_persistUserInfo;
|
|
403
|
+
this.persistUserInfo = (_options_persistUserInfo = options.persistUserInfo) !== null && _options_persistUserInfo !== void 0 ? _options_persistUserInfo : true;
|
|
404
|
+
}
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
// ../core/dist/store/index.js
|
|
410
|
+
var require_store2 = __commonJS({
|
|
411
|
+
"../core/dist/store/index.js"(exports2) {
|
|
412
|
+
"use strict";
|
|
413
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
414
|
+
function _export(target, all) {
|
|
415
|
+
for (var name in all) Object.defineProperty(target, name, { enumerable: true, get: Object.getOwnPropertyDescriptor(all, name).get });
|
|
416
|
+
}
|
|
417
|
+
_export(exports2, { get CookieSessionStorageAdapter() {
|
|
418
|
+
return _storageAdapter.CookieSessionStorageAdapter;
|
|
419
|
+
}, get LocalStorageAdapter() {
|
|
420
|
+
return _storageAdapter.LocalStorageAdapter;
|
|
421
|
+
}, get MemoryStorageAdapter() {
|
|
422
|
+
return _storageAdapter.MemoryStorageAdapter;
|
|
423
|
+
}, get SessionStorageAdapter() {
|
|
424
|
+
return _storageAdapter.SessionStorageAdapter;
|
|
425
|
+
}, get batch() {
|
|
426
|
+
return _store.batch;
|
|
427
|
+
}, get clearStoreSession() {
|
|
428
|
+
return clearStoreSession2;
|
|
429
|
+
}, get configureStorage() {
|
|
430
|
+
return configureStorage2;
|
|
431
|
+
}, get getAccessToken() {
|
|
432
|
+
return getAccessToken2;
|
|
433
|
+
}, get getAuthInfo() {
|
|
434
|
+
return getAuthInfo2;
|
|
435
|
+
}, get getAuthState() {
|
|
436
|
+
return getAuthState2;
|
|
437
|
+
}, get getRefreshToken() {
|
|
438
|
+
return getRefreshToken2;
|
|
439
|
+
}, get getState() {
|
|
440
|
+
return _store.getState;
|
|
441
|
+
}, get getStorageAdapter() {
|
|
442
|
+
return getStorageAdapter2;
|
|
443
|
+
}, get getStorageKey() {
|
|
444
|
+
return getStorageKey;
|
|
445
|
+
}, get initState() {
|
|
446
|
+
return _store.initState;
|
|
447
|
+
}, get initStore() {
|
|
448
|
+
return initStore;
|
|
449
|
+
}, get removeAccessToken() {
|
|
450
|
+
return removeAccessToken;
|
|
451
|
+
}, get removeAuthInfo() {
|
|
452
|
+
return removeAuthInfo;
|
|
453
|
+
}, get removeRefreshToken() {
|
|
454
|
+
return removeRefreshToken;
|
|
455
|
+
}, get resetAllState() {
|
|
456
|
+
return _store.resetAllState;
|
|
457
|
+
}, get setAccessToken() {
|
|
458
|
+
return setAccessToken;
|
|
459
|
+
}, get setAuthInfo() {
|
|
460
|
+
return setAuthInfo;
|
|
461
|
+
}, get setAuthState() {
|
|
462
|
+
return setAuthState;
|
|
463
|
+
}, get setRefreshToken() {
|
|
464
|
+
return setRefreshToken2;
|
|
465
|
+
}, get setState() {
|
|
466
|
+
return _store.setState;
|
|
467
|
+
}, get setupMultiTabSync() {
|
|
468
|
+
return setupMultiTabSync;
|
|
469
|
+
}, get subscribe() {
|
|
470
|
+
return _store.subscribe;
|
|
471
|
+
}, get subscribeSelector() {
|
|
472
|
+
return _store.subscribeSelector;
|
|
473
|
+
}, get teardownMultiTabSync() {
|
|
474
|
+
return teardownMultiTabSync;
|
|
475
|
+
}, get updateAuthInfo() {
|
|
476
|
+
return updateAuthInfo2;
|
|
477
|
+
}, get watchAuthInfo() {
|
|
478
|
+
return watchAuthInfo;
|
|
479
|
+
}, get watchAuthState() {
|
|
480
|
+
return watchAuthState;
|
|
481
|
+
} });
|
|
482
|
+
var _store = require_store();
|
|
483
|
+
var _value = require_value();
|
|
484
|
+
var _storageAdapter = require_storageAdapter();
|
|
485
|
+
function warnInsecureLocalStorage(storageName) {
|
|
486
|
+
if (typeof console !== "undefined" && console.warn) {
|
|
487
|
+
console.warn(`\u26A0\uFE0F [ISA-AUTH SECURITY WARNING] '${storageName}' is enabled for session persistence.
|
|
488
|
+
Storing authentication tokens in browser localStorage makes your application vulnerable to XSS (Cross-Site Scripting) token theft.
|
|
489
|
+
\u26D4 DO NOT USE IN PRODUCTION!
|
|
490
|
+
\u{1F4A1} Recommended production alternatives:
|
|
491
|
+
- 'memory' (In-memory token with silent HttpOnly refresh)
|
|
492
|
+
- 'cookie' (BFF / Server-managed HttpOnly cookies)`);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
var currentStorage = new _storageAdapter.MemoryStorageAdapter();
|
|
496
|
+
var storagePrefix = "";
|
|
497
|
+
var syncRegistered = false;
|
|
498
|
+
var syncListener = null;
|
|
499
|
+
function getStorageKey(baseKey) {
|
|
500
|
+
return storagePrefix ? `${storagePrefix}_${baseKey}` : baseKey;
|
|
501
|
+
}
|
|
502
|
+
function configureStorage2(config) {
|
|
503
|
+
if (typeof config === "string" || config && "getItem" in config) {
|
|
504
|
+
if (typeof config === "string") {
|
|
505
|
+
switch (config) {
|
|
506
|
+
case "sessionStorage":
|
|
507
|
+
currentStorage = new _storageAdapter.SessionStorageAdapter();
|
|
508
|
+
break;
|
|
509
|
+
case "cookie":
|
|
510
|
+
case "hybrid":
|
|
511
|
+
currentStorage = new _storageAdapter.CookieSessionStorageAdapter();
|
|
512
|
+
break;
|
|
513
|
+
case "dev_insecure_localStorage":
|
|
514
|
+
case "insecure_localStorage":
|
|
515
|
+
case "localStorage":
|
|
516
|
+
warnInsecureLocalStorage(config);
|
|
517
|
+
currentStorage = new _storageAdapter.LocalStorageAdapter();
|
|
518
|
+
break;
|
|
519
|
+
case "memory":
|
|
520
|
+
default:
|
|
521
|
+
currentStorage = new _storageAdapter.MemoryStorageAdapter();
|
|
522
|
+
break;
|
|
523
|
+
}
|
|
524
|
+
} else {
|
|
525
|
+
currentStorage = config;
|
|
526
|
+
}
|
|
527
|
+
} else if (config && typeof config === "object") {
|
|
528
|
+
const { type = "memory", prefix = "", persistUserInfo = true } = config;
|
|
529
|
+
storagePrefix = prefix;
|
|
530
|
+
if (typeof type === "string") {
|
|
531
|
+
switch (type) {
|
|
532
|
+
case "sessionStorage":
|
|
533
|
+
currentStorage = new _storageAdapter.SessionStorageAdapter();
|
|
534
|
+
break;
|
|
535
|
+
case "cookie":
|
|
536
|
+
case "hybrid":
|
|
537
|
+
currentStorage = new _storageAdapter.CookieSessionStorageAdapter({ persistUserInfo });
|
|
538
|
+
break;
|
|
539
|
+
case "dev_insecure_localStorage":
|
|
540
|
+
case "insecure_localStorage":
|
|
541
|
+
case "localStorage":
|
|
542
|
+
warnInsecureLocalStorage(type);
|
|
543
|
+
currentStorage = new _storageAdapter.LocalStorageAdapter();
|
|
544
|
+
break;
|
|
545
|
+
case "memory":
|
|
546
|
+
default:
|
|
547
|
+
currentStorage = new _storageAdapter.MemoryStorageAdapter();
|
|
548
|
+
break;
|
|
549
|
+
}
|
|
550
|
+
} else {
|
|
551
|
+
currentStorage = type;
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
function getStorageAdapter2() {
|
|
556
|
+
return currentStorage;
|
|
557
|
+
}
|
|
558
|
+
function setupMultiTabSync() {
|
|
559
|
+
if (syncRegistered || typeof window === "undefined") return;
|
|
560
|
+
syncRegistered = true;
|
|
561
|
+
syncListener = (event) => {
|
|
562
|
+
const tokenKey = getStorageKey(_value.TOKEN_KEY);
|
|
563
|
+
const refreshKey = getStorageKey(_value.REFRESH_KEY);
|
|
564
|
+
const infoKey = getStorageKey(_value.AUTH_INFO_KEY);
|
|
565
|
+
if (event.key === null) {
|
|
566
|
+
(0, _store.batch)(() => {
|
|
567
|
+
(0, _store.setState)(_value.TOKEN_KEY, null);
|
|
568
|
+
(0, _store.setState)(_value.REFRESH_KEY, null);
|
|
569
|
+
(0, _store.setState)(_value.AUTH_KEY, false);
|
|
570
|
+
(0, _store.setState)(_value.AUTH_INFO_KEY, null);
|
|
571
|
+
});
|
|
572
|
+
return;
|
|
573
|
+
}
|
|
574
|
+
if (event.key === tokenKey) {
|
|
575
|
+
const newToken = event.newValue;
|
|
576
|
+
(0, _store.batch)(() => {
|
|
577
|
+
if (newToken) {
|
|
578
|
+
(0, _store.setState)(_value.TOKEN_KEY, newToken);
|
|
579
|
+
(0, _store.setState)(_value.AUTH_KEY, true);
|
|
580
|
+
} else {
|
|
581
|
+
(0, _store.setState)(_value.TOKEN_KEY, null);
|
|
582
|
+
(0, _store.setState)(_value.AUTH_KEY, false);
|
|
583
|
+
(0, _store.setState)(_value.AUTH_INFO_KEY, null);
|
|
584
|
+
}
|
|
585
|
+
});
|
|
586
|
+
}
|
|
587
|
+
if (event.key === refreshKey) {
|
|
588
|
+
(0, _store.setState)(_value.REFRESH_KEY, event.newValue || null);
|
|
589
|
+
}
|
|
590
|
+
if (event.key === infoKey) {
|
|
591
|
+
const newInfoStr = event.newValue;
|
|
592
|
+
let newInfo = null;
|
|
593
|
+
if (newInfoStr) {
|
|
594
|
+
try {
|
|
595
|
+
newInfo = JSON.parse(newInfoStr);
|
|
596
|
+
} catch {
|
|
597
|
+
newInfo = null;
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
(0, _store.setState)(_value.AUTH_INFO_KEY, newInfo);
|
|
601
|
+
}
|
|
602
|
+
};
|
|
603
|
+
window.addEventListener("storage", syncListener);
|
|
604
|
+
}
|
|
605
|
+
function teardownMultiTabSync() {
|
|
606
|
+
if (syncListener && typeof window !== "undefined") {
|
|
607
|
+
window.removeEventListener("storage", syncListener);
|
|
608
|
+
syncListener = null;
|
|
609
|
+
}
|
|
610
|
+
syncRegistered = false;
|
|
611
|
+
}
|
|
612
|
+
function initStore(prevState = false) {
|
|
613
|
+
setupMultiTabSync();
|
|
614
|
+
const persistedToken = currentStorage.getItem(getStorageKey(_value.TOKEN_KEY));
|
|
615
|
+
const persistedRefreshToken = currentStorage.getItem(getStorageKey(_value.REFRESH_KEY));
|
|
616
|
+
const isInitiallyAuthed = persistedToken ? true : prevState !== null && prevState !== void 0 ? prevState : false;
|
|
617
|
+
(0, _store.initState)(_value.AUTH_KEY, isInitiallyAuthed);
|
|
618
|
+
(0, _store.initState)(_value.TOKEN_KEY, persistedToken !== null && persistedToken !== void 0 ? persistedToken : null);
|
|
619
|
+
(0, _store.initState)(_value.REFRESH_KEY, persistedRefreshToken !== null && persistedRefreshToken !== void 0 ? persistedRefreshToken : null);
|
|
620
|
+
let initialInfo = null;
|
|
621
|
+
const persistedInfo = currentStorage.getItem(getStorageKey(_value.AUTH_INFO_KEY));
|
|
622
|
+
if (persistedInfo) {
|
|
623
|
+
try {
|
|
624
|
+
initialInfo = JSON.parse(persistedInfo);
|
|
625
|
+
} catch {
|
|
626
|
+
initialInfo = null;
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
(0, _store.initState)(_value.AUTH_INFO_KEY, initialInfo);
|
|
630
|
+
}
|
|
631
|
+
function getAuthState2() {
|
|
632
|
+
var _getState;
|
|
633
|
+
return (_getState = (0, _store.getState)(_value.AUTH_KEY)) !== null && _getState !== void 0 ? _getState : false;
|
|
634
|
+
}
|
|
635
|
+
function setAuthState(value) {
|
|
636
|
+
(0, _store.setState)(_value.AUTH_KEY, value);
|
|
637
|
+
}
|
|
638
|
+
function getAccessToken2() {
|
|
639
|
+
var _getState;
|
|
640
|
+
return (_getState = (0, _store.getState)(_value.TOKEN_KEY)) !== null && _getState !== void 0 ? _getState : null;
|
|
641
|
+
}
|
|
642
|
+
function setAccessToken(value) {
|
|
643
|
+
const tokenKey = getStorageKey(_value.TOKEN_KEY);
|
|
644
|
+
(0, _store.batch)(() => {
|
|
645
|
+
(0, _store.setState)(_value.TOKEN_KEY, value);
|
|
646
|
+
if (value) {
|
|
647
|
+
currentStorage.setItem(tokenKey, value);
|
|
648
|
+
(0, _store.setState)(_value.AUTH_KEY, true);
|
|
649
|
+
} else {
|
|
650
|
+
currentStorage.removeItem(tokenKey);
|
|
651
|
+
(0, _store.setState)(_value.AUTH_KEY, false);
|
|
652
|
+
}
|
|
653
|
+
});
|
|
654
|
+
}
|
|
655
|
+
function removeAccessToken() {
|
|
656
|
+
setAccessToken(null);
|
|
657
|
+
}
|
|
658
|
+
function getRefreshToken2() {
|
|
659
|
+
var _getState;
|
|
660
|
+
return (_getState = (0, _store.getState)(_value.REFRESH_KEY)) !== null && _getState !== void 0 ? _getState : null;
|
|
661
|
+
}
|
|
662
|
+
function setRefreshToken2(value) {
|
|
663
|
+
const refreshKey = getStorageKey(_value.REFRESH_KEY);
|
|
664
|
+
(0, _store.setState)(_value.REFRESH_KEY, value);
|
|
665
|
+
if (value) {
|
|
666
|
+
currentStorage.setItem(refreshKey, value);
|
|
667
|
+
} else {
|
|
668
|
+
currentStorage.removeItem(refreshKey);
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
function removeRefreshToken() {
|
|
672
|
+
setRefreshToken2(null);
|
|
673
|
+
}
|
|
674
|
+
function getAuthInfo2() {
|
|
675
|
+
var _getState;
|
|
676
|
+
return (_getState = (0, _store.getState)(_value.AUTH_INFO_KEY)) !== null && _getState !== void 0 ? _getState : null;
|
|
677
|
+
}
|
|
678
|
+
function setAuthInfo(value) {
|
|
679
|
+
const infoKey = getStorageKey(_value.AUTH_INFO_KEY);
|
|
680
|
+
(0, _store.setState)(_value.AUTH_INFO_KEY, value);
|
|
681
|
+
if (value) {
|
|
682
|
+
try {
|
|
683
|
+
currentStorage.setItem(infoKey, JSON.stringify(value));
|
|
684
|
+
} catch (e) {
|
|
685
|
+
console.warn("[ISA-AUTH] Failed to serialize authInfo to storage", e);
|
|
686
|
+
}
|
|
687
|
+
} else {
|
|
688
|
+
currentStorage.removeItem(infoKey);
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
function updateAuthInfo2(partial) {
|
|
692
|
+
const current = getAuthInfo2() || {};
|
|
693
|
+
const updated = { ...current, ...partial };
|
|
694
|
+
setAuthInfo(updated);
|
|
695
|
+
return updated;
|
|
696
|
+
}
|
|
697
|
+
function removeAuthInfo() {
|
|
698
|
+
setAuthInfo(null);
|
|
699
|
+
}
|
|
700
|
+
function clearStoreSession2() {
|
|
701
|
+
(0, _store.batch)(() => {
|
|
702
|
+
setAccessToken(null);
|
|
703
|
+
setRefreshToken2(null);
|
|
704
|
+
setAuthInfo(null);
|
|
705
|
+
setAuthState(false);
|
|
706
|
+
});
|
|
707
|
+
}
|
|
708
|
+
function watchAuthState(callback) {
|
|
709
|
+
return (0, _store.subscribe)(_value.AUTH_KEY, (auth) => {
|
|
710
|
+
callback(Boolean(auth));
|
|
711
|
+
});
|
|
712
|
+
}
|
|
713
|
+
function watchAuthInfo(callback) {
|
|
714
|
+
return (0, _store.subscribe)(_value.AUTH_INFO_KEY, callback);
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
});
|
|
718
|
+
|
|
719
|
+
// ../core/dist/service/baseAuthService.js
|
|
720
|
+
var require_baseAuthService = __commonJS({
|
|
721
|
+
"../core/dist/service/baseAuthService.js"(exports2) {
|
|
722
|
+
"use strict";
|
|
723
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
724
|
+
function _export(target, all) {
|
|
725
|
+
for (var name in all) Object.defineProperty(target, name, { enumerable: true, get: Object.getOwnPropertyDescriptor(all, name).get });
|
|
726
|
+
}
|
|
727
|
+
_export(exports2, { get AuthBaseService() {
|
|
728
|
+
return AuthBaseService2;
|
|
729
|
+
}, get default() {
|
|
730
|
+
return _default;
|
|
731
|
+
} });
|
|
732
|
+
var _store = require_store2();
|
|
733
|
+
var AuthBaseService2 = class {
|
|
734
|
+
initStore(prevState = false) {
|
|
735
|
+
(0, _store.initStore)(prevState);
|
|
736
|
+
}
|
|
737
|
+
getAuthState() {
|
|
738
|
+
return (0, _store.getAuthState)();
|
|
739
|
+
}
|
|
740
|
+
isAuthenticated() {
|
|
741
|
+
return this.getAuthState();
|
|
742
|
+
}
|
|
743
|
+
setAuthState(value) {
|
|
744
|
+
(0, _store.setAuthState)(value);
|
|
745
|
+
}
|
|
746
|
+
getAuthInfo() {
|
|
747
|
+
return (0, _store.getAuthInfo)();
|
|
748
|
+
}
|
|
749
|
+
setAuthInfo(value) {
|
|
750
|
+
(0, _store.setAuthInfo)(value);
|
|
751
|
+
}
|
|
752
|
+
updateAuthInfo(partial) {
|
|
753
|
+
return (0, _store.updateAuthInfo)(partial);
|
|
754
|
+
}
|
|
755
|
+
watchAuthState(callback) {
|
|
756
|
+
return (0, _store.watchAuthState)(callback);
|
|
757
|
+
}
|
|
758
|
+
watchAuthInfo(callback) {
|
|
759
|
+
return (0, _store.watchAuthInfo)(callback);
|
|
760
|
+
}
|
|
761
|
+
clearAuthState() {
|
|
762
|
+
(0, _store.clearStoreSession)();
|
|
763
|
+
}
|
|
764
|
+
constructor() {
|
|
765
|
+
this.initStore(false);
|
|
766
|
+
}
|
|
767
|
+
};
|
|
768
|
+
var _default = AuthBaseService2;
|
|
769
|
+
}
|
|
770
|
+
});
|
|
771
|
+
|
|
772
|
+
// ../core/dist/auths/jwt/jwtUtils.js
|
|
773
|
+
var require_jwtUtils = __commonJS({
|
|
774
|
+
"../core/dist/auths/jwt/jwtUtils.js"(exports2) {
|
|
775
|
+
"use strict";
|
|
776
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
777
|
+
function _export(target, all) {
|
|
778
|
+
for (var name in all) Object.defineProperty(target, name, { enumerable: true, get: Object.getOwnPropertyDescriptor(all, name).get });
|
|
779
|
+
}
|
|
780
|
+
_export(exports2, { get base64UrlDecode() {
|
|
781
|
+
return base64UrlDecode;
|
|
782
|
+
}, get base64UrlEncode() {
|
|
783
|
+
return base64UrlEncode;
|
|
784
|
+
}, get decodeToken() {
|
|
785
|
+
return decodeToken2;
|
|
786
|
+
}, get getTokenFromHeader() {
|
|
787
|
+
return getTokenFromHeader2;
|
|
788
|
+
}, get getTokenPayload() {
|
|
789
|
+
return getTokenPayload2;
|
|
790
|
+
}, get getTokenTimeRemaining() {
|
|
791
|
+
return getTokenTimeRemaining2;
|
|
792
|
+
}, get isExpiredToken() {
|
|
793
|
+
return isExpiredToken2;
|
|
794
|
+
} });
|
|
795
|
+
function base64UrlDecode(str) {
|
|
796
|
+
let base64 = str.replace(/-/g, "+").replace(/_/g, "/");
|
|
797
|
+
while (base64.length % 4 !== 0) {
|
|
798
|
+
base64 += "=";
|
|
799
|
+
}
|
|
800
|
+
if (typeof atob === "function") {
|
|
801
|
+
const binaryStr = atob(base64);
|
|
802
|
+
const bytes = Uint8Array.from(binaryStr, (c) => c.charCodeAt(0));
|
|
803
|
+
return new TextDecoder().decode(bytes);
|
|
804
|
+
}
|
|
805
|
+
const nodeBuffer = globalThis.Buffer;
|
|
806
|
+
if (typeof nodeBuffer !== "undefined") {
|
|
807
|
+
return nodeBuffer.from(base64, "base64").toString("utf-8");
|
|
808
|
+
}
|
|
809
|
+
throw new Error("No base64 decoder available in the current environment");
|
|
810
|
+
}
|
|
811
|
+
function base64UrlEncode(str) {
|
|
812
|
+
let base64 = "";
|
|
813
|
+
if (typeof btoa === "function") {
|
|
814
|
+
const bytes = new TextEncoder().encode(str);
|
|
815
|
+
const binary = String.fromCharCode(...bytes);
|
|
816
|
+
base64 = btoa(binary);
|
|
817
|
+
} else {
|
|
818
|
+
const nodeBuffer = globalThis.Buffer;
|
|
819
|
+
if (typeof nodeBuffer !== "undefined") {
|
|
820
|
+
base64 = nodeBuffer.from(str, "utf-8").toString("base64");
|
|
821
|
+
} else {
|
|
822
|
+
throw new Error("No base64 encoder available");
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
return base64.replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
826
|
+
}
|
|
827
|
+
function decodeToken2(token) {
|
|
828
|
+
if (!token || typeof token !== "string") return null;
|
|
829
|
+
const parts = token.trim().split(".");
|
|
830
|
+
if (parts.length !== 3) return null;
|
|
831
|
+
try {
|
|
832
|
+
const headerStr = base64UrlDecode(parts[0]);
|
|
833
|
+
const payloadStr = base64UrlDecode(parts[1]);
|
|
834
|
+
const header = JSON.parse(headerStr);
|
|
835
|
+
const payload = JSON.parse(payloadStr);
|
|
836
|
+
return { header, payload, signature: parts[2] };
|
|
837
|
+
} catch (err) {
|
|
838
|
+
return null;
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
function isExpiredToken2(token, clockToleranceSeconds = 0) {
|
|
842
|
+
const decoded = decodeToken2(token);
|
|
843
|
+
if (!decoded || !decoded.payload || typeof decoded.payload.exp !== "number") {
|
|
844
|
+
return true;
|
|
845
|
+
}
|
|
846
|
+
const expMs = (decoded.payload.exp + clockToleranceSeconds) * 1e3;
|
|
847
|
+
return Date.now() >= expMs;
|
|
848
|
+
}
|
|
849
|
+
function getTokenTimeRemaining2(token) {
|
|
850
|
+
const decoded = decodeToken2(token);
|
|
851
|
+
if (!decoded || !decoded.payload || typeof decoded.payload.exp !== "number") {
|
|
852
|
+
return 0;
|
|
853
|
+
}
|
|
854
|
+
const expMs = decoded.payload.exp * 1e3;
|
|
855
|
+
const diff = expMs - Date.now();
|
|
856
|
+
return diff > 0 ? diff : 0;
|
|
857
|
+
}
|
|
858
|
+
function getTokenPayload2(token) {
|
|
859
|
+
const decoded = decodeToken2(token);
|
|
860
|
+
return decoded ? decoded.payload : null;
|
|
861
|
+
}
|
|
862
|
+
function getTokenFromHeader2(header) {
|
|
863
|
+
if (!header || typeof header !== "string") return null;
|
|
864
|
+
const parts = header.trim().split(/\s+/);
|
|
865
|
+
if (parts.length === 2 && parts[0].toLowerCase() === "bearer") {
|
|
866
|
+
return parts[1].trim() || null;
|
|
867
|
+
}
|
|
868
|
+
return null;
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
});
|
|
872
|
+
|
|
873
|
+
// ../core/dist/auths/jwt/jwtManager.js
|
|
874
|
+
var require_jwtManager = __commonJS({
|
|
875
|
+
"../core/dist/auths/jwt/jwtManager.js"(exports2) {
|
|
876
|
+
"use strict";
|
|
877
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
878
|
+
Object.defineProperty(exports2, "JwtManager", { enumerable: true, get: function() {
|
|
879
|
+
return JwtManager;
|
|
880
|
+
} });
|
|
881
|
+
var _jwtUtils = require_jwtUtils();
|
|
882
|
+
function _define_property(obj, key, value) {
|
|
883
|
+
if (key in obj) {
|
|
884
|
+
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
885
|
+
} else {
|
|
886
|
+
obj[key] = value;
|
|
887
|
+
}
|
|
888
|
+
return obj;
|
|
889
|
+
}
|
|
890
|
+
var JwtManager = class {
|
|
891
|
+
setSecret(secret) {
|
|
892
|
+
this.secret = secret;
|
|
893
|
+
}
|
|
894
|
+
decode(token) {
|
|
895
|
+
return (0, _jwtUtils.getTokenPayload)(token);
|
|
896
|
+
}
|
|
897
|
+
decodeWithHeader(token) {
|
|
898
|
+
return (0, _jwtUtils.decodeToken)(token);
|
|
899
|
+
}
|
|
900
|
+
isExpired(token) {
|
|
901
|
+
return (0, _jwtUtils.isExpiredToken)(token, this.clockTolerance);
|
|
902
|
+
}
|
|
903
|
+
async verifyHmacSha256(token) {
|
|
904
|
+
if (!this.secret || !token) return false;
|
|
905
|
+
const parts = token.trim().split(".");
|
|
906
|
+
if (parts.length !== 3) return false;
|
|
907
|
+
if (typeof window === "undefined" || !window.crypto || !window.crypto.subtle) {
|
|
908
|
+
return !this.isExpired(token);
|
|
909
|
+
}
|
|
910
|
+
try {
|
|
911
|
+
const enc = new TextEncoder();
|
|
912
|
+
const key = await window.crypto.subtle.importKey("raw", enc.encode(this.secret), { name: "HMAC", hash: "SHA-256" }, false, ["verify"]);
|
|
913
|
+
let sigBase64 = parts[2].replace(/-/g, "+").replace(/_/g, "/");
|
|
914
|
+
while (sigBase64.length % 4 !== 0) sigBase64 += "=";
|
|
915
|
+
const sigBytes = Uint8Array.from(atob(sigBase64), (c) => c.charCodeAt(0));
|
|
916
|
+
const dataBytes = enc.encode(`${parts[0]}.${parts[1]}`);
|
|
917
|
+
return await window.crypto.subtle.verify("HMAC", key, sigBytes, dataBytes);
|
|
918
|
+
} catch {
|
|
919
|
+
return false;
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
constructor(options = {}) {
|
|
923
|
+
_define_property(this, "secret", void 0);
|
|
924
|
+
_define_property(this, "clockTolerance", void 0);
|
|
925
|
+
this.secret = options.secret || "";
|
|
926
|
+
this.clockTolerance = options.clockTolerance || 0;
|
|
927
|
+
}
|
|
928
|
+
};
|
|
929
|
+
}
|
|
930
|
+
});
|
|
931
|
+
|
|
932
|
+
// ../core/dist/auths/jwt/index.js
|
|
933
|
+
var require_jwt = __commonJS({
|
|
934
|
+
"../core/dist/auths/jwt/index.js"(exports2) {
|
|
935
|
+
"use strict";
|
|
936
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
937
|
+
function _export(target, all) {
|
|
938
|
+
for (var name in all) Object.defineProperty(target, name, { enumerable: true, get: Object.getOwnPropertyDescriptor(all, name).get });
|
|
939
|
+
}
|
|
940
|
+
_export(exports2, { get JwtManager() {
|
|
941
|
+
return _jwtManager.JwtManager;
|
|
942
|
+
}, get base64UrlDecode() {
|
|
943
|
+
return _jwtUtils.base64UrlDecode;
|
|
944
|
+
}, get base64UrlEncode() {
|
|
945
|
+
return _jwtUtils.base64UrlEncode;
|
|
946
|
+
}, get configureJwtManager() {
|
|
947
|
+
return configureJwtManager;
|
|
948
|
+
}, get decodeToken() {
|
|
949
|
+
return _jwtUtils.decodeToken;
|
|
950
|
+
}, get getTokenFromHeader() {
|
|
951
|
+
return _jwtUtils.getTokenFromHeader;
|
|
952
|
+
}, get getTokenPayload() {
|
|
953
|
+
return _jwtUtils.getTokenPayload;
|
|
954
|
+
}, get getTokenTimeRemaining() {
|
|
955
|
+
return _jwtUtils.getTokenTimeRemaining;
|
|
956
|
+
}, get isExpiredToken() {
|
|
957
|
+
return _jwtUtils.isExpiredToken;
|
|
958
|
+
}, get isValidToken() {
|
|
959
|
+
return isValidToken;
|
|
960
|
+
} });
|
|
961
|
+
var _jwtManager = require_jwtManager();
|
|
962
|
+
var _jwtUtils = require_jwtUtils();
|
|
963
|
+
var defaultJwtManager = new _jwtManager.JwtManager();
|
|
964
|
+
function configureJwtManager(secret, clockTolerance) {
|
|
965
|
+
defaultJwtManager = new _jwtManager.JwtManager({ secret, clockTolerance });
|
|
966
|
+
}
|
|
967
|
+
function isValidToken(token) {
|
|
968
|
+
if (!token) return false;
|
|
969
|
+
const decoded = (0, _jwtUtils.decodeToken)(token);
|
|
970
|
+
if (!decoded) return false;
|
|
971
|
+
return !(0, _jwtUtils.isExpiredToken)(token);
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
});
|
|
975
|
+
|
|
976
|
+
// ../core/dist/guard/index.js
|
|
977
|
+
var require_guard = __commonJS({
|
|
978
|
+
"../core/dist/guard/index.js"(exports2) {
|
|
979
|
+
"use strict";
|
|
980
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
981
|
+
function _export(target, all) {
|
|
982
|
+
for (var name in all) Object.defineProperty(target, name, { enumerable: true, get: Object.getOwnPropertyDescriptor(all, name).get });
|
|
983
|
+
}
|
|
984
|
+
_export(exports2, { get checkPermission() {
|
|
985
|
+
return checkPermission2;
|
|
986
|
+
}, get checkRole() {
|
|
987
|
+
return checkRole2;
|
|
988
|
+
}, get createAuthGuard() {
|
|
989
|
+
return createAuthGuard2;
|
|
990
|
+
}, get createNavigationGuard() {
|
|
991
|
+
return createNavigationGuard2;
|
|
992
|
+
}, get evaluateGuard() {
|
|
993
|
+
return evaluateGuard2;
|
|
994
|
+
}, get matchPermissionRule() {
|
|
995
|
+
return matchPermissionRule2;
|
|
996
|
+
}, get resolveInheritedRoles() {
|
|
997
|
+
return resolveInheritedRoles2;
|
|
998
|
+
} });
|
|
999
|
+
function resolveInheritedRoles2(userRoles = [], hierarchy) {
|
|
1000
|
+
if (!hierarchy || Object.keys(hierarchy).length === 0) {
|
|
1001
|
+
return Array.from(new Set(userRoles));
|
|
1002
|
+
}
|
|
1003
|
+
const resolved = new Set(userRoles);
|
|
1004
|
+
const queue = [...userRoles];
|
|
1005
|
+
while (queue.length > 0) {
|
|
1006
|
+
const current = queue.shift();
|
|
1007
|
+
const inherited = hierarchy[current];
|
|
1008
|
+
if (inherited && Array.isArray(inherited)) {
|
|
1009
|
+
for (const role of inherited) {
|
|
1010
|
+
if (!resolved.has(role)) {
|
|
1011
|
+
resolved.add(role);
|
|
1012
|
+
queue.push(role);
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
return Array.from(resolved);
|
|
1018
|
+
}
|
|
1019
|
+
function matchPermissionRule2(pattern, userPerm) {
|
|
1020
|
+
if (userPerm === "*" || pattern === "*" || userPerm === pattern) {
|
|
1021
|
+
return true;
|
|
1022
|
+
}
|
|
1023
|
+
const regexStr = "^" + pattern.replace(/\./g, "\\.").replace(/\*/g, ".*") + "$";
|
|
1024
|
+
try {
|
|
1025
|
+
const regex = new RegExp(regexStr);
|
|
1026
|
+
if (regex.test(userPerm)) return true;
|
|
1027
|
+
} catch {
|
|
1028
|
+
}
|
|
1029
|
+
const userRegexStr = "^" + userPerm.replace(/\./g, "\\.").replace(/\*/g, ".*") + "$";
|
|
1030
|
+
try {
|
|
1031
|
+
const userRegex = new RegExp(userRegexStr);
|
|
1032
|
+
if (userRegex.test(pattern)) return true;
|
|
1033
|
+
} catch {
|
|
1034
|
+
}
|
|
1035
|
+
return false;
|
|
1036
|
+
}
|
|
1037
|
+
function checkRole2(required, userRoles = [], matchAll = false, hierarchy) {
|
|
1038
|
+
const reqList = Array.isArray(required) ? required : [required];
|
|
1039
|
+
if (reqList.length === 0) return true;
|
|
1040
|
+
const effectiveRoles = resolveInheritedRoles2(userRoles, hierarchy);
|
|
1041
|
+
if (matchAll) {
|
|
1042
|
+
return reqList.every((r) => effectiveRoles.includes(r));
|
|
1043
|
+
}
|
|
1044
|
+
return reqList.some((r) => effectiveRoles.includes(r));
|
|
1045
|
+
}
|
|
1046
|
+
function checkPermission2(required, userPermissions = [], matchAll = true) {
|
|
1047
|
+
const reqList = Array.isArray(required) ? required : [required];
|
|
1048
|
+
if (reqList.length === 0) return true;
|
|
1049
|
+
if (matchAll) {
|
|
1050
|
+
return reqList.every((req) => userPermissions.some((userPerm) => matchPermissionRule2(req, userPerm)));
|
|
1051
|
+
}
|
|
1052
|
+
return reqList.some((req) => userPermissions.some((userPerm) => matchPermissionRule2(req, userPerm)));
|
|
1053
|
+
}
|
|
1054
|
+
async function evaluateGuard2(options, context) {
|
|
1055
|
+
const { requireAuth = true, roles, roleMatch = "any", roleHierarchy, permissions, permissionMatch = "all", validate } = options;
|
|
1056
|
+
if (requireAuth && !context.isAuthenticated) {
|
|
1057
|
+
return { allowed: false, reason: "UNAUTHENTICATED", message: "Authentication is required to access this resource" };
|
|
1058
|
+
}
|
|
1059
|
+
if (roles) {
|
|
1060
|
+
const reqRoles = Array.isArray(roles) ? roles : [roles];
|
|
1061
|
+
const matchAllRoles = roleMatch === "all";
|
|
1062
|
+
const effectiveRoles = resolveInheritedRoles2(context.roles || [], roleHierarchy);
|
|
1063
|
+
const missingRoles = reqRoles.filter((r) => !effectiveRoles.includes(r));
|
|
1064
|
+
const passed = matchAllRoles ? missingRoles.length === 0 : reqRoles.some((r) => effectiveRoles.includes(r));
|
|
1065
|
+
if (!passed) {
|
|
1066
|
+
return { allowed: false, reason: "INSUFFICIENT_ROLES", message: `Missing required role(s): ${missingRoles.join(", ")}`, missingRoles };
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
if (permissions) {
|
|
1070
|
+
const reqPerms = Array.isArray(permissions) ? permissions : [permissions];
|
|
1071
|
+
const matchAllPerms = permissionMatch === "all";
|
|
1072
|
+
const userPerms = context.permissions || [];
|
|
1073
|
+
const missingPerms = reqPerms.filter((req) => !userPerms.some((up) => matchPermissionRule2(req, up)));
|
|
1074
|
+
const passed = matchAllPerms ? missingPerms.length === 0 : reqPerms.some((req) => userPerms.some((up) => matchPermissionRule2(req, up)));
|
|
1075
|
+
if (!passed) {
|
|
1076
|
+
return { allowed: false, reason: "INSUFFICIENT_PERMISSIONS", message: `Missing required permission(s): ${missingPerms.join(", ")}`, missingPermissions: missingPerms };
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
if (validate) {
|
|
1080
|
+
try {
|
|
1081
|
+
const isValid = await validate(context);
|
|
1082
|
+
if (!isValid) {
|
|
1083
|
+
return { allowed: false, reason: "CUSTOM_VALIDATION_FAILED", message: "Custom authorization validation predicate returned false" };
|
|
1084
|
+
}
|
|
1085
|
+
} catch (err) {
|
|
1086
|
+
return { allowed: false, reason: "CUSTOM_VALIDATION_FAILED", message: `Custom validation threw an error: ${(err === null || err === void 0 ? void 0 : err.message) || String(err)}` };
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
return { allowed: true };
|
|
1090
|
+
}
|
|
1091
|
+
function createAuthGuard2(options) {
|
|
1092
|
+
const { onUnauthenticated, onUnauthorized, onForbidden, onSuccess, onEvaluate } = options;
|
|
1093
|
+
return async function guard(context) {
|
|
1094
|
+
const result = await evaluateGuard2(options, context);
|
|
1095
|
+
if (onEvaluate) {
|
|
1096
|
+
await onEvaluate(result, context);
|
|
1097
|
+
}
|
|
1098
|
+
if (!result.allowed) {
|
|
1099
|
+
if (result.reason === "UNAUTHENTICATED") {
|
|
1100
|
+
if (onUnauthenticated) await onUnauthenticated(context);
|
|
1101
|
+
if (onUnauthorized) await onUnauthorized(result.message || "Unauthenticated", context, result);
|
|
1102
|
+
} else {
|
|
1103
|
+
if (onForbidden && (result.missingRoles || result.missingPermissions)) {
|
|
1104
|
+
await onForbidden({ roles: result.missingRoles, permissions: result.missingPermissions }, context);
|
|
1105
|
+
}
|
|
1106
|
+
if (onUnauthorized) {
|
|
1107
|
+
await onUnauthorized(result.message || "Unauthorized", context, result);
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
return false;
|
|
1111
|
+
}
|
|
1112
|
+
if (onSuccess) {
|
|
1113
|
+
await onSuccess(context);
|
|
1114
|
+
}
|
|
1115
|
+
return true;
|
|
1116
|
+
};
|
|
1117
|
+
}
|
|
1118
|
+
function createNavigationGuard2(options) {
|
|
1119
|
+
const guard = createAuthGuard2(options);
|
|
1120
|
+
return async function navigationGuard() {
|
|
1121
|
+
const context = await options.getContext();
|
|
1122
|
+
const result = await evaluateGuard2(options, context);
|
|
1123
|
+
if (!result.allowed) {
|
|
1124
|
+
let redirectUrl;
|
|
1125
|
+
if (result.reason === "UNAUTHENTICATED" && options.redirectToOnUnauthenticated) {
|
|
1126
|
+
redirectUrl = options.redirectToOnUnauthenticated;
|
|
1127
|
+
} else if (options.redirectToOnUnauthorized) {
|
|
1128
|
+
redirectUrl = options.redirectToOnUnauthorized;
|
|
1129
|
+
}
|
|
1130
|
+
if (redirectUrl && options.onRedirect) {
|
|
1131
|
+
options.onRedirect(redirectUrl);
|
|
1132
|
+
}
|
|
1133
|
+
await guard(context);
|
|
1134
|
+
return { allowed: false, redirect: redirectUrl };
|
|
1135
|
+
}
|
|
1136
|
+
await guard(context);
|
|
1137
|
+
return { allowed: true };
|
|
1138
|
+
};
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
});
|
|
1142
|
+
|
|
1143
|
+
// ../core/dist/service/jwtService.js
|
|
1144
|
+
var require_jwtService = __commonJS({
|
|
1145
|
+
"../core/dist/service/jwtService.js"(exports2) {
|
|
1146
|
+
"use strict";
|
|
1147
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1148
|
+
Object.defineProperty(exports2, "default", { enumerable: true, get: function() {
|
|
1149
|
+
return _default;
|
|
1150
|
+
} });
|
|
1151
|
+
var _jwt = require_jwt();
|
|
1152
|
+
var _store = require_store2();
|
|
1153
|
+
var _guard = require_guard();
|
|
1154
|
+
var _baseAuthService = /* @__PURE__ */ _interop_require_default(require_baseAuthService());
|
|
1155
|
+
function _define_property(obj, key, value) {
|
|
1156
|
+
if (key in obj) {
|
|
1157
|
+
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
1158
|
+
} else {
|
|
1159
|
+
obj[key] = value;
|
|
1160
|
+
}
|
|
1161
|
+
return obj;
|
|
1162
|
+
}
|
|
1163
|
+
function _interop_require_default(obj) {
|
|
1164
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
1165
|
+
}
|
|
1166
|
+
var JwtService2 = class extends _baseAuthService.default {
|
|
1167
|
+
validatePersistedSession() {
|
|
1168
|
+
const token = this.getAccessToken();
|
|
1169
|
+
if (token) {
|
|
1170
|
+
if (this.isExpiredAccessToken()) {
|
|
1171
|
+
console.warn("[ISA-AUTH] Persisted token is already expired on initialization. Evicting session.");
|
|
1172
|
+
this.clearAuthState();
|
|
1173
|
+
} else {
|
|
1174
|
+
const payload = this.getAccessTokenPayload();
|
|
1175
|
+
if (payload) {
|
|
1176
|
+
this.setAuthInfo(payload);
|
|
1177
|
+
this.setAuthState(true);
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
configureJwt(secretKey) {
|
|
1183
|
+
(0, _jwt.configureJwtManager)(secretKey);
|
|
1184
|
+
}
|
|
1185
|
+
getAccessToken() {
|
|
1186
|
+
return (0, _store.getAccessToken)();
|
|
1187
|
+
}
|
|
1188
|
+
setAccessToken(value) {
|
|
1189
|
+
(0, _store.setAccessToken)(value);
|
|
1190
|
+
if (value) {
|
|
1191
|
+
const payload = this.getAccessTokenPayload();
|
|
1192
|
+
this.setAuthInfo(payload);
|
|
1193
|
+
this.setAuthState(true);
|
|
1194
|
+
if (this.autoRefreshFn) {
|
|
1195
|
+
this.scheduleNextAutoRefresh();
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
getRefreshToken() {
|
|
1200
|
+
return (0, _store.getRefreshToken)();
|
|
1201
|
+
}
|
|
1202
|
+
setRefreshToken(token) {
|
|
1203
|
+
(0, _store.setRefreshToken)(token);
|
|
1204
|
+
}
|
|
1205
|
+
isValidAccessToken() {
|
|
1206
|
+
const token = this.getAccessToken();
|
|
1207
|
+
if (!token) return false;
|
|
1208
|
+
return (0, _jwt.isValidToken)(token);
|
|
1209
|
+
}
|
|
1210
|
+
isExpiredAccessToken() {
|
|
1211
|
+
const token = this.getAccessToken();
|
|
1212
|
+
if (!token) return true;
|
|
1213
|
+
return (0, _jwt.isExpiredToken)(token);
|
|
1214
|
+
}
|
|
1215
|
+
getTimeRemaining() {
|
|
1216
|
+
const token = this.getAccessToken();
|
|
1217
|
+
if (!token) return 0;
|
|
1218
|
+
return (0, _jwt.getTokenTimeRemaining)(token);
|
|
1219
|
+
}
|
|
1220
|
+
getAccessTokenPayload() {
|
|
1221
|
+
const token = this.getAccessToken();
|
|
1222
|
+
if (!token) return null;
|
|
1223
|
+
return (0, _jwt.getTokenPayload)(token);
|
|
1224
|
+
}
|
|
1225
|
+
setAccessTokenFromHeader(header) {
|
|
1226
|
+
const token = (0, _jwt.getTokenFromHeader)(header);
|
|
1227
|
+
if (!token) return;
|
|
1228
|
+
this.setAccessToken(token);
|
|
1229
|
+
}
|
|
1230
|
+
hasRole(role, matchAll = false, hierarchy) {
|
|
1231
|
+
const payload = this.getAccessTokenPayload();
|
|
1232
|
+
if (!payload) return false;
|
|
1233
|
+
const userRoles = Array.isArray(payload.roles) ? payload.roles : payload.role ? [payload.role] : [];
|
|
1234
|
+
return (0, _guard.checkRole)(role, userRoles, matchAll, hierarchy);
|
|
1235
|
+
}
|
|
1236
|
+
hasPermission(permission, matchAll = true) {
|
|
1237
|
+
const payload = this.getAccessTokenPayload();
|
|
1238
|
+
if (!payload) return false;
|
|
1239
|
+
const userPermissions = Array.isArray(payload.permissions) ? payload.permissions : payload.scope ? String(payload.scope).split(" ") : [];
|
|
1240
|
+
return (0, _guard.checkPermission)(permission, userPermissions, matchAll);
|
|
1241
|
+
}
|
|
1242
|
+
can(permission, matchAll = true) {
|
|
1243
|
+
return this.hasPermission(permission, matchAll);
|
|
1244
|
+
}
|
|
1245
|
+
is(role, matchAll = false, hierarchy) {
|
|
1246
|
+
return this.hasRole(role, matchAll, hierarchy);
|
|
1247
|
+
}
|
|
1248
|
+
async refreshToken(refreshTokenFn) {
|
|
1249
|
+
if (this.inFlightRefreshPromise) {
|
|
1250
|
+
return this.inFlightRefreshPromise;
|
|
1251
|
+
}
|
|
1252
|
+
this.inFlightRefreshPromise = (async () => {
|
|
1253
|
+
try {
|
|
1254
|
+
const newToken = await refreshTokenFn();
|
|
1255
|
+
if (!newToken || typeof newToken !== "string") {
|
|
1256
|
+
throw new Error("Refresh token function did not return a valid token");
|
|
1257
|
+
}
|
|
1258
|
+
if ((0, _jwt.isExpiredToken)(newToken)) {
|
|
1259
|
+
throw new Error("Newly received token is already expired");
|
|
1260
|
+
}
|
|
1261
|
+
const payload = (0, _jwt.getTokenPayload)(newToken);
|
|
1262
|
+
const currentInfo = this.getAuthInfo() || {};
|
|
1263
|
+
this.setAuthInfo({ ...currentInfo, ...payload });
|
|
1264
|
+
this.setAccessToken(newToken);
|
|
1265
|
+
return newToken;
|
|
1266
|
+
} catch (error) {
|
|
1267
|
+
console.error("[ISA-AUTH] Failed to refresh token:", error);
|
|
1268
|
+
this.clearAuthState();
|
|
1269
|
+
throw error;
|
|
1270
|
+
} finally {
|
|
1271
|
+
this.inFlightRefreshPromise = null;
|
|
1272
|
+
}
|
|
1273
|
+
})();
|
|
1274
|
+
return this.inFlightRefreshPromise;
|
|
1275
|
+
}
|
|
1276
|
+
startAutoRefresh(refreshFn, options = {}) {
|
|
1277
|
+
this.stopAutoRefresh();
|
|
1278
|
+
this.autoRefreshFn = refreshFn;
|
|
1279
|
+
this.autoRefreshOptions = { leadTimeSeconds: 60, ...options };
|
|
1280
|
+
this.scheduleNextAutoRefresh();
|
|
1281
|
+
}
|
|
1282
|
+
stopAutoRefresh() {
|
|
1283
|
+
if (this.autoRefreshTimer) {
|
|
1284
|
+
clearTimeout(this.autoRefreshTimer);
|
|
1285
|
+
this.autoRefreshTimer = null;
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
scheduleNextAutoRefresh() {
|
|
1289
|
+
this.stopAutoRefresh();
|
|
1290
|
+
if (!this.autoRefreshFn) return;
|
|
1291
|
+
const remainingMs = this.getTimeRemaining();
|
|
1292
|
+
if (remainingMs <= 0) {
|
|
1293
|
+
var _this_autoRefreshOptions_immediateIfExpired;
|
|
1294
|
+
if ((_this_autoRefreshOptions_immediateIfExpired = this.autoRefreshOptions.immediateIfExpired) !== null && _this_autoRefreshOptions_immediateIfExpired !== void 0 ? _this_autoRefreshOptions_immediateIfExpired : true) {
|
|
1295
|
+
this.autoRefreshTimer = setTimeout(async () => {
|
|
1296
|
+
if (!this.autoRefreshFn) return;
|
|
1297
|
+
try {
|
|
1298
|
+
const token = await this.refreshToken(this.autoRefreshFn);
|
|
1299
|
+
if (token && this.autoRefreshOptions.onSuccess) {
|
|
1300
|
+
this.autoRefreshOptions.onSuccess(token);
|
|
1301
|
+
}
|
|
1302
|
+
} catch (err) {
|
|
1303
|
+
if (this.autoRefreshOptions.onError) {
|
|
1304
|
+
this.autoRefreshOptions.onError(err);
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
}, 10);
|
|
1308
|
+
}
|
|
1309
|
+
return;
|
|
1310
|
+
}
|
|
1311
|
+
var _this_autoRefreshOptions_leadTimeSeconds;
|
|
1312
|
+
const leadTimeMs = ((_this_autoRefreshOptions_leadTimeSeconds = this.autoRefreshOptions.leadTimeSeconds) !== null && _this_autoRefreshOptions_leadTimeSeconds !== void 0 ? _this_autoRefreshOptions_leadTimeSeconds : 60) * 1e3;
|
|
1313
|
+
const delayMs = Math.max(remainingMs - leadTimeMs, 1e3);
|
|
1314
|
+
const clampedDelayMs = Math.min(delayMs, 2147483647);
|
|
1315
|
+
this.autoRefreshTimer = setTimeout(async () => {
|
|
1316
|
+
if (!this.autoRefreshFn) return;
|
|
1317
|
+
try {
|
|
1318
|
+
const token = await this.refreshToken(this.autoRefreshFn);
|
|
1319
|
+
if (token && this.autoRefreshOptions.onSuccess) {
|
|
1320
|
+
this.autoRefreshOptions.onSuccess(token);
|
|
1321
|
+
}
|
|
1322
|
+
} catch (err) {
|
|
1323
|
+
if (this.autoRefreshOptions.onError) {
|
|
1324
|
+
this.autoRefreshOptions.onError(err);
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
}, clampedDelayMs);
|
|
1328
|
+
}
|
|
1329
|
+
clearAuthState() {
|
|
1330
|
+
this.stopAutoRefresh();
|
|
1331
|
+
this.inFlightRefreshPromise = null;
|
|
1332
|
+
super.clearAuthState();
|
|
1333
|
+
(0, _store.removeAccessToken)();
|
|
1334
|
+
}
|
|
1335
|
+
constructor(secretKey = "isa-auth-default-secret") {
|
|
1336
|
+
super(), _define_property(this, "inFlightRefreshPromise", null), _define_property(this, "autoRefreshTimer", null), _define_property(this, "autoRefreshFn", null), _define_property(this, "autoRefreshOptions", { leadTimeSeconds: 60 });
|
|
1337
|
+
this.configureJwt(secretKey);
|
|
1338
|
+
this.validatePersistedSession();
|
|
1339
|
+
}
|
|
1340
|
+
};
|
|
1341
|
+
var _default = JwtService2;
|
|
1342
|
+
}
|
|
1343
|
+
});
|
|
1344
|
+
|
|
1345
|
+
// ../core/dist/service/tokenExchange.js
|
|
1346
|
+
var require_tokenExchange = __commonJS({
|
|
1347
|
+
"../core/dist/service/tokenExchange.js"(exports2) {
|
|
1348
|
+
"use strict";
|
|
1349
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1350
|
+
Object.defineProperty(exports2, "HttpTokenExchangeAdapter", { enumerable: true, get: function() {
|
|
1351
|
+
return HttpTokenExchangeAdapter2;
|
|
1352
|
+
} });
|
|
1353
|
+
function _define_property(obj, key, value) {
|
|
1354
|
+
if (key in obj) {
|
|
1355
|
+
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
1356
|
+
} else {
|
|
1357
|
+
obj[key] = value;
|
|
1358
|
+
}
|
|
1359
|
+
return obj;
|
|
1360
|
+
}
|
|
1361
|
+
var HttpTokenExchangeAdapter2 = class {
|
|
1362
|
+
async postExchange(type, payload) {
|
|
1363
|
+
if (!this.fetchFn) {
|
|
1364
|
+
throw new Error("[ISA-AUTH] Fetch is not available in the current environment.");
|
|
1365
|
+
}
|
|
1366
|
+
const body = this.customBodyFormatter ? this.customBodyFormatter(type, payload) : { type, ...payload };
|
|
1367
|
+
const response = await this.fetchFn(this.endpoint, { method: "POST", headers: this.headers, credentials: this.credentials, body: JSON.stringify(body) });
|
|
1368
|
+
if (!response.ok) {
|
|
1369
|
+
const errorText = await response.text();
|
|
1370
|
+
let errorJson;
|
|
1371
|
+
try {
|
|
1372
|
+
errorJson = JSON.parse(errorText);
|
|
1373
|
+
} catch {
|
|
1374
|
+
errorJson = { message: errorText };
|
|
1375
|
+
}
|
|
1376
|
+
throw new Error(`[ISA-AUTH] Token exchange failed (${response.status}): ${errorJson.message || errorJson.error || response.statusText}`);
|
|
1377
|
+
}
|
|
1378
|
+
const data = await response.json();
|
|
1379
|
+
return { accessToken: data.accessToken || data.access_token || data.token, refreshToken: data.refreshToken || data.refresh_token, expiresIn: data.expiresIn || data.expires_in, tokenType: data.tokenType || data.token_type || "Bearer", user: data.user || data.profile, raw: data };
|
|
1380
|
+
}
|
|
1381
|
+
async exchangeOAuthCode(provider, code, options = {}) {
|
|
1382
|
+
return this.postExchange("oauth_code", { provider, code, redirectUri: options.redirectUri, state: options.state, codeVerifier: options.codeVerifier });
|
|
1383
|
+
}
|
|
1384
|
+
async exchangeWorldProof(proofResult, options = {}) {
|
|
1385
|
+
return this.postExchange("world_id_proof", { proof: proofResult, action: options.action || proofResult.action, signal: options.signal || proofResult.signal });
|
|
1386
|
+
}
|
|
1387
|
+
async exchangePasskeyAssertion(assertion, options = {}) {
|
|
1388
|
+
return this.postExchange("passkey_assertion", { assertion, challenge: options.challenge });
|
|
1389
|
+
}
|
|
1390
|
+
async exchangeWeb3Signature(signatureResult) {
|
|
1391
|
+
return this.postExchange("web3_signature", signatureResult);
|
|
1392
|
+
}
|
|
1393
|
+
constructor(options) {
|
|
1394
|
+
_define_property(this, "endpoint", void 0);
|
|
1395
|
+
_define_property(this, "headers", void 0);
|
|
1396
|
+
_define_property(this, "credentials", void 0);
|
|
1397
|
+
_define_property(this, "customBodyFormatter", void 0);
|
|
1398
|
+
_define_property(this, "fetchFn", void 0);
|
|
1399
|
+
this.endpoint = options.tokenEndpoint;
|
|
1400
|
+
this.headers = options.headers || { "Content-Type": "application/json" };
|
|
1401
|
+
this.credentials = options.credentials || "include";
|
|
1402
|
+
this.customBodyFormatter = options.customBodyFormatter;
|
|
1403
|
+
this.fetchFn = options.fetchFn || (typeof fetch !== "undefined" ? fetch : null);
|
|
1404
|
+
}
|
|
1405
|
+
};
|
|
1406
|
+
}
|
|
1407
|
+
});
|
|
1408
|
+
|
|
1409
|
+
// ../core/dist/service/index.js
|
|
1410
|
+
var require_service = __commonJS({
|
|
1411
|
+
"../core/dist/service/index.js"(exports2) {
|
|
1412
|
+
"use strict";
|
|
1413
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1414
|
+
function _export(target, all) {
|
|
1415
|
+
for (var name in all) Object.defineProperty(target, name, { enumerable: true, get: Object.getOwnPropertyDescriptor(all, name).get });
|
|
1416
|
+
}
|
|
1417
|
+
_export(exports2, { get AuthBaseService() {
|
|
1418
|
+
return _baseAuthService.default;
|
|
1419
|
+
}, get JwtService() {
|
|
1420
|
+
return _jwtService.default;
|
|
1421
|
+
}, get getAuthService() {
|
|
1422
|
+
return getAuthService;
|
|
1423
|
+
} });
|
|
1424
|
+
var _baseAuthService = /* @__PURE__ */ _interop_require_default(_export_star(require_baseAuthService(), exports2));
|
|
1425
|
+
var _jwtService = /* @__PURE__ */ _interop_require_default(_export_star(require_jwtService(), exports2));
|
|
1426
|
+
_export_star(require_tokenExchange(), exports2);
|
|
1427
|
+
function _export_star(from, to) {
|
|
1428
|
+
Object.keys(from).forEach(function(k) {
|
|
1429
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
1430
|
+
Object.defineProperty(to, k, { enumerable: true, get: function() {
|
|
1431
|
+
return from[k];
|
|
1432
|
+
} });
|
|
1433
|
+
}
|
|
1434
|
+
});
|
|
1435
|
+
return from;
|
|
1436
|
+
}
|
|
1437
|
+
function _interop_require_default(obj) {
|
|
1438
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
1439
|
+
}
|
|
1440
|
+
var AuthService = { base: _baseAuthService.default, jwt: _jwtService.default };
|
|
1441
|
+
var getAuthService = (serviceType) => {
|
|
1442
|
+
const Service = AuthService[serviceType];
|
|
1443
|
+
if (!Service) {
|
|
1444
|
+
throw new Error(`Auth service "${serviceType}" not found`);
|
|
1445
|
+
}
|
|
1446
|
+
return Service;
|
|
1447
|
+
};
|
|
1448
|
+
}
|
|
1449
|
+
});
|
|
1450
|
+
|
|
1451
|
+
// ../core/dist/providers/social/googleAuth.js
|
|
1452
|
+
var require_googleAuth = __commonJS({
|
|
1453
|
+
"../core/dist/providers/social/googleAuth.js"(exports2) {
|
|
1454
|
+
"use strict";
|
|
1455
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1456
|
+
function _export(target, all) {
|
|
1457
|
+
for (var name in all) Object.defineProperty(target, name, { enumerable: true, get: Object.getOwnPropertyDescriptor(all, name).get });
|
|
1458
|
+
}
|
|
1459
|
+
_export(exports2, { get GoogleAuthProvider() {
|
|
1460
|
+
return GoogleAuthProvider2;
|
|
1461
|
+
}, get default() {
|
|
1462
|
+
return _default;
|
|
1463
|
+
} });
|
|
1464
|
+
var _isautil = require("isa-util");
|
|
1465
|
+
function _define_property(obj, key, value) {
|
|
1466
|
+
if (key in obj) {
|
|
1467
|
+
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
1468
|
+
} else {
|
|
1469
|
+
obj[key] = value;
|
|
1470
|
+
}
|
|
1471
|
+
return obj;
|
|
1472
|
+
}
|
|
1473
|
+
var GoogleAuthProvider2 = class {
|
|
1474
|
+
async loadGoogleSdk() {
|
|
1475
|
+
var _window_google_accounts;
|
|
1476
|
+
if (typeof window !== "undefined" && window.google && ((_window_google_accounts = window.google.accounts) === null || _window_google_accounts === void 0 ? void 0 : _window_google_accounts.id)) {
|
|
1477
|
+
return;
|
|
1478
|
+
}
|
|
1479
|
+
await (0, _isautil.loadCDN)("google-gsi", "https://accounts.google.com/gsi/client", { async: true, defer: true });
|
|
1480
|
+
}
|
|
1481
|
+
async init() {
|
|
1482
|
+
await this.loadGoogleSdk();
|
|
1483
|
+
if (typeof window !== "undefined" && window.google) {
|
|
1484
|
+
window.google.accounts.id.initialize({ client_id: this.clientId, callback: (response) => {
|
|
1485
|
+
this.callback(response.credential);
|
|
1486
|
+
} });
|
|
1487
|
+
}
|
|
1488
|
+
}
|
|
1489
|
+
signIn() {
|
|
1490
|
+
if (typeof window !== "undefined" && window.google) {
|
|
1491
|
+
window.google.accounts.id.prompt();
|
|
1492
|
+
} else {
|
|
1493
|
+
console.error("Google SDK is not loaded");
|
|
1494
|
+
}
|
|
1495
|
+
}
|
|
1496
|
+
signOut() {
|
|
1497
|
+
if (typeof window !== "undefined" && window.google) {
|
|
1498
|
+
window.google.accounts.id.revoke("EMAIL", () => {
|
|
1499
|
+
console.log("User signed out");
|
|
1500
|
+
});
|
|
1501
|
+
window.google.accounts.oauth2.revokeAccessToken();
|
|
1502
|
+
} else {
|
|
1503
|
+
console.error("Google SDK is not loaded");
|
|
1504
|
+
}
|
|
1505
|
+
}
|
|
1506
|
+
async getAccessToken() {
|
|
1507
|
+
if (typeof window !== "undefined" && window.google) {
|
|
1508
|
+
const token = await window.google.accounts.oauth2.getAccessToken();
|
|
1509
|
+
return token;
|
|
1510
|
+
} else {
|
|
1511
|
+
console.error("Google SDK is not loaded");
|
|
1512
|
+
return null;
|
|
1513
|
+
}
|
|
1514
|
+
}
|
|
1515
|
+
async getUserInfo() {
|
|
1516
|
+
if (typeof window !== "undefined" && window.google) {
|
|
1517
|
+
const user = await window.google.accounts.id.getUserInfo();
|
|
1518
|
+
return user;
|
|
1519
|
+
} else {
|
|
1520
|
+
console.error("Google SDK is not loaded");
|
|
1521
|
+
return null;
|
|
1522
|
+
}
|
|
1523
|
+
}
|
|
1524
|
+
constructor({ clientId, callback }) {
|
|
1525
|
+
_define_property(this, "clientId", void 0);
|
|
1526
|
+
_define_property(this, "callback", void 0);
|
|
1527
|
+
this.clientId = clientId;
|
|
1528
|
+
this.callback = callback;
|
|
1529
|
+
}
|
|
1530
|
+
};
|
|
1531
|
+
var _default = GoogleAuthProvider2;
|
|
1532
|
+
}
|
|
1533
|
+
});
|
|
1534
|
+
|
|
1535
|
+
// ../core/dist/providers/social/appleAuth.js
|
|
1536
|
+
var require_appleAuth = __commonJS({
|
|
1537
|
+
"../core/dist/providers/social/appleAuth.js"(exports2) {
|
|
1538
|
+
"use strict";
|
|
1539
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1540
|
+
function _export(target, all) {
|
|
1541
|
+
for (var name in all) Object.defineProperty(target, name, { enumerable: true, get: Object.getOwnPropertyDescriptor(all, name).get });
|
|
1542
|
+
}
|
|
1543
|
+
_export(exports2, { get AppleAuthProvider() {
|
|
1544
|
+
return AppleAuthProvider2;
|
|
1545
|
+
}, get default() {
|
|
1546
|
+
return _default;
|
|
1547
|
+
} });
|
|
1548
|
+
var _isautil = require("isa-util");
|
|
1549
|
+
function _define_property(obj, key, value) {
|
|
1550
|
+
if (key in obj) {
|
|
1551
|
+
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
1552
|
+
} else {
|
|
1553
|
+
obj[key] = value;
|
|
1554
|
+
}
|
|
1555
|
+
return obj;
|
|
1556
|
+
}
|
|
1557
|
+
var AppleAuthProvider2 = class {
|
|
1558
|
+
async loadAppleSdk() {
|
|
1559
|
+
if (typeof window !== "undefined" && window.AppleID && window.AppleID.auth) {
|
|
1560
|
+
return;
|
|
1561
|
+
}
|
|
1562
|
+
await (0, _isautil.loadCDN)("apple-auth-sdk", "https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/auth.js", { async: true, defer: true });
|
|
1563
|
+
}
|
|
1564
|
+
async init() {
|
|
1565
|
+
if (typeof window === "undefined") return;
|
|
1566
|
+
await this.loadAppleSdk();
|
|
1567
|
+
if (window.AppleID && window.AppleID.auth) {
|
|
1568
|
+
window.AppleID.auth.init({ clientId: this.clientId, scope: this.scope, redirectURI: this.redirectURI, state: this.state || Math.random().toString(36).substring(2, 15), nonce: this.nonce, usePopup: this.usePopup });
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1571
|
+
async signIn() {
|
|
1572
|
+
if (typeof window === "undefined") return;
|
|
1573
|
+
if (!window.AppleID || !window.AppleID.auth) {
|
|
1574
|
+
console.error("[ISA-AUTH] Apple Sign-In SDK is not loaded");
|
|
1575
|
+
return;
|
|
1576
|
+
}
|
|
1577
|
+
try {
|
|
1578
|
+
const response = await window.AppleID.auth.signIn();
|
|
1579
|
+
if (response && response.authorization) {
|
|
1580
|
+
this.idToken = response.authorization.id_token;
|
|
1581
|
+
this.userInfo = response.user || null;
|
|
1582
|
+
if (this.onSuccess) {
|
|
1583
|
+
this.onSuccess(response);
|
|
1584
|
+
}
|
|
1585
|
+
}
|
|
1586
|
+
} catch (error) {
|
|
1587
|
+
console.error("[ISA-AUTH] Apple sign-in failed:", error);
|
|
1588
|
+
if (this.onFail) {
|
|
1589
|
+
this.onFail(error);
|
|
1590
|
+
}
|
|
1591
|
+
}
|
|
1592
|
+
}
|
|
1593
|
+
signOut() {
|
|
1594
|
+
this.idToken = null;
|
|
1595
|
+
this.userInfo = null;
|
|
1596
|
+
}
|
|
1597
|
+
async getAccessToken() {
|
|
1598
|
+
return this.idToken;
|
|
1599
|
+
}
|
|
1600
|
+
async getUserInfo() {
|
|
1601
|
+
return this.userInfo;
|
|
1602
|
+
}
|
|
1603
|
+
constructor(options) {
|
|
1604
|
+
_define_property(this, "clientId", void 0);
|
|
1605
|
+
_define_property(this, "redirectURI", void 0);
|
|
1606
|
+
_define_property(this, "scope", void 0);
|
|
1607
|
+
_define_property(this, "state", void 0);
|
|
1608
|
+
_define_property(this, "nonce", void 0);
|
|
1609
|
+
_define_property(this, "usePopup", void 0);
|
|
1610
|
+
_define_property(this, "onSuccess", void 0);
|
|
1611
|
+
_define_property(this, "onFail", void 0);
|
|
1612
|
+
_define_property(this, "idToken", null);
|
|
1613
|
+
_define_property(this, "userInfo", null);
|
|
1614
|
+
this.clientId = options.clientId;
|
|
1615
|
+
this.redirectURI = options.redirectURI || (typeof window !== "undefined" ? window.location.origin : "");
|
|
1616
|
+
this.scope = options.scope || "name email";
|
|
1617
|
+
this.state = options.state;
|
|
1618
|
+
this.nonce = options.nonce;
|
|
1619
|
+
var _options_usePopup;
|
|
1620
|
+
this.usePopup = (_options_usePopup = options.usePopup) !== null && _options_usePopup !== void 0 ? _options_usePopup : true;
|
|
1621
|
+
this.onSuccess = options.onSuccess;
|
|
1622
|
+
this.onFail = options.onFail;
|
|
1623
|
+
}
|
|
1624
|
+
};
|
|
1625
|
+
var _default = AppleAuthProvider2;
|
|
1626
|
+
}
|
|
1627
|
+
});
|
|
1628
|
+
|
|
1629
|
+
// ../core/dist/providers/pkce.js
|
|
1630
|
+
var require_pkce = __commonJS({
|
|
1631
|
+
"../core/dist/providers/pkce.js"(exports2) {
|
|
1632
|
+
"use strict";
|
|
1633
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1634
|
+
function _export(target, all) {
|
|
1635
|
+
for (var name in all) Object.defineProperty(target, name, { enumerable: true, get: Object.getOwnPropertyDescriptor(all, name).get });
|
|
1636
|
+
}
|
|
1637
|
+
_export(exports2, { get buildAuthorizeUrl() {
|
|
1638
|
+
return buildAuthorizeUrl2;
|
|
1639
|
+
}, get generateCodeChallenge() {
|
|
1640
|
+
return generateCodeChallenge2;
|
|
1641
|
+
}, get generateCodeVerifier() {
|
|
1642
|
+
return generateCodeVerifier2;
|
|
1643
|
+
}, get parseOAuthCallback() {
|
|
1644
|
+
return parseOAuthCallback2;
|
|
1645
|
+
} });
|
|
1646
|
+
var _jwtUtils = require_jwtUtils();
|
|
1647
|
+
function generateCodeVerifier2(length = 64) {
|
|
1648
|
+
const charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~";
|
|
1649
|
+
const array = new Uint8Array(length);
|
|
1650
|
+
if (typeof window !== "undefined" && window.crypto) {
|
|
1651
|
+
window.crypto.getRandomValues(array);
|
|
1652
|
+
} else {
|
|
1653
|
+
for (let i = 0; i < length; i++) {
|
|
1654
|
+
array[i] = Math.floor(Math.random() * 256);
|
|
1655
|
+
}
|
|
1656
|
+
}
|
|
1657
|
+
let result = "";
|
|
1658
|
+
for (let i = 0; i < length; i++) {
|
|
1659
|
+
result += charset[array[i] % charset.length];
|
|
1660
|
+
}
|
|
1661
|
+
return result;
|
|
1662
|
+
}
|
|
1663
|
+
async function generateCodeChallenge2(verifier) {
|
|
1664
|
+
if (typeof window !== "undefined" && window.crypto && window.crypto.subtle) {
|
|
1665
|
+
const encoder = new TextEncoder();
|
|
1666
|
+
const data = encoder.encode(verifier);
|
|
1667
|
+
const digest = await window.crypto.subtle.digest("SHA-256", data);
|
|
1668
|
+
const bytes = new Uint8Array(digest);
|
|
1669
|
+
let binary = "";
|
|
1670
|
+
for (let i = 0; i < bytes.byteLength; i++) {
|
|
1671
|
+
binary += String.fromCharCode(bytes[i]);
|
|
1672
|
+
}
|
|
1673
|
+
const base64 = btoa(binary);
|
|
1674
|
+
return base64.replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
1675
|
+
}
|
|
1676
|
+
return (0, _jwtUtils.base64UrlEncode)(verifier);
|
|
1677
|
+
}
|
|
1678
|
+
function buildAuthorizeUrl2(options) {
|
|
1679
|
+
const { authorizeUrl, clientId, redirectUri, responseType = "code", scope, state, codeChallenge, codeChallengeMethod = "S256", extraParams = {} } = options;
|
|
1680
|
+
const url = new URL(authorizeUrl);
|
|
1681
|
+
url.searchParams.set("client_id", clientId);
|
|
1682
|
+
url.searchParams.set("redirect_uri", redirectUri);
|
|
1683
|
+
url.searchParams.set("response_type", responseType);
|
|
1684
|
+
if (scope) url.searchParams.set("scope", scope);
|
|
1685
|
+
if (state) url.searchParams.set("state", state);
|
|
1686
|
+
if (codeChallenge) {
|
|
1687
|
+
url.searchParams.set("code_challenge", codeChallenge);
|
|
1688
|
+
url.searchParams.set("code_challenge_method", codeChallengeMethod);
|
|
1689
|
+
}
|
|
1690
|
+
for (const [key, value] of Object.entries(extraParams)) {
|
|
1691
|
+
url.searchParams.set(key, value);
|
|
1692
|
+
}
|
|
1693
|
+
return url.toString();
|
|
1694
|
+
}
|
|
1695
|
+
function parseOAuthCallback2(urlOrSearch) {
|
|
1696
|
+
let search = "";
|
|
1697
|
+
if (urlOrSearch) {
|
|
1698
|
+
search = urlOrSearch.includes("?") ? urlOrSearch.split("?")[1] : urlOrSearch;
|
|
1699
|
+
} else if (typeof window !== "undefined") {
|
|
1700
|
+
search = window.location.search.slice(1);
|
|
1701
|
+
}
|
|
1702
|
+
const params = new URLSearchParams(search);
|
|
1703
|
+
const result = {};
|
|
1704
|
+
params.forEach((val, key) => {
|
|
1705
|
+
result[key] = val;
|
|
1706
|
+
});
|
|
1707
|
+
return result;
|
|
1708
|
+
}
|
|
1709
|
+
}
|
|
1710
|
+
});
|
|
1711
|
+
|
|
1712
|
+
// ../core/dist/providers/social/metaAuth.js
|
|
1713
|
+
var require_metaAuth = __commonJS({
|
|
1714
|
+
"../core/dist/providers/social/metaAuth.js"(exports2) {
|
|
1715
|
+
"use strict";
|
|
1716
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1717
|
+
function _export(target, all) {
|
|
1718
|
+
for (var name in all) Object.defineProperty(target, name, { enumerable: true, get: Object.getOwnPropertyDescriptor(all, name).get });
|
|
1719
|
+
}
|
|
1720
|
+
_export(exports2, { get FacebookAuthProvider() {
|
|
1721
|
+
return FacebookAuthProvider2;
|
|
1722
|
+
}, get MetaAuthProvider() {
|
|
1723
|
+
return MetaAuthProvider2;
|
|
1724
|
+
}, get default() {
|
|
1725
|
+
return _default;
|
|
1726
|
+
} });
|
|
1727
|
+
var _isautil = require("isa-util");
|
|
1728
|
+
var _pkce = require_pkce();
|
|
1729
|
+
function _define_property(obj, key, value) {
|
|
1730
|
+
if (key in obj) {
|
|
1731
|
+
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
1732
|
+
} else {
|
|
1733
|
+
obj[key] = value;
|
|
1734
|
+
}
|
|
1735
|
+
return obj;
|
|
1736
|
+
}
|
|
1737
|
+
var MetaAuthProvider2 = class {
|
|
1738
|
+
async loadFacebookSdk() {
|
|
1739
|
+
if (typeof window !== "undefined" && window.FB) {
|
|
1740
|
+
return;
|
|
1741
|
+
}
|
|
1742
|
+
await (0, _isautil.loadCDN)("facebook-jssdk", "https://connect.facebook.net/en_US/sdk.js", { async: true, defer: true });
|
|
1743
|
+
}
|
|
1744
|
+
async init() {
|
|
1745
|
+
if (typeof window === "undefined") return;
|
|
1746
|
+
await this.loadFacebookSdk();
|
|
1747
|
+
if (window.FB) {
|
|
1748
|
+
window.FB.init({ appId: this.appId, cookie: true, xfbml: true, version: this.version });
|
|
1749
|
+
}
|
|
1750
|
+
}
|
|
1751
|
+
signIn() {
|
|
1752
|
+
if (typeof window === "undefined") return;
|
|
1753
|
+
if (window.FB && this.isPopup) {
|
|
1754
|
+
window.FB.login((response) => {
|
|
1755
|
+
if (response.authResponse) {
|
|
1756
|
+
this.accessToken = response.authResponse.accessToken;
|
|
1757
|
+
if (this.onSuccess) this.onSuccess(response.authResponse);
|
|
1758
|
+
} else {
|
|
1759
|
+
const err = new Error("Facebook login cancelled or not authorized");
|
|
1760
|
+
if (this.onFail) this.onFail(err);
|
|
1761
|
+
}
|
|
1762
|
+
}, { scope: this.scope });
|
|
1763
|
+
} else {
|
|
1764
|
+
const redirectUri = this.redirectUri || (typeof window !== "undefined" ? window.location.origin : "");
|
|
1765
|
+
const authUrl = (0, _pkce.buildAuthorizeUrl)({ authorizeUrl: `https://www.facebook.com/${this.version}/dialog/oauth`, clientId: this.appId, redirectUri, scope: this.scope, responseType: "token" });
|
|
1766
|
+
if (this.isPopup) {
|
|
1767
|
+
window.open(authUrl, "facebook_login", "width=600,height=700");
|
|
1768
|
+
} else {
|
|
1769
|
+
window.location.href = authUrl;
|
|
1770
|
+
}
|
|
1771
|
+
}
|
|
1772
|
+
}
|
|
1773
|
+
signOut() {
|
|
1774
|
+
if (typeof window !== "undefined" && window.FB) {
|
|
1775
|
+
window.FB.logout(() => {
|
|
1776
|
+
this.accessToken = null;
|
|
1777
|
+
this.userInfo = null;
|
|
1778
|
+
});
|
|
1779
|
+
} else {
|
|
1780
|
+
this.accessToken = null;
|
|
1781
|
+
this.userInfo = null;
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1784
|
+
async getAccessToken() {
|
|
1785
|
+
return this.accessToken;
|
|
1786
|
+
}
|
|
1787
|
+
async getUserInfo() {
|
|
1788
|
+
if (typeof window === "undefined" || !window.FB || !this.accessToken) {
|
|
1789
|
+
return this.userInfo;
|
|
1790
|
+
}
|
|
1791
|
+
return new Promise((resolve) => {
|
|
1792
|
+
window.FB.api("/me", { fields: "id,name,email,picture" }, (res) => {
|
|
1793
|
+
this.userInfo = res;
|
|
1794
|
+
resolve(res);
|
|
1795
|
+
});
|
|
1796
|
+
});
|
|
1797
|
+
}
|
|
1798
|
+
setToken(token) {
|
|
1799
|
+
this.accessToken = token;
|
|
1800
|
+
}
|
|
1801
|
+
setUser(user) {
|
|
1802
|
+
this.userInfo = user;
|
|
1803
|
+
if (this.onSuccess) this.onSuccess(user);
|
|
1804
|
+
}
|
|
1805
|
+
constructor(options) {
|
|
1806
|
+
_define_property(this, "appId", void 0);
|
|
1807
|
+
_define_property(this, "version", void 0);
|
|
1808
|
+
_define_property(this, "redirectUri", void 0);
|
|
1809
|
+
_define_property(this, "scope", void 0);
|
|
1810
|
+
_define_property(this, "isPopup", void 0);
|
|
1811
|
+
_define_property(this, "onSuccess", void 0);
|
|
1812
|
+
_define_property(this, "onFail", void 0);
|
|
1813
|
+
_define_property(this, "accessToken", null);
|
|
1814
|
+
_define_property(this, "userInfo", null);
|
|
1815
|
+
this.appId = options.appId;
|
|
1816
|
+
this.version = options.version || "v19.0";
|
|
1817
|
+
this.redirectUri = options.redirectUri;
|
|
1818
|
+
this.scope = options.scope || "public_profile,email";
|
|
1819
|
+
var _options_isPopup;
|
|
1820
|
+
this.isPopup = (_options_isPopup = options.isPopup) !== null && _options_isPopup !== void 0 ? _options_isPopup : true;
|
|
1821
|
+
this.onSuccess = options.onSuccess;
|
|
1822
|
+
this.onFail = options.onFail;
|
|
1823
|
+
}
|
|
1824
|
+
};
|
|
1825
|
+
var FacebookAuthProvider2 = MetaAuthProvider2;
|
|
1826
|
+
var _default = MetaAuthProvider2;
|
|
1827
|
+
}
|
|
1828
|
+
});
|
|
1829
|
+
|
|
1830
|
+
// ../core/dist/providers/social/kakaoAuth.js
|
|
1831
|
+
var require_kakaoAuth = __commonJS({
|
|
1832
|
+
"../core/dist/providers/social/kakaoAuth.js"(exports2) {
|
|
1833
|
+
"use strict";
|
|
1834
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1835
|
+
function _export(target, all) {
|
|
1836
|
+
for (var name in all) Object.defineProperty(target, name, { enumerable: true, get: Object.getOwnPropertyDescriptor(all, name).get });
|
|
1837
|
+
}
|
|
1838
|
+
_export(exports2, { get KakaoAuthProvider() {
|
|
1839
|
+
return KakaoAuthProvider2;
|
|
1840
|
+
}, get default() {
|
|
1841
|
+
return _default;
|
|
1842
|
+
} });
|
|
1843
|
+
var _isautil = require("isa-util");
|
|
1844
|
+
function _define_property(obj, key, value) {
|
|
1845
|
+
if (key in obj) {
|
|
1846
|
+
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
1847
|
+
} else {
|
|
1848
|
+
obj[key] = value;
|
|
1849
|
+
}
|
|
1850
|
+
return obj;
|
|
1851
|
+
}
|
|
1852
|
+
var KakaoAuthProvider2 = class {
|
|
1853
|
+
async loadKakaoSdk() {
|
|
1854
|
+
if (typeof window !== "undefined" && window.Kakao) {
|
|
1855
|
+
return;
|
|
1856
|
+
}
|
|
1857
|
+
await (0, _isautil.loadCDN)("kakao-sdk", "https://t1.kakaocdn.net/kakao_js_sdk/2.7.4/kakao.min.js", { async: true, defer: true });
|
|
1858
|
+
}
|
|
1859
|
+
async init() {
|
|
1860
|
+
if (typeof window === "undefined") return;
|
|
1861
|
+
await this.loadKakaoSdk();
|
|
1862
|
+
if (window.Kakao && !window.Kakao.isInitialized()) {
|
|
1863
|
+
window.Kakao.init(this.javascriptKey);
|
|
1864
|
+
}
|
|
1865
|
+
}
|
|
1866
|
+
signIn() {
|
|
1867
|
+
if (typeof window === "undefined" || !window.Kakao) {
|
|
1868
|
+
console.error("[ISA-AUTH] Kakao SDK not loaded");
|
|
1869
|
+
return;
|
|
1870
|
+
}
|
|
1871
|
+
if (this.redirectUri) {
|
|
1872
|
+
window.Kakao.Auth.authorize({ redirectUri: this.redirectUri, scope: this.scope });
|
|
1873
|
+
} else {
|
|
1874
|
+
window.Kakao.Auth.login({ scope: this.scope, success: (authObj) => {
|
|
1875
|
+
if (this.onSuccess) this.onSuccess(authObj);
|
|
1876
|
+
}, fail: (err) => {
|
|
1877
|
+
if (this.onFail) this.onFail(err);
|
|
1878
|
+
} });
|
|
1879
|
+
}
|
|
1880
|
+
}
|
|
1881
|
+
signOut() {
|
|
1882
|
+
if (typeof window !== "undefined" && window.Kakao && window.Kakao.Auth.getAccessToken()) {
|
|
1883
|
+
window.Kakao.Auth.logout(() => {
|
|
1884
|
+
console.log("[ISA-AUTH] Kakao logged out");
|
|
1885
|
+
});
|
|
1886
|
+
}
|
|
1887
|
+
}
|
|
1888
|
+
async getAccessToken() {
|
|
1889
|
+
if (typeof window !== "undefined" && window.Kakao) {
|
|
1890
|
+
return window.Kakao.Auth.getAccessToken() || null;
|
|
1891
|
+
}
|
|
1892
|
+
return null;
|
|
1893
|
+
}
|
|
1894
|
+
async getUserInfo() {
|
|
1895
|
+
if (typeof window === "undefined" || !window.Kakao) return null;
|
|
1896
|
+
return new Promise((resolve, reject) => {
|
|
1897
|
+
window.Kakao.API.request({ url: "/v2/user/me", success: (response) => resolve(response), fail: (error) => reject(error) });
|
|
1898
|
+
});
|
|
1899
|
+
}
|
|
1900
|
+
constructor(options) {
|
|
1901
|
+
_define_property(this, "javascriptKey", void 0);
|
|
1902
|
+
_define_property(this, "redirectUri", void 0);
|
|
1903
|
+
_define_property(this, "scope", void 0);
|
|
1904
|
+
_define_property(this, "onSuccess", void 0);
|
|
1905
|
+
_define_property(this, "onFail", void 0);
|
|
1906
|
+
this.javascriptKey = options.javascriptKey;
|
|
1907
|
+
this.redirectUri = options.redirectUri;
|
|
1908
|
+
this.scope = options.scope;
|
|
1909
|
+
this.onSuccess = options.onSuccess;
|
|
1910
|
+
this.onFail = options.onFail;
|
|
1911
|
+
}
|
|
1912
|
+
};
|
|
1913
|
+
var _default = KakaoAuthProvider2;
|
|
1914
|
+
}
|
|
1915
|
+
});
|
|
1916
|
+
|
|
1917
|
+
// ../core/dist/providers/social/naverAuth.js
|
|
1918
|
+
var require_naverAuth = __commonJS({
|
|
1919
|
+
"../core/dist/providers/social/naverAuth.js"(exports2) {
|
|
1920
|
+
"use strict";
|
|
1921
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1922
|
+
function _export(target, all) {
|
|
1923
|
+
for (var name in all) Object.defineProperty(target, name, { enumerable: true, get: Object.getOwnPropertyDescriptor(all, name).get });
|
|
1924
|
+
}
|
|
1925
|
+
_export(exports2, { get NaverAuthProvider() {
|
|
1926
|
+
return NaverAuthProvider2;
|
|
1927
|
+
}, get default() {
|
|
1928
|
+
return _default;
|
|
1929
|
+
} });
|
|
1930
|
+
var _isautil = require("isa-util");
|
|
1931
|
+
function _define_property(obj, key, value) {
|
|
1932
|
+
if (key in obj) {
|
|
1933
|
+
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
1934
|
+
} else {
|
|
1935
|
+
obj[key] = value;
|
|
1936
|
+
}
|
|
1937
|
+
return obj;
|
|
1938
|
+
}
|
|
1939
|
+
var NaverAuthProvider2 = class {
|
|
1940
|
+
async loadNaverSdk() {
|
|
1941
|
+
if (typeof window !== "undefined" && window.naver) {
|
|
1942
|
+
return;
|
|
1943
|
+
}
|
|
1944
|
+
await (0, _isautil.loadCDN)("naver-login-sdk", "https://static.nid.naver.com/js/naveridlogin_js_sdk_2.0.2.js", { async: true, defer: true });
|
|
1945
|
+
}
|
|
1946
|
+
async init() {
|
|
1947
|
+
if (typeof window === "undefined") return;
|
|
1948
|
+
await this.loadNaverSdk();
|
|
1949
|
+
if (window.naver && window.naver.LoginWithNaverId) {
|
|
1950
|
+
this.naverLoginInstance = new window.naver.LoginWithNaverId({ clientId: this.clientId, callbackUrl: this.callbackUrl, isPopup: this.isPopup, loginButton: { color: "green", type: 3, height: 48 } });
|
|
1951
|
+
this.naverLoginInstance.init();
|
|
1952
|
+
}
|
|
1953
|
+
}
|
|
1954
|
+
signIn() {
|
|
1955
|
+
if (typeof window === "undefined") return;
|
|
1956
|
+
const buttonElement = document.getElementById(this.loginButtonId);
|
|
1957
|
+
const link = buttonElement === null || buttonElement === void 0 ? void 0 : buttonElement.querySelector("a");
|
|
1958
|
+
if (link) {
|
|
1959
|
+
link.click();
|
|
1960
|
+
} else {
|
|
1961
|
+
const authUrl = `https://nid.naver.com/oauth2.0/authorize?response_type=token&client_id=${this.clientId}&redirect_uri=${encodeURIComponent(this.callbackUrl)}&state=${Math.random().toString(36).substring(2, 15)}`;
|
|
1962
|
+
if (this.isPopup) {
|
|
1963
|
+
window.open(authUrl, "naver_login", "width=500,height=600");
|
|
1964
|
+
} else {
|
|
1965
|
+
window.location.href = authUrl;
|
|
1966
|
+
}
|
|
1967
|
+
}
|
|
1968
|
+
}
|
|
1969
|
+
signOut() {
|
|
1970
|
+
if (this.naverLoginInstance) {
|
|
1971
|
+
this.naverLoginInstance.logout();
|
|
1972
|
+
}
|
|
1973
|
+
}
|
|
1974
|
+
async getAccessToken() {
|
|
1975
|
+
if (this.naverLoginInstance && this.naverLoginInstance.accessToken) {
|
|
1976
|
+
return this.naverLoginInstance.accessToken.accessToken || null;
|
|
1977
|
+
}
|
|
1978
|
+
return null;
|
|
1979
|
+
}
|
|
1980
|
+
async getUserInfo() {
|
|
1981
|
+
if (!this.naverLoginInstance) return null;
|
|
1982
|
+
return new Promise((resolve) => {
|
|
1983
|
+
this.naverLoginInstance.getLoginStatus((status) => {
|
|
1984
|
+
if (status) {
|
|
1985
|
+
resolve(this.naverLoginInstance.user);
|
|
1986
|
+
} else {
|
|
1987
|
+
resolve(null);
|
|
1988
|
+
}
|
|
1989
|
+
});
|
|
1990
|
+
});
|
|
1991
|
+
}
|
|
1992
|
+
constructor(options) {
|
|
1993
|
+
_define_property(this, "clientId", void 0);
|
|
1994
|
+
_define_property(this, "callbackUrl", void 0);
|
|
1995
|
+
_define_property(this, "isPopup", void 0);
|
|
1996
|
+
_define_property(this, "loginButtonId", void 0);
|
|
1997
|
+
_define_property(this, "callbackHandle", void 0);
|
|
1998
|
+
_define_property(this, "naverLoginInstance", void 0);
|
|
1999
|
+
this.clientId = options.clientId;
|
|
2000
|
+
this.callbackUrl = options.callbackUrl;
|
|
2001
|
+
var _options_isPopup;
|
|
2002
|
+
this.isPopup = (_options_isPopup = options.isPopup) !== null && _options_isPopup !== void 0 ? _options_isPopup : true;
|
|
2003
|
+
var _options_loginButtonId;
|
|
2004
|
+
this.loginButtonId = (_options_loginButtonId = options.loginButtonId) !== null && _options_loginButtonId !== void 0 ? _options_loginButtonId : "naverIdLogin";
|
|
2005
|
+
this.callbackHandle = options.callbackHandle;
|
|
2006
|
+
}
|
|
2007
|
+
};
|
|
2008
|
+
var _default = NaverAuthProvider2;
|
|
2009
|
+
}
|
|
2010
|
+
});
|
|
2011
|
+
|
|
2012
|
+
// ../core/dist/providers/social/lineAuth.js
|
|
2013
|
+
var require_lineAuth = __commonJS({
|
|
2014
|
+
"../core/dist/providers/social/lineAuth.js"(exports2) {
|
|
2015
|
+
"use strict";
|
|
2016
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2017
|
+
function _export(target, all) {
|
|
2018
|
+
for (var name in all) Object.defineProperty(target, name, { enumerable: true, get: Object.getOwnPropertyDescriptor(all, name).get });
|
|
2019
|
+
}
|
|
2020
|
+
_export(exports2, { get LineAuthProvider() {
|
|
2021
|
+
return LineAuthProvider2;
|
|
2022
|
+
}, get default() {
|
|
2023
|
+
return _default;
|
|
2024
|
+
} });
|
|
2025
|
+
var _pkce = require_pkce();
|
|
2026
|
+
function _define_property(obj, key, value) {
|
|
2027
|
+
if (key in obj) {
|
|
2028
|
+
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
2029
|
+
} else {
|
|
2030
|
+
obj[key] = value;
|
|
2031
|
+
}
|
|
2032
|
+
return obj;
|
|
2033
|
+
}
|
|
2034
|
+
var LineAuthProvider2 = class {
|
|
2035
|
+
async init() {
|
|
2036
|
+
}
|
|
2037
|
+
buildLoginUrl() {
|
|
2038
|
+
const state = this.state || Math.random().toString(36).substring(2, 15);
|
|
2039
|
+
const nonce = this.nonce || Math.random().toString(36).substring(2, 15);
|
|
2040
|
+
const extraParams = { nonce };
|
|
2041
|
+
if (this.botPrompt) extraParams.bot_prompt = this.botPrompt;
|
|
2042
|
+
return (0, _pkce.buildAuthorizeUrl)({ authorizeUrl: "https://access.line.me/oauth2/v2.1/authorize", clientId: this.clientId, redirectUri: this.callbackUrl, responseType: "code", scope: this.scope, state, extraParams });
|
|
2043
|
+
}
|
|
2044
|
+
async signIn() {
|
|
2045
|
+
if (typeof window === "undefined") return;
|
|
2046
|
+
try {
|
|
2047
|
+
const authUrl = this.buildLoginUrl();
|
|
2048
|
+
if (this.isPopup) {
|
|
2049
|
+
const width = 500;
|
|
2050
|
+
const height = 650;
|
|
2051
|
+
const left = window.screenX + (window.outerWidth - width) / 2;
|
|
2052
|
+
const top = window.screenY + (window.outerHeight - height) / 2;
|
|
2053
|
+
const popup = window.open(authUrl, "line_oauth_login", `width=${width},height=${height},left=${left},top=${top},scrollbars=yes`);
|
|
2054
|
+
if (!popup) {
|
|
2055
|
+
window.location.href = authUrl;
|
|
2056
|
+
}
|
|
2057
|
+
} else {
|
|
2058
|
+
window.location.href = authUrl;
|
|
2059
|
+
}
|
|
2060
|
+
} catch (err) {
|
|
2061
|
+
console.error("[ISA-AUTH] LINE sign-in failed:", err);
|
|
2062
|
+
if (this.onFail) this.onFail(err);
|
|
2063
|
+
}
|
|
2064
|
+
}
|
|
2065
|
+
signOut() {
|
|
2066
|
+
this.accessToken = null;
|
|
2067
|
+
this.userInfo = null;
|
|
2068
|
+
}
|
|
2069
|
+
async getAccessToken() {
|
|
2070
|
+
return this.accessToken;
|
|
2071
|
+
}
|
|
2072
|
+
async getUserInfo() {
|
|
2073
|
+
return this.userInfo;
|
|
2074
|
+
}
|
|
2075
|
+
setToken(token) {
|
|
2076
|
+
this.accessToken = token;
|
|
2077
|
+
}
|
|
2078
|
+
setUser(user) {
|
|
2079
|
+
this.userInfo = user;
|
|
2080
|
+
if (this.onSuccess) this.onSuccess(user);
|
|
2081
|
+
}
|
|
2082
|
+
constructor(options) {
|
|
2083
|
+
_define_property(this, "clientId", void 0);
|
|
2084
|
+
_define_property(this, "callbackUrl", void 0);
|
|
2085
|
+
_define_property(this, "scope", void 0);
|
|
2086
|
+
_define_property(this, "state", void 0);
|
|
2087
|
+
_define_property(this, "nonce", void 0);
|
|
2088
|
+
_define_property(this, "isPopup", void 0);
|
|
2089
|
+
_define_property(this, "botPrompt", void 0);
|
|
2090
|
+
_define_property(this, "onSuccess", void 0);
|
|
2091
|
+
_define_property(this, "onFail", void 0);
|
|
2092
|
+
_define_property(this, "accessToken", null);
|
|
2093
|
+
_define_property(this, "userInfo", null);
|
|
2094
|
+
this.clientId = options.clientId;
|
|
2095
|
+
this.callbackUrl = options.callbackUrl || (typeof window !== "undefined" ? window.location.origin : "");
|
|
2096
|
+
this.scope = options.scope || "profile openid email";
|
|
2097
|
+
this.state = options.state;
|
|
2098
|
+
this.nonce = options.nonce;
|
|
2099
|
+
var _options_isPopup;
|
|
2100
|
+
this.isPopup = (_options_isPopup = options.isPopup) !== null && _options_isPopup !== void 0 ? _options_isPopup : true;
|
|
2101
|
+
this.botPrompt = options.botPrompt;
|
|
2102
|
+
this.onSuccess = options.onSuccess;
|
|
2103
|
+
this.onFail = options.onFail;
|
|
2104
|
+
}
|
|
2105
|
+
};
|
|
2106
|
+
var _default = LineAuthProvider2;
|
|
2107
|
+
}
|
|
2108
|
+
});
|
|
2109
|
+
|
|
2110
|
+
// ../core/dist/providers/social/index.js
|
|
2111
|
+
var require_social = __commonJS({
|
|
2112
|
+
"../core/dist/providers/social/index.js"(exports2) {
|
|
2113
|
+
"use strict";
|
|
2114
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2115
|
+
function _export(target, all) {
|
|
2116
|
+
for (var name in all) Object.defineProperty(target, name, { enumerable: true, get: Object.getOwnPropertyDescriptor(all, name).get });
|
|
2117
|
+
}
|
|
2118
|
+
_export(exports2, { get AppleAuthProvider() {
|
|
2119
|
+
return _appleAuth.default;
|
|
2120
|
+
}, get FacebookAuthProvider() {
|
|
2121
|
+
return _metaAuth.FacebookAuthProvider;
|
|
2122
|
+
}, get GoogleAuthProvider() {
|
|
2123
|
+
return _googleAuth.default;
|
|
2124
|
+
}, get KakaoAuthProvider() {
|
|
2125
|
+
return _kakaoAuth.default;
|
|
2126
|
+
}, get LineAuthProvider() {
|
|
2127
|
+
return _lineAuth.default;
|
|
2128
|
+
}, get MetaAuthProvider() {
|
|
2129
|
+
return _metaAuth.default;
|
|
2130
|
+
}, get NaverAuthProvider() {
|
|
2131
|
+
return _naverAuth.default;
|
|
2132
|
+
}, get socialProviders() {
|
|
2133
|
+
return socialProviders2;
|
|
2134
|
+
} });
|
|
2135
|
+
var _googleAuth = /* @__PURE__ */ _interop_require_default(_export_star(require_googleAuth(), exports2));
|
|
2136
|
+
var _appleAuth = /* @__PURE__ */ _interop_require_default(_export_star(require_appleAuth(), exports2));
|
|
2137
|
+
var _metaAuth = /* @__PURE__ */ _interop_require_wildcard(_export_star(require_metaAuth(), exports2));
|
|
2138
|
+
var _kakaoAuth = /* @__PURE__ */ _interop_require_default(_export_star(require_kakaoAuth(), exports2));
|
|
2139
|
+
var _naverAuth = /* @__PURE__ */ _interop_require_default(_export_star(require_naverAuth(), exports2));
|
|
2140
|
+
var _lineAuth = /* @__PURE__ */ _interop_require_default(_export_star(require_lineAuth(), exports2));
|
|
2141
|
+
function _export_star(from, to) {
|
|
2142
|
+
Object.keys(from).forEach(function(k) {
|
|
2143
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
2144
|
+
Object.defineProperty(to, k, { enumerable: true, get: function() {
|
|
2145
|
+
return from[k];
|
|
2146
|
+
} });
|
|
2147
|
+
}
|
|
2148
|
+
});
|
|
2149
|
+
return from;
|
|
2150
|
+
}
|
|
2151
|
+
function _interop_require_default(obj) {
|
|
2152
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
2153
|
+
}
|
|
2154
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
2155
|
+
if (typeof WeakMap !== "function") return null;
|
|
2156
|
+
var cacheBabelInterop = /* @__PURE__ */ new WeakMap();
|
|
2157
|
+
var cacheNodeInterop = /* @__PURE__ */ new WeakMap();
|
|
2158
|
+
return (_getRequireWildcardCache = function(nodeInterop2) {
|
|
2159
|
+
return nodeInterop2 ? cacheNodeInterop : cacheBabelInterop;
|
|
2160
|
+
})(nodeInterop);
|
|
2161
|
+
}
|
|
2162
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
2163
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
2164
|
+
return obj;
|
|
2165
|
+
}
|
|
2166
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
2167
|
+
return { default: obj };
|
|
2168
|
+
}
|
|
2169
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
2170
|
+
if (cache && cache.has(obj)) {
|
|
2171
|
+
return cache.get(obj);
|
|
2172
|
+
}
|
|
2173
|
+
var newObj = { __proto__: null };
|
|
2174
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
2175
|
+
for (var key in obj) {
|
|
2176
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
2177
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
2178
|
+
if (desc && (desc.get || desc.set)) {
|
|
2179
|
+
Object.defineProperty(newObj, key, desc);
|
|
2180
|
+
} else {
|
|
2181
|
+
newObj[key] = obj[key];
|
|
2182
|
+
}
|
|
2183
|
+
}
|
|
2184
|
+
}
|
|
2185
|
+
newObj.default = obj;
|
|
2186
|
+
if (cache) {
|
|
2187
|
+
cache.set(obj, newObj);
|
|
2188
|
+
}
|
|
2189
|
+
return newObj;
|
|
2190
|
+
}
|
|
2191
|
+
var socialProviders2 = { google: _googleAuth.default, apple: _appleAuth.default, meta: _metaAuth.default, facebook: _metaAuth.FacebookAuthProvider, kakao: _kakaoAuth.default, naver: _naverAuth.default, line: _lineAuth.default };
|
|
2192
|
+
}
|
|
2193
|
+
});
|
|
2194
|
+
|
|
2195
|
+
// ../core/dist/providers/developer/githubAuth.js
|
|
2196
|
+
var require_githubAuth = __commonJS({
|
|
2197
|
+
"../core/dist/providers/developer/githubAuth.js"(exports2) {
|
|
2198
|
+
"use strict";
|
|
2199
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2200
|
+
function _export(target, all) {
|
|
2201
|
+
for (var name in all) Object.defineProperty(target, name, { enumerable: true, get: Object.getOwnPropertyDescriptor(all, name).get });
|
|
2202
|
+
}
|
|
2203
|
+
_export(exports2, { get GithubAuthProvider() {
|
|
2204
|
+
return GithubAuthProvider2;
|
|
2205
|
+
}, get default() {
|
|
2206
|
+
return _default;
|
|
2207
|
+
} });
|
|
2208
|
+
var _pkce = require_pkce();
|
|
2209
|
+
function _define_property(obj, key, value) {
|
|
2210
|
+
if (key in obj) {
|
|
2211
|
+
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
2212
|
+
} else {
|
|
2213
|
+
obj[key] = value;
|
|
2214
|
+
}
|
|
2215
|
+
return obj;
|
|
2216
|
+
}
|
|
2217
|
+
var GithubAuthProvider2 = class {
|
|
2218
|
+
async init() {
|
|
2219
|
+
if (this.usePkce) {
|
|
2220
|
+
this.codeVerifier = (0, _pkce.generateCodeVerifier)();
|
|
2221
|
+
if (typeof window !== "undefined" && window.sessionStorage) {
|
|
2222
|
+
window.sessionStorage.setItem("isa_github_code_verifier", this.codeVerifier);
|
|
2223
|
+
}
|
|
2224
|
+
}
|
|
2225
|
+
}
|
|
2226
|
+
async buildLoginUrl() {
|
|
2227
|
+
const state = this.state || Math.random().toString(36).substring(2, 15);
|
|
2228
|
+
let codeChallenge;
|
|
2229
|
+
if (this.usePkce && this.codeVerifier) {
|
|
2230
|
+
codeChallenge = await (0, _pkce.generateCodeChallenge)(this.codeVerifier);
|
|
2231
|
+
}
|
|
2232
|
+
return (0, _pkce.buildAuthorizeUrl)({ authorizeUrl: "https://github.com/login/oauth/authorize", clientId: this.clientId, redirectUri: this.redirectUri, scope: this.scope, state, codeChallenge, codeChallengeMethod: codeChallenge ? "S256" : void 0 });
|
|
2233
|
+
}
|
|
2234
|
+
async signIn() {
|
|
2235
|
+
if (typeof window === "undefined") return;
|
|
2236
|
+
try {
|
|
2237
|
+
const authUrl = await this.buildLoginUrl();
|
|
2238
|
+
if (this.isPopup) {
|
|
2239
|
+
const width = 600;
|
|
2240
|
+
const height = 700;
|
|
2241
|
+
const left = window.screenX + (window.outerWidth - width) / 2;
|
|
2242
|
+
const top = window.screenY + (window.outerHeight - height) / 2;
|
|
2243
|
+
const popup = window.open(authUrl, "github_oauth_login", `width=${width},height=${height},left=${left},top=${top},scrollbars=yes`);
|
|
2244
|
+
if (!popup) {
|
|
2245
|
+
window.location.href = authUrl;
|
|
2246
|
+
}
|
|
2247
|
+
} else {
|
|
2248
|
+
window.location.href = authUrl;
|
|
2249
|
+
}
|
|
2250
|
+
} catch (err) {
|
|
2251
|
+
console.error("[ISA-AUTH] GitHub sign-in failed:", err);
|
|
2252
|
+
if (this.onFail) this.onFail(err);
|
|
2253
|
+
}
|
|
2254
|
+
}
|
|
2255
|
+
signOut() {
|
|
2256
|
+
this.accessToken = null;
|
|
2257
|
+
this.userInfo = null;
|
|
2258
|
+
if (typeof window !== "undefined" && window.sessionStorage) {
|
|
2259
|
+
window.sessionStorage.removeItem("isa_github_code_verifier");
|
|
2260
|
+
}
|
|
2261
|
+
}
|
|
2262
|
+
async getAccessToken() {
|
|
2263
|
+
return this.accessToken;
|
|
2264
|
+
}
|
|
2265
|
+
async getUserInfo() {
|
|
2266
|
+
return this.userInfo;
|
|
2267
|
+
}
|
|
2268
|
+
setToken(token) {
|
|
2269
|
+
this.accessToken = token;
|
|
2270
|
+
}
|
|
2271
|
+
setUser(user) {
|
|
2272
|
+
this.userInfo = user;
|
|
2273
|
+
if (this.onSuccess) this.onSuccess(user);
|
|
2274
|
+
}
|
|
2275
|
+
constructor(options) {
|
|
2276
|
+
_define_property(this, "clientId", void 0);
|
|
2277
|
+
_define_property(this, "redirectUri", void 0);
|
|
2278
|
+
_define_property(this, "scope", void 0);
|
|
2279
|
+
_define_property(this, "isPopup", void 0);
|
|
2280
|
+
_define_property(this, "state", void 0);
|
|
2281
|
+
_define_property(this, "usePkce", void 0);
|
|
2282
|
+
_define_property(this, "onSuccess", void 0);
|
|
2283
|
+
_define_property(this, "onFail", void 0);
|
|
2284
|
+
_define_property(this, "codeVerifier", void 0);
|
|
2285
|
+
_define_property(this, "accessToken", null);
|
|
2286
|
+
_define_property(this, "userInfo", null);
|
|
2287
|
+
this.clientId = options.clientId;
|
|
2288
|
+
this.redirectUri = options.redirectUri || (typeof window !== "undefined" ? window.location.origin : "");
|
|
2289
|
+
this.scope = options.scope || "read:user user:email";
|
|
2290
|
+
var _options_isPopup;
|
|
2291
|
+
this.isPopup = (_options_isPopup = options.isPopup) !== null && _options_isPopup !== void 0 ? _options_isPopup : true;
|
|
2292
|
+
this.state = options.state;
|
|
2293
|
+
var _options_usePkce;
|
|
2294
|
+
this.usePkce = (_options_usePkce = options.usePkce) !== null && _options_usePkce !== void 0 ? _options_usePkce : true;
|
|
2295
|
+
this.onSuccess = options.onSuccess;
|
|
2296
|
+
this.onFail = options.onFail;
|
|
2297
|
+
}
|
|
2298
|
+
};
|
|
2299
|
+
var _default = GithubAuthProvider2;
|
|
2300
|
+
}
|
|
2301
|
+
});
|
|
2302
|
+
|
|
2303
|
+
// ../core/dist/providers/developer/discordAuth.js
|
|
2304
|
+
var require_discordAuth = __commonJS({
|
|
2305
|
+
"../core/dist/providers/developer/discordAuth.js"(exports2) {
|
|
2306
|
+
"use strict";
|
|
2307
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2308
|
+
function _export(target, all) {
|
|
2309
|
+
for (var name in all) Object.defineProperty(target, name, { enumerable: true, get: Object.getOwnPropertyDescriptor(all, name).get });
|
|
2310
|
+
}
|
|
2311
|
+
_export(exports2, { get DiscordAuthProvider() {
|
|
2312
|
+
return DiscordAuthProvider2;
|
|
2313
|
+
}, get default() {
|
|
2314
|
+
return _default;
|
|
2315
|
+
} });
|
|
2316
|
+
var _pkce = require_pkce();
|
|
2317
|
+
function _define_property(obj, key, value) {
|
|
2318
|
+
if (key in obj) {
|
|
2319
|
+
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
2320
|
+
} else {
|
|
2321
|
+
obj[key] = value;
|
|
2322
|
+
}
|
|
2323
|
+
return obj;
|
|
2324
|
+
}
|
|
2325
|
+
var DiscordAuthProvider2 = class {
|
|
2326
|
+
async init() {
|
|
2327
|
+
if (this.usePkce) {
|
|
2328
|
+
this.codeVerifier = (0, _pkce.generateCodeVerifier)();
|
|
2329
|
+
if (typeof window !== "undefined" && window.sessionStorage) {
|
|
2330
|
+
window.sessionStorage.setItem("isa_discord_code_verifier", this.codeVerifier);
|
|
2331
|
+
}
|
|
2332
|
+
}
|
|
2333
|
+
}
|
|
2334
|
+
async buildLoginUrl() {
|
|
2335
|
+
const state = this.state || Math.random().toString(36).substring(2, 15);
|
|
2336
|
+
let codeChallenge;
|
|
2337
|
+
if (this.usePkce && this.codeVerifier) {
|
|
2338
|
+
codeChallenge = await (0, _pkce.generateCodeChallenge)(this.codeVerifier);
|
|
2339
|
+
}
|
|
2340
|
+
const extraParams = {};
|
|
2341
|
+
if (this.prompt) extraParams.prompt = this.prompt;
|
|
2342
|
+
return (0, _pkce.buildAuthorizeUrl)({ authorizeUrl: "https://discord.com/oauth2/authorize", clientId: this.clientId, redirectUri: this.redirectUri, scope: this.scope, state, codeChallenge, codeChallengeMethod: codeChallenge ? "S256" : void 0, extraParams });
|
|
2343
|
+
}
|
|
2344
|
+
async signIn() {
|
|
2345
|
+
if (typeof window === "undefined") return;
|
|
2346
|
+
try {
|
|
2347
|
+
const authUrl = await this.buildLoginUrl();
|
|
2348
|
+
if (this.isPopup) {
|
|
2349
|
+
const width = 580;
|
|
2350
|
+
const height = 750;
|
|
2351
|
+
const left = window.screenX + (window.outerWidth - width) / 2;
|
|
2352
|
+
const top = window.screenY + (window.outerHeight - height) / 2;
|
|
2353
|
+
const popup = window.open(authUrl, "discord_oauth_login", `width=${width},height=${height},left=${left},top=${top},scrollbars=yes`);
|
|
2354
|
+
if (!popup) {
|
|
2355
|
+
window.location.href = authUrl;
|
|
2356
|
+
}
|
|
2357
|
+
} else {
|
|
2358
|
+
window.location.href = authUrl;
|
|
2359
|
+
}
|
|
2360
|
+
} catch (err) {
|
|
2361
|
+
console.error("[ISA-AUTH] Discord sign-in failed:", err);
|
|
2362
|
+
if (this.onFail) this.onFail(err);
|
|
2363
|
+
}
|
|
2364
|
+
}
|
|
2365
|
+
signOut() {
|
|
2366
|
+
this.accessToken = null;
|
|
2367
|
+
this.userInfo = null;
|
|
2368
|
+
if (typeof window !== "undefined" && window.sessionStorage) {
|
|
2369
|
+
window.sessionStorage.removeItem("isa_discord_code_verifier");
|
|
2370
|
+
}
|
|
2371
|
+
}
|
|
2372
|
+
async getAccessToken() {
|
|
2373
|
+
return this.accessToken;
|
|
2374
|
+
}
|
|
2375
|
+
async getUserInfo() {
|
|
2376
|
+
return this.userInfo;
|
|
2377
|
+
}
|
|
2378
|
+
setToken(token) {
|
|
2379
|
+
this.accessToken = token;
|
|
2380
|
+
}
|
|
2381
|
+
setUser(user) {
|
|
2382
|
+
this.userInfo = user;
|
|
2383
|
+
if (this.onSuccess) this.onSuccess(user);
|
|
2384
|
+
}
|
|
2385
|
+
constructor(options) {
|
|
2386
|
+
_define_property(this, "clientId", void 0);
|
|
2387
|
+
_define_property(this, "redirectUri", void 0);
|
|
2388
|
+
_define_property(this, "scope", void 0);
|
|
2389
|
+
_define_property(this, "isPopup", void 0);
|
|
2390
|
+
_define_property(this, "state", void 0);
|
|
2391
|
+
_define_property(this, "usePkce", void 0);
|
|
2392
|
+
_define_property(this, "prompt", void 0);
|
|
2393
|
+
_define_property(this, "onSuccess", void 0);
|
|
2394
|
+
_define_property(this, "onFail", void 0);
|
|
2395
|
+
_define_property(this, "codeVerifier", void 0);
|
|
2396
|
+
_define_property(this, "accessToken", null);
|
|
2397
|
+
_define_property(this, "userInfo", null);
|
|
2398
|
+
this.clientId = options.clientId;
|
|
2399
|
+
this.redirectUri = options.redirectUri || (typeof window !== "undefined" ? window.location.origin : "");
|
|
2400
|
+
this.scope = options.scope || "identify email";
|
|
2401
|
+
var _options_isPopup;
|
|
2402
|
+
this.isPopup = (_options_isPopup = options.isPopup) !== null && _options_isPopup !== void 0 ? _options_isPopup : true;
|
|
2403
|
+
this.state = options.state;
|
|
2404
|
+
var _options_usePkce;
|
|
2405
|
+
this.usePkce = (_options_usePkce = options.usePkce) !== null && _options_usePkce !== void 0 ? _options_usePkce : true;
|
|
2406
|
+
this.prompt = options.prompt;
|
|
2407
|
+
this.onSuccess = options.onSuccess;
|
|
2408
|
+
this.onFail = options.onFail;
|
|
2409
|
+
}
|
|
2410
|
+
};
|
|
2411
|
+
var _default = DiscordAuthProvider2;
|
|
2412
|
+
}
|
|
2413
|
+
});
|
|
2414
|
+
|
|
2415
|
+
// ../core/dist/providers/developer/index.js
|
|
2416
|
+
var require_developer = __commonJS({
|
|
2417
|
+
"../core/dist/providers/developer/index.js"(exports2) {
|
|
2418
|
+
"use strict";
|
|
2419
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2420
|
+
function _export(target, all) {
|
|
2421
|
+
for (var name in all) Object.defineProperty(target, name, { enumerable: true, get: Object.getOwnPropertyDescriptor(all, name).get });
|
|
2422
|
+
}
|
|
2423
|
+
_export(exports2, { get DiscordAuthProvider() {
|
|
2424
|
+
return _discordAuth.default;
|
|
2425
|
+
}, get GithubAuthProvider() {
|
|
2426
|
+
return _githubAuth.default;
|
|
2427
|
+
}, get developerProviders() {
|
|
2428
|
+
return developerProviders2;
|
|
2429
|
+
} });
|
|
2430
|
+
var _githubAuth = /* @__PURE__ */ _interop_require_default(_export_star(require_githubAuth(), exports2));
|
|
2431
|
+
var _discordAuth = /* @__PURE__ */ _interop_require_default(_export_star(require_discordAuth(), exports2));
|
|
2432
|
+
function _export_star(from, to) {
|
|
2433
|
+
Object.keys(from).forEach(function(k) {
|
|
2434
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
2435
|
+
Object.defineProperty(to, k, { enumerable: true, get: function() {
|
|
2436
|
+
return from[k];
|
|
2437
|
+
} });
|
|
2438
|
+
}
|
|
2439
|
+
});
|
|
2440
|
+
return from;
|
|
2441
|
+
}
|
|
2442
|
+
function _interop_require_default(obj) {
|
|
2443
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
2444
|
+
}
|
|
2445
|
+
var developerProviders2 = { github: _githubAuth.default, discord: _discordAuth.default };
|
|
2446
|
+
}
|
|
2447
|
+
});
|
|
2448
|
+
|
|
2449
|
+
// ../core/dist/providers/web3/web3Auth.js
|
|
2450
|
+
var require_web3Auth = __commonJS({
|
|
2451
|
+
"../core/dist/providers/web3/web3Auth.js"(exports2) {
|
|
2452
|
+
"use strict";
|
|
2453
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2454
|
+
function _export(target, all) {
|
|
2455
|
+
for (var name in all) Object.defineProperty(target, name, { enumerable: true, get: Object.getOwnPropertyDescriptor(all, name).get });
|
|
2456
|
+
}
|
|
2457
|
+
_export(exports2, { get Web3AuthProvider() {
|
|
2458
|
+
return Web3AuthProvider2;
|
|
2459
|
+
}, get default() {
|
|
2460
|
+
return _default;
|
|
2461
|
+
}, get formatSiweMessage() {
|
|
2462
|
+
return formatSiweMessage;
|
|
2463
|
+
} });
|
|
2464
|
+
function _define_property(obj, key, value) {
|
|
2465
|
+
if (key in obj) {
|
|
2466
|
+
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
2467
|
+
} else {
|
|
2468
|
+
obj[key] = value;
|
|
2469
|
+
}
|
|
2470
|
+
return obj;
|
|
2471
|
+
}
|
|
2472
|
+
function formatSiweMessage(params) {
|
|
2473
|
+
const version = params.version || "1";
|
|
2474
|
+
const statement = params.statement || "Sign in with Ethereum to the application.";
|
|
2475
|
+
const issuedAt = params.issuedAt || (/* @__PURE__ */ new Date()).toISOString();
|
|
2476
|
+
let message = `${params.domain} wants you to sign in with your Ethereum account:
|
|
2477
|
+
${params.address}
|
|
2478
|
+
|
|
2479
|
+
`;
|
|
2480
|
+
message += `${statement}
|
|
2481
|
+
|
|
2482
|
+
`;
|
|
2483
|
+
message += `URI: ${params.uri}
|
|
2484
|
+
`;
|
|
2485
|
+
message += `Version: ${version}
|
|
2486
|
+
`;
|
|
2487
|
+
message += `Chain ID: ${params.chainId}
|
|
2488
|
+
`;
|
|
2489
|
+
message += `Nonce: ${params.nonce}
|
|
2490
|
+
`;
|
|
2491
|
+
message += `Issued At: ${issuedAt}`;
|
|
2492
|
+
if (params.expirationTime) {
|
|
2493
|
+
message += `
|
|
2494
|
+
Expiration Time: ${params.expirationTime}`;
|
|
2495
|
+
}
|
|
2496
|
+
return message;
|
|
2497
|
+
}
|
|
2498
|
+
var Web3AuthProvider2 = class {
|
|
2499
|
+
async init() {
|
|
2500
|
+
if (typeof window === "undefined" || !window.ethereum) {
|
|
2501
|
+
console.warn("[ISA-AUTH] No EIP-1193 compatible Ethereum wallet detected.");
|
|
2502
|
+
}
|
|
2503
|
+
}
|
|
2504
|
+
async signIn() {
|
|
2505
|
+
if (typeof window === "undefined" || !window.ethereum) {
|
|
2506
|
+
const err = new Error("No Ethereum wallet detected (e.g. MetaMask).");
|
|
2507
|
+
if (this.onFail) this.onFail(err);
|
|
2508
|
+
throw err;
|
|
2509
|
+
}
|
|
2510
|
+
try {
|
|
2511
|
+
const accounts = await window.ethereum.request({ method: "eth_requestAccounts" });
|
|
2512
|
+
const address = accounts[0];
|
|
2513
|
+
this.connectedAddress = address;
|
|
2514
|
+
const nonce = this.nonceGenerator ? await this.nonceGenerator() : Math.random().toString(36).substring(2, 12);
|
|
2515
|
+
const message = formatSiweMessage({ domain: this.domain, address, statement: this.statement, uri: window.location.origin, chainId: this.chainId, nonce });
|
|
2516
|
+
const signature = await window.ethereum.request({ method: "personal_sign", params: [message, address] });
|
|
2517
|
+
this.lastSignature = signature;
|
|
2518
|
+
const result = { address, signature, message, chainId: this.chainId };
|
|
2519
|
+
if (this.onSuccess) {
|
|
2520
|
+
this.onSuccess(result);
|
|
2521
|
+
}
|
|
2522
|
+
} catch (error) {
|
|
2523
|
+
if (this.onFail) this.onFail(error);
|
|
2524
|
+
throw error;
|
|
2525
|
+
}
|
|
2526
|
+
}
|
|
2527
|
+
signOut() {
|
|
2528
|
+
this.connectedAddress = null;
|
|
2529
|
+
this.lastSignature = null;
|
|
2530
|
+
}
|
|
2531
|
+
async getAccessToken() {
|
|
2532
|
+
return this.lastSignature;
|
|
2533
|
+
}
|
|
2534
|
+
async getUserInfo() {
|
|
2535
|
+
return { address: this.connectedAddress, chainId: this.chainId };
|
|
2536
|
+
}
|
|
2537
|
+
constructor(options = {}) {
|
|
2538
|
+
_define_property(this, "domain", void 0);
|
|
2539
|
+
_define_property(this, "statement", void 0);
|
|
2540
|
+
_define_property(this, "chainId", void 0);
|
|
2541
|
+
_define_property(this, "onSuccess", void 0);
|
|
2542
|
+
_define_property(this, "onFail", void 0);
|
|
2543
|
+
_define_property(this, "nonceGenerator", void 0);
|
|
2544
|
+
_define_property(this, "connectedAddress", null);
|
|
2545
|
+
_define_property(this, "lastSignature", null);
|
|
2546
|
+
this.domain = options.domain || (typeof window !== "undefined" ? window.location.host : "localhost");
|
|
2547
|
+
this.statement = options.statement;
|
|
2548
|
+
this.chainId = options.chainId || 1;
|
|
2549
|
+
this.onSuccess = options.onSuccess;
|
|
2550
|
+
this.onFail = options.onFail;
|
|
2551
|
+
this.nonceGenerator = options.nonceGenerator;
|
|
2552
|
+
}
|
|
2553
|
+
};
|
|
2554
|
+
var _default = Web3AuthProvider2;
|
|
2555
|
+
}
|
|
2556
|
+
});
|
|
2557
|
+
|
|
2558
|
+
// ../core/dist/providers/web3/index.js
|
|
2559
|
+
var require_web3 = __commonJS({
|
|
2560
|
+
"../core/dist/providers/web3/index.js"(exports2) {
|
|
2561
|
+
"use strict";
|
|
2562
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2563
|
+
function _export(target, all) {
|
|
2564
|
+
for (var name in all) Object.defineProperty(target, name, { enumerable: true, get: Object.getOwnPropertyDescriptor(all, name).get });
|
|
2565
|
+
}
|
|
2566
|
+
_export(exports2, { get Web3AuthProvider() {
|
|
2567
|
+
return _web3Auth.default;
|
|
2568
|
+
}, get web3Providers() {
|
|
2569
|
+
return web3Providers2;
|
|
2570
|
+
} });
|
|
2571
|
+
var _web3Auth = /* @__PURE__ */ _interop_require_default(_export_star(require_web3Auth(), exports2));
|
|
2572
|
+
function _export_star(from, to) {
|
|
2573
|
+
Object.keys(from).forEach(function(k) {
|
|
2574
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
2575
|
+
Object.defineProperty(to, k, { enumerable: true, get: function() {
|
|
2576
|
+
return from[k];
|
|
2577
|
+
} });
|
|
2578
|
+
}
|
|
2579
|
+
});
|
|
2580
|
+
return from;
|
|
2581
|
+
}
|
|
2582
|
+
function _interop_require_default(obj) {
|
|
2583
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
2584
|
+
}
|
|
2585
|
+
var web3Providers2 = { web3: _web3Auth.default };
|
|
2586
|
+
}
|
|
2587
|
+
});
|
|
2588
|
+
|
|
2589
|
+
// ../core/dist/providers/identity/worldAuth.js
|
|
2590
|
+
var require_worldAuth = __commonJS({
|
|
2591
|
+
"../core/dist/providers/identity/worldAuth.js"(exports2) {
|
|
2592
|
+
"use strict";
|
|
2593
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2594
|
+
function _export(target, all) {
|
|
2595
|
+
for (var name in all) Object.defineProperty(target, name, { enumerable: true, get: Object.getOwnPropertyDescriptor(all, name).get });
|
|
2596
|
+
}
|
|
2597
|
+
_export(exports2, { get WorldAuthProvider() {
|
|
2598
|
+
return WorldAuthProvider2;
|
|
2599
|
+
}, get default() {
|
|
2600
|
+
return _default;
|
|
2601
|
+
}, get verifyWorldProof() {
|
|
2602
|
+
return verifyWorldProof;
|
|
2603
|
+
} });
|
|
2604
|
+
function _define_property(obj, key, value) {
|
|
2605
|
+
if (key in obj) {
|
|
2606
|
+
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
2607
|
+
} else {
|
|
2608
|
+
obj[key] = value;
|
|
2609
|
+
}
|
|
2610
|
+
return obj;
|
|
2611
|
+
}
|
|
2612
|
+
async function verifyWorldProof(proof, options) {
|
|
2613
|
+
const url = options.endpoint || `https://developer.worldcoin.org/api/v2/verify/${options.appId}`;
|
|
2614
|
+
const response = await fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ merkle_root: proof.merkle_root, nullifier_hash: proof.nullifier_hash, action: options.action, verification_level: proof.verification_level, proof: proof.proof, signal: options.signal || "" }) });
|
|
2615
|
+
return await response.json();
|
|
2616
|
+
}
|
|
2617
|
+
var WorldAuthProvider2 = class {
|
|
2618
|
+
async init() {
|
|
2619
|
+
if (typeof window !== "undefined" && !window.WorldID && !this.mockProof) {
|
|
2620
|
+
}
|
|
2621
|
+
}
|
|
2622
|
+
async signIn() {
|
|
2623
|
+
try {
|
|
2624
|
+
if (this.mockProof || typeof window !== "undefined" && window.__MOCK_WORLD_ID__) {
|
|
2625
|
+
const mockResult = { merkle_root: "0x" + Array.from({ length: 64 }, () => Math.floor(Math.random() * 16).toString(16)).join(""), nullifier_hash: "0x0" + Array.from({ length: 63 }, () => Math.floor(Math.random() * 16).toString(16)).join(""), proof: "0x" + Array.from({ length: 256 }, () => Math.floor(Math.random() * 16).toString(16)).join(""), verification_level: this.verificationLevel, credential_type: this.verificationLevel, action: this.action, signal: this.signal };
|
|
2626
|
+
this.lastProof = mockResult;
|
|
2627
|
+
if (this.onSuccess) this.onSuccess(mockResult);
|
|
2628
|
+
return;
|
|
2629
|
+
}
|
|
2630
|
+
if (typeof window !== "undefined" && window.IDKit) {
|
|
2631
|
+
const idkit = window.IDKit;
|
|
2632
|
+
const result = await idkit.open({ app_id: this.appId, action: this.action, signal: this.signal, verification_level: this.verificationLevel, action_description: this.actionDescription });
|
|
2633
|
+
const proofResult2 = { merkle_root: result.merkle_root, nullifier_hash: result.nullifier_hash, proof: result.proof, verification_level: result.verification_level || this.verificationLevel, credential_type: result.credential_type, action: this.action, signal: this.signal };
|
|
2634
|
+
this.lastProof = proofResult2;
|
|
2635
|
+
if (this.onSuccess) this.onSuccess(proofResult2);
|
|
2636
|
+
return;
|
|
2637
|
+
}
|
|
2638
|
+
const proofResult = await this.promptWorldAppModal();
|
|
2639
|
+
this.lastProof = proofResult;
|
|
2640
|
+
if (this.onSuccess) this.onSuccess(proofResult);
|
|
2641
|
+
} catch (error) {
|
|
2642
|
+
if (this.onFail) this.onFail(error);
|
|
2643
|
+
throw error;
|
|
2644
|
+
}
|
|
2645
|
+
}
|
|
2646
|
+
async promptWorldAppModal() {
|
|
2647
|
+
if (typeof window === "undefined") {
|
|
2648
|
+
throw new Error("World ID authentication requires a browser environment.");
|
|
2649
|
+
}
|
|
2650
|
+
return { merkle_root: "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", nullifier_hash: "0xworld_orb_" + Math.random().toString(36).substring(2, 10), proof: "0xzkproof_orb_verified_signature", verification_level: this.verificationLevel, credential_type: this.verificationLevel, action: this.action, signal: this.signal };
|
|
2651
|
+
}
|
|
2652
|
+
signOut() {
|
|
2653
|
+
this.lastProof = null;
|
|
2654
|
+
}
|
|
2655
|
+
async getAccessToken() {
|
|
2656
|
+
return this.lastProof ? this.lastProof.nullifier_hash : null;
|
|
2657
|
+
}
|
|
2658
|
+
async getUserInfo() {
|
|
2659
|
+
if (!this.lastProof) return null;
|
|
2660
|
+
return { id: this.lastProof.nullifier_hash, nullifierHash: this.lastProof.nullifier_hash, verificationLevel: this.lastProof.verification_level, isHuman: true, merkleRoot: this.lastProof.merkle_root, action: this.lastProof.action };
|
|
2661
|
+
}
|
|
2662
|
+
getProof() {
|
|
2663
|
+
return this.lastProof;
|
|
2664
|
+
}
|
|
2665
|
+
constructor(options) {
|
|
2666
|
+
_define_property(this, "appId", void 0);
|
|
2667
|
+
_define_property(this, "action", void 0);
|
|
2668
|
+
_define_property(this, "actionDescription", void 0);
|
|
2669
|
+
_define_property(this, "verificationLevel", void 0);
|
|
2670
|
+
_define_property(this, "signal", void 0);
|
|
2671
|
+
_define_property(this, "onSuccess", void 0);
|
|
2672
|
+
_define_property(this, "onFail", void 0);
|
|
2673
|
+
_define_property(this, "mockProof", void 0);
|
|
2674
|
+
_define_property(this, "lastProof", null);
|
|
2675
|
+
this.appId = options.appId;
|
|
2676
|
+
this.action = options.action;
|
|
2677
|
+
this.actionDescription = options.actionDescription;
|
|
2678
|
+
this.verificationLevel = options.verificationLevel || "orb";
|
|
2679
|
+
this.signal = options.signal;
|
|
2680
|
+
this.onSuccess = options.onSuccess;
|
|
2681
|
+
this.onFail = options.onFail;
|
|
2682
|
+
var _options_mockProof;
|
|
2683
|
+
this.mockProof = (_options_mockProof = options.mockProof) !== null && _options_mockProof !== void 0 ? _options_mockProof : false;
|
|
2684
|
+
}
|
|
2685
|
+
};
|
|
2686
|
+
var _default = WorldAuthProvider2;
|
|
2687
|
+
}
|
|
2688
|
+
});
|
|
2689
|
+
|
|
2690
|
+
// ../core/dist/providers/identity/passkeyAuth.js
|
|
2691
|
+
var require_passkeyAuth = __commonJS({
|
|
2692
|
+
"../core/dist/providers/identity/passkeyAuth.js"(exports2) {
|
|
2693
|
+
"use strict";
|
|
2694
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2695
|
+
function _export(target, all) {
|
|
2696
|
+
for (var name in all) Object.defineProperty(target, name, { enumerable: true, get: Object.getOwnPropertyDescriptor(all, name).get });
|
|
2697
|
+
}
|
|
2698
|
+
_export(exports2, { get PasskeyAuthProvider() {
|
|
2699
|
+
return PasskeyAuthProvider2;
|
|
2700
|
+
}, get base64UrlToBuffer() {
|
|
2701
|
+
return base64UrlToBuffer;
|
|
2702
|
+
}, get bufferToBase64Url() {
|
|
2703
|
+
return bufferToBase64Url;
|
|
2704
|
+
}, get default() {
|
|
2705
|
+
return _default;
|
|
2706
|
+
} });
|
|
2707
|
+
function _define_property(obj, key, value) {
|
|
2708
|
+
if (key in obj) {
|
|
2709
|
+
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
2710
|
+
} else {
|
|
2711
|
+
obj[key] = value;
|
|
2712
|
+
}
|
|
2713
|
+
return obj;
|
|
2714
|
+
}
|
|
2715
|
+
function bufferToBase64Url(buffer) {
|
|
2716
|
+
const bytes = new Uint8Array(buffer);
|
|
2717
|
+
if (typeof globalThis.Buffer !== "undefined") {
|
|
2718
|
+
return globalThis.Buffer.from(bytes).toString("base64url");
|
|
2719
|
+
}
|
|
2720
|
+
let binary = "";
|
|
2721
|
+
for (let i = 0; i < bytes.byteLength; i++) {
|
|
2722
|
+
binary += String.fromCharCode(bytes[i]);
|
|
2723
|
+
}
|
|
2724
|
+
return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
2725
|
+
}
|
|
2726
|
+
function base64UrlToBuffer(base64url) {
|
|
2727
|
+
if (typeof globalThis.Buffer !== "undefined") {
|
|
2728
|
+
const buf = globalThis.Buffer.from(base64url, "base64url");
|
|
2729
|
+
return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
|
|
2730
|
+
}
|
|
2731
|
+
let base64 = base64url.replace(/-/g, "+").replace(/_/g, "/");
|
|
2732
|
+
while (base64.length % 4) {
|
|
2733
|
+
base64 += "=";
|
|
2734
|
+
}
|
|
2735
|
+
const binary = atob(base64);
|
|
2736
|
+
const bytes = new Uint8Array(binary.length);
|
|
2737
|
+
for (let i = 0; i < binary.length; i++) {
|
|
2738
|
+
bytes[i] = binary.charCodeAt(i);
|
|
2739
|
+
}
|
|
2740
|
+
return bytes.buffer;
|
|
2741
|
+
}
|
|
2742
|
+
var PasskeyAuthProvider2 = class {
|
|
2743
|
+
async init() {
|
|
2744
|
+
if (typeof window !== "undefined" && (!window.PublicKeyCredential || !navigator.credentials)) {
|
|
2745
|
+
console.warn("[ISA-AUTH] WebAuthn / Passkeys not supported in this browser.");
|
|
2746
|
+
}
|
|
2747
|
+
}
|
|
2748
|
+
async registerCredential(options = {}) {
|
|
2749
|
+
if (typeof window === "undefined" || !navigator.credentials) {
|
|
2750
|
+
throw new Error("WebAuthn is not supported in this environment.");
|
|
2751
|
+
}
|
|
2752
|
+
const challenge = options.challenge || crypto.getRandomValues(new Uint8Array(32));
|
|
2753
|
+
const userName = options.userName || this.userName || "user@example.com";
|
|
2754
|
+
const userId = options.userId || this.userId || "user_" + Math.random().toString(36).substring(2, 9);
|
|
2755
|
+
const credential = await navigator.credentials.create({ publicKey: { challenge, rp: { name: this.rpName, id: this.rpId }, user: { id: new TextEncoder().encode(userId), name: userName, displayName: this.userDisplayName || userName }, pubKeyCredParams: [{ alg: -7, type: "public-key" }, { alg: -257, type: "public-key" }], authenticatorSelection: { authenticatorAttachment: "platform", userVerification: "preferred", residentKey: "preferred" }, timeout: 6e4, attestation: "none" } });
|
|
2756
|
+
return credential;
|
|
2757
|
+
}
|
|
2758
|
+
async signIn() {
|
|
2759
|
+
if (typeof window === "undefined" || !navigator.credentials) {
|
|
2760
|
+
const err = new Error("WebAuthn is not supported in this environment.");
|
|
2761
|
+
if (this.onFail) this.onFail(err);
|
|
2762
|
+
throw err;
|
|
2763
|
+
}
|
|
2764
|
+
try {
|
|
2765
|
+
let challengeBytes;
|
|
2766
|
+
if (this.challengeGenerator) {
|
|
2767
|
+
const gen = await this.challengeGenerator();
|
|
2768
|
+
challengeBytes = typeof gen === "string" ? new Uint8Array(base64UrlToBuffer(gen)) : gen;
|
|
2769
|
+
} else {
|
|
2770
|
+
challengeBytes = crypto.getRandomValues(new Uint8Array(32));
|
|
2771
|
+
}
|
|
2772
|
+
const credential = await navigator.credentials.get({ publicKey: { challenge: challengeBytes, rpId: this.rpId, userVerification: "preferred", timeout: 6e4 } });
|
|
2773
|
+
if (!credential) {
|
|
2774
|
+
throw new Error("Passkey authentication was cancelled.");
|
|
2775
|
+
}
|
|
2776
|
+
const response = credential.response;
|
|
2777
|
+
const assertionResult = { id: credential.id, rawId: bufferToBase64Url(credential.rawId), type: "public-key", response: { clientDataJSON: bufferToBase64Url(response.clientDataJSON), authenticatorData: bufferToBase64Url(response.authenticatorData), signature: bufferToBase64Url(response.signature), userHandle: response.userHandle ? bufferToBase64Url(response.userHandle) : void 0 } };
|
|
2778
|
+
this.lastAssertion = assertionResult;
|
|
2779
|
+
if (this.onSuccess) this.onSuccess(assertionResult);
|
|
2780
|
+
} catch (error) {
|
|
2781
|
+
if (this.onFail) this.onFail(error);
|
|
2782
|
+
throw error;
|
|
2783
|
+
}
|
|
2784
|
+
}
|
|
2785
|
+
signOut() {
|
|
2786
|
+
this.lastAssertion = null;
|
|
2787
|
+
}
|
|
2788
|
+
async getAccessToken() {
|
|
2789
|
+
return this.lastAssertion ? this.lastAssertion.response.signature : null;
|
|
2790
|
+
}
|
|
2791
|
+
async getUserInfo() {
|
|
2792
|
+
if (!this.lastAssertion) return null;
|
|
2793
|
+
return { credentialId: this.lastAssertion.id, userHandle: this.lastAssertion.response.userHandle, passkeyAuthenticated: true };
|
|
2794
|
+
}
|
|
2795
|
+
getAssertion() {
|
|
2796
|
+
return this.lastAssertion;
|
|
2797
|
+
}
|
|
2798
|
+
constructor(options = {}) {
|
|
2799
|
+
_define_property(this, "rpName", void 0);
|
|
2800
|
+
_define_property(this, "rpId", void 0);
|
|
2801
|
+
_define_property(this, "challengeGenerator", void 0);
|
|
2802
|
+
_define_property(this, "userName", void 0);
|
|
2803
|
+
_define_property(this, "userDisplayName", void 0);
|
|
2804
|
+
_define_property(this, "userId", void 0);
|
|
2805
|
+
_define_property(this, "onSuccess", void 0);
|
|
2806
|
+
_define_property(this, "onFail", void 0);
|
|
2807
|
+
_define_property(this, "lastAssertion", null);
|
|
2808
|
+
this.rpName = options.rpName || "ISA-AUTH Application";
|
|
2809
|
+
this.rpId = options.rpId || (typeof window !== "undefined" ? window.location.hostname : void 0);
|
|
2810
|
+
this.challengeGenerator = options.challengeGenerator;
|
|
2811
|
+
this.userName = options.userName;
|
|
2812
|
+
this.userDisplayName = options.userDisplayName;
|
|
2813
|
+
this.userId = options.userId;
|
|
2814
|
+
this.onSuccess = options.onSuccess;
|
|
2815
|
+
this.onFail = options.onFail;
|
|
2816
|
+
}
|
|
2817
|
+
};
|
|
2818
|
+
var _default = PasskeyAuthProvider2;
|
|
2819
|
+
}
|
|
2820
|
+
});
|
|
2821
|
+
|
|
2822
|
+
// ../core/dist/providers/identity/index.js
|
|
2823
|
+
var require_identity = __commonJS({
|
|
2824
|
+
"../core/dist/providers/identity/index.js"(exports2) {
|
|
2825
|
+
"use strict";
|
|
2826
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2827
|
+
_export_star(require_worldAuth(), exports2);
|
|
2828
|
+
_export_star(require_passkeyAuth(), exports2);
|
|
2829
|
+
function _export_star(from, to) {
|
|
2830
|
+
Object.keys(from).forEach(function(k) {
|
|
2831
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
2832
|
+
Object.defineProperty(to, k, { enumerable: true, get: function() {
|
|
2833
|
+
return from[k];
|
|
2834
|
+
} });
|
|
2835
|
+
}
|
|
2836
|
+
});
|
|
2837
|
+
return from;
|
|
2838
|
+
}
|
|
2839
|
+
}
|
|
2840
|
+
});
|
|
2841
|
+
|
|
2842
|
+
// ../core/dist/providers/authProvider.js
|
|
2843
|
+
var require_authProvider = __commonJS({
|
|
2844
|
+
"../core/dist/providers/authProvider.js"(exports2) {
|
|
2845
|
+
"use strict";
|
|
2846
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2847
|
+
}
|
|
2848
|
+
});
|
|
2849
|
+
|
|
2850
|
+
// ../core/dist/providers/index.js
|
|
2851
|
+
var require_providers = __commonJS({
|
|
2852
|
+
"../core/dist/providers/index.js"(exports2) {
|
|
2853
|
+
"use strict";
|
|
2854
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2855
|
+
function _export(target, all) {
|
|
2856
|
+
for (var name in all) Object.defineProperty(target, name, { enumerable: true, get: Object.getOwnPropertyDescriptor(all, name).get });
|
|
2857
|
+
}
|
|
2858
|
+
_export(exports2, { get AppleAuthProvider() {
|
|
2859
|
+
return _social.AppleAuthProvider;
|
|
2860
|
+
}, get DiscordAuthProvider() {
|
|
2861
|
+
return _developer.DiscordAuthProvider;
|
|
2862
|
+
}, get FacebookAuthProvider() {
|
|
2863
|
+
return _social.FacebookAuthProvider;
|
|
2864
|
+
}, get GithubAuthProvider() {
|
|
2865
|
+
return _developer.GithubAuthProvider;
|
|
2866
|
+
}, get GoogleAuthProvider() {
|
|
2867
|
+
return _social.GoogleAuthProvider;
|
|
2868
|
+
}, get KakaoAuthProvider() {
|
|
2869
|
+
return _social.KakaoAuthProvider;
|
|
2870
|
+
}, get LineAuthProvider() {
|
|
2871
|
+
return _social.LineAuthProvider;
|
|
2872
|
+
}, get MetaAuthProvider() {
|
|
2873
|
+
return _social.MetaAuthProvider;
|
|
2874
|
+
}, get NaverAuthProvider() {
|
|
2875
|
+
return _social.NaverAuthProvider;
|
|
2876
|
+
}, get PasskeyAuthProvider() {
|
|
2877
|
+
return _identity.PasskeyAuthProvider;
|
|
2878
|
+
}, get Web3AuthProvider() {
|
|
2879
|
+
return _web3.Web3AuthProvider;
|
|
2880
|
+
}, get WorldAuthProvider() {
|
|
2881
|
+
return _identity.WorldAuthProvider;
|
|
2882
|
+
}, get developerProviders() {
|
|
2883
|
+
return _developer.developerProviders;
|
|
2884
|
+
}, get getProvider() {
|
|
2885
|
+
return getProvider;
|
|
2886
|
+
}, get getProviderCategory() {
|
|
2887
|
+
return getProviderCategory2;
|
|
2888
|
+
}, get getProvidersByCategory() {
|
|
2889
|
+
return getProvidersByCategory2;
|
|
2890
|
+
}, get identityProviders() {
|
|
2891
|
+
return identityProviders2;
|
|
2892
|
+
}, get providerCategoryMap() {
|
|
2893
|
+
return providerCategoryMap;
|
|
2894
|
+
}, get providers() {
|
|
2895
|
+
return providers;
|
|
2896
|
+
}, get socialProviders() {
|
|
2897
|
+
return _social.socialProviders;
|
|
2898
|
+
}, get web3Providers() {
|
|
2899
|
+
return _web3.web3Providers;
|
|
2900
|
+
} });
|
|
2901
|
+
var _social = _export_star(require_social(), exports2);
|
|
2902
|
+
var _developer = _export_star(require_developer(), exports2);
|
|
2903
|
+
var _web3 = _export_star(require_web3(), exports2);
|
|
2904
|
+
var _identity = _export_star(require_identity(), exports2);
|
|
2905
|
+
_export_star(require_authProvider(), exports2);
|
|
2906
|
+
_export_star(require_pkce(), exports2);
|
|
2907
|
+
function _export_star(from, to) {
|
|
2908
|
+
Object.keys(from).forEach(function(k) {
|
|
2909
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
2910
|
+
Object.defineProperty(to, k, { enumerable: true, get: function() {
|
|
2911
|
+
return from[k];
|
|
2912
|
+
} });
|
|
2913
|
+
}
|
|
2914
|
+
});
|
|
2915
|
+
return from;
|
|
2916
|
+
}
|
|
2917
|
+
var identityProviders2 = { world: _identity.WorldAuthProvider, passkey: _identity.PasskeyAuthProvider };
|
|
2918
|
+
var providers = { google: _social.GoogleAuthProvider, apple: _social.AppleAuthProvider, meta: _social.MetaAuthProvider, facebook: _social.FacebookAuthProvider, kakao: _social.KakaoAuthProvider, naver: _social.NaverAuthProvider, line: _social.LineAuthProvider, github: _developer.GithubAuthProvider, discord: _developer.DiscordAuthProvider, web3: _web3.Web3AuthProvider, world: _identity.WorldAuthProvider, passkey: _identity.PasskeyAuthProvider, none: null };
|
|
2919
|
+
var providerCategoryMap = { google: "social", apple: "social", meta: "social", facebook: "social", kakao: "social", naver: "social", line: "social", github: "developer", discord: "developer", web3: "web3", world: "identity", passkey: "identity" };
|
|
2920
|
+
var getProviderCategory2 = (provider) => {
|
|
2921
|
+
if (provider === "none") return null;
|
|
2922
|
+
return providerCategoryMap[provider] || null;
|
|
2923
|
+
};
|
|
2924
|
+
var getProvidersByCategory2 = (category) => {
|
|
2925
|
+
switch (category) {
|
|
2926
|
+
case "social":
|
|
2927
|
+
return _social.socialProviders;
|
|
2928
|
+
case "developer":
|
|
2929
|
+
return _developer.developerProviders;
|
|
2930
|
+
case "web3":
|
|
2931
|
+
return _web3.web3Providers;
|
|
2932
|
+
case "identity":
|
|
2933
|
+
return identityProviders2;
|
|
2934
|
+
default:
|
|
2935
|
+
return {};
|
|
2936
|
+
}
|
|
2937
|
+
};
|
|
2938
|
+
var getProvider = (provider) => {
|
|
2939
|
+
if (provider === "none") {
|
|
2940
|
+
return null;
|
|
2941
|
+
}
|
|
2942
|
+
const Provider = providers[provider];
|
|
2943
|
+
if (!Provider) {
|
|
2944
|
+
throw new Error(`[ISA-AUTH] Provider "${provider}" is not registered`);
|
|
2945
|
+
}
|
|
2946
|
+
return Provider;
|
|
2947
|
+
};
|
|
2948
|
+
}
|
|
2949
|
+
});
|
|
2950
|
+
|
|
2951
|
+
// ../core/dist/components/loginButton.js
|
|
2952
|
+
var require_loginButton = __commonJS({
|
|
2953
|
+
"../core/dist/components/loginButton.js"(exports2) {
|
|
2954
|
+
"use strict";
|
|
2955
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2956
|
+
Object.defineProperty(exports2, "default", { enumerable: true, get: function() {
|
|
2957
|
+
return _default;
|
|
2958
|
+
} });
|
|
2959
|
+
function _define_property(obj, key, value) {
|
|
2960
|
+
if (key in obj) {
|
|
2961
|
+
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
2962
|
+
} else {
|
|
2963
|
+
obj[key] = value;
|
|
2964
|
+
}
|
|
2965
|
+
return obj;
|
|
2966
|
+
}
|
|
2967
|
+
var LoginButton = class {
|
|
2968
|
+
getDefaultText() {
|
|
2969
|
+
switch (this.provider) {
|
|
2970
|
+
case "google":
|
|
2971
|
+
return "Sign in with Google";
|
|
2972
|
+
case "apple":
|
|
2973
|
+
return "Sign in with Apple";
|
|
2974
|
+
case "kakao":
|
|
2975
|
+
return "\uCE74\uCE74\uC624\uB85C \uB85C\uADF8\uC778";
|
|
2976
|
+
case "naver":
|
|
2977
|
+
return "\uB124\uC774\uBC84 \uB85C\uADF8\uC778";
|
|
2978
|
+
case "web3":
|
|
2979
|
+
return "Connect Ethereum Wallet";
|
|
2980
|
+
case "meta":
|
|
2981
|
+
case "facebook":
|
|
2982
|
+
return "Continue with Meta";
|
|
2983
|
+
case "world":
|
|
2984
|
+
return "Verify with World ID";
|
|
2985
|
+
case "passkey":
|
|
2986
|
+
return "Sign in with Passkey";
|
|
2987
|
+
default:
|
|
2988
|
+
return "\uB85C\uADF8\uC778";
|
|
2989
|
+
}
|
|
2990
|
+
}
|
|
2991
|
+
getDefaultStyle() {
|
|
2992
|
+
switch (this.type) {
|
|
2993
|
+
case "rect":
|
|
2994
|
+
return { padding: "10px 20px", borderRadius: "4px", fontSize: "14px" };
|
|
2995
|
+
case "rounded":
|
|
2996
|
+
return { padding: "10px 20px", borderRadius: "20px", fontSize: "14px" };
|
|
2997
|
+
case "circle":
|
|
2998
|
+
return { width: "40px", height: "40px", borderRadius: "50%", padding: "0", fontSize: "16px", display: "flex", alignItems: "center", justifyContent: "center" };
|
|
2999
|
+
case "link":
|
|
3000
|
+
return { backgroundColor: "transparent", color: "#007bff", textDecoration: "underline", fontSize: "14px", border: "none" };
|
|
3001
|
+
case "brand":
|
|
3002
|
+
return { backgroundColor: "#000", color: "#fff", padding: "12px 24px", fontWeight: "bold", fontSize: "16px" };
|
|
3003
|
+
default:
|
|
3004
|
+
return {};
|
|
3005
|
+
}
|
|
3006
|
+
}
|
|
3007
|
+
mergeStyles() {
|
|
3008
|
+
return { ...this.getDefaultStyle(), ...this.config.style };
|
|
3009
|
+
}
|
|
3010
|
+
getButtonClass() {
|
|
3011
|
+
const base = "isa-auth-button";
|
|
3012
|
+
const typeClass = `login-button-${this.type}`;
|
|
3013
|
+
const providerClass = `auth-button-${this.provider}`;
|
|
3014
|
+
const widthClass = this.config.fullWidth ? "full-width" : "";
|
|
3015
|
+
return [base, typeClass, providerClass, widthClass].join(" ").trim();
|
|
3016
|
+
}
|
|
3017
|
+
toJSON() {
|
|
3018
|
+
var _this_config_icon, _this_config_text, _this_config_fullWidth;
|
|
3019
|
+
return { id: this.config.id, type: this.type, provider: this.provider, icon: (_this_config_icon = this.config.icon) !== null && _this_config_icon !== void 0 ? _this_config_icon : `/icons/${this.provider}.svg`, text: (_this_config_text = this.config.text) !== null && _this_config_text !== void 0 ? _this_config_text : this.getDefaultText(), style: this.mergeStyles(), fullWidth: (_this_config_fullWidth = this.config.fullWidth) !== null && _this_config_fullWidth !== void 0 ? _this_config_fullWidth : false, className: this.getButtonClass(), onClick: this.action };
|
|
3020
|
+
}
|
|
3021
|
+
constructor(props) {
|
|
3022
|
+
_define_property(this, "type", void 0);
|
|
3023
|
+
_define_property(this, "provider", void 0);
|
|
3024
|
+
_define_property(this, "action", void 0);
|
|
3025
|
+
_define_property(this, "config", void 0);
|
|
3026
|
+
this.type = props.type;
|
|
3027
|
+
this.provider = props.provider;
|
|
3028
|
+
this.action = props.action;
|
|
3029
|
+
this.config = props.config;
|
|
3030
|
+
}
|
|
3031
|
+
};
|
|
3032
|
+
var _default = LoginButton;
|
|
3033
|
+
}
|
|
3034
|
+
});
|
|
3035
|
+
|
|
3036
|
+
// ../core/dist/components/googleLogin.js
|
|
3037
|
+
var require_googleLogin = __commonJS({
|
|
3038
|
+
"../core/dist/components/googleLogin.js"(exports2) {
|
|
3039
|
+
"use strict";
|
|
3040
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3041
|
+
Object.defineProperty(exports2, "default", { enumerable: true, get: function() {
|
|
3042
|
+
return _default;
|
|
3043
|
+
} });
|
|
3044
|
+
var _loginButton = /* @__PURE__ */ _interop_require_default(require_loginButton());
|
|
3045
|
+
function _interop_require_default(obj) {
|
|
3046
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
3047
|
+
}
|
|
3048
|
+
var googleLoginButton = new _loginButton.default({ type: "rect", provider: "google", action: () => console.log("\uB85C\uADF8\uC778 \uC2DC\uB3C4"), config: { id: "login-google", text: "Google \uACC4\uC815\uC73C\uB85C \uB85C\uADF8\uC778", fullWidth: true, style: { backgroundColor: "#fff", color: "#000" } } });
|
|
3049
|
+
var _default = googleLoginButton;
|
|
3050
|
+
}
|
|
3051
|
+
});
|
|
3052
|
+
|
|
3053
|
+
// ../core/dist/components/appleLogin.js
|
|
3054
|
+
var require_appleLogin = __commonJS({
|
|
3055
|
+
"../core/dist/components/appleLogin.js"(exports2) {
|
|
3056
|
+
"use strict";
|
|
3057
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3058
|
+
Object.defineProperty(exports2, "default", { enumerable: true, get: function() {
|
|
3059
|
+
return _default;
|
|
3060
|
+
} });
|
|
3061
|
+
var _loginButton = /* @__PURE__ */ _interop_require_default(require_loginButton());
|
|
3062
|
+
function _interop_require_default(obj) {
|
|
3063
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
3064
|
+
}
|
|
3065
|
+
var appleLoginButton = new _loginButton.default({ type: "rect", provider: "apple", action: () => console.log("\uB85C\uADF8\uC778 \uC2DC\uB3C4"), config: { id: "login-apple", text: "Apple \uACC4\uC815\uC73C\uB85C \uB85C\uADF8\uC778", fullWidth: true, style: { backgroundColor: "#000", color: "#fff" } } });
|
|
3066
|
+
var _default = appleLoginButton;
|
|
3067
|
+
}
|
|
3068
|
+
});
|
|
3069
|
+
|
|
3070
|
+
// ../core/dist/components/lineLogin.js
|
|
3071
|
+
var require_lineLogin = __commonJS({
|
|
3072
|
+
"../core/dist/components/lineLogin.js"(exports2) {
|
|
3073
|
+
"use strict";
|
|
3074
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3075
|
+
Object.defineProperty(exports2, "default", { enumerable: true, get: function() {
|
|
3076
|
+
return _default;
|
|
3077
|
+
} });
|
|
3078
|
+
var _loginButton = /* @__PURE__ */ _interop_require_default(require_loginButton());
|
|
3079
|
+
function _interop_require_default(obj) {
|
|
3080
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
3081
|
+
}
|
|
3082
|
+
var lineLoginButton = new _loginButton.default({ type: "rect", provider: "line", action: () => console.log("\uB85C\uADF8\uC778 \uC2DC\uB3C4"), config: { id: "login-line", text: "LINE \uACC4\uC815\uC73C\uB85C \uB85C\uADF8\uC778", fullWidth: true, style: { backgroundColor: "#00C300", color: "#fff" } } });
|
|
3083
|
+
var _default = lineLoginButton;
|
|
3084
|
+
}
|
|
3085
|
+
});
|
|
3086
|
+
|
|
3087
|
+
// ../core/dist/components/naverLogin.js
|
|
3088
|
+
var require_naverLogin = __commonJS({
|
|
3089
|
+
"../core/dist/components/naverLogin.js"(exports2) {
|
|
3090
|
+
"use strict";
|
|
3091
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3092
|
+
Object.defineProperty(exports2, "default", { enumerable: true, get: function() {
|
|
3093
|
+
return _default;
|
|
3094
|
+
} });
|
|
3095
|
+
var _loginButton = /* @__PURE__ */ _interop_require_default(require_loginButton());
|
|
3096
|
+
function _interop_require_default(obj) {
|
|
3097
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
3098
|
+
}
|
|
3099
|
+
var naverLoginButton = new _loginButton.default({ type: "rect", provider: "naver", action: () => console.log("\uB85C\uADF8\uC778 \uC2DC\uB3C4"), config: { id: "login-naver", text: "Naver \uACC4\uC815\uC73C\uB85C \uB85C\uADF8\uC778", fullWidth: true, style: { backgroundColor: "#03C75A", color: "#fff" } } });
|
|
3100
|
+
var _default = naverLoginButton;
|
|
3101
|
+
}
|
|
3102
|
+
});
|
|
3103
|
+
|
|
3104
|
+
// ../core/dist/components/wechatLogin.js
|
|
3105
|
+
var require_wechatLogin = __commonJS({
|
|
3106
|
+
"../core/dist/components/wechatLogin.js"(exports2) {
|
|
3107
|
+
"use strict";
|
|
3108
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3109
|
+
Object.defineProperty(exports2, "default", { enumerable: true, get: function() {
|
|
3110
|
+
return _default;
|
|
3111
|
+
} });
|
|
3112
|
+
var _loginButton = /* @__PURE__ */ _interop_require_default(require_loginButton());
|
|
3113
|
+
function _interop_require_default(obj) {
|
|
3114
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
3115
|
+
}
|
|
3116
|
+
var wechatLoginButton = new _loginButton.default({ type: "rect", provider: "wechat", action: () => console.log("\uB85C\uADF8\uC778 \uC2DC\uB3C4"), config: { id: "login-wechat", text: "WeChat \uACC4\uC815\uC73C\uB85C \uB85C\uADF8\uC778", fullWidth: true, style: { backgroundColor: "#00BFFF", color: "#fff" } } });
|
|
3117
|
+
var _default = wechatLoginButton;
|
|
3118
|
+
}
|
|
3119
|
+
});
|
|
3120
|
+
|
|
3121
|
+
// ../core/dist/components/metaLogin.js
|
|
3122
|
+
var require_metaLogin = __commonJS({
|
|
3123
|
+
"../core/dist/components/metaLogin.js"(exports2) {
|
|
3124
|
+
"use strict";
|
|
3125
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3126
|
+
Object.defineProperty(exports2, "default", { enumerable: true, get: function() {
|
|
3127
|
+
return _default;
|
|
3128
|
+
} });
|
|
3129
|
+
var _loginButton = /* @__PURE__ */ _interop_require_default(require_loginButton());
|
|
3130
|
+
function _interop_require_default(obj) {
|
|
3131
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
3132
|
+
}
|
|
3133
|
+
var metaLoginButton = new _loginButton.default({ type: "rect", provider: "facebook", action: () => console.log("\uB85C\uADF8\uC778 \uC2DC\uB3C4"), config: { id: "login-meta", text: "Facebook \uACC4\uC815\uC73C\uB85C \uB85C\uADF8\uC778", fullWidth: true, style: { backgroundColor: "#4267B2", color: "#fff" } } });
|
|
3134
|
+
var _default = metaLoginButton;
|
|
3135
|
+
}
|
|
3136
|
+
});
|
|
3137
|
+
|
|
3138
|
+
// ../core/dist/components/kakaoLogin.js
|
|
3139
|
+
var require_kakaoLogin = __commonJS({
|
|
3140
|
+
"../core/dist/components/kakaoLogin.js"(exports2) {
|
|
3141
|
+
"use strict";
|
|
3142
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3143
|
+
Object.defineProperty(exports2, "default", { enumerable: true, get: function() {
|
|
3144
|
+
return _default;
|
|
3145
|
+
} });
|
|
3146
|
+
var _loginButton = /* @__PURE__ */ _interop_require_default(require_loginButton());
|
|
3147
|
+
function _interop_require_default(obj) {
|
|
3148
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
3149
|
+
}
|
|
3150
|
+
var kakaoLoginButton = new _loginButton.default({ type: "rect", provider: "kakao", action: () => console.log("\uCE74\uCE74\uC624 \uB85C\uADF8\uC778 \uC2DC\uB3C4"), config: { id: "login-kakao", text: "\uCE74\uCE74\uC624 \uB85C\uADF8\uC778", fullWidth: true, style: { backgroundColor: "#FEE500", color: "#000000" } } });
|
|
3151
|
+
var _default = kakaoLoginButton;
|
|
3152
|
+
}
|
|
3153
|
+
});
|
|
3154
|
+
|
|
3155
|
+
// ../core/dist/components/web3Login.js
|
|
3156
|
+
var require_web3Login = __commonJS({
|
|
3157
|
+
"../core/dist/components/web3Login.js"(exports2) {
|
|
3158
|
+
"use strict";
|
|
3159
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3160
|
+
Object.defineProperty(exports2, "default", { enumerable: true, get: function() {
|
|
3161
|
+
return _default;
|
|
3162
|
+
} });
|
|
3163
|
+
var _loginButton = /* @__PURE__ */ _interop_require_default(require_loginButton());
|
|
3164
|
+
function _interop_require_default(obj) {
|
|
3165
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
3166
|
+
}
|
|
3167
|
+
var web3LoginButton = new _loginButton.default({ type: "rect", provider: "web3", action: () => console.log("Web3 \uC9C0\uAC11 \uC5F0\uACB0 \uC2DC\uB3C4"), config: { id: "login-web3", text: "Connect Ethereum Wallet", fullWidth: true, style: { backgroundColor: "#627EEA", color: "#FFFFFF" } } });
|
|
3168
|
+
var _default = web3LoginButton;
|
|
3169
|
+
}
|
|
3170
|
+
});
|
|
3171
|
+
|
|
3172
|
+
// ../core/dist/components/githubLogin.js
|
|
3173
|
+
var require_githubLogin = __commonJS({
|
|
3174
|
+
"../core/dist/components/githubLogin.js"(exports2) {
|
|
3175
|
+
"use strict";
|
|
3176
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3177
|
+
Object.defineProperty(exports2, "default", { enumerable: true, get: function() {
|
|
3178
|
+
return _default;
|
|
3179
|
+
} });
|
|
3180
|
+
var _loginButton = /* @__PURE__ */ _interop_require_default(require_loginButton());
|
|
3181
|
+
function _interop_require_default(obj) {
|
|
3182
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
3183
|
+
}
|
|
3184
|
+
var githubLoginButton = new _loginButton.default({ type: "rect", provider: "github", action: () => console.log("GitHub \uB85C\uADF8\uC778 \uC2DC\uB3C4"), config: { id: "login-github", text: "Sign in with GitHub", fullWidth: true, style: { backgroundColor: "#24292e", color: "#ffffff" } } });
|
|
3185
|
+
var _default = githubLoginButton;
|
|
3186
|
+
}
|
|
3187
|
+
});
|
|
3188
|
+
|
|
3189
|
+
// ../core/dist/components/discordLogin.js
|
|
3190
|
+
var require_discordLogin = __commonJS({
|
|
3191
|
+
"../core/dist/components/discordLogin.js"(exports2) {
|
|
3192
|
+
"use strict";
|
|
3193
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3194
|
+
Object.defineProperty(exports2, "default", { enumerable: true, get: function() {
|
|
3195
|
+
return _default;
|
|
3196
|
+
} });
|
|
3197
|
+
var _loginButton = /* @__PURE__ */ _interop_require_default(require_loginButton());
|
|
3198
|
+
function _interop_require_default(obj) {
|
|
3199
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
3200
|
+
}
|
|
3201
|
+
var discordLoginButton = new _loginButton.default({ type: "rect", provider: "discord", action: () => console.log("Discord \uB85C\uADF8\uC778 \uC2DC\uB3C4"), config: { id: "login-discord", text: "Sign in with Discord", fullWidth: true, style: { backgroundColor: "#5865F2", color: "#ffffff" } } });
|
|
3202
|
+
var _default = discordLoginButton;
|
|
3203
|
+
}
|
|
3204
|
+
});
|
|
3205
|
+
|
|
3206
|
+
// ../core/dist/components/worldLogin.js
|
|
3207
|
+
var require_worldLogin = __commonJS({
|
|
3208
|
+
"../core/dist/components/worldLogin.js"(exports2) {
|
|
3209
|
+
"use strict";
|
|
3210
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3211
|
+
function _export(target, all) {
|
|
3212
|
+
for (var name in all) Object.defineProperty(target, name, { enumerable: true, get: Object.getOwnPropertyDescriptor(all, name).get });
|
|
3213
|
+
}
|
|
3214
|
+
_export(exports2, { get default() {
|
|
3215
|
+
return _default;
|
|
3216
|
+
}, get worldLoginButton() {
|
|
3217
|
+
return worldLoginButton;
|
|
3218
|
+
} });
|
|
3219
|
+
var _loginButton = /* @__PURE__ */ _interop_require_default(require_loginButton());
|
|
3220
|
+
function _interop_require_default(obj) {
|
|
3221
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
3222
|
+
}
|
|
3223
|
+
var worldLoginButton = new _loginButton.default({ type: "rounded", provider: "world", action: () => {
|
|
3224
|
+
}, config: { id: "isa-auth-btn-world", text: "Verify with World ID (Orb)", icon: "/icons/world.svg", fullWidth: false, style: { backgroundColor: "#000000", color: "#FFFFFF", border: "1px solid #333333" } } });
|
|
3225
|
+
var _default = worldLoginButton;
|
|
3226
|
+
}
|
|
3227
|
+
});
|
|
3228
|
+
|
|
3229
|
+
// ../core/dist/components/passkeyLogin.js
|
|
3230
|
+
var require_passkeyLogin = __commonJS({
|
|
3231
|
+
"../core/dist/components/passkeyLogin.js"(exports2) {
|
|
3232
|
+
"use strict";
|
|
3233
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3234
|
+
function _export(target, all) {
|
|
3235
|
+
for (var name in all) Object.defineProperty(target, name, { enumerable: true, get: Object.getOwnPropertyDescriptor(all, name).get });
|
|
3236
|
+
}
|
|
3237
|
+
_export(exports2, { get default() {
|
|
3238
|
+
return _default;
|
|
3239
|
+
}, get passkeyLoginButton() {
|
|
3240
|
+
return passkeyLoginButton;
|
|
3241
|
+
} });
|
|
3242
|
+
var _loginButton = /* @__PURE__ */ _interop_require_default(require_loginButton());
|
|
3243
|
+
function _interop_require_default(obj) {
|
|
3244
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
3245
|
+
}
|
|
3246
|
+
var passkeyLoginButton = new _loginButton.default({ type: "rounded", provider: "passkey", action: () => {
|
|
3247
|
+
}, config: { id: "isa-auth-btn-passkey", text: "Sign in with Passkey", icon: "/icons/passkey.svg", fullWidth: false, style: { backgroundColor: "#1E293B", color: "#F8FAFC", border: "1px solid #334155" } } });
|
|
3248
|
+
var _default = passkeyLoginButton;
|
|
3249
|
+
}
|
|
3250
|
+
});
|
|
3251
|
+
|
|
3252
|
+
// ../core/dist/components/index.js
|
|
3253
|
+
var require_components = __commonJS({
|
|
3254
|
+
"../core/dist/components/index.js"(exports2) {
|
|
3255
|
+
"use strict";
|
|
3256
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3257
|
+
function _export(target, all) {
|
|
3258
|
+
for (var name in all) Object.defineProperty(target, name, { enumerable: true, get: Object.getOwnPropertyDescriptor(all, name).get });
|
|
3259
|
+
}
|
|
3260
|
+
_export(exports2, { get appleLoginButton() {
|
|
3261
|
+
return _appleLogin.default;
|
|
3262
|
+
}, get discordLoginButton() {
|
|
3263
|
+
return _discordLogin.default;
|
|
3264
|
+
}, get getButton() {
|
|
3265
|
+
return getButton;
|
|
3266
|
+
}, get githubLoginButton() {
|
|
3267
|
+
return _githubLogin.default;
|
|
3268
|
+
}, get googleLoginButton() {
|
|
3269
|
+
return _googleLogin.default;
|
|
3270
|
+
}, get kakaoLoginButton() {
|
|
3271
|
+
return _kakaoLogin.default;
|
|
3272
|
+
}, get lineLoginbutton() {
|
|
3273
|
+
return _lineLogin.default;
|
|
3274
|
+
}, get metaLoginButton() {
|
|
3275
|
+
return _metaLogin.default;
|
|
3276
|
+
}, get naverLoginButton() {
|
|
3277
|
+
return _naverLogin.default;
|
|
3278
|
+
}, get passkeyLoginButton() {
|
|
3279
|
+
return _passkeyLogin.default;
|
|
3280
|
+
}, get web3LoginButton() {
|
|
3281
|
+
return _web3Login.default;
|
|
3282
|
+
}, get wechatLoginButton() {
|
|
3283
|
+
return _wechatLogin.default;
|
|
3284
|
+
}, get worldLoginButton() {
|
|
3285
|
+
return _worldLogin.default;
|
|
3286
|
+
} });
|
|
3287
|
+
var _googleLogin = /* @__PURE__ */ _interop_require_default(require_googleLogin());
|
|
3288
|
+
var _appleLogin = /* @__PURE__ */ _interop_require_default(require_appleLogin());
|
|
3289
|
+
var _lineLogin = /* @__PURE__ */ _interop_require_default(require_lineLogin());
|
|
3290
|
+
var _naverLogin = /* @__PURE__ */ _interop_require_default(require_naverLogin());
|
|
3291
|
+
var _wechatLogin = /* @__PURE__ */ _interop_require_default(require_wechatLogin());
|
|
3292
|
+
var _metaLogin = /* @__PURE__ */ _interop_require_default(require_metaLogin());
|
|
3293
|
+
var _kakaoLogin = /* @__PURE__ */ _interop_require_default(require_kakaoLogin());
|
|
3294
|
+
var _web3Login = /* @__PURE__ */ _interop_require_default(require_web3Login());
|
|
3295
|
+
var _githubLogin = /* @__PURE__ */ _interop_require_default(require_githubLogin());
|
|
3296
|
+
var _discordLogin = /* @__PURE__ */ _interop_require_default(require_discordLogin());
|
|
3297
|
+
var _worldLogin = /* @__PURE__ */ _interop_require_default(require_worldLogin());
|
|
3298
|
+
var _passkeyLogin = /* @__PURE__ */ _interop_require_default(require_passkeyLogin());
|
|
3299
|
+
_export_star(require_loginButton(), exports2);
|
|
3300
|
+
function _export_star(from, to) {
|
|
3301
|
+
Object.keys(from).forEach(function(k) {
|
|
3302
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
3303
|
+
Object.defineProperty(to, k, { enumerable: true, get: function() {
|
|
3304
|
+
return from[k];
|
|
3305
|
+
} });
|
|
3306
|
+
}
|
|
3307
|
+
});
|
|
3308
|
+
return from;
|
|
3309
|
+
}
|
|
3310
|
+
function _interop_require_default(obj) {
|
|
3311
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
3312
|
+
}
|
|
3313
|
+
var buttons = { google: _googleLogin.default, kakao: _kakaoLogin.default, naver: _naverLogin.default, apple: _appleLogin.default, line: _lineLogin.default, wechat: _wechatLogin.default, meta: _metaLogin.default, facebook: _metaLogin.default, web3: _web3Login.default, github: _githubLogin.default, discord: _discordLogin.default, world: _worldLogin.default, passkey: _passkeyLogin.default, none: null };
|
|
3314
|
+
var getButton = (provider) => {
|
|
3315
|
+
if (provider === "none") {
|
|
3316
|
+
return null;
|
|
3317
|
+
}
|
|
3318
|
+
const button = buttons[provider];
|
|
3319
|
+
if (!button) {
|
|
3320
|
+
throw new Error(`[ISA-AUTH] Button "${provider}" not found`);
|
|
3321
|
+
}
|
|
3322
|
+
return button;
|
|
3323
|
+
};
|
|
3324
|
+
}
|
|
3325
|
+
});
|
|
3326
|
+
|
|
3327
|
+
// ../core/dist/event/customAuth.js
|
|
3328
|
+
var require_customAuth = __commonJS({
|
|
3329
|
+
"../core/dist/event/customAuth.js"(exports2) {
|
|
3330
|
+
"use strict";
|
|
3331
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3332
|
+
function _export(target, all) {
|
|
3333
|
+
for (var name in all) Object.defineProperty(target, name, { enumerable: true, get: Object.getOwnPropertyDescriptor(all, name).get });
|
|
3334
|
+
}
|
|
3335
|
+
_export(exports2, { get addAuthEventListener() {
|
|
3336
|
+
return addAuthEventListener;
|
|
3337
|
+
}, get dispatchAuthEvent() {
|
|
3338
|
+
return dispatchAuthEvent;
|
|
3339
|
+
}, get removeAuthEventListener() {
|
|
3340
|
+
return removeAuthEventListener;
|
|
3341
|
+
} });
|
|
3342
|
+
var _value = require_value();
|
|
3343
|
+
function addAuthEventListener(callback, target = typeof window !== "undefined" ? window : {}) {
|
|
3344
|
+
const handler = (event) => {
|
|
3345
|
+
const detail = event.detail;
|
|
3346
|
+
callback(detail);
|
|
3347
|
+
};
|
|
3348
|
+
if (target && typeof target.addEventListener === "function") {
|
|
3349
|
+
target.addEventListener(_value.AUTH_EVENT, handler);
|
|
3350
|
+
return () => target.removeEventListener(_value.AUTH_EVENT, handler);
|
|
3351
|
+
}
|
|
3352
|
+
return () => {
|
|
3353
|
+
};
|
|
3354
|
+
}
|
|
3355
|
+
function removeAuthEventListener(callback, target = typeof window !== "undefined" ? window : {}) {
|
|
3356
|
+
if (target && typeof target.removeEventListener === "function") {
|
|
3357
|
+
target.removeEventListener(_value.AUTH_EVENT, callback);
|
|
3358
|
+
}
|
|
3359
|
+
}
|
|
3360
|
+
function dispatchAuthEvent(eventNameOrDetail, detailOrTarget, optionalTarget) {
|
|
3361
|
+
let eventType = _value.AUTH_EVENT;
|
|
3362
|
+
let payload = eventNameOrDetail;
|
|
3363
|
+
let target = optionalTarget || (typeof window !== "undefined" ? window : {});
|
|
3364
|
+
if (typeof eventNameOrDetail === "string" && detailOrTarget !== void 0) {
|
|
3365
|
+
eventType = eventNameOrDetail;
|
|
3366
|
+
payload = detailOrTarget;
|
|
3367
|
+
} else if (typeof (detailOrTarget === null || detailOrTarget === void 0 ? void 0 : detailOrTarget.dispatchEvent) === "function") {
|
|
3368
|
+
target = detailOrTarget;
|
|
3369
|
+
}
|
|
3370
|
+
if (target && typeof target.dispatchEvent === "function") {
|
|
3371
|
+
const event = typeof CustomEvent !== "undefined" ? new CustomEvent(eventType, { detail: payload }) : { type: eventType, detail: payload };
|
|
3372
|
+
target.dispatchEvent(event);
|
|
3373
|
+
}
|
|
3374
|
+
}
|
|
3375
|
+
}
|
|
3376
|
+
});
|
|
3377
|
+
|
|
3378
|
+
// ../core/dist/mappings.js
|
|
3379
|
+
var require_mappings = __commonJS({
|
|
3380
|
+
"../core/dist/mappings.js"(exports2) {
|
|
3381
|
+
"use strict";
|
|
3382
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3383
|
+
function _export(target, all) {
|
|
3384
|
+
for (var name in all) Object.defineProperty(target, name, { enumerable: true, get: Object.getOwnPropertyDescriptor(all, name).get });
|
|
3385
|
+
}
|
|
3386
|
+
_export(exports2, { get providerToButtonMap() {
|
|
3387
|
+
return providerToButtonMap;
|
|
3388
|
+
}, get providerToServiceMap() {
|
|
3389
|
+
return providerToServiceMap;
|
|
3390
|
+
} });
|
|
3391
|
+
var providerToServiceMap = { base: "base", jwt: "jwt", google: "jwt", kakao: "jwt", naver: "jwt", web3: "base", github: "jwt", apple: "jwt", discord: "jwt", line: "jwt", meta: "jwt", facebook: "jwt", world: "base", passkey: "base" };
|
|
3392
|
+
var providerToButtonMap = { base: "none", jwt: "none", google: "google", kakao: "kakao", naver: "naver", web3: "web3", github: "github", apple: "apple", discord: "discord", line: "line", meta: "meta", facebook: "facebook", world: "world", passkey: "passkey" };
|
|
3393
|
+
}
|
|
3394
|
+
});
|
|
3395
|
+
|
|
3396
|
+
// ../core/dist/lifecycle/index.js
|
|
3397
|
+
var require_lifecycle = __commonJS({
|
|
3398
|
+
"../core/dist/lifecycle/index.js"(exports2) {
|
|
3399
|
+
"use strict";
|
|
3400
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3401
|
+
function _export(target, all) {
|
|
3402
|
+
for (var name in all) Object.defineProperty(target, name, { enumerable: true, get: Object.getOwnPropertyDescriptor(all, name).get });
|
|
3403
|
+
}
|
|
3404
|
+
_export(exports2, { get AuthLifecycleManager() {
|
|
3405
|
+
return AuthLifecycleManager2;
|
|
3406
|
+
}, get default() {
|
|
3407
|
+
return _default;
|
|
3408
|
+
} });
|
|
3409
|
+
function _define_property(obj, key, value) {
|
|
3410
|
+
if (key in obj) {
|
|
3411
|
+
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
3412
|
+
} else {
|
|
3413
|
+
obj[key] = value;
|
|
3414
|
+
}
|
|
3415
|
+
return obj;
|
|
3416
|
+
}
|
|
3417
|
+
var AuthLifecycleManager2 = class {
|
|
3418
|
+
on(event, listener) {
|
|
3419
|
+
var _this_listeners_get;
|
|
3420
|
+
const set = (_this_listeners_get = this.listeners.get(event)) !== null && _this_listeners_get !== void 0 ? _this_listeners_get : /* @__PURE__ */ new Set();
|
|
3421
|
+
set.add(listener);
|
|
3422
|
+
this.listeners.set(event, set);
|
|
3423
|
+
return () => {
|
|
3424
|
+
set.delete(listener);
|
|
3425
|
+
};
|
|
3426
|
+
}
|
|
3427
|
+
onSignIn(listener) {
|
|
3428
|
+
return this.on("signIn", listener);
|
|
3429
|
+
}
|
|
3430
|
+
onSignOut(listener) {
|
|
3431
|
+
return this.on("signOut", listener);
|
|
3432
|
+
}
|
|
3433
|
+
onTokenExpired(listener) {
|
|
3434
|
+
return this.on("tokenExpired", listener);
|
|
3435
|
+
}
|
|
3436
|
+
onTokenRefreshed(listener) {
|
|
3437
|
+
return this.on("tokenRefreshed", listener);
|
|
3438
|
+
}
|
|
3439
|
+
onError(listener) {
|
|
3440
|
+
return this.on("error", listener);
|
|
3441
|
+
}
|
|
3442
|
+
onUnauthorized(listener) {
|
|
3443
|
+
return this.on("unauthorized", listener);
|
|
3444
|
+
}
|
|
3445
|
+
onAccessDenied(listener) {
|
|
3446
|
+
return this.on("accessDenied", listener);
|
|
3447
|
+
}
|
|
3448
|
+
onRoleChanged(listener) {
|
|
3449
|
+
return this.on("roleChanged", listener);
|
|
3450
|
+
}
|
|
3451
|
+
onPermissionChanged(listener) {
|
|
3452
|
+
return this.on("permissionChanged", listener);
|
|
3453
|
+
}
|
|
3454
|
+
async emit(event, data) {
|
|
3455
|
+
const set = this.listeners.get(event);
|
|
3456
|
+
if (!set || set.size === 0) return;
|
|
3457
|
+
for (const listener of set) {
|
|
3458
|
+
try {
|
|
3459
|
+
await listener(data);
|
|
3460
|
+
} catch (err) {
|
|
3461
|
+
console.error(`[ISA-AUTH] Error in lifecycle listener for event "${event}":`, err);
|
|
3462
|
+
}
|
|
3463
|
+
}
|
|
3464
|
+
}
|
|
3465
|
+
clear() {
|
|
3466
|
+
this.listeners.clear();
|
|
3467
|
+
}
|
|
3468
|
+
constructor() {
|
|
3469
|
+
_define_property(this, "listeners", /* @__PURE__ */ new Map());
|
|
3470
|
+
}
|
|
3471
|
+
};
|
|
3472
|
+
var _default = AuthLifecycleManager2;
|
|
3473
|
+
}
|
|
3474
|
+
});
|
|
3475
|
+
|
|
3476
|
+
// ../core/dist/http/index.js
|
|
3477
|
+
var require_http = __commonJS({
|
|
3478
|
+
"../core/dist/http/index.js"(exports2) {
|
|
3479
|
+
"use strict";
|
|
3480
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3481
|
+
function _export(target, all) {
|
|
3482
|
+
for (var name in all) Object.defineProperty(target, name, { enumerable: true, get: Object.getOwnPropertyDescriptor(all, name).get });
|
|
3483
|
+
}
|
|
3484
|
+
_export(exports2, { get applyAuthInterceptor() {
|
|
3485
|
+
return applyAuthInterceptor2;
|
|
3486
|
+
}, get createAuthAxios() {
|
|
3487
|
+
return createAuthAxios2;
|
|
3488
|
+
}, get createAuthFetch() {
|
|
3489
|
+
return createAuthFetch2;
|
|
3490
|
+
} });
|
|
3491
|
+
function createAuthFetch2(options) {
|
|
3492
|
+
const { authClient, refreshFn, baseUrl = "", onUnauthorized, headerName = "Authorization", tokenPrefix = "Bearer ", withCredentials = false, customFetch = typeof fetch !== "undefined" ? fetch : void 0, beforeRequest, afterResponse } = options;
|
|
3493
|
+
if (!customFetch) {
|
|
3494
|
+
throw new Error("[ISA-AUTH] Fetch API is not available.");
|
|
3495
|
+
}
|
|
3496
|
+
let isRefreshing = false;
|
|
3497
|
+
let refreshQueue = [];
|
|
3498
|
+
const processQueue = (newToken) => {
|
|
3499
|
+
refreshQueue.forEach((callback) => callback(newToken));
|
|
3500
|
+
refreshQueue = [];
|
|
3501
|
+
};
|
|
3502
|
+
return async function authFetch(input, init = {}) {
|
|
3503
|
+
const url = typeof input === "string" && baseUrl && !input.startsWith("http") ? `${baseUrl.replace(/\/$/, "")}/${input.replace(/^\//, "")}` : input;
|
|
3504
|
+
let headers = new Headers(init.headers || {});
|
|
3505
|
+
const token = authClient.getAccessToken();
|
|
3506
|
+
if (token && !headers.has(headerName)) {
|
|
3507
|
+
headers.set(headerName, `${tokenPrefix}${token}`);
|
|
3508
|
+
}
|
|
3509
|
+
let modifiedInit = { ...init, headers };
|
|
3510
|
+
if (withCredentials) {
|
|
3511
|
+
modifiedInit.credentials = "include";
|
|
3512
|
+
}
|
|
3513
|
+
if (beforeRequest) {
|
|
3514
|
+
modifiedInit = await beforeRequest(modifiedInit) || modifiedInit;
|
|
3515
|
+
}
|
|
3516
|
+
let response = await customFetch(url, modifiedInit);
|
|
3517
|
+
if (response.status === 401 && authClient.refreshToken && refreshFn) {
|
|
3518
|
+
if (!isRefreshing) {
|
|
3519
|
+
isRefreshing = true;
|
|
3520
|
+
try {
|
|
3521
|
+
const newToken = await authClient.refreshToken(refreshFn);
|
|
3522
|
+
isRefreshing = false;
|
|
3523
|
+
processQueue(newToken);
|
|
3524
|
+
if (newToken) {
|
|
3525
|
+
const retryHeaders = new Headers(modifiedInit.headers);
|
|
3526
|
+
retryHeaders.set(headerName, `${tokenPrefix}${newToken}`);
|
|
3527
|
+
const retryResponse = await customFetch(url, { ...modifiedInit, headers: retryHeaders });
|
|
3528
|
+
return afterResponse ? await afterResponse(retryResponse) || retryResponse : retryResponse;
|
|
3529
|
+
} else {
|
|
3530
|
+
var _authClient_clearAuthState;
|
|
3531
|
+
if (onUnauthorized) onUnauthorized();
|
|
3532
|
+
(_authClient_clearAuthState = authClient.clearAuthState) === null || _authClient_clearAuthState === void 0 ? void 0 : _authClient_clearAuthState.call(authClient);
|
|
3533
|
+
}
|
|
3534
|
+
} catch (err) {
|
|
3535
|
+
var _authClient_clearAuthState1;
|
|
3536
|
+
isRefreshing = false;
|
|
3537
|
+
processQueue(null);
|
|
3538
|
+
if (onUnauthorized) onUnauthorized();
|
|
3539
|
+
(_authClient_clearAuthState1 = authClient.clearAuthState) === null || _authClient_clearAuthState1 === void 0 ? void 0 : _authClient_clearAuthState1.call(authClient);
|
|
3540
|
+
throw err;
|
|
3541
|
+
}
|
|
3542
|
+
} else {
|
|
3543
|
+
return new Promise((resolve, reject) => {
|
|
3544
|
+
refreshQueue.push(async (newToken) => {
|
|
3545
|
+
if (newToken) {
|
|
3546
|
+
try {
|
|
3547
|
+
const retryHeaders = new Headers(modifiedInit.headers);
|
|
3548
|
+
retryHeaders.set(headerName, `${tokenPrefix}${newToken}`);
|
|
3549
|
+
const retryRes = await customFetch(url, { ...modifiedInit, headers: retryHeaders });
|
|
3550
|
+
const finalRes = afterResponse ? await afterResponse(retryRes) || retryRes : retryRes;
|
|
3551
|
+
resolve(finalRes);
|
|
3552
|
+
} catch (e) {
|
|
3553
|
+
reject(e);
|
|
3554
|
+
}
|
|
3555
|
+
} else {
|
|
3556
|
+
resolve(response);
|
|
3557
|
+
}
|
|
3558
|
+
});
|
|
3559
|
+
});
|
|
3560
|
+
}
|
|
3561
|
+
}
|
|
3562
|
+
if (afterResponse) {
|
|
3563
|
+
response = await afterResponse(response) || response;
|
|
3564
|
+
}
|
|
3565
|
+
return response;
|
|
3566
|
+
};
|
|
3567
|
+
}
|
|
3568
|
+
function applyAuthInterceptor2(axiosInstance, options) {
|
|
3569
|
+
const { authClient, refreshFn, onUnauthorized, headerName = "Authorization", tokenPrefix = "Bearer ", withCredentials = false, beforeRequest, afterResponse } = options;
|
|
3570
|
+
let isRefreshing = false;
|
|
3571
|
+
let refreshQueue = [];
|
|
3572
|
+
const processQueue = (token) => {
|
|
3573
|
+
refreshQueue.forEach((callback) => callback(token));
|
|
3574
|
+
refreshQueue = [];
|
|
3575
|
+
};
|
|
3576
|
+
const reqInterceptorId = axiosInstance.interceptors.request.use(async (config) => {
|
|
3577
|
+
const token = authClient.getAccessToken();
|
|
3578
|
+
if (token && !config.headers[headerName]) {
|
|
3579
|
+
config.headers[headerName] = `${tokenPrefix}${token}`;
|
|
3580
|
+
}
|
|
3581
|
+
if (withCredentials) {
|
|
3582
|
+
config.withCredentials = true;
|
|
3583
|
+
}
|
|
3584
|
+
if (beforeRequest) {
|
|
3585
|
+
config = await beforeRequest(config) || config;
|
|
3586
|
+
}
|
|
3587
|
+
return config;
|
|
3588
|
+
}, (error) => Promise.reject(error));
|
|
3589
|
+
const resInterceptorId = axiosInstance.interceptors.response.use(async (response) => {
|
|
3590
|
+
if (afterResponse) {
|
|
3591
|
+
return await afterResponse(response) || response;
|
|
3592
|
+
}
|
|
3593
|
+
return response;
|
|
3594
|
+
}, async (error) => {
|
|
3595
|
+
const originalRequest = error.config;
|
|
3596
|
+
if (!originalRequest || !error.response || error.response.status !== 401) {
|
|
3597
|
+
return Promise.reject(error);
|
|
3598
|
+
}
|
|
3599
|
+
if (originalRequest._retry) {
|
|
3600
|
+
return Promise.reject(error);
|
|
3601
|
+
}
|
|
3602
|
+
originalRequest._retry = true;
|
|
3603
|
+
if (!authClient.refreshToken || !refreshFn) {
|
|
3604
|
+
var _authClient_clearAuthState;
|
|
3605
|
+
if (onUnauthorized) onUnauthorized();
|
|
3606
|
+
(_authClient_clearAuthState = authClient.clearAuthState) === null || _authClient_clearAuthState === void 0 ? void 0 : _authClient_clearAuthState.call(authClient);
|
|
3607
|
+
return Promise.reject(error);
|
|
3608
|
+
}
|
|
3609
|
+
if (isRefreshing) {
|
|
3610
|
+
return new Promise((resolve, reject) => {
|
|
3611
|
+
refreshQueue.push((token) => {
|
|
3612
|
+
if (token) {
|
|
3613
|
+
originalRequest.headers[headerName] = `${tokenPrefix}${token}`;
|
|
3614
|
+
resolve(axiosInstance(originalRequest));
|
|
3615
|
+
} else {
|
|
3616
|
+
reject(error);
|
|
3617
|
+
}
|
|
3618
|
+
});
|
|
3619
|
+
});
|
|
3620
|
+
}
|
|
3621
|
+
isRefreshing = true;
|
|
3622
|
+
try {
|
|
3623
|
+
const newToken = await authClient.refreshToken(refreshFn);
|
|
3624
|
+
isRefreshing = false;
|
|
3625
|
+
processQueue(newToken);
|
|
3626
|
+
if (newToken) {
|
|
3627
|
+
originalRequest.headers[headerName] = `${tokenPrefix}${newToken}`;
|
|
3628
|
+
return axiosInstance(originalRequest);
|
|
3629
|
+
} else {
|
|
3630
|
+
var _authClient_clearAuthState1;
|
|
3631
|
+
if (onUnauthorized) onUnauthorized();
|
|
3632
|
+
(_authClient_clearAuthState1 = authClient.clearAuthState) === null || _authClient_clearAuthState1 === void 0 ? void 0 : _authClient_clearAuthState1.call(authClient);
|
|
3633
|
+
return Promise.reject(error);
|
|
3634
|
+
}
|
|
3635
|
+
} catch (refreshErr) {
|
|
3636
|
+
var _authClient_clearAuthState2;
|
|
3637
|
+
isRefreshing = false;
|
|
3638
|
+
processQueue(null);
|
|
3639
|
+
if (onUnauthorized) onUnauthorized();
|
|
3640
|
+
(_authClient_clearAuthState2 = authClient.clearAuthState) === null || _authClient_clearAuthState2 === void 0 ? void 0 : _authClient_clearAuthState2.call(authClient);
|
|
3641
|
+
return Promise.reject(refreshErr);
|
|
3642
|
+
}
|
|
3643
|
+
});
|
|
3644
|
+
return { eject: () => {
|
|
3645
|
+
axiosInstance.interceptors.request.eject(reqInterceptorId);
|
|
3646
|
+
axiosInstance.interceptors.response.eject(resInterceptorId);
|
|
3647
|
+
} };
|
|
3648
|
+
}
|
|
3649
|
+
function createAuthAxios2(axiosModuleOrInstance, options) {
|
|
3650
|
+
const instance = typeof axiosModuleOrInstance.create === "function" ? axiosModuleOrInstance.create({ baseURL: options.baseUrl }) : axiosModuleOrInstance;
|
|
3651
|
+
applyAuthInterceptor2(instance, options);
|
|
3652
|
+
return instance;
|
|
3653
|
+
}
|
|
3654
|
+
}
|
|
3655
|
+
});
|
|
3656
|
+
|
|
3657
|
+
// ../core/dist/authCore.js
|
|
3658
|
+
var require_authCore = __commonJS({
|
|
3659
|
+
"../core/dist/authCore.js"(exports2) {
|
|
3660
|
+
"use strict";
|
|
3661
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3662
|
+
Object.defineProperty(exports2, "default", { enumerable: true, get: function() {
|
|
3663
|
+
return _default;
|
|
3664
|
+
} });
|
|
3665
|
+
var _service = require_service();
|
|
3666
|
+
var _providers = require_providers();
|
|
3667
|
+
var _components = require_components();
|
|
3668
|
+
var _customAuth = require_customAuth();
|
|
3669
|
+
var _mappings = require_mappings();
|
|
3670
|
+
var _lifecycle = require_lifecycle();
|
|
3671
|
+
var _guard = require_guard();
|
|
3672
|
+
var _http = require_http();
|
|
3673
|
+
var _tokenExchange = require_tokenExchange();
|
|
3674
|
+
var _store = require_store2();
|
|
3675
|
+
function _define_property(obj, key, value) {
|
|
3676
|
+
if (key in obj) {
|
|
3677
|
+
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
3678
|
+
} else {
|
|
3679
|
+
obj[key] = value;
|
|
3680
|
+
}
|
|
3681
|
+
return obj;
|
|
3682
|
+
}
|
|
3683
|
+
var AuthCore2 = class {
|
|
3684
|
+
getService() {
|
|
3685
|
+
return this.serviceInstance;
|
|
3686
|
+
}
|
|
3687
|
+
getProvider() {
|
|
3688
|
+
return this.provider;
|
|
3689
|
+
}
|
|
3690
|
+
getButton() {
|
|
3691
|
+
return this.button;
|
|
3692
|
+
}
|
|
3693
|
+
getContext() {
|
|
3694
|
+
const isAuthed = this.serviceInstance.getAuthState();
|
|
3695
|
+
const info = this.serviceInstance.getAuthInfo() || {};
|
|
3696
|
+
return { isAuthenticated: isAuthed, roles: info.roles || (info.role ? [info.role] : []), permissions: info.permissions || [], user: info };
|
|
3697
|
+
}
|
|
3698
|
+
updateAuthInfo(partial) {
|
|
3699
|
+
return this.serviceInstance.updateAuthInfo(partial);
|
|
3700
|
+
}
|
|
3701
|
+
startAutoRefresh(refreshFn, options) {
|
|
3702
|
+
if ("startAutoRefresh" in this.serviceInstance) {
|
|
3703
|
+
this.serviceInstance.startAutoRefresh(refreshFn, { onSuccess: (token) => {
|
|
3704
|
+
this.lifecycle.emit("tokenRefreshed", { token });
|
|
3705
|
+
}, onError: (error) => {
|
|
3706
|
+
this.lifecycle.emit("error", { error, phase: "autoRefresh" });
|
|
3707
|
+
}, ...options });
|
|
3708
|
+
}
|
|
3709
|
+
}
|
|
3710
|
+
stopAutoRefresh() {
|
|
3711
|
+
if ("stopAutoRefresh" in this.serviceInstance) {
|
|
3712
|
+
this.serviceInstance.stopAutoRefresh();
|
|
3713
|
+
}
|
|
3714
|
+
}
|
|
3715
|
+
async evaluateGuard(options, customContext) {
|
|
3716
|
+
const context = { ...this.getContext(), ...customContext };
|
|
3717
|
+
const result = await (0, _guard.evaluateGuard)(options, context);
|
|
3718
|
+
if (!result.allowed) {
|
|
3719
|
+
this.lifecycle.emit("unauthorized", { reason: result.message || "Unauthorized", result, context, timestamp: Date.now() });
|
|
3720
|
+
this.lifecycle.emit("accessDenied", { reason: result.message || "Access denied", result, context, target: options.target, timestamp: Date.now() });
|
|
3721
|
+
}
|
|
3722
|
+
return result;
|
|
3723
|
+
}
|
|
3724
|
+
async createGuard(options) {
|
|
3725
|
+
const context = this.getContext();
|
|
3726
|
+
const guardFn = (0, _guard.createAuthGuard)(options);
|
|
3727
|
+
const passed = await guardFn(context);
|
|
3728
|
+
if (!passed) {
|
|
3729
|
+
this.lifecycle.emit("unauthorized", { reason: "Unauthorized access", context, timestamp: Date.now() });
|
|
3730
|
+
this.lifecycle.emit("accessDenied", { reason: "Guard check failed", context, target: options.target, timestamp: Date.now() });
|
|
3731
|
+
}
|
|
3732
|
+
return passed;
|
|
3733
|
+
}
|
|
3734
|
+
hasRole(role, matchAll = false) {
|
|
3735
|
+
const context = this.getContext();
|
|
3736
|
+
return (0, _guard.checkRole)(role, context.roles || [], matchAll);
|
|
3737
|
+
}
|
|
3738
|
+
hasPermission(permission, matchAll = true) {
|
|
3739
|
+
const context = this.getContext();
|
|
3740
|
+
return (0, _guard.checkPermission)(permission, context.permissions || [], matchAll);
|
|
3741
|
+
}
|
|
3742
|
+
createFetch(options) {
|
|
3743
|
+
return (0, _http.createAuthFetch)({ authClient: this.serviceInstance, ...options });
|
|
3744
|
+
}
|
|
3745
|
+
applyAxiosInterceptor(axiosInstance, options) {
|
|
3746
|
+
return (0, _http.applyAuthInterceptor)(axiosInstance, { authClient: this.serviceInstance, ...options });
|
|
3747
|
+
}
|
|
3748
|
+
createAxios(axiosModuleOrInstance, options) {
|
|
3749
|
+
return (0, _http.createAuthAxios)(axiosModuleOrInstance, { authClient: this.serviceInstance, ...options });
|
|
3750
|
+
}
|
|
3751
|
+
createTokenExchange(tokenEndpoint, options) {
|
|
3752
|
+
return new _tokenExchange.HttpTokenExchangeAdapter({ tokenEndpoint, ...options });
|
|
3753
|
+
}
|
|
3754
|
+
getWebComponentAPI() {
|
|
3755
|
+
return { addAuthEventListener: _customAuth.addAuthEventListener, removeAuthEventListener: _customAuth.removeAuthEventListener, dispatchAuthEvent: _customAuth.dispatchAuthEvent, watchAuthState: this.serviceInstance.watchAuthState.bind(this.serviceInstance) };
|
|
3756
|
+
}
|
|
3757
|
+
constructor({ providerType = "base", secret = "isa-auth-secret", storage = "memory", storagePrefix = "" } = {}) {
|
|
3758
|
+
_define_property(this, "provider", void 0);
|
|
3759
|
+
_define_property(this, "button", void 0);
|
|
3760
|
+
_define_property(this, "serviceInstance", void 0);
|
|
3761
|
+
_define_property(this, "lifecycle", void 0);
|
|
3762
|
+
(0, _store.configureStorage)({ type: storage, prefix: storagePrefix });
|
|
3763
|
+
var _providerToServiceMap_providerType;
|
|
3764
|
+
const serviceType = (_providerToServiceMap_providerType = _mappings.providerToServiceMap[providerType]) !== null && _providerToServiceMap_providerType !== void 0 ? _providerToServiceMap_providerType : "base";
|
|
3765
|
+
var _providerToButtonMap_providerType;
|
|
3766
|
+
const buttonType = (_providerToButtonMap_providerType = _mappings.providerToButtonMap[providerType]) !== null && _providerToButtonMap_providerType !== void 0 ? _providerToButtonMap_providerType : "none";
|
|
3767
|
+
const isProviderRequired = providerType !== "base" && providerType !== "jwt";
|
|
3768
|
+
const ServiceClass = (0, _service.getAuthService)(serviceType);
|
|
3769
|
+
this.serviceInstance = new ServiceClass(secret);
|
|
3770
|
+
this.provider = (0, _providers.getProvider)(isProviderRequired ? providerType : "none");
|
|
3771
|
+
this.button = (0, _components.getButton)(buttonType);
|
|
3772
|
+
this.lifecycle = new _lifecycle.AuthLifecycleManager();
|
|
3773
|
+
this.serviceInstance.watchAuthState((isAuthenticated) => {
|
|
3774
|
+
if (isAuthenticated) {
|
|
3775
|
+
var _this_serviceInstance_getAccessToken, _this_serviceInstance;
|
|
3776
|
+
this.lifecycle.emit("signIn", { user: this.serviceInstance.getAuthInfo(), token: (_this_serviceInstance_getAccessToken = (_this_serviceInstance = this.serviceInstance).getAccessToken) === null || _this_serviceInstance_getAccessToken === void 0 ? void 0 : _this_serviceInstance_getAccessToken.call(_this_serviceInstance) });
|
|
3777
|
+
(0, _customAuth.dispatchAuthEvent)("isa-auth-login", { user: this.serviceInstance.getAuthInfo() });
|
|
3778
|
+
} else {
|
|
3779
|
+
this.lifecycle.emit("signOut");
|
|
3780
|
+
(0, _customAuth.dispatchAuthEvent)("isa-auth-logout", {});
|
|
3781
|
+
}
|
|
3782
|
+
});
|
|
3783
|
+
}
|
|
3784
|
+
};
|
|
3785
|
+
var _default = AuthCore2;
|
|
3786
|
+
}
|
|
3787
|
+
});
|
|
3788
|
+
|
|
3789
|
+
// ../core/dist/index.js
|
|
3790
|
+
var require_dist = __commonJS({
|
|
3791
|
+
"../core/dist/index.js"(exports2) {
|
|
3792
|
+
"use strict";
|
|
3793
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3794
|
+
function _export(target, all) {
|
|
3795
|
+
for (var name in all) Object.defineProperty(target, name, { enumerable: true, get: Object.getOwnPropertyDescriptor(all, name).get });
|
|
3796
|
+
}
|
|
3797
|
+
_export(exports2, { get AuthCore() {
|
|
3798
|
+
return _authCore.default;
|
|
3799
|
+
}, get default() {
|
|
3800
|
+
return _default;
|
|
3801
|
+
} });
|
|
3802
|
+
var _authCore = /* @__PURE__ */ _interop_require_default(require_authCore());
|
|
3803
|
+
_export_star(require_mappings(), exports2);
|
|
3804
|
+
_export_star(require_service(), exports2);
|
|
3805
|
+
_export_star(require_providers(), exports2);
|
|
3806
|
+
_export_star(require_components(), exports2);
|
|
3807
|
+
_export_star(require_store2(), exports2);
|
|
3808
|
+
_export_star(require_guard(), exports2);
|
|
3809
|
+
_export_star(require_lifecycle(), exports2);
|
|
3810
|
+
_export_star(require_http(), exports2);
|
|
3811
|
+
_export_star(require_jwt(), exports2);
|
|
3812
|
+
_export_star(require_customAuth(), exports2);
|
|
3813
|
+
function _export_star(from, to) {
|
|
3814
|
+
Object.keys(from).forEach(function(k) {
|
|
3815
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
3816
|
+
Object.defineProperty(to, k, { enumerable: true, get: function() {
|
|
3817
|
+
return from[k];
|
|
3818
|
+
} });
|
|
3819
|
+
}
|
|
3820
|
+
});
|
|
3821
|
+
return from;
|
|
3822
|
+
}
|
|
3823
|
+
function _interop_require_default(obj) {
|
|
3824
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
3825
|
+
}
|
|
3826
|
+
var _default = _authCore.default;
|
|
3827
|
+
}
|
|
3828
|
+
});
|
|
3829
|
+
|
|
3830
|
+
// src/index.ts
|
|
3831
|
+
var index_exports = {};
|
|
3832
|
+
__export(index_exports, {
|
|
3833
|
+
AppleAuthProvider: () => import_isa_auth_core.AppleAuthProvider,
|
|
3834
|
+
AuthBaseService: () => import_isa_auth_core.AuthBaseService,
|
|
3835
|
+
AuthCore: () => import_isa_auth_core.default,
|
|
3836
|
+
AuthProvider: () => AuthProvider_default,
|
|
3837
|
+
CookieSessionStorageAdapter: () => import_isa_auth_core.CookieSessionStorageAdapter,
|
|
3838
|
+
DiscordAuthProvider: () => import_isa_auth_core.DiscordAuthProvider,
|
|
3839
|
+
FacebookAuthProvider: () => import_isa_auth_core.FacebookAuthProvider,
|
|
3840
|
+
GithubAuthProvider: () => import_isa_auth_core.GithubAuthProvider,
|
|
3841
|
+
GoogleAuthProvider: () => import_isa_auth_core.GoogleAuthProvider,
|
|
3842
|
+
HttpTokenExchangeAdapter: () => import_isa_auth_core.HttpTokenExchangeAdapter,
|
|
3843
|
+
IsaAuth: () => IsaAuth,
|
|
3844
|
+
JwtService: () => import_isa_auth_core.JwtService,
|
|
3845
|
+
KakaoAuthProvider: () => import_isa_auth_core.KakaoAuthProvider,
|
|
3846
|
+
LineAuthProvider: () => import_isa_auth_core.LineAuthProvider,
|
|
3847
|
+
LocalStorageAdapter: () => import_isa_auth_core.LocalStorageAdapter,
|
|
3848
|
+
MemoryStorageAdapter: () => import_isa_auth_core.MemoryStorageAdapter,
|
|
3849
|
+
MetaAuthProvider: () => import_isa_auth_core.MetaAuthProvider,
|
|
3850
|
+
NaverAuthProvider: () => import_isa_auth_core.NaverAuthProvider,
|
|
3851
|
+
PasskeyAuthProvider: () => import_isa_auth_core.PasskeyAuthProvider,
|
|
3852
|
+
SessionStorageAdapter: () => import_isa_auth_core.SessionStorageAdapter,
|
|
3853
|
+
Web3AuthProvider: () => import_isa_auth_core.Web3AuthProvider,
|
|
3854
|
+
WorldAuthProvider: () => import_isa_auth_core.WorldAuthProvider,
|
|
3855
|
+
applyAuthInterceptor: () => import_isa_auth_core.applyAuthInterceptor,
|
|
3856
|
+
batch: () => import_isa_auth_core.batch,
|
|
3857
|
+
buildAuthorizeUrl: () => import_isa_auth_core.buildAuthorizeUrl,
|
|
3858
|
+
checkPermission: () => import_isa_auth_core.checkPermission,
|
|
3859
|
+
checkRole: () => import_isa_auth_core.checkRole,
|
|
3860
|
+
clearStoreSession: () => import_isa_auth_core.clearStoreSession,
|
|
3861
|
+
configureStorage: () => import_isa_auth_core.configureStorage,
|
|
3862
|
+
createAuthAxios: () => import_isa_auth_core.createAuthAxios,
|
|
3863
|
+
createAuthFetch: () => import_isa_auth_core.createAuthFetch,
|
|
3864
|
+
createAuthGuard: () => import_isa_auth_core.createAuthGuard,
|
|
3865
|
+
createNavigationGuard: () => import_isa_auth_core.createNavigationGuard,
|
|
3866
|
+
decodeToken: () => import_isa_auth_core.decodeToken,
|
|
3867
|
+
default: () => index_default,
|
|
3868
|
+
developerProviders: () => import_isa_auth_core.developerProviders,
|
|
3869
|
+
evaluateGuard: () => import_isa_auth_core.evaluateGuard,
|
|
3870
|
+
generateCodeChallenge: () => import_isa_auth_core.generateCodeChallenge,
|
|
3871
|
+
generateCodeVerifier: () => import_isa_auth_core.generateCodeVerifier,
|
|
3872
|
+
getAccessToken: () => import_isa_auth_core.getAccessToken,
|
|
3873
|
+
getAuthInfo: () => import_isa_auth_core.getAuthInfo,
|
|
3874
|
+
getAuthState: () => import_isa_auth_core.getAuthState,
|
|
3875
|
+
getProviderCategory: () => import_isa_auth_core.getProviderCategory,
|
|
3876
|
+
getProvidersByCategory: () => import_isa_auth_core.getProvidersByCategory,
|
|
3877
|
+
getRefreshToken: () => import_isa_auth_core.getRefreshToken,
|
|
3878
|
+
getStorageAdapter: () => import_isa_auth_core.getStorageAdapter,
|
|
3879
|
+
getTokenFromHeader: () => import_isa_auth_core.getTokenFromHeader,
|
|
3880
|
+
getTokenPayload: () => import_isa_auth_core.getTokenPayload,
|
|
3881
|
+
getTokenTimeRemaining: () => import_isa_auth_core.getTokenTimeRemaining,
|
|
3882
|
+
identityProviders: () => import_isa_auth_core.identityProviders,
|
|
3883
|
+
isExpiredToken: () => import_isa_auth_core.isExpiredToken,
|
|
3884
|
+
matchPermissionRule: () => import_isa_auth_core.matchPermissionRule,
|
|
3885
|
+
parseOAuthCallback: () => import_isa_auth_core.parseOAuthCallback,
|
|
3886
|
+
renderers: () => render_exports,
|
|
3887
|
+
resolveInheritedRoles: () => import_isa_auth_core.resolveInheritedRoles,
|
|
3888
|
+
setRefreshToken: () => import_isa_auth_core.setRefreshToken,
|
|
3889
|
+
socialProviders: () => import_isa_auth_core.socialProviders,
|
|
3890
|
+
subscribeSelector: () => import_isa_auth_core.subscribeSelector,
|
|
3891
|
+
updateAuthInfo: () => import_isa_auth_core.updateAuthInfo,
|
|
3892
|
+
web3Providers: () => import_isa_auth_core.web3Providers
|
|
3893
|
+
});
|
|
3894
|
+
module.exports = __toCommonJS(index_exports);
|
|
3895
|
+
var import_isa_auth_core = __toESM(require_dist());
|
|
3896
|
+
|
|
3897
|
+
// src/provider/AuthProvider.ts
|
|
3898
|
+
var AuthProvider = class {
|
|
3899
|
+
constructor(service, provider, button) {
|
|
3900
|
+
this.service = service;
|
|
3901
|
+
this.provider = provider;
|
|
3902
|
+
this.button = button;
|
|
3903
|
+
this.onClick = this.onClick.bind(this);
|
|
3904
|
+
this.init();
|
|
3905
|
+
}
|
|
3906
|
+
async init() {
|
|
3907
|
+
if (this.provider) {
|
|
3908
|
+
await this.provider.init();
|
|
3909
|
+
}
|
|
3910
|
+
}
|
|
3911
|
+
getButton() {
|
|
3912
|
+
if (!this.button) return null;
|
|
3913
|
+
return {
|
|
3914
|
+
...this.button.toJSON(),
|
|
3915
|
+
className: this.button.getButtonClass(),
|
|
3916
|
+
onClick: this.onClick
|
|
3917
|
+
};
|
|
3918
|
+
}
|
|
3919
|
+
async onClick() {
|
|
3920
|
+
await this.signIn();
|
|
3921
|
+
}
|
|
3922
|
+
async signIn() {
|
|
3923
|
+
if (this.provider) {
|
|
3924
|
+
await this.provider.signIn();
|
|
3925
|
+
const token = await this.provider.getAccessToken();
|
|
3926
|
+
if (token && this.service.setAccessToken) {
|
|
3927
|
+
this.service.setAccessToken(token);
|
|
3928
|
+
}
|
|
3929
|
+
const user = await this.provider.getUserInfo();
|
|
3930
|
+
if (user) {
|
|
3931
|
+
this.service.setAuthInfo(user);
|
|
3932
|
+
}
|
|
3933
|
+
} else {
|
|
3934
|
+
this.service.setAuthState(true);
|
|
3935
|
+
}
|
|
3936
|
+
}
|
|
3937
|
+
signOut() {
|
|
3938
|
+
if (this.provider) {
|
|
3939
|
+
this.provider.signOut();
|
|
3940
|
+
}
|
|
3941
|
+
this.service.clearAuthState();
|
|
3942
|
+
}
|
|
3943
|
+
async refresh(refreshTokenFn) {
|
|
3944
|
+
if (!this.service.refreshToken) return null;
|
|
3945
|
+
return await this.service.refreshToken(refreshTokenFn);
|
|
3946
|
+
}
|
|
3947
|
+
restore() {
|
|
3948
|
+
var _a, _b;
|
|
3949
|
+
const token = (_b = (_a = this.service).getAccessToken) == null ? void 0 : _b.call(_a);
|
|
3950
|
+
if (token) {
|
|
3951
|
+
this.service.setAuthState(true);
|
|
3952
|
+
}
|
|
3953
|
+
}
|
|
3954
|
+
async getUserInfo() {
|
|
3955
|
+
if (this.provider) {
|
|
3956
|
+
return await this.provider.getUserInfo();
|
|
3957
|
+
}
|
|
3958
|
+
return this.service.getAuthInfo();
|
|
3959
|
+
}
|
|
3960
|
+
getAccessToken() {
|
|
3961
|
+
if (!this.service.getAccessToken) return null;
|
|
3962
|
+
return this.service.getAccessToken();
|
|
3963
|
+
}
|
|
3964
|
+
getAuthState() {
|
|
3965
|
+
return this.service.getAuthState();
|
|
3966
|
+
}
|
|
3967
|
+
watchAuthState(callback) {
|
|
3968
|
+
return this.service.watchAuthState(callback);
|
|
3969
|
+
}
|
|
3970
|
+
hasRole(role) {
|
|
3971
|
+
return this.service.hasRole ? this.service.hasRole(role) : false;
|
|
3972
|
+
}
|
|
3973
|
+
hasPermission(permission) {
|
|
3974
|
+
return this.service.hasPermission ? this.service.hasPermission(permission) : false;
|
|
3975
|
+
}
|
|
3976
|
+
};
|
|
3977
|
+
var AuthProvider_default = AuthProvider;
|
|
3978
|
+
|
|
3979
|
+
// src/render/index.ts
|
|
3980
|
+
var render_exports = {};
|
|
3981
|
+
__export(render_exports, {
|
|
3982
|
+
registerWebComponent: () => registerWebComponent,
|
|
3983
|
+
renderByJs: () => renderByJs,
|
|
3984
|
+
renderByReact: () => renderByReact,
|
|
3985
|
+
renderByVue: () => renderByVue
|
|
3986
|
+
});
|
|
3987
|
+
function renderByJs(info) {
|
|
3988
|
+
const button = document.createElement("button");
|
|
3989
|
+
button.type = "button";
|
|
3990
|
+
button.onclick = info.onClick;
|
|
3991
|
+
if (info.className) {
|
|
3992
|
+
button.className = info.className;
|
|
3993
|
+
}
|
|
3994
|
+
button.style.display = "inline-flex";
|
|
3995
|
+
button.style.alignItems = "center";
|
|
3996
|
+
button.style.justifyContent = "center";
|
|
3997
|
+
button.style.gap = "8px";
|
|
3998
|
+
button.style.cursor = "pointer";
|
|
3999
|
+
if (info.style) {
|
|
4000
|
+
Object.assign(button.style, info.style);
|
|
4001
|
+
}
|
|
4002
|
+
if (info.icon) {
|
|
4003
|
+
const iconImg = document.createElement("img");
|
|
4004
|
+
iconImg.src = info.icon;
|
|
4005
|
+
iconImg.alt = info.label || "Auth icon";
|
|
4006
|
+
iconImg.style.width = "20px";
|
|
4007
|
+
iconImg.style.height = "20px";
|
|
4008
|
+
button.appendChild(iconImg);
|
|
4009
|
+
}
|
|
4010
|
+
const textSpan = document.createElement("span");
|
|
4011
|
+
textSpan.textContent = info.label || "Sign In";
|
|
4012
|
+
button.appendChild(textSpan);
|
|
4013
|
+
return button;
|
|
4014
|
+
}
|
|
4015
|
+
function renderByReact(info) {
|
|
4016
|
+
try {
|
|
4017
|
+
const React = typeof globalThis.require === "function" ? globalThis.require("react") : typeof window !== "undefined" ? window.React : null;
|
|
4018
|
+
if (!React) return null;
|
|
4019
|
+
const children = [];
|
|
4020
|
+
if (info.icon) {
|
|
4021
|
+
children.push(
|
|
4022
|
+
React.createElement("img", {
|
|
4023
|
+
key: "icon",
|
|
4024
|
+
src: info.icon,
|
|
4025
|
+
alt: info.label || "Auth icon",
|
|
4026
|
+
style: { width: "20px", height: "20px" }
|
|
4027
|
+
})
|
|
4028
|
+
);
|
|
4029
|
+
}
|
|
4030
|
+
children.push(info.label || "Sign In");
|
|
4031
|
+
return React.createElement(
|
|
4032
|
+
"button",
|
|
4033
|
+
{
|
|
4034
|
+
onClick: info.onClick,
|
|
4035
|
+
className: info.className,
|
|
4036
|
+
style: {
|
|
4037
|
+
display: "inline-flex",
|
|
4038
|
+
alignItems: "center",
|
|
4039
|
+
justifyContent: "center",
|
|
4040
|
+
gap: "8px",
|
|
4041
|
+
cursor: "pointer",
|
|
4042
|
+
...info.style
|
|
4043
|
+
}
|
|
4044
|
+
},
|
|
4045
|
+
...children
|
|
4046
|
+
);
|
|
4047
|
+
} catch {
|
|
4048
|
+
console.warn("[ISA-AUTH] React is not available in the current environment.");
|
|
4049
|
+
return null;
|
|
4050
|
+
}
|
|
4051
|
+
}
|
|
4052
|
+
function renderByVue(info) {
|
|
4053
|
+
return {
|
|
4054
|
+
name: "IsaAuthButton",
|
|
4055
|
+
props: {
|
|
4056
|
+
label: {
|
|
4057
|
+
type: String,
|
|
4058
|
+
default: info.label || "Sign In"
|
|
4059
|
+
}
|
|
4060
|
+
},
|
|
4061
|
+
emits: ["click"],
|
|
4062
|
+
template: `
|
|
4063
|
+
<button
|
|
4064
|
+
type="button"
|
|
4065
|
+
:class="className"
|
|
4066
|
+
:style="buttonStyle"
|
|
4067
|
+
@click="handleClick"
|
|
4068
|
+
>
|
|
4069
|
+
<img v-if="icon" :src="icon" style="width: 20px; height: 20px;" alt="" />
|
|
4070
|
+
<span>{{ label }}</span>
|
|
4071
|
+
</button>
|
|
4072
|
+
`,
|
|
4073
|
+
data() {
|
|
4074
|
+
return {
|
|
4075
|
+
className: info.className,
|
|
4076
|
+
icon: info.icon,
|
|
4077
|
+
buttonStyle: {
|
|
4078
|
+
display: "inline-flex",
|
|
4079
|
+
alignItems: "center",
|
|
4080
|
+
justifyContent: "center",
|
|
4081
|
+
gap: "8px",
|
|
4082
|
+
cursor: "pointer",
|
|
4083
|
+
...info.style
|
|
4084
|
+
}
|
|
4085
|
+
};
|
|
4086
|
+
},
|
|
4087
|
+
methods: {
|
|
4088
|
+
handleClick() {
|
|
4089
|
+
if (info.onClick) info.onClick();
|
|
4090
|
+
this.$emit("click");
|
|
4091
|
+
}
|
|
4092
|
+
}
|
|
4093
|
+
};
|
|
4094
|
+
}
|
|
4095
|
+
function registerWebComponent() {
|
|
4096
|
+
if (typeof window === "undefined" || !window.customElements) return;
|
|
4097
|
+
if (customElements.get("isa-auth-button")) return;
|
|
4098
|
+
class IsaAuthButtonElement extends HTMLElement {
|
|
4099
|
+
connectedCallback() {
|
|
4100
|
+
const label = this.getAttribute("label") || "Sign In";
|
|
4101
|
+
const className = this.getAttribute("class") || "";
|
|
4102
|
+
const button = renderByJs({
|
|
4103
|
+
label,
|
|
4104
|
+
className,
|
|
4105
|
+
onClick: () => {
|
|
4106
|
+
this.dispatchEvent(new CustomEvent("isa-auth-click", { bubbles: true }));
|
|
4107
|
+
}
|
|
4108
|
+
});
|
|
4109
|
+
this.appendChild(button);
|
|
4110
|
+
}
|
|
4111
|
+
}
|
|
4112
|
+
customElements.define("isa-auth-button", IsaAuthButtonElement);
|
|
4113
|
+
}
|
|
4114
|
+
|
|
4115
|
+
// src/index.ts
|
|
4116
|
+
var IsaAuth = class {
|
|
4117
|
+
constructor(config = {}) {
|
|
4118
|
+
this.providerInstance = null;
|
|
4119
|
+
const {
|
|
4120
|
+
provider = "base",
|
|
4121
|
+
secret = "isa-auth-secret",
|
|
4122
|
+
clientId = "",
|
|
4123
|
+
callbackUrl = "",
|
|
4124
|
+
scope,
|
|
4125
|
+
storage = "memory",
|
|
4126
|
+
storagePrefix = "",
|
|
4127
|
+
extraOptions = {}
|
|
4128
|
+
} = config;
|
|
4129
|
+
this.providerType = provider;
|
|
4130
|
+
this.core = new import_isa_auth_core.default({
|
|
4131
|
+
providerType: provider,
|
|
4132
|
+
secret,
|
|
4133
|
+
storage,
|
|
4134
|
+
storagePrefix
|
|
4135
|
+
});
|
|
4136
|
+
const ProviderClass = this.core.getProvider();
|
|
4137
|
+
if (ProviderClass) {
|
|
4138
|
+
if (provider === "google") {
|
|
4139
|
+
this.providerInstance = new ProviderClass({
|
|
4140
|
+
clientId,
|
|
4141
|
+
callback: (token) => {
|
|
4142
|
+
this.setAccessToken(token);
|
|
4143
|
+
return token;
|
|
4144
|
+
},
|
|
4145
|
+
...extraOptions
|
|
4146
|
+
});
|
|
4147
|
+
} else if (provider === "kakao") {
|
|
4148
|
+
this.providerInstance = new ProviderClass({
|
|
4149
|
+
javascriptKey: clientId,
|
|
4150
|
+
redirectUri: callbackUrl,
|
|
4151
|
+
scope,
|
|
4152
|
+
...extraOptions
|
|
4153
|
+
});
|
|
4154
|
+
} else if (provider === "naver") {
|
|
4155
|
+
this.providerInstance = new ProviderClass({
|
|
4156
|
+
clientId,
|
|
4157
|
+
callbackUrl,
|
|
4158
|
+
...extraOptions
|
|
4159
|
+
});
|
|
4160
|
+
} else if (provider === "web3") {
|
|
4161
|
+
this.providerInstance = new ProviderClass({
|
|
4162
|
+
domain: typeof window !== "undefined" ? window.location.host : "localhost",
|
|
4163
|
+
...extraOptions
|
|
4164
|
+
});
|
|
4165
|
+
} else if (provider === "github") {
|
|
4166
|
+
this.providerInstance = new ProviderClass({
|
|
4167
|
+
clientId,
|
|
4168
|
+
redirectUri: callbackUrl,
|
|
4169
|
+
scope,
|
|
4170
|
+
...extraOptions
|
|
4171
|
+
});
|
|
4172
|
+
} else if (provider === "apple") {
|
|
4173
|
+
this.providerInstance = new ProviderClass({
|
|
4174
|
+
clientId,
|
|
4175
|
+
redirectURI: callbackUrl,
|
|
4176
|
+
scope,
|
|
4177
|
+
...extraOptions
|
|
4178
|
+
});
|
|
4179
|
+
} else if (provider === "discord") {
|
|
4180
|
+
this.providerInstance = new ProviderClass({
|
|
4181
|
+
clientId,
|
|
4182
|
+
redirectUri: callbackUrl,
|
|
4183
|
+
scope,
|
|
4184
|
+
...extraOptions
|
|
4185
|
+
});
|
|
4186
|
+
} else if (provider === "line") {
|
|
4187
|
+
this.providerInstance = new ProviderClass({
|
|
4188
|
+
clientId,
|
|
4189
|
+
callbackUrl,
|
|
4190
|
+
scope,
|
|
4191
|
+
...extraOptions
|
|
4192
|
+
});
|
|
4193
|
+
} else if (provider === "meta" || provider === "facebook") {
|
|
4194
|
+
this.providerInstance = new ProviderClass({
|
|
4195
|
+
appId: clientId,
|
|
4196
|
+
redirectUri: callbackUrl,
|
|
4197
|
+
scope,
|
|
4198
|
+
...extraOptions
|
|
4199
|
+
});
|
|
4200
|
+
} else if (provider === "world") {
|
|
4201
|
+
this.providerInstance = new ProviderClass({
|
|
4202
|
+
appId: clientId,
|
|
4203
|
+
action: extraOptions.action || "login",
|
|
4204
|
+
verificationLevel: extraOptions.verificationLevel || "orb",
|
|
4205
|
+
...extraOptions
|
|
4206
|
+
});
|
|
4207
|
+
} else if (provider === "passkey") {
|
|
4208
|
+
this.providerInstance = new ProviderClass({
|
|
4209
|
+
rpName: extraOptions.rpName || "ISA-AUTH Application",
|
|
4210
|
+
rpId: extraOptions.rpId,
|
|
4211
|
+
...extraOptions
|
|
4212
|
+
});
|
|
4213
|
+
} else {
|
|
4214
|
+
this.providerInstance = new ProviderClass({
|
|
4215
|
+
clientId,
|
|
4216
|
+
...extraOptions
|
|
4217
|
+
});
|
|
4218
|
+
}
|
|
4219
|
+
}
|
|
4220
|
+
const button = this.core.getButton();
|
|
4221
|
+
const service = this.core.getService();
|
|
4222
|
+
this.authProvider = new AuthProvider_default(service, this.providerInstance, button);
|
|
4223
|
+
}
|
|
4224
|
+
// 1. Core State Methods
|
|
4225
|
+
isAuthenticated() {
|
|
4226
|
+
return this.authProvider.getAuthState();
|
|
4227
|
+
}
|
|
4228
|
+
getAccessToken() {
|
|
4229
|
+
return this.authProvider.getAccessToken();
|
|
4230
|
+
}
|
|
4231
|
+
getUserInfo() {
|
|
4232
|
+
return this.authProvider.getUserInfo();
|
|
4233
|
+
}
|
|
4234
|
+
getContext() {
|
|
4235
|
+
return this.core.getContext();
|
|
4236
|
+
}
|
|
4237
|
+
/**
|
|
4238
|
+
* Returns current provider category ('social' | 'developer' | 'web3' | 'identity' | null)
|
|
4239
|
+
*/
|
|
4240
|
+
getCategory() {
|
|
4241
|
+
return (0, import_isa_auth_core.getProviderCategory)(this.providerType);
|
|
4242
|
+
}
|
|
4243
|
+
setAccessToken(token) {
|
|
4244
|
+
const service = this.core.getService();
|
|
4245
|
+
if (service.setAccessToken) {
|
|
4246
|
+
service.setAccessToken(token);
|
|
4247
|
+
}
|
|
4248
|
+
}
|
|
4249
|
+
getRefreshToken() {
|
|
4250
|
+
var _a;
|
|
4251
|
+
const service = this.core.getService();
|
|
4252
|
+
return ((_a = service.getRefreshToken) == null ? void 0 : _a.call(service)) || null;
|
|
4253
|
+
}
|
|
4254
|
+
setRefreshToken(token) {
|
|
4255
|
+
const service = this.core.getService();
|
|
4256
|
+
if (service.setRefreshToken) {
|
|
4257
|
+
service.setRefreshToken(token);
|
|
4258
|
+
}
|
|
4259
|
+
}
|
|
4260
|
+
updateAuthInfo(partial) {
|
|
4261
|
+
return this.core.updateAuthInfo(partial);
|
|
4262
|
+
}
|
|
4263
|
+
// 2. Authentication Actions
|
|
4264
|
+
async signIn() {
|
|
4265
|
+
return await this.authProvider.signIn();
|
|
4266
|
+
}
|
|
4267
|
+
signOut() {
|
|
4268
|
+
this.stopAutoRefresh();
|
|
4269
|
+
this.authProvider.signOut();
|
|
4270
|
+
}
|
|
4271
|
+
async refresh(refreshFn) {
|
|
4272
|
+
return await this.authProvider.refresh(refreshFn);
|
|
4273
|
+
}
|
|
4274
|
+
/**
|
|
4275
|
+
* Starts automatic background token refresh prior to expiration
|
|
4276
|
+
*/
|
|
4277
|
+
startAutoRefresh(refreshFn, options) {
|
|
4278
|
+
this.core.startAutoRefresh(refreshFn, options);
|
|
4279
|
+
}
|
|
4280
|
+
/**
|
|
4281
|
+
* Stops automatic background token refresh
|
|
4282
|
+
*/
|
|
4283
|
+
stopAutoRefresh() {
|
|
4284
|
+
this.core.stopAutoRefresh();
|
|
4285
|
+
}
|
|
4286
|
+
// 3. UI and Renderers
|
|
4287
|
+
getButton() {
|
|
4288
|
+
return this.authProvider.getButton();
|
|
4289
|
+
}
|
|
4290
|
+
renderButton(container) {
|
|
4291
|
+
const buttonData = this.getButton();
|
|
4292
|
+
if (!buttonData) return null;
|
|
4293
|
+
const btn = renderByJs({
|
|
4294
|
+
onClick: () => this.signIn(),
|
|
4295
|
+
label: buttonData.text,
|
|
4296
|
+
className: buttonData.className,
|
|
4297
|
+
style: buttonData.style
|
|
4298
|
+
});
|
|
4299
|
+
if (container) {
|
|
4300
|
+
container.innerHTML = "";
|
|
4301
|
+
container.appendChild(btn);
|
|
4302
|
+
}
|
|
4303
|
+
return btn;
|
|
4304
|
+
}
|
|
4305
|
+
// 4. RBAC, ABAC & Enhanced Guards
|
|
4306
|
+
hasRole(role) {
|
|
4307
|
+
return this.authProvider.hasRole(role);
|
|
4308
|
+
}
|
|
4309
|
+
hasPermission(permission) {
|
|
4310
|
+
return this.authProvider.hasPermission(permission);
|
|
4311
|
+
}
|
|
4312
|
+
/**
|
|
4313
|
+
* Check permission with wildcard matching support
|
|
4314
|
+
* E.g. isaAuth.can('users:read') or isaAuth.can(['users:read', 'users:write'])
|
|
4315
|
+
*/
|
|
4316
|
+
can(permission, matchAll = true) {
|
|
4317
|
+
return this.core.hasPermission(permission, matchAll);
|
|
4318
|
+
}
|
|
4319
|
+
/**
|
|
4320
|
+
* Check role with optional matchAll option
|
|
4321
|
+
*/
|
|
4322
|
+
is(role, matchAll = false) {
|
|
4323
|
+
return this.core.hasRole(role, matchAll);
|
|
4324
|
+
}
|
|
4325
|
+
/**
|
|
4326
|
+
* Evaluates guard and returns detailed GuardResult
|
|
4327
|
+
*/
|
|
4328
|
+
async evaluateGuard(options, customContext) {
|
|
4329
|
+
return this.core.evaluateGuard(options, customContext);
|
|
4330
|
+
}
|
|
4331
|
+
/**
|
|
4332
|
+
* Instant boolean guard check (backwards compatible)
|
|
4333
|
+
*/
|
|
4334
|
+
createGuard(options) {
|
|
4335
|
+
return this.core.createGuard(options);
|
|
4336
|
+
}
|
|
4337
|
+
/**
|
|
4338
|
+
* Creates a reusable router navigation guard
|
|
4339
|
+
*/
|
|
4340
|
+
createNavigationGuard(options) {
|
|
4341
|
+
return (0, import_isa_auth_core.createNavigationGuard)({
|
|
4342
|
+
...options,
|
|
4343
|
+
getContext: () => this.getContext()
|
|
4344
|
+
});
|
|
4345
|
+
}
|
|
4346
|
+
// 5. Lifecycle & Authorization Callbacks
|
|
4347
|
+
onSignIn(listener) {
|
|
4348
|
+
return this.core.lifecycle.onSignIn(listener);
|
|
4349
|
+
}
|
|
4350
|
+
onSignOut(listener) {
|
|
4351
|
+
return this.core.lifecycle.onSignOut(listener);
|
|
4352
|
+
}
|
|
4353
|
+
onTokenExpired(listener) {
|
|
4354
|
+
return this.core.lifecycle.onTokenExpired(listener);
|
|
4355
|
+
}
|
|
4356
|
+
onUnauthorized(listener) {
|
|
4357
|
+
return this.core.lifecycle.onUnauthorized(listener);
|
|
4358
|
+
}
|
|
4359
|
+
onAccessDenied(listener) {
|
|
4360
|
+
return this.core.lifecycle.onAccessDenied(listener);
|
|
4361
|
+
}
|
|
4362
|
+
onRoleChanged(listener) {
|
|
4363
|
+
return this.core.lifecycle.onRoleChanged(listener);
|
|
4364
|
+
}
|
|
4365
|
+
onPermissionChanged(listener) {
|
|
4366
|
+
return this.core.lifecycle.onPermissionChanged(listener);
|
|
4367
|
+
}
|
|
4368
|
+
// 6. Authenticated HTTP Clients (Fetch & Axios)
|
|
4369
|
+
createFetch(options) {
|
|
4370
|
+
return this.core.createFetch(options);
|
|
4371
|
+
}
|
|
4372
|
+
applyAxiosInterceptor(axiosInstance, options) {
|
|
4373
|
+
return this.core.applyAxiosInterceptor(axiosInstance, options);
|
|
4374
|
+
}
|
|
4375
|
+
createAxios(axiosModuleOrInstance, options) {
|
|
4376
|
+
return this.core.createAxios(axiosModuleOrInstance, options);
|
|
4377
|
+
}
|
|
4378
|
+
createTokenExchange(tokenEndpoint, options) {
|
|
4379
|
+
return this.core.createTokenExchange(tokenEndpoint, options);
|
|
4380
|
+
}
|
|
4381
|
+
// 7. Watcher
|
|
4382
|
+
subscribe(callback) {
|
|
4383
|
+
return this.authProvider.watchAuthState(callback);
|
|
4384
|
+
}
|
|
4385
|
+
};
|
|
4386
|
+
var index_default = IsaAuth;
|
|
4387
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
4388
|
+
0 && (module.exports = {
|
|
4389
|
+
AppleAuthProvider,
|
|
4390
|
+
AuthBaseService,
|
|
4391
|
+
AuthCore,
|
|
4392
|
+
AuthProvider,
|
|
4393
|
+
CookieSessionStorageAdapter,
|
|
4394
|
+
DiscordAuthProvider,
|
|
4395
|
+
FacebookAuthProvider,
|
|
4396
|
+
GithubAuthProvider,
|
|
4397
|
+
GoogleAuthProvider,
|
|
4398
|
+
HttpTokenExchangeAdapter,
|
|
4399
|
+
IsaAuth,
|
|
4400
|
+
JwtService,
|
|
4401
|
+
KakaoAuthProvider,
|
|
4402
|
+
LineAuthProvider,
|
|
4403
|
+
LocalStorageAdapter,
|
|
4404
|
+
MemoryStorageAdapter,
|
|
4405
|
+
MetaAuthProvider,
|
|
4406
|
+
NaverAuthProvider,
|
|
4407
|
+
PasskeyAuthProvider,
|
|
4408
|
+
SessionStorageAdapter,
|
|
4409
|
+
Web3AuthProvider,
|
|
4410
|
+
WorldAuthProvider,
|
|
4411
|
+
applyAuthInterceptor,
|
|
4412
|
+
batch,
|
|
4413
|
+
buildAuthorizeUrl,
|
|
4414
|
+
checkPermission,
|
|
4415
|
+
checkRole,
|
|
4416
|
+
clearStoreSession,
|
|
4417
|
+
configureStorage,
|
|
4418
|
+
createAuthAxios,
|
|
4419
|
+
createAuthFetch,
|
|
4420
|
+
createAuthGuard,
|
|
4421
|
+
createNavigationGuard,
|
|
4422
|
+
decodeToken,
|
|
4423
|
+
developerProviders,
|
|
4424
|
+
evaluateGuard,
|
|
4425
|
+
generateCodeChallenge,
|
|
4426
|
+
generateCodeVerifier,
|
|
4427
|
+
getAccessToken,
|
|
4428
|
+
getAuthInfo,
|
|
4429
|
+
getAuthState,
|
|
4430
|
+
getProviderCategory,
|
|
4431
|
+
getProvidersByCategory,
|
|
4432
|
+
getRefreshToken,
|
|
4433
|
+
getStorageAdapter,
|
|
4434
|
+
getTokenFromHeader,
|
|
4435
|
+
getTokenPayload,
|
|
4436
|
+
getTokenTimeRemaining,
|
|
4437
|
+
identityProviders,
|
|
4438
|
+
isExpiredToken,
|
|
4439
|
+
matchPermissionRule,
|
|
4440
|
+
parseOAuthCallback,
|
|
4441
|
+
renderers,
|
|
4442
|
+
resolveInheritedRoles,
|
|
4443
|
+
setRefreshToken,
|
|
4444
|
+
socialProviders,
|
|
4445
|
+
subscribeSelector,
|
|
4446
|
+
updateAuthInfo,
|
|
4447
|
+
web3Providers
|
|
4448
|
+
});
|
|
4449
|
+
//# sourceMappingURL=index.js.map
|