@ic-reactor/react 3.6.0 → 3.8.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 +117 -13
- package/dist/auth/authentication-manager.d.ts +98 -0
- package/dist/auth/authentication-manager.d.ts.map +1 -0
- package/dist/auth/authentication-manager.js +532 -0
- package/dist/auth/authentication-manager.js.map +1 -0
- package/dist/auth/constants.d.ts +18 -0
- package/dist/auth/constants.d.ts.map +1 -0
- package/dist/auth/constants.js +18 -0
- package/dist/auth/constants.js.map +1 -0
- package/dist/auth/createIdentityAttributeHooks.d.ts +14 -0
- package/dist/auth/createIdentityAttributeHooks.d.ts.map +1 -0
- package/dist/auth/createIdentityAttributeHooks.js +54 -0
- package/dist/auth/createIdentityAttributeHooks.js.map +1 -0
- package/dist/auth/identity-attributes-manager.d.ts +26 -0
- package/dist/auth/identity-attributes-manager.d.ts.map +1 -0
- package/dist/auth/identity-attributes-manager.js +108 -0
- package/dist/auth/identity-attributes-manager.js.map +1 -0
- package/dist/auth/identity-attributes.d.ts +19 -0
- package/dist/auth/identity-attributes.d.ts.map +1 -0
- package/dist/auth/identity-attributes.js +170 -0
- package/dist/auth/identity-attributes.js.map +1 -0
- package/dist/auth/index.d.ts +8 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +8 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/types.d.ts +182 -0
- package/dist/auth/types.d.ts.map +1 -0
- package/dist/auth/types.js +2 -0
- package/dist/auth/types.js.map +1 -0
- package/dist/createActorHooks.d.ts +16 -16
- package/dist/createActorHooks.d.ts.map +1 -1
- package/dist/createActorHooks.js +6 -6
- package/dist/createActorHooks.js.map +1 -1
- package/dist/createInfiniteQuery.d.ts +33 -33
- package/dist/createInfiniteQuery.d.ts.map +1 -1
- package/dist/createInfiniteQuery.js +6 -6
- package/dist/createInfiniteQuery.js.map +1 -1
- package/dist/createMutation.d.ts +13 -2
- package/dist/createMutation.d.ts.map +1 -1
- package/dist/createMutation.js +11 -0
- package/dist/createMutation.js.map +1 -1
- package/dist/createQuery.d.ts +13 -3
- package/dist/createQuery.d.ts.map +1 -1
- package/dist/createQuery.js +16 -6
- package/dist/createQuery.js.map +1 -1
- package/dist/createSuspenseInfiniteQuery.d.ts +32 -32
- package/dist/createSuspenseInfiniteQuery.d.ts.map +1 -1
- package/dist/createSuspenseInfiniteQuery.js +6 -6
- package/dist/createSuspenseInfiniteQuery.js.map +1 -1
- package/dist/createSuspenseQuery.d.ts +3 -3
- package/dist/createSuspenseQuery.d.ts.map +1 -1
- package/dist/createSuspenseQuery.js +1 -1
- package/dist/createSuspenseQuery.js.map +1 -1
- package/dist/defineReactor.d.ts +124 -0
- package/dist/defineReactor.d.ts.map +1 -0
- package/dist/defineReactor.js +145 -0
- package/dist/defineReactor.js.map +1 -0
- package/dist/{createAuthHooks.d.ts → hooks/createAuthHooks.d.ts} +6 -13
- package/dist/hooks/createAuthHooks.d.ts.map +1 -0
- package/dist/{createAuthHooks.js → hooks/createAuthHooks.js} +18 -58
- package/dist/hooks/createAuthHooks.js.map +1 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +2 -0
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/useActorInfiniteQuery.d.ts +9 -9
- package/dist/hooks/useActorInfiniteQuery.d.ts.map +1 -1
- package/dist/hooks/useActorInfiniteQuery.js +3 -1
- package/dist/hooks/useActorInfiniteQuery.js.map +1 -1
- package/dist/hooks/useActorMethod.d.ts +17 -17
- package/dist/hooks/useActorMethod.d.ts.map +1 -1
- package/dist/hooks/useActorMethod.js.map +1 -1
- package/dist/hooks/useActorMutation.d.ts +18 -7
- package/dist/hooks/useActorMutation.d.ts.map +1 -1
- package/dist/hooks/useActorMutation.js +11 -0
- package/dist/hooks/useActorMutation.js.map +1 -1
- package/dist/hooks/useActorQuery.d.ts +8 -8
- package/dist/hooks/useActorQuery.d.ts.map +1 -1
- package/dist/hooks/useActorQuery.js.map +1 -1
- package/dist/hooks/useActorSuspenseInfiniteQuery.d.ts +9 -9
- package/dist/hooks/useActorSuspenseInfiniteQuery.d.ts.map +1 -1
- package/dist/hooks/useActorSuspenseInfiniteQuery.js +3 -1
- package/dist/hooks/useActorSuspenseInfiniteQuery.js.map +1 -1
- package/dist/hooks/useActorSuspenseQuery.d.ts +8 -8
- package/dist/hooks/useActorSuspenseQuery.d.ts.map +1 -1
- package/dist/hooks/useActorSuspenseQuery.js.map +1 -1
- package/dist/index.d.ts +11 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -10
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +24 -24
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.d.ts +3 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +10 -2
- package/dist/utils.js.map +1 -1
- package/llms.txt +48 -0
- package/package.json +34 -23
- package/src/auth/authentication-manager.ts +591 -0
- package/src/auth/constants.ts +25 -0
- package/src/auth/createIdentityAttributeHooks.ts +83 -0
- package/src/auth/identity-attributes-manager.ts +136 -0
- package/src/auth/identity-attributes.ts +270 -0
- package/src/auth/index.ts +7 -0
- package/src/auth/types.ts +204 -0
- package/src/createActorHooks.ts +90 -58
- package/src/createInfiniteQuery.ts +154 -98
- package/src/createMutation.ts +35 -19
- package/src/createQuery.ts +94 -50
- package/src/createSuspenseInfiniteQuery.ts +166 -115
- package/src/createSuspenseQuery.ts +69 -43
- package/src/defineReactor.ts +272 -0
- package/src/{createAuthHooks.ts → hooks/createAuthHooks.ts} +23 -99
- package/src/hooks/index.ts +4 -0
- package/src/hooks/useActorInfiniteQuery.ts +44 -30
- package/src/hooks/useActorMethod.ts +62 -53
- package/src/hooks/useActorMutation.ts +47 -30
- package/src/hooks/useActorQuery.ts +36 -32
- package/src/hooks/useActorSuspenseInfiniteQuery.ts +56 -30
- package/src/hooks/useActorSuspenseQuery.ts +42 -32
- package/src/index.ts +12 -10
- package/src/types.ts +76 -71
- package/src/utils.ts +15 -2
- package/dist/createAuthHooks.d.ts.map +0 -1
- package/dist/createAuthHooks.js.map +0 -1
- package/src/hooks/useActorInfiniteQuery.test.tsx +0 -457
- package/src/hooks/useActorMethod.test.tsx +0 -798
- package/src/hooks/useActorMutation.test.tsx +0 -220
- package/src/hooks/useActorQuery.test.tsx +0 -287
- package/src/hooks/useActorSuspenseInfiniteQuery.test.tsx +0 -472
- package/src/hooks/useActorSuspenseQuery.test.tsx +0 -254
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { useCallback, useState } from "react";
|
|
2
|
+
export function createIdentityAttributeHooks(identityAttributes) {
|
|
3
|
+
const useIdentityAttributes = () => {
|
|
4
|
+
const [attributes, setAttributes] = useState(null);
|
|
5
|
+
const [isRequestingAttributes, setIsRequestingAttributes] = useState(false);
|
|
6
|
+
const [attributeError, setAttributeError] = useState(null);
|
|
7
|
+
const requestAttributes = useCallback(async (params) => {
|
|
8
|
+
setIsRequestingAttributes(true);
|
|
9
|
+
setAttributeError(null);
|
|
10
|
+
try {
|
|
11
|
+
const result = await identityAttributes.request(params);
|
|
12
|
+
setAttributes(result);
|
|
13
|
+
return result;
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
setAttributeError(error);
|
|
17
|
+
throw error;
|
|
18
|
+
}
|
|
19
|
+
finally {
|
|
20
|
+
setIsRequestingAttributes(false);
|
|
21
|
+
}
|
|
22
|
+
}, []);
|
|
23
|
+
const requestOpenIdAttributes = useCallback(async (params) => {
|
|
24
|
+
setIsRequestingAttributes(true);
|
|
25
|
+
setAttributeError(null);
|
|
26
|
+
try {
|
|
27
|
+
const result = await identityAttributes.requestOpenId(params);
|
|
28
|
+
setAttributes(result);
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
setAttributeError(error);
|
|
33
|
+
throw error;
|
|
34
|
+
}
|
|
35
|
+
finally {
|
|
36
|
+
setIsRequestingAttributes(false);
|
|
37
|
+
}
|
|
38
|
+
}, []);
|
|
39
|
+
const clearAttributes = useCallback(() => {
|
|
40
|
+
setAttributes(null);
|
|
41
|
+
setAttributeError(null);
|
|
42
|
+
}, []);
|
|
43
|
+
return {
|
|
44
|
+
requestAttributes,
|
|
45
|
+
requestOpenIdAttributes,
|
|
46
|
+
attributes,
|
|
47
|
+
isRequestingAttributes,
|
|
48
|
+
attributeError,
|
|
49
|
+
clearAttributes,
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
return { useIdentityAttributes };
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=createIdentityAttributeHooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createIdentityAttributeHooks.js","sourceRoot":"","sources":["../../src/auth/createIdentityAttributeHooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAqB7C,MAAM,UAAU,4BAA4B,CAC1C,kBAA6C;IAE7C,MAAM,qBAAqB,GAAG,GAAgC,EAAE;QAC9D,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAC/B,QAAQ,CAAiC,IAAI,CAAC,CAAA;QAChD,MAAM,CAAC,sBAAsB,EAAE,yBAAyB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;QAC3E,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAe,IAAI,CAAC,CAAA;QAExE,MAAM,iBAAiB,GAAG,WAAW,CACnC,KAAK,EAAE,MAA2C,EAAE,EAAE;YACpD,yBAAyB,CAAC,IAAI,CAAC,CAAA;YAC/B,iBAAiB,CAAC,IAAI,CAAC,CAAA;YACvB,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;gBACvD,aAAa,CAAC,MAAM,CAAC,CAAA;gBACrB,OAAO,MAAM,CAAA;YACf,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,iBAAiB,CAAC,KAAc,CAAC,CAAA;gBACjC,MAAM,KAAK,CAAA;YACb,CAAC;oBAAS,CAAC;gBACT,yBAAyB,CAAC,KAAK,CAAC,CAAA;YAClC,CAAC;QACH,CAAC,EACD,EAAE,CACH,CAAA;QAED,MAAM,uBAAuB,GAAG,WAAW,CACzC,KAAK,EAAE,MAAiD,EAAE,EAAE;YAC1D,yBAAyB,CAAC,IAAI,CAAC,CAAA;YAC/B,iBAAiB,CAAC,IAAI,CAAC,CAAA;YACvB,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAC,aAAa,CAAC,MAAM,CAAC,CAAA;gBAC7D,aAAa,CAAC,MAAM,CAAC,CAAA;gBACrB,OAAO,MAAM,CAAA;YACf,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,iBAAiB,CAAC,KAAc,CAAC,CAAA;gBACjC,MAAM,KAAK,CAAA;YACb,CAAC;oBAAS,CAAC;gBACT,yBAAyB,CAAC,KAAK,CAAC,CAAA;YAClC,CAAC;QACH,CAAC,EACD,EAAE,CACH,CAAA;QAED,MAAM,eAAe,GAAG,WAAW,CAAC,GAAG,EAAE;YACvC,aAAa,CAAC,IAAI,CAAC,CAAA;YACnB,iBAAiB,CAAC,IAAI,CAAC,CAAA;QACzB,CAAC,EAAE,EAAE,CAAC,CAAA;QAEN,OAAO;YACL,iBAAiB;YACjB,uBAAuB;YACvB,UAAU;YACV,sBAAsB;YACtB,cAAc;YACd,eAAe;SAChB,CAAA;IACH,CAAC,CAAA;IAED,OAAO,EAAE,qBAAqB,EAAE,CAAA;AAClC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { IdentityAttributeResult, RequestIdentityAttributesParameters, RequestOpenIdIdentityAttributesParameters } from "./types.js";
|
|
2
|
+
import { AuthenticationManager } from "./authentication-manager.js";
|
|
3
|
+
/**
|
|
4
|
+
* Requests and decodes signed identity attributes for an authenticated
|
|
5
|
+
* Internet Identity session.
|
|
6
|
+
*
|
|
7
|
+
* Await `authentication.prepareClient()` once during startup (the `useAuth`
|
|
8
|
+
* hook already does) so that {@link request} can open the identity provider
|
|
9
|
+
* window synchronously from a click handler.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const attributes = new IdentityAttributesManager(authentication)
|
|
14
|
+
* const result = await attributes.request({
|
|
15
|
+
* keys: ["name"],
|
|
16
|
+
* nonce: () => fetchNonceFromCanister(),
|
|
17
|
+
* })
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare class IdentityAttributesManager {
|
|
21
|
+
readonly authentication: AuthenticationManager;
|
|
22
|
+
constructor(authentication: AuthenticationManager);
|
|
23
|
+
request: ({ keys, nonce, signIn, maxTimeToLive, targets, ...clientOptions }: RequestIdentityAttributesParameters) => Promise<IdentityAttributeResult>;
|
|
24
|
+
requestOpenId: ({ keys, openIdProvider, ...rest }: RequestOpenIdIdentityAttributesParameters) => Promise<IdentityAttributeResult>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=identity-attributes-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity-attributes-manager.d.ts","sourceRoot":"","sources":["../../src/auth/identity-attributes-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,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"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { decodeIdentityAttributeValues, identityAttributeKeys, normalizeSignedIdentityAttributes, } from "./identity-attributes.js";
|
|
2
|
+
/**
|
|
3
|
+
* Requests and decodes signed identity attributes for an authenticated
|
|
4
|
+
* Internet Identity session.
|
|
5
|
+
*
|
|
6
|
+
* Await `authentication.prepareClient()` once during startup (the `useAuth`
|
|
7
|
+
* hook already does) so that {@link request} can open the identity provider
|
|
8
|
+
* window synchronously from a click handler.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const attributes = new IdentityAttributesManager(authentication)
|
|
13
|
+
* const result = await attributes.request({
|
|
14
|
+
* keys: ["name"],
|
|
15
|
+
* nonce: () => fetchNonceFromCanister(),
|
|
16
|
+
* })
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export class IdentityAttributesManager {
|
|
20
|
+
constructor(authentication) {
|
|
21
|
+
Object.defineProperty(this, "authentication", {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
configurable: true,
|
|
24
|
+
writable: true,
|
|
25
|
+
value: authentication
|
|
26
|
+
});
|
|
27
|
+
Object.defineProperty(this, "request", {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
configurable: true,
|
|
30
|
+
writable: true,
|
|
31
|
+
value: async ({ keys, nonce, signIn = true, maxTimeToLive, targets, ...clientOptions }) => {
|
|
32
|
+
// Nothing may be awaited before `requestAttributes` / `signIn` are invoked:
|
|
33
|
+
// the ICRC-29 transport only opens the identity provider window while the
|
|
34
|
+
// browser still considers us inside the user gesture. `getPreparedClient`
|
|
35
|
+
// is synchronous whenever `prepareClient()` has run.
|
|
36
|
+
const preparedClient = this.authentication.getPreparedClient(clientOptions);
|
|
37
|
+
const authClient = preparedClient ?? (await this.authentication.ensureClient(clientOptions));
|
|
38
|
+
if (!authClient) {
|
|
39
|
+
throw new Error("Authentication module is missing or failed to initialize. To request identity attributes, please install @icp-sdk/auth v7 or later, or provide a compatible authClient.");
|
|
40
|
+
}
|
|
41
|
+
this.authentication.setAuthenticating();
|
|
42
|
+
try {
|
|
43
|
+
// `signIn` first: it opens the transport channel synchronously, and the
|
|
44
|
+
// attribute request then reuses that same channel and window.
|
|
45
|
+
const identityPromise = signIn
|
|
46
|
+
? this.authentication.signInOrRecoverIdentity({
|
|
47
|
+
maxTimeToLive,
|
|
48
|
+
targets,
|
|
49
|
+
})
|
|
50
|
+
: Promise.resolve(authClient.getIdentity());
|
|
51
|
+
const requestPromise = authClient.requestAttributes({
|
|
52
|
+
keys,
|
|
53
|
+
nonce: toAuthClientNonce(authClient, nonce),
|
|
54
|
+
});
|
|
55
|
+
const [signedAttributes, identity] = await Promise.all([
|
|
56
|
+
requestPromise,
|
|
57
|
+
identityPromise,
|
|
58
|
+
]);
|
|
59
|
+
const finalIdentity = identity ?? (await authClient.getIdentity());
|
|
60
|
+
const isAuthenticated = await authClient.isAuthenticated();
|
|
61
|
+
await this.authentication.commitIdentity(finalIdentity, isAuthenticated);
|
|
62
|
+
const normalizedSignedAttributes = normalizeSignedIdentityAttributes(signedAttributes);
|
|
63
|
+
return {
|
|
64
|
+
principal: finalIdentity.getPrincipal().toText(),
|
|
65
|
+
requestedKeys: keys,
|
|
66
|
+
signedAttributes: normalizedSignedAttributes,
|
|
67
|
+
decodedAttributes: decodeIdentityAttributeValues(normalizedSignedAttributes.data, keys),
|
|
68
|
+
completedAt: new Date().toISOString(),
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
this.authentication.setAuthenticationError(error);
|
|
73
|
+
throw error;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
Object.defineProperty(this, "requestOpenId", {
|
|
78
|
+
enumerable: true,
|
|
79
|
+
configurable: true,
|
|
80
|
+
writable: true,
|
|
81
|
+
value: ({ keys, openIdProvider, ...rest }) => {
|
|
82
|
+
// Called (not awaited) synchronously so the user gesture is preserved.
|
|
83
|
+
return this.request({
|
|
84
|
+
...rest,
|
|
85
|
+
openIdProvider,
|
|
86
|
+
keys: identityAttributeKeys({ openIdProvider, keys }),
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Bridges the two `@icp-sdk/auth` nonce contracts.
|
|
94
|
+
*
|
|
95
|
+
* v8 takes `() => Promise<Uint8Array>` (it journals the value so a redirect
|
|
96
|
+
* flow replays the same bytes); v7 takes `Uint8Array | Promise<Uint8Array>`.
|
|
97
|
+
* Both open the transport channel synchronously for the deferred forms, so we
|
|
98
|
+
* always hand over the deferred shape the installed client understands.
|
|
99
|
+
* `memoize` only exists from v8 onwards, which makes it a reliable marker.
|
|
100
|
+
*/
|
|
101
|
+
function toAuthClientNonce(authClient, nonce) {
|
|
102
|
+
const supportsNonceThunk = typeof authClient.memoize === "function";
|
|
103
|
+
if (supportsNonceThunk) {
|
|
104
|
+
return () => Promise.resolve(typeof nonce === "function" ? nonce() : nonce);
|
|
105
|
+
}
|
|
106
|
+
return Promise.resolve(typeof nonce === "function" ? nonce() : nonce);
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=identity-attributes-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity-attributes-manager.js","sourceRoot":"","sources":["../../src/auth/identity-attributes-manager.ts"],"names":[],"mappings":"AASA,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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1,19 @@
|
|
|
1
|
+
import type { IdentityAttributeOpenIdProvider, IdentityAttributeValues, SignedIdentityAttributes } from "./types.js";
|
|
2
|
+
export declare const IDENTITY_ATTRIBUTES_PROVIDER = "https://id.ai/authorize";
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated Use the default ClientManager identity provider or
|
|
5
|
+
* `IDENTITY_ATTRIBUTES_PROVIDER` instead.
|
|
6
|
+
*/
|
|
7
|
+
export declare const IDENTITY_ATTRIBUTES_BETA_PROVIDER = "https://id.ai/authorize";
|
|
8
|
+
export declare function identityAttributeKeys({ openIdProvider, keys, }: {
|
|
9
|
+
openIdProvider: IdentityAttributeOpenIdProvider;
|
|
10
|
+
keys: string[];
|
|
11
|
+
}): string[];
|
|
12
|
+
export declare function normalizeOpenIdProvider(openIdProvider: IdentityAttributeOpenIdProvider): string;
|
|
13
|
+
export declare function resolveIdentityAttributeKeys({ openIdProvider, keys, }: {
|
|
14
|
+
openIdProvider: IdentityAttributeOpenIdProvider;
|
|
15
|
+
keys: string[];
|
|
16
|
+
}): Promise<string[]>;
|
|
17
|
+
export declare function decodeIdentityAttributeValues(data: Uint8Array, requestedKeys: string[]): IdentityAttributeValues;
|
|
18
|
+
export declare function normalizeSignedIdentityAttributes(attributes: SignedIdentityAttributes): SignedIdentityAttributes;
|
|
19
|
+
//# sourceMappingURL=identity-attributes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity-attributes.d.ts","sourceRoot":"","sources":["../../src/auth/identity-attributes.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,+BAA+B,EAC/B,uBAAuB,EACvB,wBAAwB,EACzB,MAAM,YAAY,CAAA;AAGnB,eAAO,MAAM,4BAA4B,4BAAgC,CAAA;AAEzE;;;GAGG;AACH,eAAO,MAAM,iCAAiC,4BAA+B,CAAA;AAQ7E,wBAAgB,qBAAqB,CAAC,EACpC,cAAc,EACd,IAAI,GACL,EAAE;IACD,cAAc,EAAE,+BAA+B,CAAA;IAC/C,IAAI,EAAE,MAAM,EAAE,CAAA;CACf,GAAG,MAAM,EAAE,CAGX;AAED,wBAAgB,uBAAuB,CACrC,cAAc,EAAE,+BAA+B,GAC9C,MAAM,CAMR;AAED,wBAAsB,4BAA4B,CAAC,EACjD,cAAc,EACd,IAAI,GACL,EAAE;IACD,cAAc,EAAE,+BAA+B,CAAA;IAC/C,IAAI,EAAE,MAAM,EAAE,CAAA;CACf,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAEpB;AAED,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,UAAU,EAChB,aAAa,EAAE,MAAM,EAAE,GACtB,uBAAuB,CAgBzB;AA6LD,wBAAgB,iCAAiC,CAC/C,UAAU,EAAE,wBAAwB,GACnC,wBAAwB,CAK1B"}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { IDL } from "@icp-sdk/core/candid";
|
|
2
|
+
import { IC_INTERNET_IDENTITY_PROVIDER } from "./constants.js";
|
|
3
|
+
export const IDENTITY_ATTRIBUTES_PROVIDER = IC_INTERNET_IDENTITY_PROVIDER;
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated Use the default ClientManager identity provider or
|
|
6
|
+
* `IDENTITY_ATTRIBUTES_PROVIDER` instead.
|
|
7
|
+
*/
|
|
8
|
+
export const IDENTITY_ATTRIBUTES_BETA_PROVIDER = IDENTITY_ATTRIBUTES_PROVIDER;
|
|
9
|
+
const OPEN_ID_PROVIDER_URLS = {
|
|
10
|
+
apple: "https://appleid.apple.com",
|
|
11
|
+
google: "https://accounts.google.com",
|
|
12
|
+
microsoft: "https://login.microsoftonline.com/{tid}/v2.0",
|
|
13
|
+
};
|
|
14
|
+
export function identityAttributeKeys({ openIdProvider, keys, }) {
|
|
15
|
+
const provider = normalizeOpenIdProvider(openIdProvider);
|
|
16
|
+
return keys.map((key) => `openid:${provider}:${key}`);
|
|
17
|
+
}
|
|
18
|
+
export function normalizeOpenIdProvider(openIdProvider) {
|
|
19
|
+
return (OPEN_ID_PROVIDER_URLS[openIdProvider] ?? openIdProvider);
|
|
20
|
+
}
|
|
21
|
+
export async function resolveIdentityAttributeKeys({ openIdProvider, keys, }) {
|
|
22
|
+
return identityAttributeKeys({ openIdProvider, keys });
|
|
23
|
+
}
|
|
24
|
+
export function decodeIdentityAttributeValues(data, requestedKeys) {
|
|
25
|
+
const requestedKeyMap = requestedKeys.reduce((acc, key) => {
|
|
26
|
+
acc[key] = identityAttributeDisplayKey(key);
|
|
27
|
+
acc[identityAttributeDisplayKey(key)] = identityAttributeDisplayKey(key);
|
|
28
|
+
return acc;
|
|
29
|
+
}, {});
|
|
30
|
+
const decodedValues = decodeCandidAttributeValues(data, requestedKeyMap);
|
|
31
|
+
if (Object.keys(decodedValues).length > 0) {
|
|
32
|
+
return decodedValues;
|
|
33
|
+
}
|
|
34
|
+
return extractPrintableAttributeValues(data, requestedKeys);
|
|
35
|
+
}
|
|
36
|
+
function decodeCandidAttributeValues(data, requestedKeyMap) {
|
|
37
|
+
const textPairs = IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text));
|
|
38
|
+
const recordPairs = IDL.Vec(IDL.Record({
|
|
39
|
+
key: IDL.Text,
|
|
40
|
+
value: IDL.Text,
|
|
41
|
+
}));
|
|
42
|
+
const candidates = [
|
|
43
|
+
[textPairs],
|
|
44
|
+
[recordPairs],
|
|
45
|
+
[IDL.Record({ attributes: textPairs })],
|
|
46
|
+
[IDL.Record({ values: textPairs })],
|
|
47
|
+
[IDL.Record({ attributes: recordPairs })],
|
|
48
|
+
[IDL.Record({ values: recordPairs })],
|
|
49
|
+
];
|
|
50
|
+
for (const candidate of candidates) {
|
|
51
|
+
try {
|
|
52
|
+
const decoded = IDL.decode(candidate, data);
|
|
53
|
+
const values = collectDecodedAttributeValues(decoded, requestedKeyMap);
|
|
54
|
+
if (Object.keys(values).length > 0) {
|
|
55
|
+
return values;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
// Try the next known beta payload shape, then fall back to text extraction.
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return {};
|
|
63
|
+
}
|
|
64
|
+
function collectDecodedAttributeValues(value, requestedKeyMap, activeKey) {
|
|
65
|
+
const values = {};
|
|
66
|
+
if (typeof value === "string") {
|
|
67
|
+
const displayKey = requestedKeyMap[value];
|
|
68
|
+
if (displayKey) {
|
|
69
|
+
return values;
|
|
70
|
+
}
|
|
71
|
+
if (activeKey && isPrintableTextValue(value)) {
|
|
72
|
+
values[activeKey] = value;
|
|
73
|
+
}
|
|
74
|
+
return values;
|
|
75
|
+
}
|
|
76
|
+
if (Array.isArray(value)) {
|
|
77
|
+
if (value.length === 2 && typeof value[0] === "string") {
|
|
78
|
+
const displayKey = requestedKeyMap[value[0]];
|
|
79
|
+
if (displayKey &&
|
|
80
|
+
typeof value[1] === "string" &&
|
|
81
|
+
isPrintableTextValue(value[1])) {
|
|
82
|
+
values[displayKey] = value[1];
|
|
83
|
+
return values;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
for (const item of value) {
|
|
87
|
+
Object.assign(values, collectDecodedAttributeValues(item, requestedKeyMap, activeKey));
|
|
88
|
+
}
|
|
89
|
+
return values;
|
|
90
|
+
}
|
|
91
|
+
if (value && typeof value === "object") {
|
|
92
|
+
const record = value;
|
|
93
|
+
if (typeof record.key === "string" && typeof record.value === "string") {
|
|
94
|
+
const displayKey = requestedKeyMap[record.key];
|
|
95
|
+
if (displayKey && isPrintableTextValue(record.value)) {
|
|
96
|
+
values[displayKey] = record.value;
|
|
97
|
+
return values;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
for (const [key, nested] of Object.entries(record)) {
|
|
101
|
+
const displayKey = requestedKeyMap[key] ?? activeKey;
|
|
102
|
+
if (displayKey &&
|
|
103
|
+
typeof nested === "string" &&
|
|
104
|
+
isPrintableTextValue(nested)) {
|
|
105
|
+
values[displayKey] = nested;
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
Object.assign(values, collectDecodedAttributeValues(nested, requestedKeyMap, displayKey));
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return values;
|
|
112
|
+
}
|
|
113
|
+
function extractPrintableAttributeValues(data, requestedKeys) {
|
|
114
|
+
const text = new TextDecoder().decode(data);
|
|
115
|
+
const values = {};
|
|
116
|
+
for (const requestedKey of requestedKeys) {
|
|
117
|
+
const start = text.indexOf(requestedKey);
|
|
118
|
+
if (start === -1) {
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
const tail = text.slice(start + requestedKey.length);
|
|
122
|
+
const printableRuns = tail.match(/[\x20-\x7E]{2,512}/g) ?? [];
|
|
123
|
+
const value = printableRuns
|
|
124
|
+
.map((candidate) => cleanPrintableAttributeValue(candidate, requestedKeys))
|
|
125
|
+
.find((candidate) => isPrintableTextValue(candidate) &&
|
|
126
|
+
candidate !== requestedKey &&
|
|
127
|
+
!candidate.startsWith("openid:"));
|
|
128
|
+
if (value) {
|
|
129
|
+
values[identityAttributeDisplayKey(requestedKey)] = value.trim();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return values;
|
|
133
|
+
}
|
|
134
|
+
function cleanPrintableAttributeValue(value, requestedKeys) {
|
|
135
|
+
let cleaned = value;
|
|
136
|
+
for (const requestedKey of requestedKeys) {
|
|
137
|
+
const nextKeyIndex = cleaned.indexOf(requestedKey);
|
|
138
|
+
if (nextKeyIndex > 0) {
|
|
139
|
+
cleaned = cleaned.slice(0, trimCandidTextLengthPrefix(cleaned, nextKeyIndex));
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
const nextOpenIdKeyIndex = cleaned.indexOf("openid:");
|
|
143
|
+
if (nextOpenIdKeyIndex > 0) {
|
|
144
|
+
cleaned = cleaned.slice(0, trimCandidTextLengthPrefix(cleaned, nextOpenIdKeyIndex));
|
|
145
|
+
}
|
|
146
|
+
return cleaned.trim();
|
|
147
|
+
}
|
|
148
|
+
function trimCandidTextLengthPrefix(value, index) {
|
|
149
|
+
let trimmedIndex = index;
|
|
150
|
+
while (trimmedIndex > 0 && isAsciiDigit(value.charCodeAt(trimmedIndex - 1))) {
|
|
151
|
+
trimmedIndex -= 1;
|
|
152
|
+
}
|
|
153
|
+
return trimmedIndex;
|
|
154
|
+
}
|
|
155
|
+
function isAsciiDigit(charCode) {
|
|
156
|
+
return charCode >= 48 && charCode <= 57;
|
|
157
|
+
}
|
|
158
|
+
function identityAttributeDisplayKey(key) {
|
|
159
|
+
return key.split(":").pop() || key;
|
|
160
|
+
}
|
|
161
|
+
function isPrintableTextValue(value) {
|
|
162
|
+
return value.length > 0 && value.length <= 512 && /^[\x20-\x7E]+$/.test(value);
|
|
163
|
+
}
|
|
164
|
+
export function normalizeSignedIdentityAttributes(attributes) {
|
|
165
|
+
return {
|
|
166
|
+
data: new Uint8Array(attributes.data),
|
|
167
|
+
signature: new Uint8Array(attributes.signature),
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=identity-attributes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity-attributes.js","sourceRoot":"","sources":["../../src/auth/identity-attributes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAO1C,OAAO,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAA;AAE9D,MAAM,CAAC,MAAM,4BAA4B,GAAG,6BAA6B,CAAA;AAEzE;;;GAGG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,4BAA4B,CAAA;AAE7E,MAAM,qBAAqB,GAAG;IAC5B,KAAK,EAAE,2BAA2B;IAClC,MAAM,EAAE,6BAA6B;IACrC,SAAS,EAAE,8CAA8C;CACjD,CAAA;AAEV,MAAM,UAAU,qBAAqB,CAAC,EACpC,cAAc,EACd,IAAI,GAIL;IACC,MAAM,QAAQ,GAAG,uBAAuB,CAAC,cAAc,CAAC,CAAA;IACxD,OAAO,IA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,IAAI,QAAQ,IAAI,EAAE,CAAA;AACzC,CAAC;AAED,SAAS,2BAA2B,CAAC,GAAW;IAC9C,OAAO,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,GAAG,CAAA;AACpC,CAAC;AAED,SAAS,oBAAoB,CAAC,KAAa;IACzC,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,MAAM,IAAI,GAAG,IAAI,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;AAChF,CAAC;AAED,MAAM,UAAU,iCAAiC,CAC/C,UAAoC;IAEpC,OAAO;QACL,IAAI,EAAE,IAAI,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC;QACrC,SAAS,EAAE,IAAI,UAAU,CAAC,UAAU,CAAC,SAAS,CAAC;KAChD,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./authentication-manager.js";
|
|
2
|
+
export * from "./identity-attributes-manager.js";
|
|
3
|
+
export * from "./identity-attributes.js";
|
|
4
|
+
export * from "./constants.js";
|
|
5
|
+
export * from "./types.js";
|
|
6
|
+
export * from "../hooks/createAuthHooks.js";
|
|
7
|
+
export * from "./createIdentityAttributeHooks.js";
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAA;AAC3C,cAAc,kCAAkC,CAAA;AAChD,cAAc,0BAA0B,CAAA;AACxC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA;AAC1B,cAAc,6BAA6B,CAAA;AAC3C,cAAc,mCAAmC,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./authentication-manager.js";
|
|
2
|
+
export * from "./identity-attributes-manager.js";
|
|
3
|
+
export * from "./identity-attributes.js";
|
|
4
|
+
export * from "./constants.js";
|
|
5
|
+
export * from "./types.js";
|
|
6
|
+
export * from "../hooks/createAuthHooks.js";
|
|
7
|
+
export * from "./createIdentityAttributeHooks.js";
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAA;AAC3C,cAAc,kCAAkC,CAAA;AAChD,cAAc,0BAA0B,CAAA;AACxC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA;AAC1B,cAAc,6BAA6B,CAAA;AAC3C,cAAc,mCAAmC,CAAA"}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import type { Identity, SignIdentity } from "@icp-sdk/core/agent";
|
|
2
|
+
import type { PartialIdentity } from "@icp-sdk/core/identity";
|
|
3
|
+
import type { Principal } from "@icp-sdk/core/principal";
|
|
4
|
+
export interface SignedIdentityAttributes {
|
|
5
|
+
data: Uint8Array;
|
|
6
|
+
signature: Uint8Array;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The 32-byte nonce issued by the relying-party canister.
|
|
10
|
+
*
|
|
11
|
+
* A function (or promise) lets the Internet Identity window open while the
|
|
12
|
+
* nonce is still being fetched, so the popup is opened inside the user gesture
|
|
13
|
+
* instead of after it. `@icp-sdk/auth` v8 requires the function form; v7
|
|
14
|
+
* accepts the promise form. IC Reactor normalizes whichever you pass to the
|
|
15
|
+
* shape the installed client expects.
|
|
16
|
+
*/
|
|
17
|
+
export type IdentityAttributeNonce = Uint8Array | Promise<Uint8Array> | (() => Uint8Array | Promise<Uint8Array>);
|
|
18
|
+
export interface IdentityAttributeRequest {
|
|
19
|
+
keys: string[];
|
|
20
|
+
nonce: IdentityAttributeNonce;
|
|
21
|
+
}
|
|
22
|
+
export interface IdentityAttributeValues {
|
|
23
|
+
email?: string;
|
|
24
|
+
name?: string;
|
|
25
|
+
verified_email?: string;
|
|
26
|
+
[key: string]: string | undefined;
|
|
27
|
+
}
|
|
28
|
+
export interface IdentityAttributeResult {
|
|
29
|
+
principal: string;
|
|
30
|
+
requestedKeys: string[];
|
|
31
|
+
signedAttributes: SignedIdentityAttributes;
|
|
32
|
+
decodedAttributes: IdentityAttributeValues;
|
|
33
|
+
completedAt: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The providers that Internet Identity supports for one-click sign-in. Only
|
|
37
|
+
* these three reach the underlying auth client.
|
|
38
|
+
*/
|
|
39
|
+
type IdentityAttributeOpenIdProviderAlias = "google" | "apple" | "microsoft";
|
|
40
|
+
/**
|
|
41
|
+
* An OpenID provider, either as a well-known alias or as a raw issuer URL.
|
|
42
|
+
*
|
|
43
|
+
* The two forms are **not** interchangeable, and what each one does depends on
|
|
44
|
+
* where it is passed:
|
|
45
|
+
*
|
|
46
|
+
* - An alias (`"google" | "apple" | "microsoft"`) is forwarded to the auth
|
|
47
|
+
* client, which adds an `openid` search param to the identity provider URL so
|
|
48
|
+
* the user signs in through that provider directly.
|
|
49
|
+
* - Any other string is treated as a raw issuer URL and is **never** forwarded
|
|
50
|
+
* to the auth client, so it never affects how the user signs in. It is only
|
|
51
|
+
* meaningful when passed to {@link IdentityAttributesManager.requestOpenId}
|
|
52
|
+
* (or `identityAttributeKeys`), which scopes the requested keys to
|
|
53
|
+
* `openid:<issuer>:<key>`. Passed anywhere else it has no effect at all.
|
|
54
|
+
*/
|
|
55
|
+
export type IdentityAttributeOpenIdProvider = IdentityAttributeOpenIdProviderAlias | (string & {});
|
|
56
|
+
/** Session key algorithm used for each sign-in. */
|
|
57
|
+
export type AuthClientKeyType = "ECDSA" | "Ed25519";
|
|
58
|
+
/** Structural shape of an `@icp-sdk/auth` `AuthClientStorage`. */
|
|
59
|
+
export interface AuthClientStorageLike {
|
|
60
|
+
get(key: string): Promise<string | CryptoKeyPair | null>;
|
|
61
|
+
set(key: string, value: string | CryptoKeyPair): Promise<void>;
|
|
62
|
+
remove(key: string): Promise<void>;
|
|
63
|
+
}
|
|
64
|
+
/** Idle-session configuration forwarded to the underlying AuthClient. */
|
|
65
|
+
export interface AuthClientIdleOptions {
|
|
66
|
+
/** Called once the user has been idle for `idleTimeout` ms. */
|
|
67
|
+
onIdle?: () => unknown;
|
|
68
|
+
/** Idle timeout in ms. @default 600_000 (10 minutes) */
|
|
69
|
+
idleTimeout?: number;
|
|
70
|
+
/** Treat scroll events as activity. @default false */
|
|
71
|
+
captureScroll?: boolean;
|
|
72
|
+
/** Scroll debounce in ms. @default 100 */
|
|
73
|
+
scrollDebounce?: number;
|
|
74
|
+
/** Disable idle detection entirely. @default false */
|
|
75
|
+
disableIdle?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Disable the built-in idle callback, which signs the user out and reloads
|
|
78
|
+
* the page. @default false
|
|
79
|
+
*/
|
|
80
|
+
disableDefaultIdleCallback?: boolean;
|
|
81
|
+
}
|
|
82
|
+
export interface AuthenticationClientOptions {
|
|
83
|
+
/** Identity provider URL. @default "https://id.ai/authorize" */
|
|
84
|
+
identityProvider?: string | URL;
|
|
85
|
+
/** `window.open` features string for the identity provider popup. */
|
|
86
|
+
windowOpenerFeatures?: string;
|
|
87
|
+
/**
|
|
88
|
+
* Provider for one-click sign-in.
|
|
89
|
+
*
|
|
90
|
+
* Only the `"google" | "apple" | "microsoft"` aliases reach the auth client.
|
|
91
|
+
* Any other value is dropped here and has **no effect** — raw issuer URLs are
|
|
92
|
+
* only meaningful on `requestOpenId`, where they scope the requested keys.
|
|
93
|
+
* @see {@link IdentityAttributeOpenIdProvider}
|
|
94
|
+
*/
|
|
95
|
+
openIdProvider?: IdentityAttributeOpenIdProvider;
|
|
96
|
+
/**
|
|
97
|
+
* Derivation origin for the identity provider.
|
|
98
|
+
*
|
|
99
|
+
* Required when the app is served from more than one origin (e.g. a custom
|
|
100
|
+
* domain plus `<canisterId>.icp0.io`) and every origin must resolve to the
|
|
101
|
+
* same principal.
|
|
102
|
+
* @see https://github.com/dfinity/internet-identity/blob/main/docs/internet-identity-spec.adoc
|
|
103
|
+
*/
|
|
104
|
+
derivationOrigin?: string | URL;
|
|
105
|
+
/** Persistent storage backend. @default IndexedDB */
|
|
106
|
+
storage?: AuthClientStorageLike;
|
|
107
|
+
/**
|
|
108
|
+
* Session key algorithm. Use `"Ed25519"` when the storage backend cannot
|
|
109
|
+
* hold a `CryptoKey`. @default "ECDSA"
|
|
110
|
+
*/
|
|
111
|
+
keyType?: AuthClientKeyType;
|
|
112
|
+
/**
|
|
113
|
+
* Idle timeout configuration. Pass `{ disableIdle: true }` to opt out of the
|
|
114
|
+
* default behaviour, which signs the user out and reloads after 10 minutes.
|
|
115
|
+
*/
|
|
116
|
+
idleOptions?: AuthClientIdleOptions;
|
|
117
|
+
/** An existing identity to authenticate via delegation. */
|
|
118
|
+
identity?: SignIdentity | PartialIdentity;
|
|
119
|
+
/**
|
|
120
|
+
* How the client talks to the identity provider. `"redirect"` requires
|
|
121
|
+
* `@icp-sdk/auth` v8 or later and is ignored by older versions.
|
|
122
|
+
* @default "window"
|
|
123
|
+
*/
|
|
124
|
+
transport?: "window" | "redirect";
|
|
125
|
+
}
|
|
126
|
+
export interface AuthClientSignInOptions {
|
|
127
|
+
maxTimeToLive?: bigint;
|
|
128
|
+
targets?: Principal[];
|
|
129
|
+
}
|
|
130
|
+
export interface AuthenticationSignInOptions extends AuthClientSignInOptions, AuthenticationClientOptions {
|
|
131
|
+
onSuccess?: () => void | Promise<void>;
|
|
132
|
+
onError?: (error?: string) => void | Promise<void>;
|
|
133
|
+
}
|
|
134
|
+
export interface RequestIdentityAttributesParameters extends AuthenticationClientOptions {
|
|
135
|
+
keys: string[];
|
|
136
|
+
nonce: IdentityAttributeNonce;
|
|
137
|
+
/**
|
|
138
|
+
* Sign in as part of the same identity-provider interaction.
|
|
139
|
+
* @default true
|
|
140
|
+
*/
|
|
141
|
+
signIn?: boolean;
|
|
142
|
+
maxTimeToLive?: bigint;
|
|
143
|
+
targets?: Principal[];
|
|
144
|
+
}
|
|
145
|
+
export interface RequestOpenIdIdentityAttributesParameters extends Omit<RequestIdentityAttributesParameters, "openIdProvider"> {
|
|
146
|
+
/**
|
|
147
|
+
* Provider the requested `keys` are scoped to, producing
|
|
148
|
+
* `openid:<issuer>:<key>`.
|
|
149
|
+
*
|
|
150
|
+
* Passing one of the `"google" | "apple" | "microsoft"` aliases additionally
|
|
151
|
+
* routes sign-in through that provider, so the user grants attribute access
|
|
152
|
+
* in the same step. A raw issuer URL only scopes the keys.
|
|
153
|
+
* @see {@link IdentityAttributeOpenIdProvider}
|
|
154
|
+
*/
|
|
155
|
+
openIdProvider: IdentityAttributeOpenIdProvider;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Structural subset of `@icp-sdk/auth`'s `AuthClient` that IC Reactor relies
|
|
159
|
+
* on. Declared locally so `@icp-sdk/auth` stays an optional peer dependency.
|
|
160
|
+
*/
|
|
161
|
+
export interface AuthClientLike {
|
|
162
|
+
getIdentity(): Promise<Identity> | Identity;
|
|
163
|
+
isAuthenticated(): Promise<boolean> | boolean;
|
|
164
|
+
signIn(options?: AuthClientSignInOptions): Promise<Identity>;
|
|
165
|
+
signOut(options?: {
|
|
166
|
+
returnTo?: string;
|
|
167
|
+
}): Promise<void>;
|
|
168
|
+
requestAttributes(params: {
|
|
169
|
+
keys: string[];
|
|
170
|
+
nonce: Uint8Array | Promise<Uint8Array> | (() => Promise<Uint8Array>);
|
|
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
|
+
}
|
|
175
|
+
export interface AuthState {
|
|
176
|
+
identity: Identity | null;
|
|
177
|
+
isAuthenticating: boolean;
|
|
178
|
+
isAuthenticated: boolean;
|
|
179
|
+
error: Error | undefined;
|
|
180
|
+
}
|
|
181
|
+
export {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