@cartridge/controller 0.13.3 → 0.13.5
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 +40 -20
- package/.turbo/turbo-build.log +38 -18
- package/HEADLESS_MODE.md +113 -0
- package/LICENSE +16 -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.d.ts +1 -0
- package/dist/index.js +1662 -1244
- package/dist/index.js.map +1 -1
- package/dist/node/index.cjs +28 -3
- 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 +26 -4
- package/dist/node/index.js.map +1 -1
- package/dist/{provider-bC9cKItb.js → provider-NKp7_oNj.js} +134 -116
- package/dist/provider-NKp7_oNj.js.map +1 -0
- package/dist/session/provider.d.ts +1 -0
- package/dist/session.js +13 -10
- package/dist/session.js.map +1 -1
- package/dist/stats.html +1 -1
- package/dist/types.d.ts +20 -1
- package/package.json +26 -25
- 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/controller.ts +165 -13
- package/src/errors.ts +30 -0
- package/src/iframe/base.ts +14 -3
- package/src/iframe/keychain.ts +1 -5
- package/src/iframe/security.ts +48 -0
- package/src/index.ts +1 -0
- package/src/session/provider.ts +2 -0
- package/src/types.ts +30 -1
- package/src/utils.ts +2 -2
- package/dist/provider-bC9cKItb.js.map +0 -1
|
@@ -1,18 +1,38 @@
|
|
|
1
1
|
|
|
2
|
-
> @cartridge/controller@0.13.
|
|
2
|
+
> @cartridge/controller@0.13.5 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.5 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.5 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 [39m[1m[2m 10.
|
|
24
|
-
[2mdist/[22m[36mprovider-
|
|
25
|
-
[2mdist/[22m[36mindex.js [39m[1m[
|
|
26
|
-
[vite:dts] Declaration files built in
|
|
43
|
+
[2mdist/[22m[36msession.js [39m[1m[2m 10.19 kB[22m[1m[22m[2m │ gzip: 3.09 kB[22m[2m │ map: 23.94 kB[22m
|
|
44
|
+
[2mdist/[22m[36mprovider-NKp7_oNj.js [39m[1m[2m 15.63 kB[22m[1m[22m[2m │ gzip: 6.32 kB[22m[2m │ map: 41.81 kB[22m
|
|
45
|
+
[2mdist/[22m[36mindex.js [39m[1m[2m208.69 kB[22m[1m[22m[2m │ gzip: 55.04 kB[22m[2m │ map: 607.52 kB[22m
|
|
46
|
+
[vite:dts] Declaration files built in 3567ms.
|
|
27
47
|
|
|
28
|
-
[32m✓ built in 5.
|
|
48
|
+
[32m✓ built in 5.63s[39m
|
|
29
49
|
|
|
30
|
-
> @cartridge/controller@0.13.
|
|
50
|
+
> @cartridge/controller@0.13.5 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
|
|
61
|
+
"constants", "getChecksumAddress" and "shortString" are imported from external module "starknet" but never used in "dist/node/index.js".
|
|
41
62
|
"constants", "getChecksumAddress" and "shortString" are imported from external module "starknet" but never used in "dist/node/index.cjs".
|
|
42
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.
|
|
43
|
-
|
|
44
|
-
[
|
|
45
|
-
[
|
|
46
|
-
[32mCJS[39m
|
|
47
|
-
[
|
|
48
|
-
[
|
|
49
|
-
[32mESM[39m ⚡️ Build success in 295ms
|
|
64
|
+
[32mESM[39m [1mdist/node/index.js [22m[32m23.43 KB[39m
|
|
65
|
+
[32mESM[39m [1mdist/node/index.js.map [22m[32m55.93 KB[39m
|
|
66
|
+
[32mESM[39m ⚡️ Build success in 320ms
|
|
67
|
+
[32mCJS[39m [1mdist/node/index.cjs [22m[32m24.32 KB[39m
|
|
68
|
+
[32mCJS[39m [1mdist/node/index.cjs.map [22m[32m56.16 KB[39m
|
|
69
|
+
[32mCJS[39m ⚡️ Build success in 320ms
|
|
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 3096ms
|
|
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.5 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.5 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 [39m[1m[2m 10.
|
|
20
|
-
[2mdist/[22m[36mprovider-
|
|
21
|
-
[2mdist/[22m[36mindex.js [39m[1m[
|
|
22
|
-
[vite:dts] Declaration files built in
|
|
39
|
+
[2mdist/[22m[36msession.js [39m[1m[2m 10.19 kB[22m[1m[22m[2m │ gzip: 3.09 kB[22m[2m │ map: 23.94 kB[22m
|
|
40
|
+
[2mdist/[22m[36mprovider-NKp7_oNj.js [39m[1m[2m 15.63 kB[22m[1m[22m[2m │ gzip: 6.32 kB[22m[2m │ map: 41.81 kB[22m
|
|
41
|
+
[2mdist/[22m[36mindex.js [39m[1m[2m208.69 kB[22m[1m[22m[2m │ gzip: 55.04 kB[22m[2m │ map: 607.52 kB[22m
|
|
42
|
+
[vite:dts] Declaration files built in 3532ms.
|
|
23
43
|
|
|
24
|
-
[32m✓ built in 5.
|
|
44
|
+
[32m✓ built in 5.65s[39m
|
|
25
45
|
|
|
26
|
-
> @cartridge/controller@0.13.
|
|
46
|
+
> @cartridge/controller@0.13.5 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
|
|
@@ -37,13 +57,13 @@ computing gzip size...
|
|
|
37
57
|
"constants", "getChecksumAddress" and "shortString" are imported from external module "starknet" but never used in "dist/node/index.cjs".
|
|
38
58
|
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
59
|
"constants", "getChecksumAddress" and "shortString" are imported from external module "starknet" but never used in "dist/node/index.js".
|
|
40
|
-
[32mESM[39m [1mdist/node/index.js [22m[
|
|
41
|
-
[32mESM[39m [1mdist/node/index.js.map [22m[
|
|
42
|
-
[32mESM[39m ⚡️ Build success in
|
|
43
|
-
[32mCJS[39m [1mdist/node/index.cjs [22m[
|
|
44
|
-
[32mCJS[39m [1mdist/node/index.cjs.map [22m[
|
|
45
|
-
[32mCJS[39m ⚡️ Build success in
|
|
60
|
+
[32mESM[39m [1mdist/node/index.js [22m[32m23.43 KB[39m
|
|
61
|
+
[32mESM[39m [1mdist/node/index.js.map [22m[32m55.93 KB[39m
|
|
62
|
+
[32mESM[39m ⚡️ Build success in 289ms
|
|
63
|
+
[32mCJS[39m [1mdist/node/index.cjs [22m[32m24.32 KB[39m
|
|
64
|
+
[32mCJS[39m [1mdist/node/index.cjs.map [22m[32m56.16 KB[39m
|
|
65
|
+
[32mCJS[39m ⚡️ Build success in 289ms
|
|
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 3292ms
|
|
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/LICENSE
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
Copyright Cartridge Gaming Company 2022. All rights reserved.
|
|
2
|
+
|
|
3
|
+
You acknowledge and agree that Cartridge Gaming Company (“Cartridge”) (or Cartridge’s licensors) own all legal right, title and interest in and to the work, software, application, source code, documentation and any other documents in this repository (collectively, the “Program”), including any intellectual property rights which subsist in the Program (whether those rights happen to be registered or not, and wherever in the world those rights may exist), whether in source code or any other form.
|
|
4
|
+
|
|
5
|
+
Subject to the limited license below, you may not (and you may not permit anyone else to) distribute, publish, copy, modify, merge, combine with another program, create derivative works of, reverse engineer, decompile or otherwise attempt to extract the source code of, the Program or any part thereof, except that you may contribute to this repository.
|
|
6
|
+
|
|
7
|
+
You are granted a non-exclusive, non-transferable, non-sublicensable license to distribute, publish, copy, modify, merge, combine with another program or create derivative works of the Program (such resulting program, collectively, the “Resulting Program”) solely for Non-Commercial Use as long as you:
|
|
8
|
+
1. give prominent notice (“Notice”) with each copy of the Resulting Program that the Program is used in the Resulting Program and that the Program is the copyright of Cartridge; and
|
|
9
|
+
2. subject the Resulting Program and any distribution, publication, copy, modification, merger therewith, combination with another program or derivative works thereof to the same Notice requirement and Non-Commercial Use restriction set forth herein.
|
|
10
|
+
|
|
11
|
+
“Non-Commercial Use” means each use as described in clauses (1)-(3) below, as reasonably determined by Cartridge in its sole discretion:
|
|
12
|
+
1. personal use for research, personal study, private entertainment, hobby projects or amateur pursuits, in each case without any anticipated commercial application;
|
|
13
|
+
2. use by any charitable organization, educational institution, public research organization, public safety or health organization, environmental protection organization or government institution; or
|
|
14
|
+
3. the number of monthly active users of the Resulting Program across all versions thereof and platforms globally do not exceed 10,000 at any time.
|
|
15
|
+
|
|
16
|
+
You will not use any trade mark, service mark, trade name, logo of Cartridge or any other company or organization in a way that is likely or intended to cause confusion about the owner or authorized user of such marks, names or logos.
|
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;
|