capacitor-oidc 0.0.6 → 0.1.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/README.md +30 -23
- package/SECURITY.md +4 -3
- package/dist/esm/base-capacitor-user-manager.d.ts +30 -0
- package/dist/esm/base-capacitor-user-manager.js +104 -0
- package/dist/esm/base-capacitor-user-manager.js.map +1 -0
- package/dist/esm/capacitor-user-manager.d.ts +9 -32
- package/dist/esm/capacitor-user-manager.js +20 -174
- package/dist/esm/capacitor-user-manager.js.map +1 -1
- package/dist/esm/configuration.d.ts +14 -0
- package/dist/esm/configuration.js +72 -0
- package/dist/esm/configuration.js.map +1 -0
- package/dist/esm/definitions.d.ts +53 -3
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.d.ts +5 -4
- package/dist/esm/index.js +8 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/native-capacitor-user-manager.d.ts +24 -0
- package/dist/esm/native-capacitor-user-manager.js +112 -0
- package/dist/esm/native-capacitor-user-manager.js.map +1 -0
- package/dist/esm/web-capacitor-user-manager.d.ts +11 -0
- package/dist/esm/web-capacitor-user-manager.js +44 -0
- package/dist/esm/web-capacitor-user-manager.js.map +1 -0
- package/dist/plugin.cjs +303 -126
- package/dist/plugin.cjs.map +1 -1
- package/docs/API.md +106 -60
- package/docs/GETTING_STARTED.md +85 -62
- package/docs/PLATFORM_SETUP.md +15 -4
- package/docs/PROVIDERS.md +30 -17
- package/docs/README.md +3 -3
- package/docs/TESTING.md +3 -1
- package/docs/TROUBLESHOOTING.md +23 -13
- package/docs/adr/0004-use-one-manager-across-platforms.md +64 -0
- package/package.json +3 -2
package/dist/plugin.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var app = require('@capacitor/app');
|
|
4
|
-
var oidcClientTs = require('oidc-client-ts');
|
|
5
3
|
var core = require('@capacitor/core');
|
|
4
|
+
var oidcClientTs = require('oidc-client-ts');
|
|
5
|
+
var app = require('@capacitor/app');
|
|
6
6
|
|
|
7
7
|
class CapacitorOidcError extends Error {
|
|
8
8
|
code;
|
|
@@ -16,6 +16,205 @@ function unsupported(feature) {
|
|
|
16
16
|
throw new CapacitorOidcError('UNSUPPORTED_RUNTIME', `${feature} is not available in a native Capacitor runtime`);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
class BaseCapacitorUserManager extends oidcClientTs.UserManager {
|
|
20
|
+
automaticRenewalPromise;
|
|
21
|
+
refreshPromise;
|
|
22
|
+
signinMode;
|
|
23
|
+
signoutMode;
|
|
24
|
+
defaultSigninArgs;
|
|
25
|
+
defaultSignoutArgs;
|
|
26
|
+
constructor(configuration, redirectNavigator, popupNavigator, iframeNavigator) {
|
|
27
|
+
super(configuration.settings, redirectNavigator, popupNavigator, iframeNavigator);
|
|
28
|
+
this.signinMode = configuration.signinMode;
|
|
29
|
+
this.signoutMode = configuration.signoutMode;
|
|
30
|
+
this.defaultSigninArgs = configuration.signinArgs;
|
|
31
|
+
this.defaultSignoutArgs = configuration.signoutArgs;
|
|
32
|
+
}
|
|
33
|
+
async initialize() {
|
|
34
|
+
await this.getUser();
|
|
35
|
+
}
|
|
36
|
+
async signin(args = {}) {
|
|
37
|
+
const mergedArgs = { ...this.defaultSigninArgs, ...args };
|
|
38
|
+
if (this.signinMode === 'redirect')
|
|
39
|
+
return this.signinRedirect(mergedArgs);
|
|
40
|
+
await this.signinPopup(mergedArgs);
|
|
41
|
+
}
|
|
42
|
+
async signout(args = {}) {
|
|
43
|
+
const mergedArgs = { ...this.defaultSignoutArgs, ...args };
|
|
44
|
+
if (this.signoutMode === 'redirect')
|
|
45
|
+
return this.signoutRedirect(mergedArgs);
|
|
46
|
+
await this.signoutPopup(mergedArgs);
|
|
47
|
+
}
|
|
48
|
+
async getValidUser(minimumValiditySeconds = 60) {
|
|
49
|
+
const user = await this.getUser();
|
|
50
|
+
if (!user)
|
|
51
|
+
return null;
|
|
52
|
+
if (user.expires_in === undefined || user.expires_in > minimumValiditySeconds)
|
|
53
|
+
return user;
|
|
54
|
+
return this.signinSilent();
|
|
55
|
+
}
|
|
56
|
+
async signinPopup(args = {}) {
|
|
57
|
+
await this.waitForRenewal();
|
|
58
|
+
return super.signinPopup(args);
|
|
59
|
+
}
|
|
60
|
+
async signoutPopup(args = {}) {
|
|
61
|
+
await this.waitForRenewal();
|
|
62
|
+
await super.signoutPopup(args);
|
|
63
|
+
}
|
|
64
|
+
async signinRedirect(args = {}) {
|
|
65
|
+
await this.waitForRenewal();
|
|
66
|
+
await super.signinRedirect(args);
|
|
67
|
+
}
|
|
68
|
+
async signoutRedirect(args = {}) {
|
|
69
|
+
await this.waitForRenewal();
|
|
70
|
+
await super.signoutRedirect(args);
|
|
71
|
+
}
|
|
72
|
+
signinSilent(args = {}) {
|
|
73
|
+
if (!this.refreshPromise) {
|
|
74
|
+
const refresh = this.performSilentSignin(args);
|
|
75
|
+
this.refreshPromise = refresh.finally(() => {
|
|
76
|
+
this.refreshPromise = undefined;
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
return this.refreshPromise;
|
|
80
|
+
}
|
|
81
|
+
async signinResourceOwnerCredentials(_args) {
|
|
82
|
+
unsupported('Resource Owner Password Credentials');
|
|
83
|
+
}
|
|
84
|
+
async removeUser() {
|
|
85
|
+
await this.waitForRenewal();
|
|
86
|
+
await this.removeUserWithoutWaiting();
|
|
87
|
+
}
|
|
88
|
+
cancel() {
|
|
89
|
+
return Promise.resolve();
|
|
90
|
+
}
|
|
91
|
+
async dispose() {
|
|
92
|
+
this.stopSilentRenew();
|
|
93
|
+
await this.disposePlatform();
|
|
94
|
+
await this.waitForRenewal();
|
|
95
|
+
await this.cancel();
|
|
96
|
+
}
|
|
97
|
+
performSilentSignin(args) {
|
|
98
|
+
return super.signinSilent(args);
|
|
99
|
+
}
|
|
100
|
+
removeUserWithoutWaiting() {
|
|
101
|
+
return super.removeUser();
|
|
102
|
+
}
|
|
103
|
+
checkForAutomaticRenewal() {
|
|
104
|
+
if (!this.settings.automaticSilentRenew || this.automaticRenewalPromise)
|
|
105
|
+
return;
|
|
106
|
+
const renewal = this.getValidUser();
|
|
107
|
+
this.automaticRenewalPromise = renewal;
|
|
108
|
+
void renewal
|
|
109
|
+
.catch((error) => this.events._raiseSilentRenewError(error instanceof Error ? error : new Error('Silent renewal failed')))
|
|
110
|
+
.finally(() => {
|
|
111
|
+
if (this.automaticRenewalPromise === renewal)
|
|
112
|
+
this.automaticRenewalPromise = undefined;
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
async waitForRenewal() {
|
|
116
|
+
await this.automaticRenewalPromise?.catch(() => undefined);
|
|
117
|
+
await this.refreshPromise?.catch(() => undefined);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function resolveConfiguration(configuration, platform) {
|
|
122
|
+
if (platform === 'web')
|
|
123
|
+
return resolveWebConfiguration(configuration);
|
|
124
|
+
return resolveNativeConfiguration(configuration, platform);
|
|
125
|
+
}
|
|
126
|
+
function resolveLegacyNativeConfiguration(settings, nativeOptions, platform) {
|
|
127
|
+
if (platform === 'web') {
|
|
128
|
+
throw new CapacitorOidcError('UNSUPPORTED_RUNTIME', 'Legacy CapacitorUserManager settings are only supported on iOS and Android');
|
|
129
|
+
}
|
|
130
|
+
assertPublicClient(settings);
|
|
131
|
+
if ('dpop' in settings) {
|
|
132
|
+
throw new CapacitorOidcError('UNSUPPORTED_RUNTIME', 'Native configuration does not support dpop');
|
|
133
|
+
}
|
|
134
|
+
return resolvedNativeConfiguration(platform, settings, nativeOptions);
|
|
135
|
+
}
|
|
136
|
+
function resolveWebConfiguration(configuration) {
|
|
137
|
+
const web = configuration.web;
|
|
138
|
+
if (!web)
|
|
139
|
+
unsupportedConfiguration('web');
|
|
140
|
+
const signoutMode = web.signoutMode ?? 'redirect';
|
|
141
|
+
const settings = { ...configuration.common, ...web.settings };
|
|
142
|
+
assertPublicClient(settings);
|
|
143
|
+
if (signoutMode === 'popup' && !settings.popup_post_logout_redirect_uri && !settings.post_logout_redirect_uri) {
|
|
144
|
+
throw new CapacitorOidcError('UNSUPPORTED_RUNTIME', 'Web popup signout requires post_logout_redirect_uri or popup_post_logout_redirect_uri');
|
|
145
|
+
}
|
|
146
|
+
return {
|
|
147
|
+
platform: 'web',
|
|
148
|
+
settings,
|
|
149
|
+
signinMode: web.signinMode ?? 'redirect',
|
|
150
|
+
signoutMode,
|
|
151
|
+
signinArgs: web.signinArgs ?? {},
|
|
152
|
+
signoutArgs: web.signoutArgs ?? {},
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
function resolveNativeConfiguration(configuration, platform) {
|
|
156
|
+
const native = configuration.native;
|
|
157
|
+
if (!native)
|
|
158
|
+
unsupportedConfiguration(platform);
|
|
159
|
+
const override = configuration[platform];
|
|
160
|
+
const settings = { ...configuration.common, ...native.settings, ...override?.settings };
|
|
161
|
+
assertPublicClient(settings);
|
|
162
|
+
assertNativeSettings(settings);
|
|
163
|
+
return resolvedNativeConfiguration(platform, settings, { ...native.options, ...override?.options }, { ...native.signinArgs, ...override?.signinArgs }, { ...native.signoutArgs, ...override?.signoutArgs });
|
|
164
|
+
}
|
|
165
|
+
function resolvedNativeConfiguration(platform, settings, nativeOptions, signinArgs = {}, signoutArgs = {}) {
|
|
166
|
+
return {
|
|
167
|
+
platform,
|
|
168
|
+
settings: { ...settings, response_type: 'code', disablePKCE: false, monitorSession: false },
|
|
169
|
+
nativeOptions,
|
|
170
|
+
signinMode: 'popup',
|
|
171
|
+
signoutMode: 'popup',
|
|
172
|
+
signinArgs,
|
|
173
|
+
signoutArgs,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
function assertPublicClient(settings) {
|
|
177
|
+
const unsupported = ['client_authentication', 'client_secret', 'disablePKCE', 'response_type'].find((key) => key in settings);
|
|
178
|
+
if (unsupported) {
|
|
179
|
+
throw new CapacitorOidcError('UNSUPPORTED_RUNTIME', `Public-client configuration does not support ${unsupported}`);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
function assertNativeSettings(settings) {
|
|
183
|
+
const unsupported = ['dpop', 'monitorSession', 'silent_redirect_uri', 'stateStore', 'userStore'].find((key) => key in settings);
|
|
184
|
+
if (unsupported) {
|
|
185
|
+
throw new CapacitorOidcError('UNSUPPORTED_RUNTIME', `Native configuration does not support ${unsupported}`);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
function unsupportedConfiguration(platform) {
|
|
189
|
+
throw new CapacitorOidcError('UNSUPPORTED_RUNTIME', `No ${platform} configuration was provided`);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
class CapacitorUserManager extends BaseCapacitorUserManager {
|
|
193
|
+
static async create(configuration, nativeOptions = {}) {
|
|
194
|
+
assertRuntime();
|
|
195
|
+
const platform = currentPlatform();
|
|
196
|
+
const resolved = 'redirect_uri' in configuration
|
|
197
|
+
? resolveLegacyNativeConfiguration(configuration, nativeOptions, platform)
|
|
198
|
+
: resolveConfiguration(configuration, platform);
|
|
199
|
+
const manager = await platformUserManagerFactory(resolved);
|
|
200
|
+
await manager.initialize();
|
|
201
|
+
return manager;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
let platformUserManagerFactory;
|
|
205
|
+
function setPlatformUserManagerFactory(factory) {
|
|
206
|
+
platformUserManagerFactory = factory;
|
|
207
|
+
}
|
|
208
|
+
function currentPlatform() {
|
|
209
|
+
const platform = core.Capacitor.getPlatform();
|
|
210
|
+
return platform === 'ios' || platform === 'android' ? platform : 'web';
|
|
211
|
+
}
|
|
212
|
+
function assertRuntime() {
|
|
213
|
+
if (!globalThis.crypto?.subtle || !globalThis.crypto.getRandomValues) {
|
|
214
|
+
throw new CapacitorOidcError('UNSUPPORTED_RUNTIME', 'Web Crypto is required by oidc-client-ts');
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
19
218
|
const NativeOidc = core.registerPlugin('CapacitorOidc');
|
|
20
219
|
|
|
21
220
|
class CapacitorNavigator {
|
|
@@ -105,124 +304,39 @@ class CapacitorSecureStateStore {
|
|
|
105
304
|
}
|
|
106
305
|
}
|
|
107
306
|
|
|
108
|
-
class
|
|
109
|
-
storageNamespace;
|
|
110
|
-
automaticRenewalPromise;
|
|
111
|
-
refreshPromise;
|
|
307
|
+
class NativeCapacitorUserManager extends CapacitorUserManager {
|
|
112
308
|
appStateListener;
|
|
113
|
-
|
|
309
|
+
storageNamespace;
|
|
310
|
+
constructor(configuration) {
|
|
311
|
+
const storageNamespace = configuration.nativeOptions?.storageNamespace ?? 'default';
|
|
114
312
|
const stateStore = new CapacitorSecureStateStore(`${storageNamespace}.transactions`);
|
|
115
313
|
const userStore = new CapacitorSecureStateStore(`${storageNamespace}.session`);
|
|
116
|
-
const navigator = new CapacitorNavigator(nativeOptions
|
|
314
|
+
const navigator = new CapacitorNavigator(configuration.nativeOptions?.prefersEphemeralWebBrowserSession ?? false);
|
|
117
315
|
super({
|
|
118
|
-
...
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
316
|
+
...configuration,
|
|
317
|
+
settings: {
|
|
318
|
+
...configuration.settings,
|
|
319
|
+
popup_redirect_uri: configuration.settings.redirect_uri,
|
|
320
|
+
popup_post_logout_redirect_uri: configuration.settings.post_logout_redirect_uri,
|
|
321
|
+
stateStore,
|
|
322
|
+
userStore,
|
|
323
|
+
},
|
|
126
324
|
}, navigator, navigator, new UnsupportedIframeNavigator());
|
|
127
325
|
this.storageNamespace = storageNamespace;
|
|
128
326
|
}
|
|
129
|
-
static async
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
await NativeOidc.configure(nativeOptions.ios ?? {});
|
|
133
|
-
const manager = new CapacitorUserManager(settings, nativeOptions, nativeOptions.storageNamespace ?? 'default');
|
|
134
|
-
await manager.getUser();
|
|
135
|
-
manager.appStateListener = await app.App.addListener('appStateChange', ({ isActive }) => {
|
|
136
|
-
if (isActive) {
|
|
137
|
-
manager.checkForAutomaticRenewal();
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
manager.checkForAutomaticRenewal();
|
|
141
|
-
return manager;
|
|
142
|
-
}
|
|
143
|
-
async signin(args = {}) {
|
|
144
|
-
return this.signinPopup(args);
|
|
145
|
-
}
|
|
146
|
-
async signinPopup(args = {}) {
|
|
147
|
-
await this.waitForRenewal();
|
|
148
|
-
return super.signinPopup(args);
|
|
149
|
-
}
|
|
150
|
-
async signout(args = {}) {
|
|
151
|
-
await this.signoutPopup(args);
|
|
152
|
-
}
|
|
153
|
-
async signoutPopup(args = {}) {
|
|
154
|
-
await this.waitForRenewal();
|
|
155
|
-
await super.signoutPopup(args);
|
|
327
|
+
static async fromConfiguration(configuration) {
|
|
328
|
+
await NativeOidc.configure(configuration.nativeOptions?.ios ?? {});
|
|
329
|
+
return new NativeCapacitorUserManager(configuration);
|
|
156
330
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
void renewal
|
|
163
|
-
.catch((error) => this.events._raiseSilentRenewError(error instanceof Error ? error : new Error('Silent renewal failed')))
|
|
164
|
-
.finally(() => {
|
|
165
|
-
if (this.automaticRenewalPromise === renewal)
|
|
166
|
-
this.automaticRenewalPromise = undefined;
|
|
331
|
+
async initialize() {
|
|
332
|
+
await super.initialize();
|
|
333
|
+
this.appStateListener = await app.App.addListener('appStateChange', ({ isActive }) => {
|
|
334
|
+
if (isActive)
|
|
335
|
+
this.checkForAutomaticRenewal();
|
|
167
336
|
});
|
|
337
|
+
this.checkForAutomaticRenewal();
|
|
168
338
|
}
|
|
169
|
-
async
|
|
170
|
-
const user = await this.getUser();
|
|
171
|
-
if (!user)
|
|
172
|
-
return null;
|
|
173
|
-
if (user.expires_in === undefined || user.expires_in > minimumValiditySeconds)
|
|
174
|
-
return user;
|
|
175
|
-
return this.signinSilent();
|
|
176
|
-
}
|
|
177
|
-
async removeUser() {
|
|
178
|
-
await this.waitForRenewal();
|
|
179
|
-
await super.removeUser();
|
|
180
|
-
}
|
|
181
|
-
signinSilent(args = {}) {
|
|
182
|
-
if (!this.refreshPromise) {
|
|
183
|
-
this.refreshPromise = this.refresh(args).finally(() => {
|
|
184
|
-
this.refreshPromise = undefined;
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
return this.refreshPromise;
|
|
188
|
-
}
|
|
189
|
-
async refresh(args) {
|
|
190
|
-
const user = await this.getUser();
|
|
191
|
-
if (!user?.refresh_token) {
|
|
192
|
-
if (user?.expired)
|
|
193
|
-
await super.removeUser();
|
|
194
|
-
return null;
|
|
195
|
-
}
|
|
196
|
-
const refresh = super.signinSilent({ ...args, forceIframeAuth: false }).catch(async (error) => {
|
|
197
|
-
if (error instanceof oidcClientTs.ErrorResponse && error.error === 'invalid_grant')
|
|
198
|
-
await super.removeUser();
|
|
199
|
-
throw error;
|
|
200
|
-
});
|
|
201
|
-
return refresh;
|
|
202
|
-
}
|
|
203
|
-
async waitForRenewal() {
|
|
204
|
-
await this.automaticRenewalPromise?.catch(() => undefined);
|
|
205
|
-
await this.refreshPromise?.catch(() => undefined);
|
|
206
|
-
}
|
|
207
|
-
async storeUser(user) {
|
|
208
|
-
await super.storeUser(user);
|
|
209
|
-
await NativeOidc.setSessionSnapshot({
|
|
210
|
-
namespace: this.storageNamespace,
|
|
211
|
-
value: user
|
|
212
|
-
? JSON.stringify(toStoredSession(user, user.profile.iss ?? this.settings.metadata?.issuer ?? this.settings.authority, this.settings.client_id))
|
|
213
|
-
: null,
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
async cancel() {
|
|
217
|
-
await NativeOidc.cancel();
|
|
218
|
-
}
|
|
219
|
-
async dispose() {
|
|
220
|
-
this.stopSilentRenew();
|
|
221
|
-
await this.appStateListener?.remove();
|
|
222
|
-
await this.waitForRenewal();
|
|
223
|
-
await this.cancel();
|
|
224
|
-
}
|
|
225
|
-
async signinRedirect() {
|
|
339
|
+
async signinRedirect(_args = {}) {
|
|
226
340
|
unsupported('Redirect navigation');
|
|
227
341
|
}
|
|
228
342
|
async signinRedirectCallback(_url) {
|
|
@@ -231,13 +345,10 @@ class CapacitorUserManager extends oidcClientTs.UserManager {
|
|
|
231
345
|
async signinCallback(_url) {
|
|
232
346
|
unsupported('Browser callback dispatch');
|
|
233
347
|
}
|
|
234
|
-
async signinResourceOwnerCredentials(_args) {
|
|
235
|
-
unsupported('Resource Owner Password Credentials');
|
|
236
|
-
}
|
|
237
348
|
async signinSilentCallback(_url) {
|
|
238
349
|
unsupported('Iframe navigation');
|
|
239
350
|
}
|
|
240
|
-
async signoutRedirect() {
|
|
351
|
+
async signoutRedirect(_args = {}) {
|
|
241
352
|
unsupported('Redirect navigation');
|
|
242
353
|
}
|
|
243
354
|
async signoutRedirectCallback(_url) {
|
|
@@ -246,27 +357,42 @@ class CapacitorUserManager extends oidcClientTs.UserManager {
|
|
|
246
357
|
async signoutCallback(_url, _keepOpen) {
|
|
247
358
|
unsupported('Browser callback dispatch');
|
|
248
359
|
}
|
|
249
|
-
async signoutSilent() {
|
|
360
|
+
async signoutSilent(_args = {}) {
|
|
250
361
|
unsupported('Iframe logout');
|
|
251
362
|
}
|
|
252
363
|
async signoutSilentCallback(_url) {
|
|
253
364
|
unsupported('Iframe logout');
|
|
254
365
|
}
|
|
255
|
-
async querySessionStatus() {
|
|
366
|
+
async querySessionStatus(_args = {}) {
|
|
256
367
|
unsupported('Browser session monitoring');
|
|
257
368
|
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
369
|
+
async storeUser(user) {
|
|
370
|
+
await super.storeUser(user);
|
|
371
|
+
await NativeOidc.setSessionSnapshot({
|
|
372
|
+
namespace: this.storageNamespace,
|
|
373
|
+
value: user
|
|
374
|
+
? JSON.stringify(toStoredSession(user, user.profile.iss ?? this.settings.metadata?.issuer ?? this.settings.authority, this.settings.client_id))
|
|
375
|
+
: null,
|
|
376
|
+
});
|
|
262
377
|
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
378
|
+
cancel() {
|
|
379
|
+
return NativeOidc.cancel();
|
|
380
|
+
}
|
|
381
|
+
async disposePlatform() {
|
|
382
|
+
await this.appStateListener?.remove();
|
|
267
383
|
}
|
|
268
|
-
|
|
269
|
-
|
|
384
|
+
async performSilentSignin(args) {
|
|
385
|
+
const user = await this.getUser();
|
|
386
|
+
if (!user?.refresh_token) {
|
|
387
|
+
if (user?.expired)
|
|
388
|
+
await this.removeUserWithoutWaiting();
|
|
389
|
+
return null;
|
|
390
|
+
}
|
|
391
|
+
return super.performSilentSignin({ ...args, forceIframeAuth: false }).catch(async (error) => {
|
|
392
|
+
if (error instanceof oidcClientTs.ErrorResponse && error.error === 'invalid_grant')
|
|
393
|
+
await this.removeUserWithoutWaiting();
|
|
394
|
+
throw error;
|
|
395
|
+
});
|
|
270
396
|
}
|
|
271
397
|
}
|
|
272
398
|
function toStoredSession(user, issuer, clientId) {
|
|
@@ -283,10 +409,61 @@ function toStoredSession(user, issuer, clientId) {
|
|
|
283
409
|
};
|
|
284
410
|
}
|
|
285
411
|
|
|
412
|
+
class WebCapacitorUserManager extends CapacitorUserManager {
|
|
413
|
+
sessionMonitor;
|
|
414
|
+
disposed = false;
|
|
415
|
+
constructor(configuration) {
|
|
416
|
+
super(configuration);
|
|
417
|
+
this.sessionMonitor = this.captureSessionMonitor();
|
|
418
|
+
}
|
|
419
|
+
async querySessionStatus(args = {}) {
|
|
420
|
+
if (this.disposed)
|
|
421
|
+
return null;
|
|
422
|
+
const session = await super.querySessionStatus(args);
|
|
423
|
+
return this.disposed ? null : session;
|
|
424
|
+
}
|
|
425
|
+
disposePlatform() {
|
|
426
|
+
this.disposed = true;
|
|
427
|
+
if (this.sessionMonitor) {
|
|
428
|
+
this.events.removeUserLoaded(this.sessionMonitor.start);
|
|
429
|
+
this.events.removeUserUnloaded(this.sessionMonitor.stop);
|
|
430
|
+
this.sessionMonitor.stop();
|
|
431
|
+
}
|
|
432
|
+
return Promise.resolve();
|
|
433
|
+
}
|
|
434
|
+
captureSessionMonitor() {
|
|
435
|
+
// oidc-client-ts does not expose public session-monitor lifecycle hooks.
|
|
436
|
+
const monitor = this._sessionMonitor;
|
|
437
|
+
if (!monitor)
|
|
438
|
+
return undefined;
|
|
439
|
+
const originalStart = monitor._start;
|
|
440
|
+
const stop = monitor._stop;
|
|
441
|
+
const start = async (user) => {
|
|
442
|
+
if (this.disposed)
|
|
443
|
+
return;
|
|
444
|
+
await originalStart(user);
|
|
445
|
+
if (this.disposed)
|
|
446
|
+
stop();
|
|
447
|
+
};
|
|
448
|
+
this.events.removeUserLoaded(originalStart);
|
|
449
|
+
this.events.addUserLoaded(start);
|
|
450
|
+
monitor._start = start;
|
|
451
|
+
return { start, stop };
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
setPlatformUserManagerFactory((configuration) => configuration.platform === 'web'
|
|
456
|
+
? new WebCapacitorUserManager(configuration)
|
|
457
|
+
: NativeCapacitorUserManager.fromConfiguration(configuration));
|
|
458
|
+
|
|
286
459
|
Object.defineProperty(exports, "User", {
|
|
287
460
|
enumerable: true,
|
|
288
461
|
get: function () { return oidcClientTs.User; }
|
|
289
462
|
});
|
|
463
|
+
Object.defineProperty(exports, "WebStorageStateStore", {
|
|
464
|
+
enumerable: true,
|
|
465
|
+
get: function () { return oidcClientTs.WebStorageStateStore; }
|
|
466
|
+
});
|
|
290
467
|
exports.CapacitorOidcError = CapacitorOidcError;
|
|
291
468
|
exports.CapacitorSecureStateStore = CapacitorSecureStateStore;
|
|
292
469
|
exports.CapacitorUserManager = CapacitorUserManager;
|
package/dist/plugin.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs","sources":["esm/errors.js","esm/native.js","esm/capacitor-navigator.js","esm/capacitor-secure-state-store.js","esm/capacitor-user-manager.js"],"sourcesContent":["export class CapacitorOidcError extends Error {\n code;\n constructor(code, message) {\n super(message);\n this.code = code;\n this.name = 'CapacitorOidcError';\n }\n}\nexport function unsupported(feature) {\n throw new CapacitorOidcError('UNSUPPORTED_RUNTIME', `${feature} is not available in a native Capacitor runtime`);\n}\n//# sourceMappingURL=errors.js.map","import { registerPlugin } from '@capacitor/core';\nexport const NativeOidc = registerPlugin('CapacitorOidc');\n//# sourceMappingURL=native.js.map","import { CapacitorOidcError, unsupported } from './errors.js';\nimport { NativeOidc } from './native.js';\nexport class CapacitorNavigator {\n prefersEphemeralWebBrowserSession;\n constructor(prefersEphemeralWebBrowserSession) {\n this.prefersEphemeralWebBrowserSession = prefersEphemeralWebBrowserSession;\n }\n async prepare() {\n return new CapacitorWindow(this.prefersEphemeralWebBrowserSession);\n }\n async callback() {\n unsupported('Navigator callbacks');\n }\n}\nclass CapacitorWindow {\n prefersEphemeralWebBrowserSession;\n constructor(prefersEphemeralWebBrowserSession) {\n this.prefersEphemeralWebBrowserSession = prefersEphemeralWebBrowserSession;\n }\n async navigate({ url }) {\n assertSecureRequestUrl(url);\n const callbackUrl = callbackUrlFromRequest(url);\n const response = await NativeOidc.open({\n url,\n callbackUrl,\n prefersEphemeralWebBrowserSession: this.prefersEphemeralWebBrowserSession,\n });\n if (!isExpectedCallback(response.url, callbackUrl)) {\n throw new CapacitorOidcError('INVALID_CALLBACK', 'The authentication callback does not match the configured redirect URI');\n }\n return response;\n }\n close() {\n void NativeOidc.cancel();\n }\n}\nexport function assertSecureRequestUrl(requestUrl) {\n const url = new URL(requestUrl);\n const isHttpLoopback = url.protocol === 'http:' &&\n (url.hostname === 'localhost' || url.hostname === '127.0.0.1' || url.hostname === '[::1]');\n if (url.protocol !== 'https:' && !isHttpLoopback) {\n throw new CapacitorOidcError('BROWSER_UNAVAILABLE', 'OIDC authorization and logout endpoints must use HTTPS');\n }\n}\nexport function callbackUrlFromRequest(requestUrl) {\n const url = new URL(requestUrl);\n const callback = url.searchParams.get('post_logout_redirect_uri') ??\n url.searchParams.get('logout_uri') ??\n url.searchParams.get('redirect_uri');\n if (!callback) {\n throw new CapacitorOidcError('INVALID_CALLBACK', 'The OIDC request does not contain a callback URI');\n }\n return callback;\n}\nexport function isExpectedCallback(actualValue, expectedValue) {\n const actual = new URL(actualValue);\n const expected = new URL(expectedValue);\n return (actual.protocol.toLowerCase() === expected.protocol.toLowerCase() &&\n actual.host.toLowerCase() === expected.host.toLowerCase() &&\n actual.pathname === expected.pathname);\n}\nexport class UnsupportedIframeNavigator {\n async prepare() {\n unsupported('Iframe navigation');\n }\n async callback() {\n unsupported('Iframe navigation');\n }\n}\n//# sourceMappingURL=capacitor-navigator.js.map","import { NativeOidc } from './native.js';\nexport class CapacitorSecureStateStore {\n namespace;\n constructor(namespace) {\n this.namespace = namespace;\n }\n async set(key, value) {\n await NativeOidc.storageSet({ namespace: this.namespace, key, value });\n }\n async get(key) {\n return (await NativeOidc.storageGet({ namespace: this.namespace, key })).value;\n }\n async remove(key) {\n return (await NativeOidc.storageRemove({ namespace: this.namespace, key })).value;\n }\n async getAllKeys() {\n return (await NativeOidc.storageGetAllKeys({ namespace: this.namespace })).keys;\n }\n}\n//# sourceMappingURL=capacitor-secure-state-store.js.map","import { App } from '@capacitor/app';\nimport { ErrorResponse, UserManager, } from 'oidc-client-ts';\nimport { CapacitorNavigator, UnsupportedIframeNavigator } from './capacitor-navigator.js';\nimport { CapacitorSecureStateStore } from './capacitor-secure-state-store.js';\nimport { CapacitorOidcError, unsupported } from './errors.js';\nimport { NativeOidc } from './native.js';\nexport class CapacitorUserManager extends UserManager {\n storageNamespace;\n automaticRenewalPromise;\n refreshPromise;\n appStateListener;\n constructor(settings, nativeOptions, storageNamespace) {\n const stateStore = new CapacitorSecureStateStore(`${storageNamespace}.transactions`);\n const userStore = new CapacitorSecureStateStore(`${storageNamespace}.session`);\n const navigator = new CapacitorNavigator(nativeOptions.prefersEphemeralWebBrowserSession ?? false);\n super({\n ...settings,\n response_type: 'code',\n disablePKCE: false,\n monitorSession: false,\n popup_redirect_uri: settings.redirect_uri,\n popup_post_logout_redirect_uri: settings.post_logout_redirect_uri,\n stateStore,\n userStore,\n }, navigator, navigator, new UnsupportedIframeNavigator());\n this.storageNamespace = storageNamespace;\n }\n static async create(settings, nativeOptions = {}) {\n assertRuntime();\n assertSettings(settings);\n await NativeOidc.configure(nativeOptions.ios ?? {});\n const manager = new CapacitorUserManager(settings, nativeOptions, nativeOptions.storageNamespace ?? 'default');\n await manager.getUser();\n manager.appStateListener = await App.addListener('appStateChange', ({ isActive }) => {\n if (isActive) {\n manager.checkForAutomaticRenewal();\n }\n });\n manager.checkForAutomaticRenewal();\n return manager;\n }\n async signin(args = {}) {\n return this.signinPopup(args);\n }\n async signinPopup(args = {}) {\n await this.waitForRenewal();\n return super.signinPopup(args);\n }\n async signout(args = {}) {\n await this.signoutPopup(args);\n }\n async signoutPopup(args = {}) {\n await this.waitForRenewal();\n await super.signoutPopup(args);\n }\n checkForAutomaticRenewal() {\n if (!this.settings.automaticSilentRenew || this.automaticRenewalPromise)\n return;\n const renewal = this.getValidUser();\n this.automaticRenewalPromise = renewal;\n void renewal\n .catch((error) => this.events._raiseSilentRenewError(error instanceof Error ? error : new Error('Silent renewal failed')))\n .finally(() => {\n if (this.automaticRenewalPromise === renewal)\n this.automaticRenewalPromise = undefined;\n });\n }\n async getValidUser(minimumValiditySeconds = 60) {\n const user = await this.getUser();\n if (!user)\n return null;\n if (user.expires_in === undefined || user.expires_in > minimumValiditySeconds)\n return user;\n return this.signinSilent();\n }\n async removeUser() {\n await this.waitForRenewal();\n await super.removeUser();\n }\n signinSilent(args = {}) {\n if (!this.refreshPromise) {\n this.refreshPromise = this.refresh(args).finally(() => {\n this.refreshPromise = undefined;\n });\n }\n return this.refreshPromise;\n }\n async refresh(args) {\n const user = await this.getUser();\n if (!user?.refresh_token) {\n if (user?.expired)\n await super.removeUser();\n return null;\n }\n const refresh = super.signinSilent({ ...args, forceIframeAuth: false }).catch(async (error) => {\n if (error instanceof ErrorResponse && error.error === 'invalid_grant')\n await super.removeUser();\n throw error;\n });\n return refresh;\n }\n async waitForRenewal() {\n await this.automaticRenewalPromise?.catch(() => undefined);\n await this.refreshPromise?.catch(() => undefined);\n }\n async storeUser(user) {\n await super.storeUser(user);\n await NativeOidc.setSessionSnapshot({\n namespace: this.storageNamespace,\n value: user\n ? JSON.stringify(toStoredSession(user, user.profile.iss ?? this.settings.metadata?.issuer ?? this.settings.authority, this.settings.client_id))\n : null,\n });\n }\n async cancel() {\n await NativeOidc.cancel();\n }\n async dispose() {\n this.stopSilentRenew();\n await this.appStateListener?.remove();\n await this.waitForRenewal();\n await this.cancel();\n }\n async signinRedirect() {\n unsupported('Redirect navigation');\n }\n async signinRedirectCallback(_url) {\n unsupported('Redirect navigation');\n }\n async signinCallback(_url) {\n unsupported('Browser callback dispatch');\n }\n async signinResourceOwnerCredentials(_args) {\n unsupported('Resource Owner Password Credentials');\n }\n async signinSilentCallback(_url) {\n unsupported('Iframe navigation');\n }\n async signoutRedirect() {\n unsupported('Redirect navigation');\n }\n async signoutRedirectCallback(_url) {\n unsupported('Redirect navigation');\n }\n async signoutCallback(_url, _keepOpen) {\n unsupported('Browser callback dispatch');\n }\n async signoutSilent() {\n unsupported('Iframe logout');\n }\n async signoutSilentCallback(_url) {\n unsupported('Iframe logout');\n }\n async querySessionStatus() {\n unsupported('Browser session monitoring');\n }\n}\nfunction assertRuntime() {\n if (!globalThis.crypto?.subtle || !globalThis.crypto.getRandomValues) {\n throw new CapacitorOidcError('UNSUPPORTED_RUNTIME', 'Web Crypto is required by oidc-client-ts');\n }\n}\nfunction assertSettings(settings) {\n if ('client_secret' in settings) {\n throw new CapacitorOidcError('UNSUPPORTED_RUNTIME', 'Native public clients must not contain a client secret');\n }\n if ('client_authentication' in settings || 'dpop' in settings) {\n throw new CapacitorOidcError('UNSUPPORTED_RUNTIME', 'The supplied settings contain an unsupported native-client option');\n }\n}\nfunction toStoredSession(user, issuer, clientId) {\n return {\n version: 1,\n issuer,\n clientId,\n accessToken: user.access_token,\n refreshToken: user.refresh_token,\n idToken: user.id_token,\n tokenType: user.token_type,\n scope: user.scope,\n expiresAt: user.expires_at,\n };\n}\n//# sourceMappingURL=capacitor-user-manager.js.map"],"names":["registerPlugin","UserManager","App","ErrorResponse"],"mappings":";;;;;;AAAO,MAAM,kBAAkB,SAAS,KAAK,CAAC;AAC9C,IAAI,IAAI;AACR,IAAI,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE;AAC/B,QAAQ,KAAK,CAAC,OAAO,CAAC;AACtB,QAAQ,IAAI,CAAC,IAAI,GAAG,IAAI;AACxB,QAAQ,IAAI,CAAC,IAAI,GAAG,oBAAoB;AACxC,IAAI;AACJ;AACO,SAAS,WAAW,CAAC,OAAO,EAAE;AACrC,IAAI,MAAM,IAAI,kBAAkB,CAAC,qBAAqB,EAAE,CAAC,EAAE,OAAO,CAAC,+CAA+C,CAAC,CAAC;AACpH;;ACTO,MAAM,UAAU,GAAGA,mBAAc,CAAC,eAAe,CAAC;;ACClD,MAAM,kBAAkB,CAAC;AAChC,IAAI,iCAAiC;AACrC,IAAI,WAAW,CAAC,iCAAiC,EAAE;AACnD,QAAQ,IAAI,CAAC,iCAAiC,GAAG,iCAAiC;AAClF,IAAI;AACJ,IAAI,MAAM,OAAO,GAAG;AACpB,QAAQ,OAAO,IAAI,eAAe,CAAC,IAAI,CAAC,iCAAiC,CAAC;AAC1E,IAAI;AACJ,IAAI,MAAM,QAAQ,GAAG;AACrB,QAAQ,WAAW,CAAC,qBAAqB,CAAC;AAC1C,IAAI;AACJ;AACA,MAAM,eAAe,CAAC;AACtB,IAAI,iCAAiC;AACrC,IAAI,WAAW,CAAC,iCAAiC,EAAE;AACnD,QAAQ,IAAI,CAAC,iCAAiC,GAAG,iCAAiC;AAClF,IAAI;AACJ,IAAI,MAAM,QAAQ,CAAC,EAAE,GAAG,EAAE,EAAE;AAC5B,QAAQ,sBAAsB,CAAC,GAAG,CAAC;AACn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AAC,UAAU;AAClC,QAAQ,KAAK,EAAE,IAAI,CAAC,KAAK;AACzB,QAAQ,SAAS,EAAE,IAAI,CAAC,UAAU;AAClC,KAAK;AACL;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.cjs","sources":["esm/errors.js","esm/base-capacitor-user-manager.js","esm/configuration.js","esm/capacitor-user-manager.js","esm/native.js","esm/capacitor-navigator.js","esm/capacitor-secure-state-store.js","esm/native-capacitor-user-manager.js","esm/web-capacitor-user-manager.js","esm/index.js"],"sourcesContent":["export class CapacitorOidcError extends Error {\n code;\n constructor(code, message) {\n super(message);\n this.code = code;\n this.name = 'CapacitorOidcError';\n }\n}\nexport function unsupported(feature) {\n throw new CapacitorOidcError('UNSUPPORTED_RUNTIME', `${feature} is not available in a native Capacitor runtime`);\n}\n//# sourceMappingURL=errors.js.map","import { UserManager, } from 'oidc-client-ts';\nimport { unsupported } from './errors.js';\nexport class BaseCapacitorUserManager extends UserManager {\n automaticRenewalPromise;\n refreshPromise;\n signinMode;\n signoutMode;\n defaultSigninArgs;\n defaultSignoutArgs;\n constructor(configuration, redirectNavigator, popupNavigator, iframeNavigator) {\n super(configuration.settings, redirectNavigator, popupNavigator, iframeNavigator);\n this.signinMode = configuration.signinMode;\n this.signoutMode = configuration.signoutMode;\n this.defaultSigninArgs = configuration.signinArgs;\n this.defaultSignoutArgs = configuration.signoutArgs;\n }\n async initialize() {\n await this.getUser();\n }\n async signin(args = {}) {\n const mergedArgs = { ...this.defaultSigninArgs, ...args };\n if (this.signinMode === 'redirect')\n return this.signinRedirect(mergedArgs);\n await this.signinPopup(mergedArgs);\n }\n async signout(args = {}) {\n const mergedArgs = { ...this.defaultSignoutArgs, ...args };\n if (this.signoutMode === 'redirect')\n return this.signoutRedirect(mergedArgs);\n await this.signoutPopup(mergedArgs);\n }\n async getValidUser(minimumValiditySeconds = 60) {\n const user = await this.getUser();\n if (!user)\n return null;\n if (user.expires_in === undefined || user.expires_in > minimumValiditySeconds)\n return user;\n return this.signinSilent();\n }\n async signinPopup(args = {}) {\n await this.waitForRenewal();\n return super.signinPopup(args);\n }\n async signoutPopup(args = {}) {\n await this.waitForRenewal();\n await super.signoutPopup(args);\n }\n async signinRedirect(args = {}) {\n await this.waitForRenewal();\n await super.signinRedirect(args);\n }\n async signoutRedirect(args = {}) {\n await this.waitForRenewal();\n await super.signoutRedirect(args);\n }\n signinSilent(args = {}) {\n if (!this.refreshPromise) {\n const refresh = this.performSilentSignin(args);\n this.refreshPromise = refresh.finally(() => {\n this.refreshPromise = undefined;\n });\n }\n return this.refreshPromise;\n }\n async signinResourceOwnerCredentials(_args) {\n unsupported('Resource Owner Password Credentials');\n }\n async removeUser() {\n await this.waitForRenewal();\n await this.removeUserWithoutWaiting();\n }\n cancel() {\n return Promise.resolve();\n }\n async dispose() {\n this.stopSilentRenew();\n await this.disposePlatform();\n await this.waitForRenewal();\n await this.cancel();\n }\n performSilentSignin(args) {\n return super.signinSilent(args);\n }\n removeUserWithoutWaiting() {\n return super.removeUser();\n }\n checkForAutomaticRenewal() {\n if (!this.settings.automaticSilentRenew || this.automaticRenewalPromise)\n return;\n const renewal = this.getValidUser();\n this.automaticRenewalPromise = renewal;\n void renewal\n .catch((error) => this.events._raiseSilentRenewError(error instanceof Error ? error : new Error('Silent renewal failed')))\n .finally(() => {\n if (this.automaticRenewalPromise === renewal)\n this.automaticRenewalPromise = undefined;\n });\n }\n async waitForRenewal() {\n await this.automaticRenewalPromise?.catch(() => undefined);\n await this.refreshPromise?.catch(() => undefined);\n }\n}\n//# sourceMappingURL=base-capacitor-user-manager.js.map","import { CapacitorOidcError } from './errors.js';\nexport function resolveConfiguration(configuration, platform) {\n if (platform === 'web')\n return resolveWebConfiguration(configuration);\n return resolveNativeConfiguration(configuration, platform);\n}\nexport function resolveLegacyNativeConfiguration(settings, nativeOptions, platform) {\n if (platform === 'web') {\n throw new CapacitorOidcError('UNSUPPORTED_RUNTIME', 'Legacy CapacitorUserManager settings are only supported on iOS and Android');\n }\n assertPublicClient(settings);\n if ('dpop' in settings) {\n throw new CapacitorOidcError('UNSUPPORTED_RUNTIME', 'Native configuration does not support dpop');\n }\n return resolvedNativeConfiguration(platform, settings, nativeOptions);\n}\nfunction resolveWebConfiguration(configuration) {\n const web = configuration.web;\n if (!web)\n unsupportedConfiguration('web');\n const signoutMode = web.signoutMode ?? 'redirect';\n const settings = { ...configuration.common, ...web.settings };\n assertPublicClient(settings);\n if (signoutMode === 'popup' && !settings.popup_post_logout_redirect_uri && !settings.post_logout_redirect_uri) {\n throw new CapacitorOidcError('UNSUPPORTED_RUNTIME', 'Web popup signout requires post_logout_redirect_uri or popup_post_logout_redirect_uri');\n }\n return {\n platform: 'web',\n settings,\n signinMode: web.signinMode ?? 'redirect',\n signoutMode,\n signinArgs: web.signinArgs ?? {},\n signoutArgs: web.signoutArgs ?? {},\n };\n}\nfunction resolveNativeConfiguration(configuration, platform) {\n const native = configuration.native;\n if (!native)\n unsupportedConfiguration(platform);\n const override = configuration[platform];\n const settings = { ...configuration.common, ...native.settings, ...override?.settings };\n assertPublicClient(settings);\n assertNativeSettings(settings);\n return resolvedNativeConfiguration(platform, settings, { ...native.options, ...override?.options }, { ...native.signinArgs, ...override?.signinArgs }, { ...native.signoutArgs, ...override?.signoutArgs });\n}\nfunction resolvedNativeConfiguration(platform, settings, nativeOptions, signinArgs = {}, signoutArgs = {}) {\n return {\n platform,\n settings: { ...settings, response_type: 'code', disablePKCE: false, monitorSession: false },\n nativeOptions,\n signinMode: 'popup',\n signoutMode: 'popup',\n signinArgs,\n signoutArgs,\n };\n}\nfunction assertPublicClient(settings) {\n const unsupported = ['client_authentication', 'client_secret', 'disablePKCE', 'response_type'].find((key) => key in settings);\n if (unsupported) {\n throw new CapacitorOidcError('UNSUPPORTED_RUNTIME', `Public-client configuration does not support ${unsupported}`);\n }\n}\nfunction assertNativeSettings(settings) {\n const unsupported = ['dpop', 'monitorSession', 'silent_redirect_uri', 'stateStore', 'userStore'].find((key) => key in settings);\n if (unsupported) {\n throw new CapacitorOidcError('UNSUPPORTED_RUNTIME', `Native configuration does not support ${unsupported}`);\n }\n}\nfunction unsupportedConfiguration(platform) {\n throw new CapacitorOidcError('UNSUPPORTED_RUNTIME', `No ${platform} configuration was provided`);\n}\n//# sourceMappingURL=configuration.js.map","import { Capacitor } from '@capacitor/core';\nimport { BaseCapacitorUserManager } from './base-capacitor-user-manager.js';\nimport { resolveConfiguration, resolveLegacyNativeConfiguration, } from './configuration.js';\nimport { CapacitorOidcError } from './errors.js';\nexport class CapacitorUserManager extends BaseCapacitorUserManager {\n static async create(configuration, nativeOptions = {}) {\n assertRuntime();\n const platform = currentPlatform();\n const resolved = 'redirect_uri' in configuration\n ? resolveLegacyNativeConfiguration(configuration, nativeOptions, platform)\n : resolveConfiguration(configuration, platform);\n const manager = await platformUserManagerFactory(resolved);\n await manager.initialize();\n return manager;\n }\n}\nlet platformUserManagerFactory;\nexport function setPlatformUserManagerFactory(factory) {\n platformUserManagerFactory = factory;\n}\nfunction currentPlatform() {\n const platform = Capacitor.getPlatform();\n return platform === 'ios' || platform === 'android' ? platform : 'web';\n}\nfunction assertRuntime() {\n if (!globalThis.crypto?.subtle || !globalThis.crypto.getRandomValues) {\n throw new CapacitorOidcError('UNSUPPORTED_RUNTIME', 'Web Crypto is required by oidc-client-ts');\n }\n}\n//# sourceMappingURL=capacitor-user-manager.js.map","import { registerPlugin } from '@capacitor/core';\nexport const NativeOidc = registerPlugin('CapacitorOidc');\n//# sourceMappingURL=native.js.map","import { CapacitorOidcError, unsupported } from './errors.js';\nimport { NativeOidc } from './native.js';\nexport class CapacitorNavigator {\n prefersEphemeralWebBrowserSession;\n constructor(prefersEphemeralWebBrowserSession) {\n this.prefersEphemeralWebBrowserSession = prefersEphemeralWebBrowserSession;\n }\n async prepare() {\n return new CapacitorWindow(this.prefersEphemeralWebBrowserSession);\n }\n async callback() {\n unsupported('Navigator callbacks');\n }\n}\nclass CapacitorWindow {\n prefersEphemeralWebBrowserSession;\n constructor(prefersEphemeralWebBrowserSession) {\n this.prefersEphemeralWebBrowserSession = prefersEphemeralWebBrowserSession;\n }\n async navigate({ url }) {\n assertSecureRequestUrl(url);\n const callbackUrl = callbackUrlFromRequest(url);\n const response = await NativeOidc.open({\n url,\n callbackUrl,\n prefersEphemeralWebBrowserSession: this.prefersEphemeralWebBrowserSession,\n });\n if (!isExpectedCallback(response.url, callbackUrl)) {\n throw new CapacitorOidcError('INVALID_CALLBACK', 'The authentication callback does not match the configured redirect URI');\n }\n return response;\n }\n close() {\n void NativeOidc.cancel();\n }\n}\nexport function assertSecureRequestUrl(requestUrl) {\n const url = new URL(requestUrl);\n const isHttpLoopback = url.protocol === 'http:' &&\n (url.hostname === 'localhost' || url.hostname === '127.0.0.1' || url.hostname === '[::1]');\n if (url.protocol !== 'https:' && !isHttpLoopback) {\n throw new CapacitorOidcError('BROWSER_UNAVAILABLE', 'OIDC authorization and logout endpoints must use HTTPS');\n }\n}\nexport function callbackUrlFromRequest(requestUrl) {\n const url = new URL(requestUrl);\n const callback = url.searchParams.get('post_logout_redirect_uri') ??\n url.searchParams.get('logout_uri') ??\n url.searchParams.get('redirect_uri');\n if (!callback) {\n throw new CapacitorOidcError('INVALID_CALLBACK', 'The OIDC request does not contain a callback URI');\n }\n return callback;\n}\nexport function isExpectedCallback(actualValue, expectedValue) {\n const actual = new URL(actualValue);\n const expected = new URL(expectedValue);\n return (actual.protocol.toLowerCase() === expected.protocol.toLowerCase() &&\n actual.host.toLowerCase() === expected.host.toLowerCase() &&\n actual.pathname === expected.pathname);\n}\nexport class UnsupportedIframeNavigator {\n async prepare() {\n unsupported('Iframe navigation');\n }\n async callback() {\n unsupported('Iframe navigation');\n }\n}\n//# sourceMappingURL=capacitor-navigator.js.map","import { NativeOidc } from './native.js';\nexport class CapacitorSecureStateStore {\n namespace;\n constructor(namespace) {\n this.namespace = namespace;\n }\n async set(key, value) {\n await NativeOidc.storageSet({ namespace: this.namespace, key, value });\n }\n async get(key) {\n return (await NativeOidc.storageGet({ namespace: this.namespace, key })).value;\n }\n async remove(key) {\n return (await NativeOidc.storageRemove({ namespace: this.namespace, key })).value;\n }\n async getAllKeys() {\n return (await NativeOidc.storageGetAllKeys({ namespace: this.namespace })).keys;\n }\n}\n//# sourceMappingURL=capacitor-secure-state-store.js.map","import { App } from '@capacitor/app';\nimport { ErrorResponse, } from 'oidc-client-ts';\nimport { CapacitorNavigator, UnsupportedIframeNavigator } from './capacitor-navigator.js';\nimport { CapacitorSecureStateStore } from './capacitor-secure-state-store.js';\nimport { CapacitorUserManager } from './capacitor-user-manager.js';\nimport { unsupported } from './errors.js';\nimport { NativeOidc } from './native.js';\nexport class NativeCapacitorUserManager extends CapacitorUserManager {\n appStateListener;\n storageNamespace;\n constructor(configuration) {\n const storageNamespace = configuration.nativeOptions?.storageNamespace ?? 'default';\n const stateStore = new CapacitorSecureStateStore(`${storageNamespace}.transactions`);\n const userStore = new CapacitorSecureStateStore(`${storageNamespace}.session`);\n const navigator = new CapacitorNavigator(configuration.nativeOptions?.prefersEphemeralWebBrowserSession ?? false);\n super({\n ...configuration,\n settings: {\n ...configuration.settings,\n popup_redirect_uri: configuration.settings.redirect_uri,\n popup_post_logout_redirect_uri: configuration.settings.post_logout_redirect_uri,\n stateStore,\n userStore,\n },\n }, navigator, navigator, new UnsupportedIframeNavigator());\n this.storageNamespace = storageNamespace;\n }\n static async fromConfiguration(configuration) {\n await NativeOidc.configure(configuration.nativeOptions?.ios ?? {});\n return new NativeCapacitorUserManager(configuration);\n }\n async initialize() {\n await super.initialize();\n this.appStateListener = await App.addListener('appStateChange', ({ isActive }) => {\n if (isActive)\n this.checkForAutomaticRenewal();\n });\n this.checkForAutomaticRenewal();\n }\n async signinRedirect(_args = {}) {\n unsupported('Redirect navigation');\n }\n async signinRedirectCallback(_url) {\n unsupported('Redirect navigation');\n }\n async signinCallback(_url) {\n unsupported('Browser callback dispatch');\n }\n async signinSilentCallback(_url) {\n unsupported('Iframe navigation');\n }\n async signoutRedirect(_args = {}) {\n unsupported('Redirect navigation');\n }\n async signoutRedirectCallback(_url) {\n unsupported('Redirect navigation');\n }\n async signoutCallback(_url, _keepOpen) {\n unsupported('Browser callback dispatch');\n }\n async signoutSilent(_args = {}) {\n unsupported('Iframe logout');\n }\n async signoutSilentCallback(_url) {\n unsupported('Iframe logout');\n }\n async querySessionStatus(_args = {}) {\n unsupported('Browser session monitoring');\n }\n async storeUser(user) {\n await super.storeUser(user);\n await NativeOidc.setSessionSnapshot({\n namespace: this.storageNamespace,\n value: user\n ? JSON.stringify(toStoredSession(user, user.profile.iss ?? this.settings.metadata?.issuer ?? this.settings.authority, this.settings.client_id))\n : null,\n });\n }\n cancel() {\n return NativeOidc.cancel();\n }\n async disposePlatform() {\n await this.appStateListener?.remove();\n }\n async performSilentSignin(args) {\n const user = await this.getUser();\n if (!user?.refresh_token) {\n if (user?.expired)\n await this.removeUserWithoutWaiting();\n return null;\n }\n return super.performSilentSignin({ ...args, forceIframeAuth: false }).catch(async (error) => {\n if (error instanceof ErrorResponse && error.error === 'invalid_grant')\n await this.removeUserWithoutWaiting();\n throw error;\n });\n }\n}\nfunction toStoredSession(user, issuer, clientId) {\n return {\n version: 1,\n issuer,\n clientId,\n accessToken: user.access_token,\n refreshToken: user.refresh_token,\n idToken: user.id_token,\n tokenType: user.token_type,\n scope: user.scope,\n expiresAt: user.expires_at,\n };\n}\n//# sourceMappingURL=native-capacitor-user-manager.js.map","import { CapacitorUserManager } from './capacitor-user-manager.js';\nexport class WebCapacitorUserManager extends CapacitorUserManager {\n sessionMonitor;\n disposed = false;\n constructor(configuration) {\n super(configuration);\n this.sessionMonitor = this.captureSessionMonitor();\n }\n async querySessionStatus(args = {}) {\n if (this.disposed)\n return null;\n const session = await super.querySessionStatus(args);\n return this.disposed ? null : session;\n }\n disposePlatform() {\n this.disposed = true;\n if (this.sessionMonitor) {\n this.events.removeUserLoaded(this.sessionMonitor.start);\n this.events.removeUserUnloaded(this.sessionMonitor.stop);\n this.sessionMonitor.stop();\n }\n return Promise.resolve();\n }\n captureSessionMonitor() {\n // oidc-client-ts does not expose public session-monitor lifecycle hooks.\n const monitor = this._sessionMonitor;\n if (!monitor)\n return undefined;\n const originalStart = monitor._start;\n const stop = monitor._stop;\n const start = async (user) => {\n if (this.disposed)\n return;\n await originalStart(user);\n if (this.disposed)\n stop();\n };\n this.events.removeUserLoaded(originalStart);\n this.events.addUserLoaded(start);\n monitor._start = start;\n return { start, stop };\n }\n}\n//# sourceMappingURL=web-capacitor-user-manager.js.map","import { CapacitorUserManager, setPlatformUserManagerFactory } from './capacitor-user-manager.js';\nimport { NativeCapacitorUserManager } from './native-capacitor-user-manager.js';\nimport { WebCapacitorUserManager } from './web-capacitor-user-manager.js';\nsetPlatformUserManagerFactory((configuration) => configuration.platform === 'web'\n ? new WebCapacitorUserManager(configuration)\n : NativeCapacitorUserManager.fromConfiguration(configuration));\nexport { CapacitorUserManager };\nexport { CapacitorSecureStateStore } from './capacitor-secure-state-store.js';\nexport { CapacitorOidcError } from './errors.js';\nexport { User, WebStorageStateStore } from 'oidc-client-ts';\n//# sourceMappingURL=index.js.map"],"names":["UserManager","Capacitor","registerPlugin","App","ErrorResponse"],"mappings":";;;;;;AAAO,MAAM,kBAAkB,SAAS,KAAK,CAAC;AAC9C,IAAI,IAAI;AACR,IAAI,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE;AAC/B,QAAQ,KAAK,CAAC,OAAO,CAAC;AACtB,QAAQ,IAAI,CAAC,IAAI,GAAG,IAAI;AACxB,QAAQ,IAAI,CAAC,IAAI,GAAG,oBAAoB;AACxC,IAAI;AACJ;AACO,SAAS,WAAW,CAAC,OAAO,EAAE;AACrC,IAAI,MAAM,IAAI,kBAAkB,CAAC,qBAAqB,EAAE,CAAC,EAAE,OAAO,CAAC,+CAA+C,CAAC,CAAC;AACpH;;ACRO,MAAM,wBAAwB,SAASA,wBAAW,CAAC;AAC1D,IAAI,uBAAuB;AAC3B,IAAI,cAAc;AAClB,IAAI,UA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