@cartridge/controller 0.13.4 → 0.13.6
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/.turbo/turbo-build$colon$deps.log +41 -21
- package/.turbo/turbo-build.log +40 -20
- package/HEADLESS_MODE.md +113 -0
- package/dist/controller.d.ts +9 -2
- package/dist/errors.d.ts +10 -0
- package/dist/iframe/security.d.ts +10 -0
- package/dist/index-BdTFKueB.js +1072 -0
- package/dist/index-BdTFKueB.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2273 -2524
- package/dist/index.js.map +1 -1
- package/dist/node/index.cjs +30 -5
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.d.cts +11 -1
- package/dist/node/index.d.ts +11 -1
- package/dist/node/index.js +29 -7
- package/dist/node/index.js.map +1 -1
- package/dist/session/provider.d.ts +8 -2
- package/dist/session.js +141 -139
- package/dist/session.js.map +1 -1
- package/dist/stats.html +1 -1
- package/dist/types.d.ts +20 -1
- package/dist/utils.d.ts +5 -3
- package/package.json +4 -3
- package/src/__tests__/asWalletStandard.test.ts +87 -0
- package/src/__tests__/headlessConnectApproval.test.ts +97 -0
- package/src/__tests__/iframeSecurity.test.ts +84 -0
- package/src/__tests__/parseChainId.test.ts +1 -1
- package/src/__tests__/toWasmPolicies.test.ts +89 -40
- package/src/controller.ts +165 -13
- package/src/errors.ts +30 -0
- package/src/iframe/base.ts +14 -3
- package/src/iframe/keychain.ts +8 -5
- package/src/iframe/security.ts +48 -0
- package/src/index.ts +1 -0
- package/src/session/provider.ts +77 -48
- package/src/types.ts +30 -1
- package/src/utils.ts +21 -7
- package/dist/provider-DSqqvDee.js +0 -369
- package/dist/provider-DSqqvDee.js.map +0 -1
|
@@ -1,18 +1,38 @@
|
|
|
1
1
|
|
|
2
|
-
> @cartridge/controller@0.13.
|
|
2
|
+
> @cartridge/controller@0.13.6 build:deps /home/runner/work/controller/controller/packages/controller
|
|
3
3
|
> pnpm build
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> @cartridge/controller@0.13.
|
|
6
|
+
> @cartridge/controller@0.13.6 build /home/runner/work/controller/controller/packages/controller
|
|
7
7
|
> pnpm build:browser && pnpm build:node
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
> @cartridge/controller@0.13.
|
|
10
|
+
> @cartridge/controller@0.13.6 build:browser /home/runner/work/controller/controller/packages/controller
|
|
11
11
|
> vite build
|
|
12
12
|
|
|
13
13
|
[36mvite v6.3.4 [32mbuilding for production...[36m[39m
|
|
14
14
|
transforming...
|
|
15
|
-
[
|
|
15
|
+
[33m../../node_modules/.pnpm/ox@0.4.4_typescript@5.8.3_zod@3.24.4/node_modules/ox/_esm/core/Address.js (6:21): A comment
|
|
16
|
+
|
|
17
|
+
"/*#__PURE__*/"
|
|
18
|
+
|
|
19
|
+
in "../../node_modules/.pnpm/ox@0.4.4_typescript@5.8.3_zod@3.24.4/node_modules/ox/_esm/core/Address.js" contains an annotation that Rollup cannot interpret due to the position of the comment. The comment will be removed to avoid issues.[39m
|
|
20
|
+
[33m../../node_modules/.pnpm/ox@0.4.4_typescript@5.8.3_zod@3.24.4/node_modules/ox/_esm/core/Base64.js (6:27): A comment
|
|
21
|
+
|
|
22
|
+
"/*#__PURE__*/"
|
|
23
|
+
|
|
24
|
+
in "../../node_modules/.pnpm/ox@0.4.4_typescript@5.8.3_zod@3.24.4/node_modules/ox/_esm/core/Base64.js" contains an annotation that Rollup cannot interpret due to the position of the comment. The comment will be removed to avoid issues.[39m
|
|
25
|
+
[33m../../node_modules/.pnpm/ox@0.4.4_typescript@5.8.3_zod@3.24.4/node_modules/ox/_esm/core/Json.js (1:21): A comment
|
|
26
|
+
|
|
27
|
+
"/*#__PURE__*/"
|
|
28
|
+
|
|
29
|
+
in "../../node_modules/.pnpm/ox@0.4.4_typescript@5.8.3_zod@3.24.4/node_modules/ox/_esm/core/Json.js" contains an annotation that Rollup cannot interpret due to the position of the comment. The comment will be removed to avoid issues.[39m
|
|
30
|
+
[33m../../node_modules/.pnpm/ox@0.4.4_typescript@5.8.3_zod@3.24.4/node_modules/ox/_esm/core/internal/cursor.js (2:21): A comment
|
|
31
|
+
|
|
32
|
+
"/*#__PURE__*/"
|
|
33
|
+
|
|
34
|
+
in "../../node_modules/.pnpm/ox@0.4.4_typescript@5.8.3_zod@3.24.4/node_modules/ox/_esm/core/internal/cursor.js" contains an annotation that Rollup cannot interpret due to the position of the comment. The comment will be removed to avoid issues.[39m
|
|
35
|
+
[32m✓[39m 389 modules transformed.
|
|
16
36
|
rendering chunks...
|
|
17
37
|
[33m[plugin vite:reporter]
|
|
18
38
|
(!) /home/runner/work/controller/controller/packages/controller/src/toast/index.ts is dynamically imported by /home/runner/work/controller/controller/packages/controller/src/account.ts but also statically imported by /home/runner/work/controller/controller/packages/controller/src/index.ts, dynamic import will not move module into another chunk.
|
|
@@ -20,14 +40,14 @@ rendering chunks...
|
|
|
20
40
|
|
|
21
41
|
[vite:dts] Start generate declaration files...
|
|
22
42
|
computing gzip size...
|
|
23
|
-
[2mdist/[22m[36msession.js
|
|
24
|
-
[2mdist/[22m[
|
|
25
|
-
[2mdist/[22m[36mindex.js
|
|
26
|
-
[vite:dts] Declaration files built in
|
|
43
|
+
[2mdist/[22m[36msession.js [39m[1m[2m 10.53 kB[22m[1m[22m[2m │ gzip: 3.24 kB[22m[2m │ map: 25.46 kB[22m
|
|
44
|
+
[2mdist/[22m[36mindex-BdTFKueB.js [39m[1m[2m 38.34 kB[22m[1m[22m[2m │ gzip: 12.80 kB[22m[2m │ map: 81.00 kB[22m
|
|
45
|
+
[2mdist/[22m[36mindex.js [39m[1m[2m186.49 kB[22m[1m[22m[2m │ gzip: 49.14 kB[22m[2m │ map: 569.43 kB[22m
|
|
46
|
+
[vite:dts] Declaration files built in 3707ms.
|
|
27
47
|
|
|
28
|
-
[32m✓ built in 5.
|
|
48
|
+
[32m✓ built in 5.77s[39m
|
|
29
49
|
|
|
30
|
-
> @cartridge/controller@0.13.
|
|
50
|
+
> @cartridge/controller@0.13.6 build:node /home/runner/work/controller/controller/packages/controller
|
|
31
51
|
> tsup --config tsup.node.config.ts
|
|
32
52
|
|
|
33
53
|
[34mCLI[39m Building entry: src/node/index.ts
|
|
@@ -38,16 +58,16 @@ computing gzip size...
|
|
|
38
58
|
[34mCLI[39m Cleaning output folder
|
|
39
59
|
[34mESM[39m Build start
|
|
40
60
|
[34mCJS[39m Build start
|
|
41
|
-
"constants"
|
|
42
|
-
"constants"
|
|
61
|
+
"constants" and "shortString" are imported from external module "starknet" but never used in "dist/node/index.js".
|
|
62
|
+
"constants" and "shortString" are imported from external module "starknet" but never used in "dist/node/index.cjs".
|
|
43
63
|
Entry module "dist/node/index.cjs" is using named and default exports together. Consumers of your bundle will have to use `chunk.default` to access the default export, which may not be what you want. Use `output.exports: "named"` to disable this warning.
|
|
44
|
-
[32mESM[39m [1mdist/node/index.js [22m[
|
|
45
|
-
[32mESM[39m [1mdist/node/index.js.map [22m[
|
|
46
|
-
[32mESM[39m ⚡️ Build success in
|
|
47
|
-
[32mCJS[39m [1mdist/node/index.cjs [22m[
|
|
48
|
-
[32mCJS[39m [1mdist/node/index.cjs.map [22m[
|
|
49
|
-
[32mCJS[39m ⚡️ Build success in
|
|
64
|
+
[32mESM[39m [1mdist/node/index.js [22m[32m23.50 KB[39m
|
|
65
|
+
[32mESM[39m [1mdist/node/index.js.map [22m[32m56.57 KB[39m
|
|
66
|
+
[32mESM[39m ⚡️ Build success in 359ms
|
|
67
|
+
[32mCJS[39m [1mdist/node/index.cjs [22m[32m24.40 KB[39m
|
|
68
|
+
[32mCJS[39m [1mdist/node/index.cjs.map [22m[32m56.82 KB[39m
|
|
69
|
+
[32mCJS[39m ⚡️ Build success in 357ms
|
|
50
70
|
[34mDTS[39m Build start
|
|
51
|
-
[32mDTS[39m ⚡️ Build success in
|
|
52
|
-
[32mDTS[39m [1mdist/node/index.d.ts [22m[
|
|
53
|
-
[32mDTS[39m [1mdist/node/index.d.cts [22m[
|
|
71
|
+
[32mDTS[39m ⚡️ Build success in 3125ms
|
|
72
|
+
[32mDTS[39m [1mdist/node/index.d.ts [22m[32m6.42 KB[39m
|
|
73
|
+
[32mDTS[39m [1mdist/node/index.d.cts [22m[32m6.42 KB[39m
|
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,14 +1,34 @@
|
|
|
1
1
|
|
|
2
|
-
> @cartridge/controller@0.13.
|
|
2
|
+
> @cartridge/controller@0.13.6 build /home/runner/work/controller/controller/packages/controller
|
|
3
3
|
> pnpm build:browser && pnpm build:node
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> @cartridge/controller@0.13.
|
|
6
|
+
> @cartridge/controller@0.13.6 build:browser /home/runner/work/controller/controller/packages/controller
|
|
7
7
|
> vite build
|
|
8
8
|
|
|
9
9
|
[36mvite v6.3.4 [32mbuilding for production...[36m[39m
|
|
10
10
|
transforming...
|
|
11
|
-
[
|
|
11
|
+
[33m../../node_modules/.pnpm/ox@0.4.4_typescript@5.8.3_zod@3.24.4/node_modules/ox/_esm/core/Address.js (6:21): A comment
|
|
12
|
+
|
|
13
|
+
"/*#__PURE__*/"
|
|
14
|
+
|
|
15
|
+
in "../../node_modules/.pnpm/ox@0.4.4_typescript@5.8.3_zod@3.24.4/node_modules/ox/_esm/core/Address.js" contains an annotation that Rollup cannot interpret due to the position of the comment. The comment will be removed to avoid issues.[39m
|
|
16
|
+
[33m../../node_modules/.pnpm/ox@0.4.4_typescript@5.8.3_zod@3.24.4/node_modules/ox/_esm/core/Base64.js (6:27): A comment
|
|
17
|
+
|
|
18
|
+
"/*#__PURE__*/"
|
|
19
|
+
|
|
20
|
+
in "../../node_modules/.pnpm/ox@0.4.4_typescript@5.8.3_zod@3.24.4/node_modules/ox/_esm/core/Base64.js" contains an annotation that Rollup cannot interpret due to the position of the comment. The comment will be removed to avoid issues.[39m
|
|
21
|
+
[33m../../node_modules/.pnpm/ox@0.4.4_typescript@5.8.3_zod@3.24.4/node_modules/ox/_esm/core/Json.js (1:21): A comment
|
|
22
|
+
|
|
23
|
+
"/*#__PURE__*/"
|
|
24
|
+
|
|
25
|
+
in "../../node_modules/.pnpm/ox@0.4.4_typescript@5.8.3_zod@3.24.4/node_modules/ox/_esm/core/Json.js" contains an annotation that Rollup cannot interpret due to the position of the comment. The comment will be removed to avoid issues.[39m
|
|
26
|
+
[33m../../node_modules/.pnpm/ox@0.4.4_typescript@5.8.3_zod@3.24.4/node_modules/ox/_esm/core/internal/cursor.js (2:21): A comment
|
|
27
|
+
|
|
28
|
+
"/*#__PURE__*/"
|
|
29
|
+
|
|
30
|
+
in "../../node_modules/.pnpm/ox@0.4.4_typescript@5.8.3_zod@3.24.4/node_modules/ox/_esm/core/internal/cursor.js" contains an annotation that Rollup cannot interpret due to the position of the comment. The comment will be removed to avoid issues.[39m
|
|
31
|
+
[32m✓[39m 389 modules transformed.
|
|
12
32
|
rendering chunks...
|
|
13
33
|
[33m[plugin vite:reporter]
|
|
14
34
|
(!) /home/runner/work/controller/controller/packages/controller/src/toast/index.ts is dynamically imported by /home/runner/work/controller/controller/packages/controller/src/account.ts but also statically imported by /home/runner/work/controller/controller/packages/controller/src/index.ts, dynamic import will not move module into another chunk.
|
|
@@ -16,14 +36,14 @@ rendering chunks...
|
|
|
16
36
|
|
|
17
37
|
[vite:dts] Start generate declaration files...
|
|
18
38
|
computing gzip size...
|
|
19
|
-
[2mdist/[22m[36msession.js
|
|
20
|
-
[2mdist/[22m[
|
|
21
|
-
[2mdist/[22m[36mindex.js
|
|
22
|
-
[vite:dts] Declaration files built in
|
|
39
|
+
[2mdist/[22m[36msession.js [39m[1m[2m 10.53 kB[22m[1m[22m[2m │ gzip: 3.24 kB[22m[2m │ map: 25.46 kB[22m
|
|
40
|
+
[2mdist/[22m[36mindex-BdTFKueB.js [39m[1m[2m 38.34 kB[22m[1m[22m[2m │ gzip: 12.80 kB[22m[2m │ map: 81.00 kB[22m
|
|
41
|
+
[2mdist/[22m[36mindex.js [39m[1m[2m186.49 kB[22m[1m[22m[2m │ gzip: 49.14 kB[22m[2m │ map: 569.43 kB[22m
|
|
42
|
+
[vite:dts] Declaration files built in 3504ms.
|
|
23
43
|
|
|
24
|
-
[32m✓ built in 5.
|
|
44
|
+
[32m✓ built in 5.59s[39m
|
|
25
45
|
|
|
26
|
-
> @cartridge/controller@0.13.
|
|
46
|
+
> @cartridge/controller@0.13.6 build:node /home/runner/work/controller/controller/packages/controller
|
|
27
47
|
> tsup --config tsup.node.config.ts
|
|
28
48
|
|
|
29
49
|
[34mCLI[39m Building entry: src/node/index.ts
|
|
@@ -34,16 +54,16 @@ computing gzip size...
|
|
|
34
54
|
[34mCLI[39m Cleaning output folder
|
|
35
55
|
[34mESM[39m Build start
|
|
36
56
|
[34mCJS[39m Build start
|
|
37
|
-
"constants"
|
|
57
|
+
"constants" and "shortString" are imported from external module "starknet" but never used in "dist/node/index.js".
|
|
58
|
+
"constants" and "shortString" are imported from external module "starknet" but never used in "dist/node/index.cjs".
|
|
38
59
|
Entry module "dist/node/index.cjs" is using named and default exports together. Consumers of your bundle will have to use `chunk.default` to access the default export, which may not be what you want. Use `output.exports: "named"` to disable this warning.
|
|
39
|
-
|
|
40
|
-
[
|
|
41
|
-
[
|
|
42
|
-
[32mCJS[39m
|
|
43
|
-
[
|
|
44
|
-
[
|
|
45
|
-
[32mESM[39m ⚡️ Build success in 250ms
|
|
60
|
+
[32mESM[39m [1mdist/node/index.js [22m[32m23.50 KB[39m
|
|
61
|
+
[32mESM[39m [1mdist/node/index.js.map [22m[32m56.57 KB[39m
|
|
62
|
+
[32mESM[39m ⚡️ Build success in 323ms
|
|
63
|
+
[32mCJS[39m [1mdist/node/index.cjs [22m[32m24.40 KB[39m
|
|
64
|
+
[32mCJS[39m [1mdist/node/index.cjs.map [22m[32m56.82 KB[39m
|
|
65
|
+
[32mCJS[39m ⚡️ Build success in 324ms
|
|
46
66
|
[34mDTS[39m Build start
|
|
47
|
-
[32mDTS[39m ⚡️ Build success in
|
|
48
|
-
[32mDTS[39m [1mdist/node/index.d.ts [22m[
|
|
49
|
-
[32mDTS[39m [1mdist/node/index.d.cts [22m[
|
|
67
|
+
[32mDTS[39m ⚡️ Build success in 3326ms
|
|
68
|
+
[32mDTS[39m [1mdist/node/index.d.ts [22m[32m6.42 KB[39m
|
|
69
|
+
[32mDTS[39m [1mdist/node/index.d.cts [22m[32m6.42 KB[39m
|
package/HEADLESS_MODE.md
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Headless Mode Guide
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Headless mode enables programmatic authentication with the Cartridge Controller SDK without displaying any UI. You trigger headless mode by passing a `username` and `signer` to `connect(...)`.
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
Controller SDK → Keychain iframe (hidden) → Backend API
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
**Key Points**
|
|
12
|
+
- The keychain iframe still exists, but the modal is not opened.
|
|
13
|
+
- The SDK passes the connect request to keychain over Penpal.
|
|
14
|
+
- Keychain executes the same authentication logic as the UI flow.
|
|
15
|
+
- No duplicated auth logic in the SDK.
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
### Basic (Passkey / WebAuthn)
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import Controller from "@cartridge/controller";
|
|
23
|
+
|
|
24
|
+
const controller = new Controller({
|
|
25
|
+
defaultChainId: "SN_SEPOLIA",
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
await controller.connect({
|
|
29
|
+
username: "alice",
|
|
30
|
+
signer: "webauthn",
|
|
31
|
+
});
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Password
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
await controller.connect({
|
|
38
|
+
username: "alice",
|
|
39
|
+
signer: "password",
|
|
40
|
+
password: "correct horse battery staple",
|
|
41
|
+
});
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### OAuth / EVM / WalletConnect
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
// Google / Discord
|
|
48
|
+
await controller.connect({ username: "alice", signer: "google" });
|
|
49
|
+
await controller.connect({ username: "alice", signer: "discord" });
|
|
50
|
+
|
|
51
|
+
// EVM wallets
|
|
52
|
+
await controller.connect({ username: "alice", signer: "metamask" });
|
|
53
|
+
await controller.connect({ username: "alice", signer: "rabby" });
|
|
54
|
+
await controller.connect({ username: "alice", signer: "phantom-evm" });
|
|
55
|
+
|
|
56
|
+
// WalletConnect
|
|
57
|
+
await controller.connect({ username: "alice", signer: "walletconnect" });
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Supported Auth Options
|
|
61
|
+
|
|
62
|
+
Headless mode supports all **implemented** auth options:
|
|
63
|
+
- `webauthn`
|
|
64
|
+
- `password`
|
|
65
|
+
- `google`
|
|
66
|
+
- `discord`
|
|
67
|
+
- `walletconnect`
|
|
68
|
+
- `metamask`
|
|
69
|
+
- `rabby`
|
|
70
|
+
- `phantom-evm`
|
|
71
|
+
|
|
72
|
+
## Handling Session Approval
|
|
73
|
+
|
|
74
|
+
If policies are unverified or include approvals, Keychain will prompt for
|
|
75
|
+
session approval **after** authentication. In that case, `connect` will open
|
|
76
|
+
the approval UI and resolve once the session is approved.
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
const account = await controller.connect({
|
|
80
|
+
username: "alice",
|
|
81
|
+
signer: "webauthn",
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
console.log("Session approved:", account.address);
|
|
85
|
+
```
|
|
86
|
+
If you want to react to connection state changes, subscribe to the standard
|
|
87
|
+
wallet events (for example `accountsChanged`) or just await `connect(...)` and
|
|
88
|
+
update your app state afterwards.
|
|
89
|
+
|
|
90
|
+
## Error Handling
|
|
91
|
+
|
|
92
|
+
The SDK provides specific error classes for headless mode:
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
import {
|
|
96
|
+
HeadlessAuthenticationError,
|
|
97
|
+
} from "@cartridge/controller";
|
|
98
|
+
|
|
99
|
+
try {
|
|
100
|
+
await controller.connect({ username: "alice", signer: "webauthn" });
|
|
101
|
+
} catch (error) {
|
|
102
|
+
if (error instanceof HeadlessAuthenticationError) {
|
|
103
|
+
// Auth failed (invalid credentials, signer mismatch, etc.)
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Notes
|
|
109
|
+
|
|
110
|
+
- Headless mode uses the **existing signers** on the controller for the given username.
|
|
111
|
+
- For passkeys, the account must already have a WebAuthn signer registered.
|
|
112
|
+
- If policies are unverified or include approvals, Keychain will request
|
|
113
|
+
explicit approval after authentication.
|
package/dist/controller.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Policy } from '@cartridge/presets';
|
|
2
|
+
import { WalletWithStarknetFeatures } from '@starknet-io/get-starknet-wallet-standard/features';
|
|
2
3
|
import { AddStarknetChainParameters } from '@starknet-io/types-js';
|
|
3
4
|
import { WalletAccount } from 'starknet';
|
|
4
5
|
import { default as BaseProvider } from './provider';
|
|
5
|
-
import { AuthOptions, ControllerOptions, ProfileContextTypeVariant, OpenOptions, StarterpackOptions } from './types';
|
|
6
|
+
import { AuthOptions, ConnectOptions, ControllerOptions, ProfileContextTypeVariant, OpenOptions, StarterpackOptions } from './types';
|
|
6
7
|
export default class ControllerProvider extends BaseProvider {
|
|
7
8
|
private keychain?;
|
|
8
9
|
private options;
|
|
@@ -15,7 +16,7 @@ export default class ControllerProvider extends BaseProvider {
|
|
|
15
16
|
constructor(options?: ControllerOptions);
|
|
16
17
|
logout(): Promise<void>;
|
|
17
18
|
probe(): Promise<WalletAccount | undefined>;
|
|
18
|
-
connect(
|
|
19
|
+
connect(options?: AuthOptions | ConnectOptions): Promise<WalletAccount | undefined>;
|
|
19
20
|
switchStarknetChain(chainId: string): Promise<boolean>;
|
|
20
21
|
addStarknetChain(_chain: AddStarknetChainParameters): Promise<boolean>;
|
|
21
22
|
disconnect(): Promise<void>;
|
|
@@ -23,6 +24,7 @@ export default class ControllerProvider extends BaseProvider {
|
|
|
23
24
|
openProfileTo(to: string): Promise<void>;
|
|
24
25
|
openProfileAt(at: string): Promise<void>;
|
|
25
26
|
openSettings(): void;
|
|
27
|
+
close(): Promise<void>;
|
|
26
28
|
revoke(origin: string, _policy: Policy[]): Promise<void> | null;
|
|
27
29
|
rpcUrl(): string;
|
|
28
30
|
username(): Promise<string> | undefined;
|
|
@@ -33,6 +35,11 @@ export default class ControllerProvider extends BaseProvider {
|
|
|
33
35
|
transactionHash: string;
|
|
34
36
|
} | undefined>;
|
|
35
37
|
delegateAccount(): Promise<string | null>;
|
|
38
|
+
/**
|
|
39
|
+
* Returns a wallet standard interface for the controller.
|
|
40
|
+
* This allows using the controller with libraries that expect the wallet standard interface.
|
|
41
|
+
*/
|
|
42
|
+
asWalletStandard(): WalletWithStarknetFeatures;
|
|
36
43
|
/**
|
|
37
44
|
* Opens the keychain in standalone mode (first-party context) for authentication.
|
|
38
45
|
* This establishes first-party storage, enabling seamless iframe access across all games.
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
export declare class NotReadyToConnect extends Error {
|
|
2
2
|
constructor();
|
|
3
3
|
}
|
|
4
|
+
export declare class HeadlessAuthenticationError extends Error {
|
|
5
|
+
cause?: Error | undefined;
|
|
6
|
+
constructor(message: string, cause?: Error | undefined);
|
|
7
|
+
}
|
|
8
|
+
export declare class InvalidCredentialsError extends HeadlessAuthenticationError {
|
|
9
|
+
constructor(credentialType: string);
|
|
10
|
+
}
|
|
11
|
+
export declare class HeadlessModeNotSupportedError extends Error {
|
|
12
|
+
constructor(operation: string);
|
|
13
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare function isLocalhostHostname(hostname: string): boolean;
|
|
2
|
+
/**
|
|
3
|
+
* Restrict iframe targets to HTTPS in production, while still allowing local HTTP dev.
|
|
4
|
+
*/
|
|
5
|
+
export declare function validateKeychainIframeUrl(url: URL): void;
|
|
6
|
+
/**
|
|
7
|
+
* Build a conservative allow list for iframe feature policy.
|
|
8
|
+
* Local network access is only needed for localhost development.
|
|
9
|
+
*/
|
|
10
|
+
export declare function buildIframeAllowList(url: URL): string;
|