@ic-reactor/react 3.10.0 → 3.12.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 +11 -0
- package/dist/auth/authentication-manager.d.ts +15 -0
- package/dist/auth/authentication-manager.d.ts.map +1 -1
- package/dist/auth/authentication-manager.js +70 -13
- package/dist/auth/authentication-manager.js.map +1 -1
- package/dist/auth/constants.d.ts +7 -1
- package/dist/auth/constants.d.ts.map +1 -1
- package/dist/auth/constants.js +7 -1
- package/dist/auth/constants.js.map +1 -1
- package/dist/auth/identity-attributes-manager.d.ts.map +1 -1
- package/dist/auth/identity-attributes-manager.js +13 -14
- package/dist/auth/identity-attributes-manager.js.map +1 -1
- package/dist/auth/local-ii-probe.d.ts +46 -0
- package/dist/auth/local-ii-probe.d.ts.map +1 -0
- package/dist/auth/local-ii-probe.js +102 -0
- package/dist/auth/local-ii-probe.js.map +1 -0
- package/dist/auth/types.d.ts +1 -3
- package/dist/auth/types.d.ts.map +1 -1
- package/package.json +12 -12
- package/src/auth/authentication-manager.ts +86 -15
- package/src/auth/constants.ts +9 -2
- package/src/auth/identity-attributes-manager.ts +13 -18
- package/src/auth/local-ii-probe.ts +147 -0
- package/src/auth/types.ts +1 -3
package/README.md
CHANGED
|
@@ -13,6 +13,17 @@ pnpm add @ic-reactor/react @icp-sdk/core @tanstack/react-query
|
|
|
13
13
|
pnpm add @icp-sdk/auth
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
+
> **npm needs an override to install this set.** Every published
|
|
17
|
+
> `@icp-sdk/auth` peers `@icp-sdk/core@^5`, while this package needs `^6`, so a
|
|
18
|
+
> strict `npm install` fails with `ERESOLVE`. The metadata is stale rather than
|
|
19
|
+
> the versions being incompatible — auth v8 runs against core v6, and this
|
|
20
|
+
> repository's own suite exercises that combination. pnpm and yarn install it
|
|
21
|
+
> as-is; for npm, add:
|
|
22
|
+
>
|
|
23
|
+
> ```json
|
|
24
|
+
> { "overrides": { "@icp-sdk/auth": { "@icp-sdk/core": "$@icp-sdk/core" } } }
|
|
25
|
+
> ```
|
|
26
|
+
|
|
16
27
|
`@icp-sdk/auth` is an optional peer. `AuthenticationManager` reaches it through a
|
|
17
28
|
literal `import("@icp-sdk/auth/client")`, so Vite, Rollup and webpack code-split
|
|
18
29
|
it into its own async chunk. That chunk is never fetched unless something
|
|
@@ -34,6 +34,13 @@ export declare class AuthenticationManager {
|
|
|
34
34
|
private authStateValue;
|
|
35
35
|
private readonly identityProvider?;
|
|
36
36
|
private readonly internetIdentityId?;
|
|
37
|
+
/**
|
|
38
|
+
* Which authorize path the locally deployed Internet Identity serves, once
|
|
39
|
+
* probed. `undefined` means not probed yet; `null` means it serves no sign-in
|
|
40
|
+
* UI and login should fail with an explanation rather than open a popup onto
|
|
41
|
+
* a gateway error page.
|
|
42
|
+
*/
|
|
43
|
+
private localAuthorizePath?;
|
|
37
44
|
private readonly defaultClientOptions;
|
|
38
45
|
readonly clientManager: ClientManager;
|
|
39
46
|
/** The current authentication state. */
|
|
@@ -51,6 +58,14 @@ export declare class AuthenticationManager {
|
|
|
51
58
|
* what browser popup blockers and the ICRC-29 transport require.
|
|
52
59
|
*/
|
|
53
60
|
prepareClient(options?: AuthenticationClientOptions): Promise<AuthClientLike | undefined>;
|
|
61
|
+
/**
|
|
62
|
+
* Probe the local Internet Identity canister once, and remember what it
|
|
63
|
+
* serves.
|
|
64
|
+
*
|
|
65
|
+
* Only for the derived local provider: an explicitly configured
|
|
66
|
+
* `identityProvider` is the caller's business, and mainnet is fixed.
|
|
67
|
+
*/
|
|
68
|
+
private ensureLocalAuthorizePath;
|
|
54
69
|
/**
|
|
55
70
|
* Returns an AuthClient without awaiting, or `undefined` when the auth
|
|
56
71
|
* module has not been loaded yet.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authentication-manager.d.ts","sourceRoot":"","sources":["../../src/auth/authentication-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QA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CAkCxC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { isDev,
|
|
1
|
+
import { isDev, allowsEnvRootKey } from "@ic-reactor/core";
|
|
2
2
|
import { Principal } from "@icp-sdk/core/principal";
|
|
3
3
|
import { safeGetCanisterEnv } from "@icp-sdk/core/agent/canister-env";
|
|
4
|
-
import {
|
|
4
|
+
import { probeLocalInternetIdentity, localInternetIdentityUnavailableError, } from "./local-ii-probe.js";
|
|
5
|
+
import { IC_INTERNET_IDENTITY_PROVIDER, INTERNET_IDENTITY_PROVIDER_ENV_KEY, LOCAL_INTERNET_IDENTITY_CANISTER_ID, localInternetIdentityProvider, } from "./constants.js";
|
|
5
6
|
/**
|
|
6
7
|
* Manages Internet Identity sign-in, session restoration, and authentication
|
|
7
8
|
* state for a {@link ClientManager}.
|
|
@@ -95,6 +96,18 @@ export class AuthenticationManager {
|
|
|
95
96
|
writable: true,
|
|
96
97
|
value: void 0
|
|
97
98
|
});
|
|
99
|
+
/**
|
|
100
|
+
* Which authorize path the locally deployed Internet Identity serves, once
|
|
101
|
+
* probed. `undefined` means not probed yet; `null` means it serves no sign-in
|
|
102
|
+
* UI and login should fail with an explanation rather than open a popup onto
|
|
103
|
+
* a gateway error page.
|
|
104
|
+
*/
|
|
105
|
+
Object.defineProperty(this, "localAuthorizePath", {
|
|
106
|
+
enumerable: true,
|
|
107
|
+
configurable: true,
|
|
108
|
+
writable: true,
|
|
109
|
+
value: void 0
|
|
110
|
+
});
|
|
98
111
|
Object.defineProperty(this, "defaultClientOptions", {
|
|
99
112
|
enumerable: true,
|
|
100
113
|
configurable: true,
|
|
@@ -312,12 +325,42 @@ export class AuthenticationManager {
|
|
|
312
325
|
* what browser popup blockers and the ICRC-29 transport require.
|
|
313
326
|
*/
|
|
314
327
|
async prepareClient(options) {
|
|
328
|
+
// Before resolving options, because resolving them is what picks the
|
|
329
|
+
// provider URL. This is the last async point before `login()` has to stay
|
|
330
|
+
// inside the user gesture, so the answer has to be cached by now.
|
|
331
|
+
await this.ensureLocalAuthorizePath();
|
|
315
332
|
const clientOptions = this.resolveClientOptions(options);
|
|
316
333
|
if (this.authClient && !this.shouldRecreateClient(clientOptions)) {
|
|
317
334
|
return this.authClient;
|
|
318
335
|
}
|
|
319
336
|
return this.initializeClient(clientOptions);
|
|
320
337
|
}
|
|
338
|
+
/**
|
|
339
|
+
* Probe the local Internet Identity canister once, and remember what it
|
|
340
|
+
* serves.
|
|
341
|
+
*
|
|
342
|
+
* Only for the derived local provider: an explicitly configured
|
|
343
|
+
* `identityProvider` is the caller's business, and mainnet is fixed.
|
|
344
|
+
*/
|
|
345
|
+
async ensureLocalAuthorizePath() {
|
|
346
|
+
if (this.localAuthorizePath !== undefined)
|
|
347
|
+
return;
|
|
348
|
+
if (this.identityProvider)
|
|
349
|
+
return;
|
|
350
|
+
if (!this.clientManager.isLocal)
|
|
351
|
+
return;
|
|
352
|
+
const canisterId = this.internetIdentityId ?? LOCAL_INTERNET_IDENTITY_CANISTER_ID;
|
|
353
|
+
const { path, inconclusive } = await probeLocalInternetIdentity(this.clientManager.agent, canisterId);
|
|
354
|
+
// An inconclusive probe must not change behaviour: the canister may be
|
|
355
|
+
// fine and merely unreachable from here, and a diagnostic that blocks a
|
|
356
|
+
// working login is worse than the failure it explains.
|
|
357
|
+
this.localAuthorizePath = inconclusive ? "/authorize" : path;
|
|
358
|
+
if (path === "/#authorize" && !inconclusive) {
|
|
359
|
+
console.warn(`[ic-reactor] Internet Identity canister ${canisterId} serves its sign-in UI at ` +
|
|
360
|
+
`"/" rather than "/authorize" — using the legacy #authorize flow. This is a ` +
|
|
361
|
+
`pre-2026 build; newer ones through release-2026-03-16 serve /authorize directly.`);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
321
364
|
/**
|
|
322
365
|
* Returns an AuthClient without awaiting, or `undefined` when the auth
|
|
323
366
|
* module has not been loaded yet.
|
|
@@ -439,9 +482,18 @@ export class AuthenticationManager {
|
|
|
439
482
|
if (this.identityProvider) {
|
|
440
483
|
return this.identityProvider;
|
|
441
484
|
}
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
485
|
+
if (!this.clientManager.isLocal) {
|
|
486
|
+
return IC_INTERNET_IDENTITY_PROVIDER;
|
|
487
|
+
}
|
|
488
|
+
const canisterId = this.internetIdentityId ?? LOCAL_INTERNET_IDENTITY_CANISTER_ID;
|
|
489
|
+
// `null` is the probe's positive finding that this build serves no sign-in
|
|
490
|
+
// UI. Throwing here surfaces an actionable message where the caller can see
|
|
491
|
+
// it, instead of opening a popup onto the gateway's verification-error page
|
|
492
|
+
// and leaving the app waiting until the user closes it.
|
|
493
|
+
if (this.localAuthorizePath === null) {
|
|
494
|
+
throw localInternetIdentityUnavailableError(canisterId);
|
|
495
|
+
}
|
|
496
|
+
return localInternetIdentityProvider(Number(this.clientManager.agentHost?.port) || 4943, this.internetIdentityId, this.localAuthorizePath);
|
|
445
497
|
}
|
|
446
498
|
updateState(newState) {
|
|
447
499
|
if (isDev())
|
|
@@ -588,15 +640,20 @@ function acceptEnvIdentityProvider(value, clientManager) {
|
|
|
588
640
|
if (pageOrigin && url.origin === pageOrigin) {
|
|
589
641
|
return url.toString();
|
|
590
642
|
}
|
|
591
|
-
//
|
|
592
|
-
//
|
|
593
|
-
//
|
|
594
|
-
//
|
|
595
|
-
|
|
643
|
+
// Positive allowlist, not `!isMainnetHost(...)`.
|
|
644
|
+
//
|
|
645
|
+
// The old comment here claimed this defaulted to true for an unknown host so
|
|
646
|
+
// that "anything that looks like mainnet fails closed". It did not:
|
|
647
|
+
// isMainnetHost defaults to true only for `undefined`, and returns false for
|
|
648
|
+
// every unrecognised host — so a dapp on a custom domain accepted an identity
|
|
649
|
+
// provider chosen by a cookie, and the ic_env cookie is writable by any
|
|
650
|
+
// sibling subdomain. Redirecting the Internet Identity flow is as severe as
|
|
651
|
+
// substituting the root key, so both now use the same test.
|
|
652
|
+
if (!allowsEnvRootKey(clientManager.agentHost?.toString())) {
|
|
596
653
|
console.warn(`[ic-reactor] Ignoring the Internet Identity provider from the ic_env cookie ` +
|
|
597
|
-
`("${url.origin}") because this reactor
|
|
598
|
-
`is taken from configuration rather than the environment. Pass ` +
|
|
599
|
-
`\`identityProvider\` to AuthenticationManager to use a custom provider
|
|
654
|
+
`("${url.origin}") because this reactor does not target a local replica, where ` +
|
|
655
|
+
`the provider is taken from configuration rather than the environment. Pass ` +
|
|
656
|
+
`\`identityProvider\` to AuthenticationManager to use a custom provider.`);
|
|
600
657
|
return undefined;
|
|
601
658
|
}
|
|
602
659
|
return url.toString();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authentication-manager.js","sourceRoot":"","sources":["../../src/auth/authentication-manager.ts"],"names":[],"mappings":"AAQA,OAAO,EAAiB,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAEtE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AACrE,OAAO,EACL,6BAA6B,EAC7B,kCAAkC,EAClC,6BAA6B,GAC9B,MAAM,gBAAgB,CAAA;AAiBvB;;;;;;;;;GASG;AACH,MAAM,OAAO,qBAAqB;IAuBhC,wCAAwC;IACxC,IAAW,SAAS;QAClB,OAAO,IAAI,CAAC,cAAc,CAAA;IAC5B,CAAC;IAED,YAAY,EACV,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,kBAAkB,EAClB,GAAG,aAAa,EACgB;QAjC1B;;;;;WAA2B;QAC3B;;;;;WAA2C;QAC3C;;;;mBAAwB,KAAK;WAAA;QAC7B;;;;mBAAoB,CAAC;WAAA;QACrB;;;;mBAA0D,EAAE;WAAA;QAC5D;;;;;WAA6C;QAC7C;;;;;WAEP;QACO;;;;mBAAoB,KAAK;WAAA;QACzB;;;;;WAA+C;QAC/C;;;;mBAA4B;gBAClC,QAAQ,EAAE,IAAI;gBACd,gBAAgB,EAAE,KAAK;gBACvB,eAAe,EAAE,KAAK;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AAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAA;IAClE,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,MAAM,GAAG,GAAG,MAAM,CAAC,WAAW,CAC5B,kBAAkB,CAAC,YAAY,CAAC;SAC7B,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QACb,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;QACzC,OAAO,cAAc,KAAK,CAAC,CAAC;YAC1B,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC;YACb,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,cAAc,GAAG,CAAC,CAAC,CAAC,CAAA;IACvE,CAAC,CAAC,CACL,CAAA;IAED,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAA;AAClD,CAAC;AAED,SAAS,gBAAgB,CACvB,OAAqC;IAErC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,OAAO;QACL,aAAa,EAAE,OAAO,CAAC,aAAa;QACpC,OAAO,EAAE,OAAO,CAAC,OAAO;KACzB,CAAA;AACH,CAAC"}
|
|
1
|
+
{"version":3,"file":"authentication-manager.js","sourceRoot":"","sources":["../../src/auth/authentication-manager.ts"],"names":[],"mappings":"AAQA,OAAO,EAAiB,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAEzE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AACrE,OAAO,EACL,0BAA0B,EAC1B,qCAAqC,GAEtC,MAAM,qBAAqB,C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AM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAA;AAClD,CAAC;AAED,SAAS,gBAAgB,CACvB,OAAqC;IAErC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,OAAO;QACL,aAAa,EAAE,OAAO,CAAC,aAAa;QACpC,OAAO,EAAE,OAAO,CAAC,OAAO;KACzB,CAAA;AACH,CAAC"}
|
package/dist/auth/constants.d.ts
CHANGED
|
@@ -9,8 +9,14 @@ export declare const INTERNET_IDENTITY_PROVIDER_ENV_KEY = "INTERNET_IDENTITY_PRO
|
|
|
9
9
|
export declare const LOCAL_INTERNET_IDENTITY_CANISTER_ID = "rdmx6-jaaaa-aaaaa-aaadq-cai";
|
|
10
10
|
/**
|
|
11
11
|
* Builds the local Internet Identity provider URL for the given replica port.
|
|
12
|
+
*
|
|
13
|
+
* `authorizePath` selects the shape the installed build understands: modern
|
|
14
|
+
* builds serve `/authorize` as a real asset, while pre-2026 ones serve the SPA
|
|
15
|
+
* at `/` and drive the flow from a `#authorize` fragment. `AuthenticationManager`
|
|
16
|
+
* probes the canister and passes the right one; the default keeps the previous
|
|
17
|
+
* behaviour for direct callers.
|
|
12
18
|
*/
|
|
13
|
-
export declare const localInternetIdentityProvider: (port: number, canisterId?: string) => string;
|
|
19
|
+
export declare const localInternetIdentityProvider: (port: number, canisterId?: string, authorizePath?: "/authorize" | "/#authorize") => string;
|
|
14
20
|
/**
|
|
15
21
|
* Legacy default URL for local Internet Identity, using port `4943`.
|
|
16
22
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/auth/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,6BAA6B,4BAA4B,CAAA;AAEtE;;GAEG;AACH,eAAO,MAAM,kCAAkC,+BAA+B,CAAA;AAE9E;;GAEG;AACH,eAAO,MAAM,mCAAmC,gCAAgC,CAAA;AAEhF
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/auth/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,6BAA6B,4BAA4B,CAAA;AAEtE;;GAEG;AACH,eAAO,MAAM,kCAAkC,+BAA+B,CAAA;AAE9E;;GAEG;AACH,eAAO,MAAM,mCAAmC,gCAAgC,CAAA;AAEhF;;;;;;;;GAQG;AACH,eAAO,MAAM,6BAA6B,GACxC,MAAM,MAAM,EACZ,aAAY,MAA4C,EACxD,gBAAe,YAAY,GAAG,aAA4B,WACC,CAAA;AAE7D;;GAEG;AACH,eAAO,MAAM,gCAAgC,QACR,CAAA"}
|
package/dist/auth/constants.js
CHANGED
|
@@ -9,8 +9,14 @@ export const INTERNET_IDENTITY_PROVIDER_ENV_KEY = "INTERNET_IDENTITY_PROVIDER";
|
|
|
9
9
|
export const LOCAL_INTERNET_IDENTITY_CANISTER_ID = "rdmx6-jaaaa-aaaaa-aaadq-cai";
|
|
10
10
|
/**
|
|
11
11
|
* Builds the local Internet Identity provider URL for the given replica port.
|
|
12
|
+
*
|
|
13
|
+
* `authorizePath` selects the shape the installed build understands: modern
|
|
14
|
+
* builds serve `/authorize` as a real asset, while pre-2026 ones serve the SPA
|
|
15
|
+
* at `/` and drive the flow from a `#authorize` fragment. `AuthenticationManager`
|
|
16
|
+
* probes the canister and passes the right one; the default keeps the previous
|
|
17
|
+
* behaviour for direct callers.
|
|
12
18
|
*/
|
|
13
|
-
export const localInternetIdentityProvider = (port, canisterId = LOCAL_INTERNET_IDENTITY_CANISTER_ID) => `http://${canisterId}.localhost:${port}
|
|
19
|
+
export const localInternetIdentityProvider = (port, canisterId = LOCAL_INTERNET_IDENTITY_CANISTER_ID, authorizePath = "/authorize") => `http://${canisterId}.localhost:${port}${authorizePath}`;
|
|
14
20
|
/**
|
|
15
21
|
* Legacy default URL for local Internet Identity, using port `4943`.
|
|
16
22
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/auth/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,6BAA6B,GAAG,yBAAyB,CAAA;AAEtE;;GAEG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,4BAA4B,CAAA;AAE9E;;GAEG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAG,6BAA6B,CAAA;AAEhF
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/auth/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,6BAA6B,GAAG,yBAAyB,CAAA;AAEtE;;GAEG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,4BAA4B,CAAA;AAE9E;;GAEG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAG,6BAA6B,CAAA;AAEhF;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAC3C,IAAY,EACZ,aAAqB,mCAAmC,EACxD,gBAA8C,YAAY,EAC1D,EAAE,CAAC,UAAU,UAAU,cAAc,IAAI,GAAG,aAAa,EAAE,CAAA;AAE7D;;GAEG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAC3C,6BAA6B,CAAC,IAAI,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity-attributes-manager.d.ts","sourceRoot":"","sources":["../../src/auth/identity-attributes-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"identity-attributes-manager.d.ts","sourceRoot":"","sources":["../../src/auth/identity-attributes-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,uBAAuB,EACvB,mCAAmC,EACnC,yCAAyC,EAC1C,MAAM,YAAY,CAAA;AAEnB,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;AAOnE;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,yBAAyB;aACR,cAAc,EAAE,qBAAqB;gBAArC,cAAc,EAAE,qBAAqB;IAE1D,OAAO,GAAU,mEAOrB,mCAAmC,KAAG,OAAO,CAAC,uBAAuB,CAAC,CAyDxE;IAEM,aAAa,GAAI,mCAIrB,yCAAyC,KAAG,OAAO,CAAC,uBAAuB,CAAC,CAO9E;CACF"}
|
|
@@ -36,7 +36,7 @@ export class IdentityAttributesManager {
|
|
|
36
36
|
const preparedClient = this.authentication.getPreparedClient(clientOptions);
|
|
37
37
|
const authClient = preparedClient ?? (await this.authentication.ensureClient(clientOptions));
|
|
38
38
|
if (!authClient) {
|
|
39
|
-
throw new Error("Authentication module is missing or failed to initialize. To request identity attributes, please install @icp-sdk/auth
|
|
39
|
+
throw new Error("Authentication module is missing or failed to initialize. To request identity attributes, please install @icp-sdk/auth v8, or provide a compatible authClient.");
|
|
40
40
|
}
|
|
41
41
|
this.authentication.setAuthenticating();
|
|
42
42
|
try {
|
|
@@ -50,7 +50,7 @@ export class IdentityAttributesManager {
|
|
|
50
50
|
: Promise.resolve(authClient.getIdentity());
|
|
51
51
|
const requestPromise = authClient.requestAttributes({
|
|
52
52
|
keys,
|
|
53
|
-
nonce: toAuthClientNonce(
|
|
53
|
+
nonce: toAuthClientNonce(nonce),
|
|
54
54
|
});
|
|
55
55
|
const [signedAttributes, identity] = await Promise.all([
|
|
56
56
|
requestPromise,
|
|
@@ -90,19 +90,18 @@ export class IdentityAttributesManager {
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
/**
|
|
93
|
-
*
|
|
93
|
+
* Adapts our nonce input to the `@icp-sdk/auth` nonce contract.
|
|
94
94
|
*
|
|
95
|
-
* v8 takes `() => Promise<Uint8Array>`
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
95
|
+
* v8 takes `() => Promise<Uint8Array>` — a thunk, so it can journal the value
|
|
96
|
+
* and replay the same bytes through a redirect flow. The thunk form also opens
|
|
97
|
+
* the transport channel synchronously, which is what preserves the user
|
|
98
|
+
* gesture.
|
|
99
|
+
*
|
|
100
|
+
* Until 3.12.0 this probed `typeof authClient.memoize === "function"` to detect
|
|
101
|
+
* v8 and fell back to a bare promise for v7. The peer range is now `^8.0.0`, so
|
|
102
|
+
* the probe would only ever take one branch.
|
|
100
103
|
*/
|
|
101
|
-
function toAuthClientNonce(
|
|
102
|
-
|
|
103
|
-
if (supportsNonceThunk) {
|
|
104
|
-
return () => Promise.resolve(typeof nonce === "function" ? nonce() : nonce);
|
|
105
|
-
}
|
|
106
|
-
return Promise.resolve(typeof nonce === "function" ? nonce() : nonce);
|
|
104
|
+
function toAuthClientNonce(nonce) {
|
|
105
|
+
return () => Promise.resolve(typeof nonce === "function" ? nonce() : nonce);
|
|
107
106
|
}
|
|
108
107
|
//# sourceMappingURL=identity-attributes-manager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity-attributes-manager.js","sourceRoot":"","sources":["../../src/auth/identity-attributes-manager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"identity-attributes-manager.js","sourceRoot":"","sources":["../../src/auth/identity-attributes-manager.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,6BAA6B,EAC7B,qBAAqB,EACrB,iCAAiC,GAClC,MAAM,0BAA0B,CAAA;AAEjC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,yBAAyB;IACpC,YAA4B,cAAqC;QAArD;;;;mBAAgB,cAAc;WAAuB;QAE1D;;;;mBAAU,KAAK,EAAE,EACtB,IAAI,EACJ,KAAK,EACL,MAAM,GAAG,IAAI,EACb,aAAa,EACb,OAAO,EACP,GAAG,aAAa,EACoB,EAAoC,EAAE;gBAC1E,4EAA4E;gBAC5E,0EAA0E;gBAC1E,0EAA0E;gBAC1E,qDAAqD;gBACrD,MAAM,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAAA;gBAC3E,MAAM,UAAU,GACd,cAAc,IAAI,CAAC,MAAM,IAAI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AW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;qBACtC,CAAA;gBACH,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,IAAI,CAAC,cAAc,CAAC,sBAAsB,CAAC,KAAc,CAAC,CAAA;oBAC1D,MAAM,KAAK,CAAA;gBACb,CAAC;YACH,CAAC;WAAA;QAEM;;;;mBAAgB,CAAC,EACtB,IAAI,EACJ,cAAc,EACd,GAAG,IAAI,EACmC,EAAoC,EAAE;gBAChF,uEAAuE;gBACvE,OAAO,IAAI,CAAC,OAAO,CAAC;oBAClB,GAAG,IAAI;oBACP,cAAc;oBACd,IAAI,EAAE,qBAAqB,CAAC,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC;iBACtD,CAAC,CAAA;YACJ,CAAC;WAAA;IA/EmE,CAAC;CAgFtE;AAED;;;;;;;;;;;GAWG;AACH,SAAS,iBAAiB,CACxB,KAA6B;IAE7B,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;AAC7E,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ask a locally deployed Internet Identity canister what it actually serves.
|
|
3
|
+
*
|
|
4
|
+
* `localInternetIdentityProvider` builds `http://<id>.localhost:<port>/authorize`,
|
|
5
|
+
* the id.ai-era path. Whether that works depends on which Internet Identity
|
|
6
|
+
* build is installed, and the window is narrow:
|
|
7
|
+
*
|
|
8
|
+
* - up to `release-2025-03-07`, the SPA lived at `/` and used a `#authorize`
|
|
9
|
+
* fragment; `/authorize` is not an asset
|
|
10
|
+
* - `release-2026-01-05` through `release-2026-03-16` serve `/authorize`
|
|
11
|
+
* - from `release-2026-03-23` the frontend left the canister entirely (the id.ai
|
|
12
|
+
* split), so `/authorize` 404s even on `.raw`
|
|
13
|
+
*
|
|
14
|
+
* Outside that window the login popup renders the gateway's
|
|
15
|
+
* "Response Verification Error" page and the app simply waits until the user
|
|
16
|
+
* closes it. Nothing points at the cause.
|
|
17
|
+
*
|
|
18
|
+
* Asking the canister over the agent avoids the gateway, so the answer is about
|
|
19
|
+
* the canister's assets rather than about how the gateway felt about them.
|
|
20
|
+
*/
|
|
21
|
+
import { type HttpAgent } from "@icp-sdk/core/agent";
|
|
22
|
+
/** Where a given Internet Identity build expects the sign-in flow to start. */
|
|
23
|
+
export type AuthorizePath = "/authorize" | "/#authorize";
|
|
24
|
+
export interface LocalIiProbe {
|
|
25
|
+
/** The path that works, or `null` when the canister serves no sign-in UI. */
|
|
26
|
+
path: AuthorizePath | null;
|
|
27
|
+
/**
|
|
28
|
+
* The probe could not reach a conclusion — the canister was unreachable, or
|
|
29
|
+
* it does not expose `http_request` at all. Callers keep their existing
|
|
30
|
+
* behaviour rather than blocking a login that might well work.
|
|
31
|
+
*/
|
|
32
|
+
inconclusive: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Determine which authorize path a locally deployed Internet Identity serves.
|
|
36
|
+
*
|
|
37
|
+
* Never throws. A probe that cannot answer returns `inconclusive`, because a
|
|
38
|
+
* diagnostic that blocks a working setup is worse than the failure it explains.
|
|
39
|
+
*/
|
|
40
|
+
export declare function probeLocalInternetIdentity(agent: HttpAgent, canisterId: string): Promise<LocalIiProbe>;
|
|
41
|
+
/**
|
|
42
|
+
* The error a login gets when the installed build serves no sign-in UI, in
|
|
43
|
+
* place of a 503 page inside a popup the app cannot see.
|
|
44
|
+
*/
|
|
45
|
+
export declare function localInternetIdentityUnavailableError(canisterId: string): Error;
|
|
46
|
+
//# sourceMappingURL=local-ii-probe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-ii-probe.d.ts","sourceRoot":"","sources":["../../src/auth/local-ii-probe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAS,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAqC3D,+EAA+E;AAC/E,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,aAAa,CAAA;AAExD,MAAM,WAAW,YAAY;IAC3B,6EAA6E;IAC7E,IAAI,EAAE,aAAa,GAAG,IAAI,CAAA;IAC1B;;;;OAIG;IACH,YAAY,EAAE,OAAO,CAAA;CACtB;AAmBD;;;;;GAKG;AACH,wBAAsB,0BAA0B,CAC9C,KAAK,EAAE,SAAS,EAChB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,YAAY,CAAC,CA+BvB;AAED;;;GAGG;AACH,wBAAgB,qCAAqC,CACnD,UAAU,EAAE,MAAM,GACjB,KAAK,CASP"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ask a locally deployed Internet Identity canister what it actually serves.
|
|
3
|
+
*
|
|
4
|
+
* `localInternetIdentityProvider` builds `http://<id>.localhost:<port>/authorize`,
|
|
5
|
+
* the id.ai-era path. Whether that works depends on which Internet Identity
|
|
6
|
+
* build is installed, and the window is narrow:
|
|
7
|
+
*
|
|
8
|
+
* - up to `release-2025-03-07`, the SPA lived at `/` and used a `#authorize`
|
|
9
|
+
* fragment; `/authorize` is not an asset
|
|
10
|
+
* - `release-2026-01-05` through `release-2026-03-16` serve `/authorize`
|
|
11
|
+
* - from `release-2026-03-23` the frontend left the canister entirely (the id.ai
|
|
12
|
+
* split), so `/authorize` 404s even on `.raw`
|
|
13
|
+
*
|
|
14
|
+
* Outside that window the login popup renders the gateway's
|
|
15
|
+
* "Response Verification Error" page and the app simply waits until the user
|
|
16
|
+
* closes it. Nothing points at the cause.
|
|
17
|
+
*
|
|
18
|
+
* Asking the canister over the agent avoids the gateway, so the answer is about
|
|
19
|
+
* the canister's assets rather than about how the gateway felt about them.
|
|
20
|
+
*/
|
|
21
|
+
import { Actor } from "@icp-sdk/core/agent";
|
|
22
|
+
/** The `http_request` query every asset-serving canister exposes. */
|
|
23
|
+
const httpInterface = ({ IDL }) => {
|
|
24
|
+
const HeaderField = IDL.Tuple(IDL.Text, IDL.Text);
|
|
25
|
+
return IDL.Service({
|
|
26
|
+
http_request: IDL.Func([
|
|
27
|
+
IDL.Record({
|
|
28
|
+
method: IDL.Text,
|
|
29
|
+
url: IDL.Text,
|
|
30
|
+
headers: IDL.Vec(HeaderField),
|
|
31
|
+
body: IDL.Vec(IDL.Nat8),
|
|
32
|
+
}),
|
|
33
|
+
], [
|
|
34
|
+
IDL.Record({
|
|
35
|
+
status_code: IDL.Nat16,
|
|
36
|
+
headers: IDL.Vec(HeaderField),
|
|
37
|
+
body: IDL.Vec(IDL.Nat8),
|
|
38
|
+
}),
|
|
39
|
+
], ["query"]),
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
async function statusOf(actor, url) {
|
|
43
|
+
try {
|
|
44
|
+
const response = await actor.http_request({
|
|
45
|
+
method: "GET",
|
|
46
|
+
url,
|
|
47
|
+
headers: [],
|
|
48
|
+
body: new Uint8Array(),
|
|
49
|
+
});
|
|
50
|
+
return response.status_code;
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Determine which authorize path a locally deployed Internet Identity serves.
|
|
58
|
+
*
|
|
59
|
+
* Never throws. A probe that cannot answer returns `inconclusive`, because a
|
|
60
|
+
* diagnostic that blocks a working setup is worse than the failure it explains.
|
|
61
|
+
*/
|
|
62
|
+
export async function probeLocalInternetIdentity(agent, canisterId) {
|
|
63
|
+
let actor;
|
|
64
|
+
try {
|
|
65
|
+
actor = Actor.createActor(httpInterface, {
|
|
66
|
+
agent,
|
|
67
|
+
canisterId,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
return { path: "/authorize", inconclusive: true };
|
|
72
|
+
}
|
|
73
|
+
const authorize = await statusOf(actor, "/authorize");
|
|
74
|
+
// The canister does not answer http_request at all — not an asset canister,
|
|
75
|
+
// not deployed, or the replica is down. Not our call to make.
|
|
76
|
+
if (authorize === undefined) {
|
|
77
|
+
return { path: "/authorize", inconclusive: true };
|
|
78
|
+
}
|
|
79
|
+
if (authorize >= 200 && authorize < 300) {
|
|
80
|
+
return { path: "/authorize", inconclusive: false };
|
|
81
|
+
}
|
|
82
|
+
// Pre-2026 builds serve the SPA at the root and drive the flow from a
|
|
83
|
+
// `#authorize` fragment, which is a path the gateway never sees.
|
|
84
|
+
const root = await statusOf(actor, "/");
|
|
85
|
+
if (root !== undefined && root >= 200 && root < 300) {
|
|
86
|
+
return { path: "/#authorize", inconclusive: false };
|
|
87
|
+
}
|
|
88
|
+
return { path: null, inconclusive: false };
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* The error a login gets when the installed build serves no sign-in UI, in
|
|
92
|
+
* place of a 503 page inside a popup the app cannot see.
|
|
93
|
+
*/
|
|
94
|
+
export function localInternetIdentityUnavailableError(canisterId) {
|
|
95
|
+
return new Error(`[ic-reactor] The Internet Identity canister ${canisterId} does not serve a sign-in UI: ` +
|
|
96
|
+
`neither /authorize nor / returned a page. Internet Identity builds from ` +
|
|
97
|
+
`release-2026-03-23 onward moved their frontend out of the canister (the id.ai split) ` +
|
|
98
|
+
`and cannot be used locally. Install internet_identity_dev.wasm from release-2026-03-16, ` +
|
|
99
|
+
`the newest build that still self-serves /authorize, or point \`identityProvider\` at a ` +
|
|
100
|
+
`provider you host yourself.`);
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=local-ii-probe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-ii-probe.js","sourceRoot":"","sources":["../../src/auth/local-ii-probe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,KAAK,EAAkB,MAAM,qBAAqB,CAAA;AAG3D,qEAAqE;AACrE,MAAM,aAAa,GAAyB,CAAC,EAAE,GA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aAAa,EAAE;YACzD,KAAK;YACL,UAAU;SACX,CAAC,CAAA;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,IAAI,EAAE,CAAA;IACnD,CAAC;IAED,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC,CAAA;IAErD,4EAA4E;IAC5E,8DAA8D;IAC9D,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC5B,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,IAAI,EAAE,CAAA;IACnD,CAAC;IAED,IAAI,SAAS,IAAI,GAAG,IAAI,SAAS,GAAG,GAAG,EAAE,CAAC;QACxC,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,CAAA;IACpD,CAAC;IAED,sEAAsE;IACtE,iEAAiE;IACjE,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;IACvC,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,IAAI,GAAG,IAAI,IAAI,GAAG,GAAG,EAAE,CAAC;QACpD,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,YAAY,EAAE,KAAK,EAAE,CAAA;IACrD,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,CAAA;AAC5C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qCAAqC,CACnD,UAAkB;IAElB,OAAO,IAAI,KAAK,CACd,+CAA+C,UAAU,gCAAgC;QACvF,0EAA0E;QAC1E,uFAAuF;QACvF,0FAA0F;QAC1F,yFAAyF;QACzF,6BAA6B,CAChC,CAAA;AACH,CAAC"}
|
package/dist/auth/types.d.ts
CHANGED
|
@@ -167,10 +167,8 @@ export interface AuthClientLike {
|
|
|
167
167
|
}): Promise<void>;
|
|
168
168
|
requestAttributes(params: {
|
|
169
169
|
keys: string[];
|
|
170
|
-
nonce:
|
|
170
|
+
nonce: () => Promise<Uint8Array>;
|
|
171
171
|
}): Promise<SignedIdentityAttributes>;
|
|
172
|
-
/** Present from `@icp-sdk/auth` v8; used to detect the nonce contract. */
|
|
173
|
-
memoize?<T>(produce: () => T | Promise<T>): Promise<T>;
|
|
174
172
|
}
|
|
175
173
|
export interface AuthState {
|
|
176
174
|
identity: Identity | null;
|
package/dist/auth/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/auth/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAExD,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,UAAU,CAAA;IAChB,SAAS,EAAE,UAAU,CAAA;CACtB;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,sBAAsB,GAChC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,CAAA;AAE7E,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,KAAK,EAAE,sBAAsB,CAAA;CAC9B;AAED,MAAM,WAAW,uBAAuB;IACtC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;CAClC;AAED,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,gBAAgB,EAAE,wB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,MAAM,CAAC,OAAO,CAAC,EAAE,uBAAuB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;IAC5D,OAAO,CAAC,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACvD,iBAAiB,CAAC,MAAM,EAAE;QACxB,IAAI,EAAE,MAAM,EAAE,CAAA;QAId,KAAK,EAAE,MAAM,OAAO,CAAC,UAAU,CAAC,CAAA;KACjC,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAA;CACtC;AAED,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAA;IACzB,gBAAgB,EAAE,OAAO,CAAA;IACzB,eAAe,EAAE,OAAO,CAAA;IACxB,KAAK,EAAE,KAAK,GAAG,SAAS,CAAA;CACzB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ic-reactor/react",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.12.0",
|
|
4
4
|
"description": "IC Reactor React library for building Internet Computer apps",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -53,30 +53,30 @@
|
|
|
53
53
|
"author": "Behrad Deylami",
|
|
54
54
|
"license": "MIT",
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@ic-reactor/core": "^3.
|
|
56
|
+
"@ic-reactor/core": "^3.12.0"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"@icp-sdk/auth": "^
|
|
60
|
-
"@icp-sdk/core": "^6.
|
|
59
|
+
"@icp-sdk/auth": "^8.0.0",
|
|
60
|
+
"@icp-sdk/core": "^6.1.0",
|
|
61
61
|
"@tanstack/react-query": "^5.0.0",
|
|
62
62
|
"react": ">=18.0.0",
|
|
63
63
|
"react-dom": ">=18.0.0"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@icp-sdk/auth": "^8.0.
|
|
67
|
-
"@icp-sdk/core": "^6.
|
|
68
|
-
"@size-limit/preset-small-lib": "^
|
|
66
|
+
"@icp-sdk/auth": "^8.0.3",
|
|
67
|
+
"@icp-sdk/core": "^6.1.0",
|
|
68
|
+
"@size-limit/preset-small-lib": "^13.0.3",
|
|
69
69
|
"@tanstack/react-query": "^5.101.4",
|
|
70
70
|
"@testing-library/dom": "^10.4.1",
|
|
71
|
-
"@testing-library/jest-dom": "^
|
|
71
|
+
"@testing-library/jest-dom": "^7.0.1",
|
|
72
72
|
"@testing-library/react": "^16.3.2",
|
|
73
|
-
"@types/react": "^19.2.
|
|
74
|
-
"@types/react-dom": "^19.2.
|
|
73
|
+
"@types/react": "^19.2.18",
|
|
74
|
+
"@types/react-dom": "^19.2.4",
|
|
75
75
|
"fake-indexeddb": "^6.2.5",
|
|
76
|
-
"jsdom": "^
|
|
76
|
+
"jsdom": "^30.0.1",
|
|
77
77
|
"react": "^19.2.8",
|
|
78
78
|
"react-dom": "^19.2.8",
|
|
79
|
-
"size-limit": "^
|
|
79
|
+
"size-limit": "^13.0.3",
|
|
80
80
|
"vitest": "^4.1.10"
|
|
81
81
|
},
|
|
82
82
|
"size-limit": [
|
|
@@ -6,13 +6,19 @@ import type {
|
|
|
6
6
|
AuthenticationClientOptions,
|
|
7
7
|
AuthenticationSignInOptions,
|
|
8
8
|
} from "./types.js"
|
|
9
|
-
import { ClientManager, isDev,
|
|
9
|
+
import { ClientManager, isDev, allowsEnvRootKey } from "@ic-reactor/core"
|
|
10
10
|
|
|
11
11
|
import { Principal } from "@icp-sdk/core/principal"
|
|
12
12
|
import { safeGetCanisterEnv } from "@icp-sdk/core/agent/canister-env"
|
|
13
|
+
import {
|
|
14
|
+
probeLocalInternetIdentity,
|
|
15
|
+
localInternetIdentityUnavailableError,
|
|
16
|
+
type AuthorizePath,
|
|
17
|
+
} from "./local-ii-probe.js"
|
|
13
18
|
import {
|
|
14
19
|
IC_INTERNET_IDENTITY_PROVIDER,
|
|
15
20
|
INTERNET_IDENTITY_PROVIDER_ENV_KEY,
|
|
21
|
+
LOCAL_INTERNET_IDENTITY_CANISTER_ID,
|
|
16
22
|
localInternetIdentityProvider,
|
|
17
23
|
} from "./constants.js"
|
|
18
24
|
|
|
@@ -61,6 +67,13 @@ export class AuthenticationManager {
|
|
|
61
67
|
}
|
|
62
68
|
private readonly identityProvider?: string | URL
|
|
63
69
|
private readonly internetIdentityId?: string
|
|
70
|
+
/**
|
|
71
|
+
* Which authorize path the locally deployed Internet Identity serves, once
|
|
72
|
+
* probed. `undefined` means not probed yet; `null` means it serves no sign-in
|
|
73
|
+
* UI and login should fail with an explanation rather than open a popup onto
|
|
74
|
+
* a gateway error page.
|
|
75
|
+
*/
|
|
76
|
+
private localAuthorizePath?: AuthorizePath | null
|
|
64
77
|
private readonly defaultClientOptions: AuthenticationClientOptions
|
|
65
78
|
public readonly clientManager: ClientManager
|
|
66
79
|
|
|
@@ -131,6 +144,11 @@ export class AuthenticationManager {
|
|
|
131
144
|
* what browser popup blockers and the ICRC-29 transport require.
|
|
132
145
|
*/
|
|
133
146
|
public async prepareClient(options?: AuthenticationClientOptions) {
|
|
147
|
+
// Before resolving options, because resolving them is what picks the
|
|
148
|
+
// provider URL. This is the last async point before `login()` has to stay
|
|
149
|
+
// inside the user gesture, so the answer has to be cached by now.
|
|
150
|
+
await this.ensureLocalAuthorizePath()
|
|
151
|
+
|
|
134
152
|
const clientOptions = this.resolveClientOptions(options)
|
|
135
153
|
|
|
136
154
|
if (this.authClient && !this.shouldRecreateClient(clientOptions)) {
|
|
@@ -140,6 +158,40 @@ export class AuthenticationManager {
|
|
|
140
158
|
return this.initializeClient(clientOptions)
|
|
141
159
|
}
|
|
142
160
|
|
|
161
|
+
/**
|
|
162
|
+
* Probe the local Internet Identity canister once, and remember what it
|
|
163
|
+
* serves.
|
|
164
|
+
*
|
|
165
|
+
* Only for the derived local provider: an explicitly configured
|
|
166
|
+
* `identityProvider` is the caller's business, and mainnet is fixed.
|
|
167
|
+
*/
|
|
168
|
+
private async ensureLocalAuthorizePath(): Promise<void> {
|
|
169
|
+
if (this.localAuthorizePath !== undefined) return
|
|
170
|
+
if (this.identityProvider) return
|
|
171
|
+
if (!this.clientManager.isLocal) return
|
|
172
|
+
|
|
173
|
+
const canisterId =
|
|
174
|
+
this.internetIdentityId ?? LOCAL_INTERNET_IDENTITY_CANISTER_ID
|
|
175
|
+
|
|
176
|
+
const { path, inconclusive } = await probeLocalInternetIdentity(
|
|
177
|
+
this.clientManager.agent,
|
|
178
|
+
canisterId
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
// An inconclusive probe must not change behaviour: the canister may be
|
|
182
|
+
// fine and merely unreachable from here, and a diagnostic that blocks a
|
|
183
|
+
// working login is worse than the failure it explains.
|
|
184
|
+
this.localAuthorizePath = inconclusive ? "/authorize" : path
|
|
185
|
+
|
|
186
|
+
if (path === "/#authorize" && !inconclusive) {
|
|
187
|
+
console.warn(
|
|
188
|
+
`[ic-reactor] Internet Identity canister ${canisterId} serves its sign-in UI at ` +
|
|
189
|
+
`"/" rather than "/authorize" — using the legacy #authorize flow. This is a ` +
|
|
190
|
+
`pre-2026 build; newer ones through release-2026-03-16 serve /authorize directly.`
|
|
191
|
+
)
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
143
195
|
/**
|
|
144
196
|
* Returns an AuthClient without awaiting, or `undefined` when the auth
|
|
145
197
|
* module has not been loaded yet.
|
|
@@ -467,12 +519,26 @@ export class AuthenticationManager {
|
|
|
467
519
|
if (this.identityProvider) {
|
|
468
520
|
return this.identityProvider
|
|
469
521
|
}
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
522
|
+
if (!this.clientManager.isLocal) {
|
|
523
|
+
return IC_INTERNET_IDENTITY_PROVIDER
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
const canisterId =
|
|
527
|
+
this.internetIdentityId ?? LOCAL_INTERNET_IDENTITY_CANISTER_ID
|
|
528
|
+
|
|
529
|
+
// `null` is the probe's positive finding that this build serves no sign-in
|
|
530
|
+
// UI. Throwing here surfaces an actionable message where the caller can see
|
|
531
|
+
// it, instead of opening a popup onto the gateway's verification-error page
|
|
532
|
+
// and leaving the app waiting until the user closes it.
|
|
533
|
+
if (this.localAuthorizePath === null) {
|
|
534
|
+
throw localInternetIdentityUnavailableError(canisterId)
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
return localInternetIdentityProvider(
|
|
538
|
+
Number(this.clientManager.agentHost?.port) || 4943,
|
|
539
|
+
this.internetIdentityId,
|
|
540
|
+
this.localAuthorizePath
|
|
541
|
+
)
|
|
476
542
|
}
|
|
477
543
|
|
|
478
544
|
private updateState(newState: Partial<AuthState>) {
|
|
@@ -651,16 +717,21 @@ function acceptEnvIdentityProvider(
|
|
|
651
717
|
return url.toString()
|
|
652
718
|
}
|
|
653
719
|
|
|
654
|
-
//
|
|
655
|
-
//
|
|
656
|
-
//
|
|
657
|
-
//
|
|
658
|
-
|
|
720
|
+
// Positive allowlist, not `!isMainnetHost(...)`.
|
|
721
|
+
//
|
|
722
|
+
// The old comment here claimed this defaulted to true for an unknown host so
|
|
723
|
+
// that "anything that looks like mainnet fails closed". It did not:
|
|
724
|
+
// isMainnetHost defaults to true only for `undefined`, and returns false for
|
|
725
|
+
// every unrecognised host — so a dapp on a custom domain accepted an identity
|
|
726
|
+
// provider chosen by a cookie, and the ic_env cookie is writable by any
|
|
727
|
+
// sibling subdomain. Redirecting the Internet Identity flow is as severe as
|
|
728
|
+
// substituting the root key, so both now use the same test.
|
|
729
|
+
if (!allowsEnvRootKey(clientManager.agentHost?.toString())) {
|
|
659
730
|
console.warn(
|
|
660
731
|
`[ic-reactor] Ignoring the Internet Identity provider from the ic_env cookie ` +
|
|
661
|
-
`("${url.origin}") because this reactor
|
|
662
|
-
`is taken from configuration rather than the environment. Pass ` +
|
|
663
|
-
`\`identityProvider\` to AuthenticationManager to use a custom provider
|
|
732
|
+
`("${url.origin}") because this reactor does not target a local replica, where ` +
|
|
733
|
+
`the provider is taken from configuration rather than the environment. Pass ` +
|
|
734
|
+
`\`identityProvider\` to AuthenticationManager to use a custom provider.`
|
|
664
735
|
)
|
|
665
736
|
return undefined
|
|
666
737
|
}
|
package/src/auth/constants.ts
CHANGED
|
@@ -12,11 +12,18 @@ export const LOCAL_INTERNET_IDENTITY_CANISTER_ID = "rdmx6-jaaaa-aaaaa-aaadq-cai"
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Builds the local Internet Identity provider URL for the given replica port.
|
|
15
|
+
*
|
|
16
|
+
* `authorizePath` selects the shape the installed build understands: modern
|
|
17
|
+
* builds serve `/authorize` as a real asset, while pre-2026 ones serve the SPA
|
|
18
|
+
* at `/` and drive the flow from a `#authorize` fragment. `AuthenticationManager`
|
|
19
|
+
* probes the canister and passes the right one; the default keeps the previous
|
|
20
|
+
* behaviour for direct callers.
|
|
15
21
|
*/
|
|
16
22
|
export const localInternetIdentityProvider = (
|
|
17
23
|
port: number,
|
|
18
|
-
canisterId: string = LOCAL_INTERNET_IDENTITY_CANISTER_ID
|
|
19
|
-
|
|
24
|
+
canisterId: string = LOCAL_INTERNET_IDENTITY_CANISTER_ID,
|
|
25
|
+
authorizePath: "/authorize" | "/#authorize" = "/authorize"
|
|
26
|
+
) => `http://${canisterId}.localhost:${port}${authorizePath}`
|
|
20
27
|
|
|
21
28
|
/**
|
|
22
29
|
* Legacy default URL for local Internet Identity, using port `4943`.
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
AuthClientLike,
|
|
3
2
|
IdentityAttributeNonce,
|
|
4
3
|
IdentityAttributeResult,
|
|
5
4
|
RequestIdentityAttributesParameters,
|
|
@@ -51,7 +50,7 @@ export class IdentityAttributesManager {
|
|
|
51
50
|
|
|
52
51
|
if (!authClient) {
|
|
53
52
|
throw new Error(
|
|
54
|
-
"Authentication module is missing or failed to initialize. To request identity attributes, please install @icp-sdk/auth
|
|
53
|
+
"Authentication module is missing or failed to initialize. To request identity attributes, please install @icp-sdk/auth v8, or provide a compatible authClient."
|
|
55
54
|
)
|
|
56
55
|
}
|
|
57
56
|
|
|
@@ -68,7 +67,7 @@ export class IdentityAttributesManager {
|
|
|
68
67
|
: Promise.resolve(authClient.getIdentity())
|
|
69
68
|
const requestPromise = authClient.requestAttributes({
|
|
70
69
|
keys,
|
|
71
|
-
nonce: toAuthClientNonce(
|
|
70
|
+
nonce: toAuthClientNonce(nonce),
|
|
72
71
|
})
|
|
73
72
|
|
|
74
73
|
const [signedAttributes, identity] = await Promise.all([
|
|
@@ -114,23 +113,19 @@ export class IdentityAttributesManager {
|
|
|
114
113
|
}
|
|
115
114
|
|
|
116
115
|
/**
|
|
117
|
-
*
|
|
116
|
+
* Adapts our nonce input to the `@icp-sdk/auth` nonce contract.
|
|
118
117
|
*
|
|
119
|
-
* v8 takes `() => Promise<Uint8Array>`
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
118
|
+
* v8 takes `() => Promise<Uint8Array>` — a thunk, so it can journal the value
|
|
119
|
+
* and replay the same bytes through a redirect flow. The thunk form also opens
|
|
120
|
+
* the transport channel synchronously, which is what preserves the user
|
|
121
|
+
* gesture.
|
|
122
|
+
*
|
|
123
|
+
* Until 3.12.0 this probed `typeof authClient.memoize === "function"` to detect
|
|
124
|
+
* v8 and fell back to a bare promise for v7. The peer range is now `^8.0.0`, so
|
|
125
|
+
* the probe would only ever take one branch.
|
|
124
126
|
*/
|
|
125
127
|
function toAuthClientNonce(
|
|
126
|
-
authClient: AuthClientLike,
|
|
127
128
|
nonce: IdentityAttributeNonce
|
|
128
|
-
):
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
if (supportsNonceThunk) {
|
|
132
|
-
return () => Promise.resolve(typeof nonce === "function" ? nonce() : nonce)
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
return Promise.resolve(typeof nonce === "function" ? nonce() : nonce)
|
|
129
|
+
): () => Promise<Uint8Array> {
|
|
130
|
+
return () => Promise.resolve(typeof nonce === "function" ? nonce() : nonce)
|
|
136
131
|
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ask a locally deployed Internet Identity canister what it actually serves.
|
|
3
|
+
*
|
|
4
|
+
* `localInternetIdentityProvider` builds `http://<id>.localhost:<port>/authorize`,
|
|
5
|
+
* the id.ai-era path. Whether that works depends on which Internet Identity
|
|
6
|
+
* build is installed, and the window is narrow:
|
|
7
|
+
*
|
|
8
|
+
* - up to `release-2025-03-07`, the SPA lived at `/` and used a `#authorize`
|
|
9
|
+
* fragment; `/authorize` is not an asset
|
|
10
|
+
* - `release-2026-01-05` through `release-2026-03-16` serve `/authorize`
|
|
11
|
+
* - from `release-2026-03-23` the frontend left the canister entirely (the id.ai
|
|
12
|
+
* split), so `/authorize` 404s even on `.raw`
|
|
13
|
+
*
|
|
14
|
+
* Outside that window the login popup renders the gateway's
|
|
15
|
+
* "Response Verification Error" page and the app simply waits until the user
|
|
16
|
+
* closes it. Nothing points at the cause.
|
|
17
|
+
*
|
|
18
|
+
* Asking the canister over the agent avoids the gateway, so the answer is about
|
|
19
|
+
* the canister's assets rather than about how the gateway felt about them.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import { Actor, type HttpAgent } from "@icp-sdk/core/agent"
|
|
23
|
+
import { IDL } from "@icp-sdk/core/candid"
|
|
24
|
+
|
|
25
|
+
/** The `http_request` query every asset-serving canister exposes. */
|
|
26
|
+
const httpInterface: IDL.InterfaceFactory = ({ IDL }) => {
|
|
27
|
+
const HeaderField = IDL.Tuple(IDL.Text, IDL.Text)
|
|
28
|
+
return IDL.Service({
|
|
29
|
+
http_request: IDL.Func(
|
|
30
|
+
[
|
|
31
|
+
IDL.Record({
|
|
32
|
+
method: IDL.Text,
|
|
33
|
+
url: IDL.Text,
|
|
34
|
+
headers: IDL.Vec(HeaderField),
|
|
35
|
+
body: IDL.Vec(IDL.Nat8),
|
|
36
|
+
}),
|
|
37
|
+
],
|
|
38
|
+
[
|
|
39
|
+
IDL.Record({
|
|
40
|
+
status_code: IDL.Nat16,
|
|
41
|
+
headers: IDL.Vec(HeaderField),
|
|
42
|
+
body: IDL.Vec(IDL.Nat8),
|
|
43
|
+
}),
|
|
44
|
+
],
|
|
45
|
+
["query"]
|
|
46
|
+
),
|
|
47
|
+
})
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface HttpCapableActor {
|
|
51
|
+
http_request: (request: {
|
|
52
|
+
method: string
|
|
53
|
+
url: string
|
|
54
|
+
headers: [string, string][]
|
|
55
|
+
body: Uint8Array
|
|
56
|
+
}) => Promise<{ status_code: number }>
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** Where a given Internet Identity build expects the sign-in flow to start. */
|
|
60
|
+
export type AuthorizePath = "/authorize" | "/#authorize"
|
|
61
|
+
|
|
62
|
+
export interface LocalIiProbe {
|
|
63
|
+
/** The path that works, or `null` when the canister serves no sign-in UI. */
|
|
64
|
+
path: AuthorizePath | null
|
|
65
|
+
/**
|
|
66
|
+
* The probe could not reach a conclusion — the canister was unreachable, or
|
|
67
|
+
* it does not expose `http_request` at all. Callers keep their existing
|
|
68
|
+
* behaviour rather than blocking a login that might well work.
|
|
69
|
+
*/
|
|
70
|
+
inconclusive: boolean
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async function statusOf(
|
|
74
|
+
actor: HttpCapableActor,
|
|
75
|
+
url: string
|
|
76
|
+
): Promise<number | undefined> {
|
|
77
|
+
try {
|
|
78
|
+
const response = await actor.http_request({
|
|
79
|
+
method: "GET",
|
|
80
|
+
url,
|
|
81
|
+
headers: [],
|
|
82
|
+
body: new Uint8Array(),
|
|
83
|
+
})
|
|
84
|
+
return response.status_code
|
|
85
|
+
} catch {
|
|
86
|
+
return undefined
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Determine which authorize path a locally deployed Internet Identity serves.
|
|
92
|
+
*
|
|
93
|
+
* Never throws. A probe that cannot answer returns `inconclusive`, because a
|
|
94
|
+
* diagnostic that blocks a working setup is worse than the failure it explains.
|
|
95
|
+
*/
|
|
96
|
+
export async function probeLocalInternetIdentity(
|
|
97
|
+
agent: HttpAgent,
|
|
98
|
+
canisterId: string
|
|
99
|
+
): Promise<LocalIiProbe> {
|
|
100
|
+
let actor: HttpCapableActor
|
|
101
|
+
try {
|
|
102
|
+
actor = Actor.createActor<HttpCapableActor>(httpInterface, {
|
|
103
|
+
agent,
|
|
104
|
+
canisterId,
|
|
105
|
+
})
|
|
106
|
+
} catch {
|
|
107
|
+
return { path: "/authorize", inconclusive: true }
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const authorize = await statusOf(actor, "/authorize")
|
|
111
|
+
|
|
112
|
+
// The canister does not answer http_request at all — not an asset canister,
|
|
113
|
+
// not deployed, or the replica is down. Not our call to make.
|
|
114
|
+
if (authorize === undefined) {
|
|
115
|
+
return { path: "/authorize", inconclusive: true }
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (authorize >= 200 && authorize < 300) {
|
|
119
|
+
return { path: "/authorize", inconclusive: false }
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Pre-2026 builds serve the SPA at the root and drive the flow from a
|
|
123
|
+
// `#authorize` fragment, which is a path the gateway never sees.
|
|
124
|
+
const root = await statusOf(actor, "/")
|
|
125
|
+
if (root !== undefined && root >= 200 && root < 300) {
|
|
126
|
+
return { path: "/#authorize", inconclusive: false }
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return { path: null, inconclusive: false }
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* The error a login gets when the installed build serves no sign-in UI, in
|
|
134
|
+
* place of a 503 page inside a popup the app cannot see.
|
|
135
|
+
*/
|
|
136
|
+
export function localInternetIdentityUnavailableError(
|
|
137
|
+
canisterId: string
|
|
138
|
+
): Error {
|
|
139
|
+
return new Error(
|
|
140
|
+
`[ic-reactor] The Internet Identity canister ${canisterId} does not serve a sign-in UI: ` +
|
|
141
|
+
`neither /authorize nor / returned a page. Internet Identity builds from ` +
|
|
142
|
+
`release-2026-03-23 onward moved their frontend out of the canister (the id.ai split) ` +
|
|
143
|
+
`and cannot be used locally. Install internet_identity_dev.wasm from release-2026-03-16, ` +
|
|
144
|
+
`the newest build that still self-serves /authorize, or point \`identityProvider\` at a ` +
|
|
145
|
+
`provider you host yourself.`
|
|
146
|
+
)
|
|
147
|
+
}
|
package/src/auth/types.ts
CHANGED
|
@@ -190,10 +190,8 @@ export interface AuthClientLike {
|
|
|
190
190
|
// Widened across `@icp-sdk/auth` v7 (value or promise) and v8 (thunk).
|
|
191
191
|
// Method-shorthand parameters are bivariant, so both real signatures are
|
|
192
192
|
// assignable to this one.
|
|
193
|
-
nonce:
|
|
193
|
+
nonce: () => Promise<Uint8Array>
|
|
194
194
|
}): Promise<SignedIdentityAttributes>
|
|
195
|
-
/** Present from `@icp-sdk/auth` v8; used to detect the nonce contract. */
|
|
196
|
-
memoize?<T>(produce: () => T | Promise<T>): Promise<T>
|
|
197
195
|
}
|
|
198
196
|
|
|
199
197
|
export interface AuthState {
|