passkey-kit 0.12.0 → 0.13.1

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.
Files changed (172) hide show
  1. package/README.md +399 -227
  2. package/{types → dist}/base.d.ts +2 -1
  3. package/dist/base.d.ts.map +1 -0
  4. package/{src/base.ts → dist/base.js} +8 -10
  5. package/dist/base.js.map +1 -0
  6. package/dist/base64url.d.ts +18 -0
  7. package/dist/base64url.d.ts.map +1 -0
  8. package/dist/base64url.js +18 -0
  9. package/dist/base64url.js.map +1 -0
  10. package/dist/constants.d.ts +87 -0
  11. package/dist/constants.d.ts.map +1 -0
  12. package/dist/constants.js +111 -0
  13. package/dist/constants.js.map +1 -0
  14. package/dist/contract-errors.d.ts +69 -0
  15. package/dist/contract-errors.d.ts.map +1 -0
  16. package/dist/contract-errors.js +129 -0
  17. package/dist/contract-errors.js.map +1 -0
  18. package/dist/errors.d.ts +163 -0
  19. package/dist/errors.d.ts.map +1 -0
  20. package/dist/errors.js +244 -0
  21. package/dist/errors.js.map +1 -0
  22. package/dist/events.d.ts +94 -0
  23. package/dist/events.d.ts.map +1 -0
  24. package/dist/events.js +92 -0
  25. package/dist/events.js.map +1 -0
  26. package/dist/index.d.ts +22 -0
  27. package/dist/index.d.ts.map +1 -0
  28. package/dist/index.js +36 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/indexer/codec.d.ts +18 -0
  31. package/dist/indexer/codec.d.ts.map +1 -0
  32. package/dist/indexer/codec.js +32 -0
  33. package/dist/indexer/codec.js.map +1 -0
  34. package/dist/indexer/index.d.ts +25 -0
  35. package/dist/indexer/index.d.ts.map +1 -0
  36. package/dist/indexer/index.js +34 -0
  37. package/dist/indexer/index.js.map +1 -0
  38. package/dist/indexer/mercury.d.ts +88 -0
  39. package/dist/indexer/mercury.d.ts.map +1 -0
  40. package/dist/indexer/mercury.js +237 -0
  41. package/dist/indexer/mercury.js.map +1 -0
  42. package/dist/indexer/stellar-indexer.d.ts +115 -0
  43. package/dist/indexer/stellar-indexer.d.ts.map +1 -0
  44. package/dist/indexer/stellar-indexer.js +279 -0
  45. package/dist/indexer/stellar-indexer.js.map +1 -0
  46. package/dist/indexer/types.d.ts +73 -0
  47. package/dist/indexer/types.d.ts.map +1 -0
  48. package/dist/indexer/types.js +9 -0
  49. package/dist/indexer/types.js.map +1 -0
  50. package/dist/kit/auth-payload.d.ts +89 -0
  51. package/dist/kit/auth-payload.d.ts.map +1 -0
  52. package/dist/kit/auth-payload.js +203 -0
  53. package/dist/kit/auth-payload.js.map +1 -0
  54. package/dist/kit/deploy-ops.d.ts +45 -0
  55. package/dist/kit/deploy-ops.d.ts.map +1 -0
  56. package/dist/kit/deploy-ops.js +69 -0
  57. package/dist/kit/deploy-ops.js.map +1 -0
  58. package/dist/kit/tx-ops.d.ts +92 -0
  59. package/dist/kit/tx-ops.d.ts.map +1 -0
  60. package/dist/kit/tx-ops.js +113 -0
  61. package/dist/kit/tx-ops.js.map +1 -0
  62. package/dist/kit/wallet-ops.d.ts +59 -0
  63. package/dist/kit/wallet-ops.d.ts.map +1 -0
  64. package/dist/kit/wallet-ops.js +122 -0
  65. package/dist/kit/wallet-ops.js.map +1 -0
  66. package/dist/kit/webauthn-ops.d.ts +55 -0
  67. package/dist/kit/webauthn-ops.d.ts.map +1 -0
  68. package/dist/kit/webauthn-ops.js +79 -0
  69. package/dist/kit/webauthn-ops.js.map +1 -0
  70. package/dist/kit.d.ts +128 -0
  71. package/dist/kit.d.ts.map +1 -0
  72. package/dist/kit.js +276 -0
  73. package/dist/kit.js.map +1 -0
  74. package/dist/managers/credential-manager.d.ts +39 -0
  75. package/dist/managers/credential-manager.d.ts.map +1 -0
  76. package/dist/managers/credential-manager.js +47 -0
  77. package/dist/managers/credential-manager.js.map +1 -0
  78. package/dist/managers/index.d.ts +7 -0
  79. package/dist/managers/index.d.ts.map +1 -0
  80. package/dist/managers/index.js +7 -0
  81. package/dist/managers/index.js.map +1 -0
  82. package/dist/managers/signer-manager.d.ts +51 -0
  83. package/dist/managers/signer-manager.d.ts.map +1 -0
  84. package/dist/managers/signer-manager.js +92 -0
  85. package/dist/managers/signer-manager.js.map +1 -0
  86. package/dist/managers/submission-manager.d.ts +52 -0
  87. package/dist/managers/submission-manager.d.ts.map +1 -0
  88. package/dist/managers/submission-manager.js +77 -0
  89. package/dist/managers/submission-manager.js.map +1 -0
  90. package/dist/relayer.d.ts +61 -0
  91. package/dist/relayer.d.ts.map +1 -0
  92. package/dist/relayer.js +119 -0
  93. package/dist/relayer.js.map +1 -0
  94. package/dist/rpc-data.d.ts +35 -0
  95. package/dist/rpc-data.d.ts.map +1 -0
  96. package/dist/rpc-data.js +49 -0
  97. package/dist/rpc-data.js.map +1 -0
  98. package/dist/sac.d.ts +31 -0
  99. package/dist/sac.d.ts.map +1 -0
  100. package/dist/sac.js +47 -0
  101. package/dist/sac.js.map +1 -0
  102. package/dist/server.d.ts +79 -0
  103. package/dist/server.d.ts.map +1 -0
  104. package/dist/server.js +152 -0
  105. package/dist/server.js.map +1 -0
  106. package/dist/signers.d.ts +83 -0
  107. package/dist/signers.d.ts.map +1 -0
  108. package/dist/signers.js +124 -0
  109. package/dist/signers.js.map +1 -0
  110. package/dist/storage/index.d.ts +13 -0
  111. package/dist/storage/index.d.ts.map +1 -0
  112. package/dist/storage/index.js +12 -0
  113. package/dist/storage/index.js.map +1 -0
  114. package/dist/storage/indexeddb.d.ts +26 -0
  115. package/dist/storage/indexeddb.d.ts.map +1 -0
  116. package/dist/storage/indexeddb.js +100 -0
  117. package/dist/storage/indexeddb.js.map +1 -0
  118. package/dist/storage/localStorage.d.ts +22 -0
  119. package/dist/storage/localStorage.d.ts.map +1 -0
  120. package/dist/storage/localStorage.js +86 -0
  121. package/dist/storage/localStorage.js.map +1 -0
  122. package/dist/storage/memory.d.ts +18 -0
  123. package/dist/storage/memory.d.ts.map +1 -0
  124. package/dist/storage/memory.js +41 -0
  125. package/dist/storage/memory.js.map +1 -0
  126. package/dist/types.d.ts +136 -0
  127. package/dist/types.d.ts.map +1 -0
  128. package/dist/types.js +39 -0
  129. package/dist/types.js.map +1 -0
  130. package/dist/utils.d.ts +52 -0
  131. package/dist/utils.d.ts.map +1 -0
  132. package/dist/utils.js +153 -0
  133. package/dist/utils.js.map +1 -0
  134. package/dist/validation.d.ts +40 -0
  135. package/dist/validation.d.ts.map +1 -0
  136. package/dist/validation.js +73 -0
  137. package/dist/validation.js.map +1 -0
  138. package/dist/version.d.ts +7 -0
  139. package/dist/version.d.ts.map +1 -0
  140. package/dist/version.js +9 -0
  141. package/dist/version.js.map +1 -0
  142. package/package.json +48 -20
  143. package/.claude/settings.local.json +0 -20
  144. package/.cursorrules +0 -170
  145. package/.gitattributes +0 -2
  146. package/.github/workflows/release.yml +0 -21
  147. package/.vscode/settings.json +0 -6
  148. package/PROPOSAL.md +0 -397
  149. package/cheatsheet.txt +0 -18
  150. package/clone-js-sdk.sh +0 -21
  151. package/packages/passkey-kit-sdk/README.md +0 -54
  152. package/packages/passkey-kit-sdk/package.json +0 -18
  153. package/packages/passkey-kit-sdk/src/index.ts +0 -171
  154. package/packages/passkey-kit-sdk/tsconfig.json +0 -98
  155. package/packages/passkey-kit-sdk/types/index.d.ts +0 -190
  156. package/packages/sac-sdk/README.md +0 -54
  157. package/packages/sac-sdk/package.json +0 -18
  158. package/packages/sac-sdk/src/index.ts +0 -586
  159. package/packages/sac-sdk/tsconfig.json +0 -98
  160. package/packages/sac-sdk/types/index.d.ts +0 -532
  161. package/pnpm-workspace.yaml +0 -2
  162. package/src/index.ts +0 -5
  163. package/src/kit.ts +0 -698
  164. package/src/sac.ts +0 -29
  165. package/src/server.ts +0 -179
  166. package/src/types.ts +0 -32
  167. package/tsconfig.json +0 -28
  168. package/types/index.d.ts +0 -5
  169. package/types/kit.d.ts +0 -89
  170. package/types/sac.d.ts +0 -13
  171. package/types/server.d.ts +0 -29
  172. package/types/types.d.ts +0 -22
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Client-side input validation.
3
+ *
4
+ * Produces clear {@link ValidationError}s before submission instead of opaque
5
+ * on-chain or WebCrypto failures. The smart wallet imposes no signer-count caps
6
+ * (unlike a policy-based account), so validation here is about shapes and
7
+ * ranges: addresses, amounts, expirations, and secp256r1 public keys.
8
+ *
9
+ * @packageDocumentation
10
+ */
11
+ import { StrKey } from "@stellar/stellar-sdk";
12
+ import { SECP256R1_PUBLIC_KEY_SIZE, UNCOMPRESSED_PUBKEY_PREFIX, } from "./constants.js";
13
+ import { PasskeyKitErrorCode, ValidationError } from "./errors.js";
14
+ /**
15
+ * Validate that a string is a Stellar account (`G…`) or contract (`C…`) address.
16
+ *
17
+ * @throws {ValidationError} If the address is missing or malformed.
18
+ */
19
+ export function validateAddress(address, fieldName = "address") {
20
+ if (!address || typeof address !== "string") {
21
+ throw new ValidationError(`${fieldName} is required`, PasskeyKitErrorCode.INVALID_ADDRESS, { field: fieldName });
22
+ }
23
+ if (!StrKey.isValidEd25519PublicKey(address) &&
24
+ !StrKey.isValidContract(address)) {
25
+ throw new ValidationError(`Invalid ${fieldName}: must be a valid Stellar account (G…) or contract (C…) address`, PasskeyKitErrorCode.INVALID_ADDRESS, { field: fieldName, value: address.slice(0, 10) + "…" });
26
+ }
27
+ }
28
+ /**
29
+ * Validate that an amount is a positive, finite number.
30
+ *
31
+ * @throws {ValidationError} If the amount is not a positive number.
32
+ */
33
+ export function validateAmount(amount, fieldName = "amount") {
34
+ if (typeof amount !== "number" || !Number.isFinite(amount)) {
35
+ throw new ValidationError(`${fieldName} must be a number`, PasskeyKitErrorCode.INVALID_AMOUNT, { field: fieldName });
36
+ }
37
+ if (amount <= 0) {
38
+ throw new ValidationError(`${fieldName} must be positive`, PasskeyKitErrorCode.INVALID_AMOUNT, { field: fieldName, value: amount });
39
+ }
40
+ }
41
+ /**
42
+ * Validate a signer expiration.
43
+ *
44
+ * Must be a non-negative integer within `u32` bounds when provided; `undefined`
45
+ * means "no expiration". (Unix-second timestamps fit in `u32` through the year
46
+ * 2106, so this bound holds whether the contract interprets the value as a
47
+ * ledger sequence or a UNIX timestamp.)
48
+ *
49
+ * @throws {ValidationError} If the expiration is out of range.
50
+ */
51
+ export function validateExpiration(expiration, fieldName = "expiration") {
52
+ if (expiration === undefined)
53
+ return;
54
+ if (!Number.isInteger(expiration) ||
55
+ expiration < 0 ||
56
+ expiration > 0xffffffff) {
57
+ throw new ValidationError(`${fieldName} must be a non-negative integer within u32 bounds`, PasskeyKitErrorCode.INVALID_INPUT, { field: fieldName, value: expiration });
58
+ }
59
+ }
60
+ /**
61
+ * Validate a secp256r1 public key: 65 bytes, uncompressed (`0x04`) prefix.
62
+ *
63
+ * @throws {ValidationError} If the key is not a valid uncompressed EC point.
64
+ */
65
+ export function validateSecp256r1PublicKey(publicKey, fieldName = "publicKey") {
66
+ if (publicKey.length !== SECP256R1_PUBLIC_KEY_SIZE) {
67
+ throw new ValidationError(`${fieldName} must be ${SECP256R1_PUBLIC_KEY_SIZE} bytes (got ${publicKey.length})`, PasskeyKitErrorCode.INVALID_PUBLIC_KEY, { field: fieldName, length: publicKey.length });
68
+ }
69
+ if (publicKey[0] !== UNCOMPRESSED_PUBKEY_PREFIX) {
70
+ throw new ValidationError(`${fieldName} must be an uncompressed EC point (0x04 prefix)`, PasskeyKitErrorCode.INVALID_PUBLIC_KEY, { field: fieldName, prefix: publicKey[0] });
71
+ }
72
+ }
73
+ //# sourceMappingURL=validation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.js","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Package version — auto-generated from package.json.
3
+ * @packageDocumentation
4
+ */
5
+ export declare const VERSION = "0.13.1";
6
+ export declare const NAME = "passkey-kit";
7
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,eAAO,MAAM,OAAO,WAAW,CAAC;AAChC,eAAO,MAAM,IAAI,gBAAgB,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Package version — auto-generated from package.json.
3
+ * @packageDocumentation
4
+ */
5
+ // This file is auto-generated. Do not edit manually.
6
+ // Run `pnpm run sync-version` (or `pnpm build`) to update.
7
+ export const VERSION = "0.13.1";
8
+ export const NAME = "passkey-kit";
9
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,qDAAqD;AACrD,2DAA2D;AAE3D,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC;AAChC,MAAM,CAAC,MAAM,IAAI,GAAG,aAAa,CAAC"}
package/package.json CHANGED
@@ -1,30 +1,53 @@
1
1
  {
2
2
  "name": "passkey-kit",
3
- "version": "0.12.0",
3
+ "version": "0.13.1",
4
4
  "description": "A helper library for creating and using smart wallet accounts on the Stellar blockchain.",
5
- "author": "Tyler van der Hoeven",
5
+ "author": "Tyler van der Hoeven <tyler@stellar.org>",
6
6
  "license": "MIT",
7
7
  "type": "module",
8
- "main": "src/index.ts",
9
- "types": "types/index.d.ts",
8
+ "main": "dist/index.js",
9
+ "module": "dist/index.js",
10
+ "types": "dist/index.d.ts",
11
+ "sideEffects": false,
12
+ "exports": {
13
+ ".": {
14
+ "import": "./dist/index.js",
15
+ "types": "./dist/index.d.ts"
16
+ },
17
+ "./storage": {
18
+ "import": "./dist/storage/index.js",
19
+ "types": "./dist/storage/index.d.ts"
20
+ },
21
+ "./server": {
22
+ "import": "./dist/server.js",
23
+ "types": "./dist/server.d.ts"
24
+ }
25
+ },
26
+ "files": [
27
+ "dist",
28
+ "README.md",
29
+ "LICENCE"
30
+ ],
10
31
  "dependencies": {
11
- "@openzeppelin/relayer-plugin-channels": "^0.5.0",
12
- "@simplewebauthn/browser": "^13.2.0",
13
- "@stellar/stellar-sdk": "^14.2.0",
32
+ "@openzeppelin/relayer-plugin-channels": "^0.20.0",
33
+ "@simplewebauthn/browser": "^13.3.0",
34
+ "@stellar/stellar-sdk": "16.0.1",
14
35
  "base64url": "^3.0.1",
15
36
  "buffer": "^6.0.3",
16
- "passkey-kit-sdk": "0.7.2",
17
- "sac-sdk": "0.4.2"
37
+ "passkey-kit-sdk": "0.7.3",
38
+ "sac-sdk": "0.4.3"
18
39
  },
19
40
  "devDependencies": {
20
41
  "@types/node": "^24.6.0",
21
- "typescript": "^5.9.2"
42
+ "fake-indexeddb": "^6.2.5",
43
+ "typescript": "^5.9.2",
44
+ "vitest": "^3.2.4"
22
45
  },
23
- "workspaces": [
24
- "packages/*"
25
- ],
26
- "engine": {
27
- "node": ">=20"
46
+ "peerDependencies": {
47
+ "@stellar/stellar-sdk": ">=16.0.0"
48
+ },
49
+ "engines": {
50
+ "node": ">=22.0.0"
28
51
  },
29
52
  "repository": {
30
53
  "type": "git",
@@ -48,12 +71,17 @@
48
71
  },
49
72
  "homepage": "https://github.com/kalepail/passkey-kit/blob/main/README.md",
50
73
  "scripts": {
74
+ "sync-version": "node scripts/sync-version.js",
75
+ "prebuild": "node scripts/sync-version.js",
76
+ "build:bindings": "pnpm --filter sac-sdk run build && pnpm --filter passkey-kit-sdk run build",
77
+ "bindings:regen": "bash scripts/bindings/build.sh",
78
+ "verify:bindings": "bash scripts/bindings/verify.sh",
79
+ "build": "pnpm run build:bindings && tsc && node scripts/verify-esm.mjs",
80
+ "verify:esm": "node scripts/verify-esm.mjs",
81
+ "test": "vitest",
82
+ "clean": "rm -rf dist packages/passkey-kit-sdk/dist packages/sac-sdk/dist",
51
83
  "build:demo": "cd demo && pnpm --ignore-workspace install && pnpm run build",
52
84
  "deploy:demo": "npx wrangler pages deploy",
53
- "deploy:demo:prod": "npx wrangler pages deploy --env production",
54
- "build:sac": "pnpm --filter=sac-sdk run build",
55
- "build:pks": "pnpm --filter=passkey-kit-sdk run build",
56
- "build": "pnpm run build:sac && pnpm run build:pks && tsc",
57
- "ext:cp": "./clone-js-sdk.sh"
85
+ "deploy:demo:prod": "npx wrangler pages deploy --branch production"
58
86
  }
59
87
  }
@@ -1,20 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "WebSearch",
5
- "mcp__context7__resolve-library-id",
6
- "Bash(tree:*)",
7
- "mcp__deepwiki__read_wiki_structure",
8
- "mcp__context7__query-docs",
9
- "mcp__deepwiki__read_wiki_contents",
10
- "Bash(curl:*)",
11
- "Bash(pnpm install:*)",
12
- "Bash(pnpm run build:*)",
13
- "mcp__github__get_file_contents",
14
- "mcp__perplexity__perplexity_ask",
15
- "mcp__perplexity__perplexity_search"
16
- ],
17
- "deny": [],
18
- "ask": []
19
- }
20
- }
package/.cursorrules DELETED
@@ -1,170 +0,0 @@
1
- # Passkey Kit – Cursor Workspace Rules (v2025-06-12)
2
-
3
- These rules provide canonical guidance to AI assistants and contributors interacting with this repository. They supersede any previous `.cursorrules` file.
4
- Their intent is to stay *future-proof*: they encode principles that should hold even as tooling evolves. When in doubt, prefer the spirit of the rule over its letter.
5
-
6
- ---
7
-
8
- ## 1 Repository Topology (overview)
9
-
10
- • `src/` – Core **passkey-kit** TypeScript library (published to npm).
11
- • `packages/passkey-kit-sdk/` – Stand-alone TS SDK used by the main package.
12
- • `packages/sac-sdk/` – SAC (smart-account contract) SDK.
13
- • `contracts/` – Soroban smart contracts written in Rust.
14
- • `zephyr/` – Deterministic Zephyr program exposing HTTP endpoints.
15
- • `demo/` – Svelte demo showcasing end-to-end usage.
16
-
17
- This repo is a **pnpm workspace**; always use `pnpm` (≥ 8) for Node tasks.
18
-
19
- ---
20
-
21
- ## 2 Language & Toolchain Baselines
22
-
23
- | Domain | Minimum Supported | Notes |
24
- |--------|-------------------|-------|
25
- | Node.js | 20 LTS | ESM by default, top-level `await` allowed |
26
- | TypeScript | 5.4 | `strict`, `moduleResolution: node16` |
27
- | Rust (contracts) | 1.79 | Follow the current stable Soroban toolchain |
28
- | Soroban SDK | 22.x | Keep minor versions in lock-step across contracts |
29
- | Bun (tests) | 1.x | Used for ultrafast unit tests (`bun test`) |
30
- | pnpm | 8.x | Managed via **Corepack**; lockfile v5 enforced |
31
-
32
- Upgrade the baselines on every **major** release of the kit.
33
-
34
- ---
35
-
36
- ## 3 General Coding Principles
37
-
38
- 1. **Functional & immutable** – avoid shared mutable state; favour pure functions.
39
- 2. **Fail loudly, fail early** – surface rich, actionable error messages.
40
- 3. **Minimal dependencies** – prefer platform APIs or internal utils; justify every new dep.
41
- 4. **Typed first** – all public surfaces must be *fully* typed; export `.d.ts` files.
42
- 5. **Async-first** – use `async/await`; never chain raw `Promise` callbacks.
43
- 6. **Workspace integrity** – after changes run `pnpm run build` at the repo root to guarantee type-safety across packages.
44
-
45
- ---
46
-
47
- ## 4 JavaScript / TypeScript Specifics
48
-
49
- • Import Stellar via `@stellar/stellar-sdk/minimal` unless full bundle is strictly required.
50
- • Base-64 URL encode/decode with `base64url`; avoid `Buffer.from(x, 'base64')`.
51
- • Prefer **named exports**; avoid `export default` in new code.
52
- • File extensions: `.ts` / `.tsx` (React) / `.svelte` (demo) only.
53
- • Module import grouping: external → workspace → relative → style imports; blank line between groups.
54
- • Leverage modern ECMAScript (`??`, `?.`, `Array#at`, `Intl`) – but avoid stage-3 proposals unless polyfilled.
55
- • Publish ESM-first: every package must declare `"type": "module"` and expose an `exports` map with `import`, `require` (fallback), and `types` conditions.
56
- • Mark packages `"sideEffects": false` when safe to enable aggressive tree-shaking.
57
- • Ship first-party `.d.ts` bundles (either via `tsc --emitDeclarationOnly` or `api-extractor`). Do **not** rely on DefinitelyTyped for kit packages.
58
- • Top-level entrypoints should be 100 % statically analyzable – avoid dynamic `require()` or `eval()`.
59
-
60
- ---
61
-
62
- ## 5 Rust / Soroban Contract Rules
63
-
64
- 1. Contracts live in `contracts/*/src`.
65
- 2. `#![no_std]` mandatory; rely on `soroban-sdk` helpers instead of `std`.
66
- 3. Expose a top-level `Contract` struct marked with `#[contract]`.
67
- 4. Model errors with `#[contracterror]`; surface via `panic_with_error!`.
68
- 5. Tests belong under `contracts/*/src/tests` using `soroban_sdk::testutils`.
69
- 6. New contracts must be registered in `contracts/Cargo.toml` workspace members.
70
-
71
- ---
72
-
73
- ## 6 Zephyr Program Rules
74
-
75
- • Zephyr code resides in `zephyr/src` and **must remain deterministic** – avoid non-deterministic data sources (e.g. system time, randomness) unless explicitly mocked.
76
- • Each externally exposed endpoint must be documented *above* its `#[no_mangle]` function.
77
-
78
- ---
79
-
80
- ## 7 Svelte / Demo Rules
81
-
82
- • Demo code lives in `demo/src`.
83
- • Follow existing component conventions: PascalCase filenames, `<script lang="ts">`, `<style scoped>`.
84
- • Prefer lightweight stores over global state; mock network calls when possible.
85
-
86
- ---
87
-
88
- ## 8 Testing & CI
89
-
90
- 1. Run `bun test` to execute JavaScript unit tests (`bun_tests/`).
91
- 2. Rust contract tests live alongside contracts.
92
- 3. All new public functions (TS) or contract interfaces (Rust) require unit tests.
93
- 4. Use **Conventional Commits** in PR titles to automate semantic-release notes.
94
- 5. CI (GitHub Actions) must run: `pnpm lint`, `pnpm run build`, `bun test`, and contract tests.
95
-
96
- ---
97
-
98
- ## 9 Versioning & Release
99
-
100
- • Independent package versions, shared workspace lockfile.
101
- • Semantic Versioning: breaking changes → major bump.
102
- • Root `prepublishOnly` script builds **all** packages; never publish from a dirty tree.
103
- • Tags follow `pkg-name@x.y.z` format.
104
- • Adopt **Changesets** for automated changelog generation and version bumping across the workspace; release pipeline should consume the generated changelog artefacts.
105
-
106
- ---
107
-
108
- ## 10 Style, Linting & Formatting
109
-
110
- • Indent: 2 spaces, trailing commas, single quotes.
111
- • Code formatted with **Prettier** (`pnpm format`).
112
- • Lint with **ESLint** + `@typescript-eslint`. Lint errors are CI blockers.
113
- • Prefer `const`; use `let` only when reassignment is needed.
114
-
115
- ---
116
-
117
- ## 11 AI Usage Etiquette
118
-
119
- • These rules are the *source of truth* for AI coding assistants.
120
- • Assistants must **never** write secrets, API keys, or personal data into the codebase.
121
- • When creating code, ensure it can run *immediately* and is fully typed.
122
- • Before adding dependencies, verify they fit the "minimal deps" philosophy and update `package.json` accordingly.
123
-
124
- ---
125
-
126
- ## 12 Context Shortcuts
127
-
128
- Use these aliases when referencing files in chat:
129
-
130
- ```text
131
- @kit.ts → src/kit.ts
132
- @smart-wallet → contracts/smart-wallet/src/lib.rs
133
- @passkey-sdk → packages/passkey-kit-sdk/src
134
- ```
135
-
136
- ---
137
-
138
- ## 13 Performance & Build Optimisation
139
-
140
- 1. Prefer **incremental builds** (e.g. `pnpm --filter`, `--recursive --workspace-concurrency`) to accelerate CI and local development.
141
- 2. Enable intelligent cache layers (GitHub Actions cache / bun test cache) to avoid redundant compilation of unchanged packages.
142
- 3. Leverage Bun's ultra-fast test runner; keep test suites granular to maximise parallelism.
143
- 4. When introducing heavy tasks (e.g. Soroban WASM compilation), gate them behind conditional steps so that they execute only when relevant code changes.
144
- 5. Monitor build & test times; aim for sub-5-minute end-to-end CI under normal load.
145
-
146
- ---
147
-
148
- ## 14 npm Package Publishing Principles
149
-
150
- • Source of truth is **ESM**; if CJS support is required, publish it under `./cjs` and reference with the `require` condition – no transpiled dual-bundles in `dist/`.
151
- • Generate a **size-snapshot** report (e.g. with `size-limit`) and block PRs that increase size over budget.
152
- • `package.json` must include: `license`, `funding`, `homepage`, `repository`, `bugs`, and a short but descriptive `description`.
153
- • Use the `files` whitelist (or `.npmignore`) to keep the published tarball lean (< 30 KiB ideally).
154
- • Release via GitHub Actions with `npm publish --provenance` to attach Sigstore metadata; use **two-factor auth** on the npm org.
155
- • After publish, run `npm view @scope/pkg dist.unpackedSize` in CI and fail if unexpectedly large.
156
-
157
- ---
158
-
159
- ## 15 Security & Supply Chain
160
-
161
- 1. Enforce automated dependency scanning (GitHub Dependabot + `pnpm audit --recursive`).
162
- 2. Run **OpenSSF Scorecard** weekly; block merges if score < 7.
163
- 3. Sign commits & tags (Conventional Commits + `git config commit.gpgsign`); CI verifies signatures.
164
- 4. Harden CI with minimal permissions (`GITHUB_TOKEN` → read-only except on `release/*` jobs).
165
- 5. Adopt `.npmrc` with `ignore-scripts=true` for CI and `prefer-offline=true` for faster deterministic installs.
166
- 6. All public APIs must have runtime assertions (zod or custom) to prevent type coercion exploits.
167
-
168
- ---
169
-
170
- End of rules.
package/.gitattributes DELETED
@@ -1,2 +0,0 @@
1
- # Auto detect text files and perform LF normalization
2
- * text=auto
@@ -1,21 +0,0 @@
1
- name: Contract Release
2
-
3
- on:
4
- workflow_dispatch:
5
- inputs:
6
- release_name:
7
- description: 'Unique release name'
8
- required: true
9
- type: string
10
-
11
- jobs:
12
-
13
- release-contract-smart-wallet:
14
- uses: stellar-expert/soroban-build-workflow/.github/workflows/release.yml@main
15
- with:
16
- release_name: ${{ github.ref_name }}
17
- release_description: 'Release of the smart wallet contract'
18
- relative_path: 'contracts'
19
- package: 'smart-wallet'
20
- secrets:
21
- release_token: ${{ secrets.GITHUB_TOKEN }}
@@ -1,6 +0,0 @@
1
- {
2
- "rust-analyzer.linkedProjects": [
3
- "./zephyr/Cargo.toml",
4
- "./contracts/Cargo.toml",
5
- ]
6
- }