@soropass/core 0.1.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.
Files changed (83) hide show
  1. package/dist/checkAuth-C2AcXqFe.d.cts +110 -0
  2. package/dist/checkAuth-C2AcXqFe.d.ts +110 -0
  3. package/dist/chunk-AHFGTIBY.js +36 -0
  4. package/dist/chunk-AHFGTIBY.js.map +1 -0
  5. package/dist/chunk-AMYFJQAC.js +29 -0
  6. package/dist/chunk-AMYFJQAC.js.map +1 -0
  7. package/dist/chunk-BIRF5I6I.js +265 -0
  8. package/dist/chunk-BIRF5I6I.js.map +1 -0
  9. package/dist/chunk-JNJ2FY45.js +209 -0
  10. package/dist/chunk-JNJ2FY45.js.map +1 -0
  11. package/dist/chunk-LB4HOTLV.js +135 -0
  12. package/dist/chunk-LB4HOTLV.js.map +1 -0
  13. package/dist/chunk-LM2AZXKZ.js +108 -0
  14. package/dist/chunk-LM2AZXKZ.js.map +1 -0
  15. package/dist/chunk-LUDXP56M.js +3 -0
  16. package/dist/chunk-LUDXP56M.js.map +1 -0
  17. package/dist/chunk-MMB4ZIW3.js +48 -0
  18. package/dist/chunk-MMB4ZIW3.js.map +1 -0
  19. package/dist/chunk-MOLZIRIH.js +22 -0
  20. package/dist/chunk-MOLZIRIH.js.map +1 -0
  21. package/dist/chunk-OGSUGATA.js +3 -0
  22. package/dist/chunk-OGSUGATA.js.map +1 -0
  23. package/dist/chunk-TPBBZNPP.js +30 -0
  24. package/dist/chunk-TPBBZNPP.js.map +1 -0
  25. package/dist/chunk-UQKNPO44.js +32 -0
  26. package/dist/chunk-UQKNPO44.js.map +1 -0
  27. package/dist/chunk-UV5HORMF.js +175 -0
  28. package/dist/chunk-UV5HORMF.js.map +1 -0
  29. package/dist/chunk-W75OQKHR.js +133 -0
  30. package/dist/chunk-W75OQKHR.js.map +1 -0
  31. package/dist/connect.cjs +166 -0
  32. package/dist/connect.cjs.map +1 -0
  33. package/dist/connect.d.cts +24 -0
  34. package/dist/connect.d.ts +24 -0
  35. package/dist/connect.js +6 -0
  36. package/dist/connect.js.map +1 -0
  37. package/dist/create.cjs +483 -0
  38. package/dist/create.cjs.map +1 -0
  39. package/dist/create.d.cts +106 -0
  40. package/dist/create.d.ts +106 -0
  41. package/dist/create.js +8 -0
  42. package/dist/create.js.map +1 -0
  43. package/dist/index.cjs +1542 -0
  44. package/dist/index.cjs.map +1 -0
  45. package/dist/index.d.cts +197 -0
  46. package/dist/index.d.ts +197 -0
  47. package/dist/index.js +354 -0
  48. package/dist/index.js.map +1 -0
  49. package/dist/recover-0wbOXDjR.d.cts +23 -0
  50. package/dist/recover-COnsxhYk.d.ts +23 -0
  51. package/dist/recover.cjs +802 -0
  52. package/dist/recover.cjs.map +1 -0
  53. package/dist/recover.d.cts +49 -0
  54. package/dist/recover.d.ts +49 -0
  55. package/dist/recover.js +10 -0
  56. package/dist/recover.js.map +1 -0
  57. package/dist/sign-Cfg0NM0T.d.cts +73 -0
  58. package/dist/sign-Cfg0NM0T.d.ts +73 -0
  59. package/dist/sign.cjs +883 -0
  60. package/dist/sign.cjs.map +1 -0
  61. package/dist/sign.d.cts +143 -0
  62. package/dist/sign.d.ts +143 -0
  63. package/dist/sign.js +8 -0
  64. package/dist/sign.js.map +1 -0
  65. package/dist/submit-BDKADQq0.d.cts +112 -0
  66. package/dist/submit-BO0Nh49I.d.ts +112 -0
  67. package/dist/testing.cjs +955 -0
  68. package/dist/testing.cjs.map +1 -0
  69. package/dist/testing.d.cts +86 -0
  70. package/dist/testing.d.ts +86 -0
  71. package/dist/testing.js +235 -0
  72. package/dist/testing.js.map +1 -0
  73. package/dist/types--WNl-Sda.d.cts +125 -0
  74. package/dist/types--WNl-Sda.d.ts +125 -0
  75. package/dist/types-dMRWEEo0.d.cts +73 -0
  76. package/dist/types-lW2h8Uxn.d.ts +73 -0
  77. package/dist/types.cjs +44 -0
  78. package/dist/types.cjs.map +1 -0
  79. package/dist/types.d.cts +5 -0
  80. package/dist/types.d.ts +5 -0
  81. package/dist/types.js +5 -0
  82. package/dist/types.js.map +1 -0
  83. package/package.json +117 -0
@@ -0,0 +1,112 @@
1
+ import { xdr } from '@stellar/stellar-sdk';
2
+ import { S as SubmissionAdapter, c as SubmitResult } from './types--WNl-Sda.cjs';
3
+ import { b as WebAuthnSigner, S as SignVerifyOptions } from './sign-Cfg0NM0T.cjs';
4
+
5
+ /**
6
+ * passkey-kit v1 (v0.13.0, Protocol 27) smart-wallet SIGNER encoders — the WRITE
7
+ * path (what `add_signer` / `remove_signer` consume), complementing
8
+ * `smartWallet.ts` (the signature READ path the wallet's `__check_auth` reads).
9
+ *
10
+ * A signer is added on-chain as
11
+ *
12
+ * Signer::Secp256r1(Bytes id, BytesN<65> public_key,
13
+ * SignerExpiration, SignerLimits, SignerStorage)
14
+ *
15
+ * which `process_signer` reduces to `SignerKey::Secp256r1(id) ->
16
+ * SignerVal::Secp256r1(public_key, ..)`: the raw credential id is the key, the
17
+ * SEC-1 public key lives in the value. Shape + field order confirmed by kalepail
18
+ * (passkey-kit author) in issue #32 and proven on testnet against the audited v1
19
+ * wasm (`scripts/smartwallet-v1-e2e.ts`).
20
+ *
21
+ * v1 note: `SignerExpiration` is a UNIX-seconds `u64` timestamp (Protocol 27),
22
+ * NOT a ledger sequence as in the pre-v1 kit.
23
+ */
24
+ /** `SignerStorage` — where the contract persists the signer entry. */
25
+ type SignerStorage = 'Persistent' | 'Temporary';
26
+ interface Secp256r1SignerSpec {
27
+ /** Raw WebAuthn credential-id bytes (base64url-decoded `rawId`) — becomes the SignerKey. */
28
+ credentialId: Uint8Array;
29
+ /** SEC-1 uncompressed public key (65 bytes, `0x04 ‖ X ‖ Y`) — stored in SignerVal. */
30
+ publicKey: Uint8Array;
31
+ /**
32
+ * `SignerExpiration` — a UNIX-seconds timestamp (v1 / Protocol 27) after which
33
+ * the signer stops being valid. Omit for `None` (a non-expiring signer, the
34
+ * usual choice for a recovery / second device).
35
+ */
36
+ expiration?: number | bigint;
37
+ /** `SignerStorage` — defaults to `Persistent`. */
38
+ storage?: SignerStorage;
39
+ }
40
+ /**
41
+ * Encode a `Signer::Secp256r1(..)` for `add_signer`. `SignerLimits` is always
42
+ * `None` (unrestricted) — policy/limited signers are out of scope for this
43
+ * minimal passkey SDK. Validates the credential id and the SEC-1 public key so a
44
+ * malformed signer can never be handed to the contract.
45
+ */
46
+ declare function buildSecp256r1Signer(spec: Secp256r1SignerSpec): xdr.ScVal;
47
+ interface BuildAddSignerOptions {
48
+ /** The smart-wallet C-address the signer is being added to. */
49
+ walletContractId: string;
50
+ /** The signer to add — a `Secp256r1SignerSpec`, or a pre-built `Signer` ScVal. */
51
+ signer: Secp256r1SignerSpec | xdr.ScVal;
52
+ }
53
+ /**
54
+ * Build the `wallet.add_signer(signer)` invocation. The resulting invoke-host
55
+ * operation requires the wallet's OWN auth: an EXISTING signer authorizes adding
56
+ * the new one, which is what keeps a lost device from locking the user out.
57
+ * Sign the produced transaction's auth entry with
58
+ * `signTransaction(.., { target: 'smart-wallet' })`.
59
+ */
60
+ declare function buildAddSignerOperation(options: BuildAddSignerOptions): xdr.Operation;
61
+ interface BuildRemoveSignerOptions {
62
+ walletContractId: string;
63
+ /** Raw credential-id bytes of the signer to remove (its `SignerKey`). */
64
+ credentialId: Uint8Array;
65
+ }
66
+ /** Build the `wallet.remove_signer(SignerKey::Secp256r1(id))` invocation (wallet-authorized). */
67
+ declare function buildRemoveSignerOperation(options: BuildRemoveSignerOptions): xdr.Operation;
68
+
69
+ interface SendSmartWalletTxOptions {
70
+ /** The single wallet-authorized invocation to run (SAC transfer, contract call, add_signer, …). */
71
+ operation: xdr.Operation;
72
+ networkPassphrase: string;
73
+ rpcUrl: string;
74
+ /**
75
+ * Secret of the funded classic account that pays the fee + sequences the tx. The
76
+ * passkey provides the wallet's AUTH; this only sponsors the envelope
77
+ * (ephemeral/friendbot-funded in a demo; a relayer key otherwise).
78
+ */
79
+ sourceSecret: string;
80
+ /** The wallet's passkey signer that authorizes the invocation. */
81
+ sign: WebAuthnSigner;
82
+ /** Where the signed tx is submitted. Defaults to `direct` (soroban-rpc). */
83
+ submission?: SubmissionAdapter;
84
+ /** Opt-in pre-flight validation of the authorizing assertion. */
85
+ verify?: SignVerifyOptions;
86
+ fee?: string;
87
+ timeoutSeconds?: number;
88
+ /** Ledgers ahead of `latestLedger` to expire the auth signature at (default 60). */
89
+ signatureExpirationLedgerOffset?: number;
90
+ allowHttp?: boolean;
91
+ }
92
+ /**
93
+ * Sign and submit a single passkey-authorized smart-wallet transaction — the
94
+ * general primitive behind every smart-wallet action (payment, contract call,
95
+ * add/remove signer). The full dance:
96
+ *
97
+ * 1. recording sim → assemble (discovers the wallet's auth requirement);
98
+ * 2. sign the wallet auth entry with the passkey (smart-wallet Signatures map),
99
+ * binding the expiration ledger the contract re-derives;
100
+ * 3. enforcing re-sim of the SIGNED tx — recording auth never runs the custom
101
+ * account's `__check_auth`, so it misses the signer-storage reads and
102
+ * under-counts instructions; the enforcing pass yields the true footprint +
103
+ * resources, and doubles as a client-side proof the auth is accepted;
104
+ * 4. pay the fee from the classic source and submit via the pluggable adapter.
105
+ *
106
+ * tx.fee + sorobanData are outside the auth preimage, so re-assembling with the
107
+ * enforcing resources never invalidates the signature. Throws a typed KitError on
108
+ * any simulation/validation failure.
109
+ */
110
+ declare function sendSmartWalletTx(options: SendSmartWalletTxOptions): Promise<SubmitResult>;
111
+
112
+ export { type BuildAddSignerOptions as B, type Secp256r1SignerSpec as S, type BuildRemoveSignerOptions as a, type SendSmartWalletTxOptions as b, type SignerStorage as c, buildAddSignerOperation as d, buildRemoveSignerOperation as e, buildSecp256r1Signer as f, sendSmartWalletTx as s };
@@ -0,0 +1,112 @@
1
+ import { xdr } from '@stellar/stellar-sdk';
2
+ import { S as SubmissionAdapter, c as SubmitResult } from './types--WNl-Sda.js';
3
+ import { b as WebAuthnSigner, S as SignVerifyOptions } from './sign-Cfg0NM0T.js';
4
+
5
+ /**
6
+ * passkey-kit v1 (v0.13.0, Protocol 27) smart-wallet SIGNER encoders — the WRITE
7
+ * path (what `add_signer` / `remove_signer` consume), complementing
8
+ * `smartWallet.ts` (the signature READ path the wallet's `__check_auth` reads).
9
+ *
10
+ * A signer is added on-chain as
11
+ *
12
+ * Signer::Secp256r1(Bytes id, BytesN<65> public_key,
13
+ * SignerExpiration, SignerLimits, SignerStorage)
14
+ *
15
+ * which `process_signer` reduces to `SignerKey::Secp256r1(id) ->
16
+ * SignerVal::Secp256r1(public_key, ..)`: the raw credential id is the key, the
17
+ * SEC-1 public key lives in the value. Shape + field order confirmed by kalepail
18
+ * (passkey-kit author) in issue #32 and proven on testnet against the audited v1
19
+ * wasm (`scripts/smartwallet-v1-e2e.ts`).
20
+ *
21
+ * v1 note: `SignerExpiration` is a UNIX-seconds `u64` timestamp (Protocol 27),
22
+ * NOT a ledger sequence as in the pre-v1 kit.
23
+ */
24
+ /** `SignerStorage` — where the contract persists the signer entry. */
25
+ type SignerStorage = 'Persistent' | 'Temporary';
26
+ interface Secp256r1SignerSpec {
27
+ /** Raw WebAuthn credential-id bytes (base64url-decoded `rawId`) — becomes the SignerKey. */
28
+ credentialId: Uint8Array;
29
+ /** SEC-1 uncompressed public key (65 bytes, `0x04 ‖ X ‖ Y`) — stored in SignerVal. */
30
+ publicKey: Uint8Array;
31
+ /**
32
+ * `SignerExpiration` — a UNIX-seconds timestamp (v1 / Protocol 27) after which
33
+ * the signer stops being valid. Omit for `None` (a non-expiring signer, the
34
+ * usual choice for a recovery / second device).
35
+ */
36
+ expiration?: number | bigint;
37
+ /** `SignerStorage` — defaults to `Persistent`. */
38
+ storage?: SignerStorage;
39
+ }
40
+ /**
41
+ * Encode a `Signer::Secp256r1(..)` for `add_signer`. `SignerLimits` is always
42
+ * `None` (unrestricted) — policy/limited signers are out of scope for this
43
+ * minimal passkey SDK. Validates the credential id and the SEC-1 public key so a
44
+ * malformed signer can never be handed to the contract.
45
+ */
46
+ declare function buildSecp256r1Signer(spec: Secp256r1SignerSpec): xdr.ScVal;
47
+ interface BuildAddSignerOptions {
48
+ /** The smart-wallet C-address the signer is being added to. */
49
+ walletContractId: string;
50
+ /** The signer to add — a `Secp256r1SignerSpec`, or a pre-built `Signer` ScVal. */
51
+ signer: Secp256r1SignerSpec | xdr.ScVal;
52
+ }
53
+ /**
54
+ * Build the `wallet.add_signer(signer)` invocation. The resulting invoke-host
55
+ * operation requires the wallet's OWN auth: an EXISTING signer authorizes adding
56
+ * the new one, which is what keeps a lost device from locking the user out.
57
+ * Sign the produced transaction's auth entry with
58
+ * `signTransaction(.., { target: 'smart-wallet' })`.
59
+ */
60
+ declare function buildAddSignerOperation(options: BuildAddSignerOptions): xdr.Operation;
61
+ interface BuildRemoveSignerOptions {
62
+ walletContractId: string;
63
+ /** Raw credential-id bytes of the signer to remove (its `SignerKey`). */
64
+ credentialId: Uint8Array;
65
+ }
66
+ /** Build the `wallet.remove_signer(SignerKey::Secp256r1(id))` invocation (wallet-authorized). */
67
+ declare function buildRemoveSignerOperation(options: BuildRemoveSignerOptions): xdr.Operation;
68
+
69
+ interface SendSmartWalletTxOptions {
70
+ /** The single wallet-authorized invocation to run (SAC transfer, contract call, add_signer, …). */
71
+ operation: xdr.Operation;
72
+ networkPassphrase: string;
73
+ rpcUrl: string;
74
+ /**
75
+ * Secret of the funded classic account that pays the fee + sequences the tx. The
76
+ * passkey provides the wallet's AUTH; this only sponsors the envelope
77
+ * (ephemeral/friendbot-funded in a demo; a relayer key otherwise).
78
+ */
79
+ sourceSecret: string;
80
+ /** The wallet's passkey signer that authorizes the invocation. */
81
+ sign: WebAuthnSigner;
82
+ /** Where the signed tx is submitted. Defaults to `direct` (soroban-rpc). */
83
+ submission?: SubmissionAdapter;
84
+ /** Opt-in pre-flight validation of the authorizing assertion. */
85
+ verify?: SignVerifyOptions;
86
+ fee?: string;
87
+ timeoutSeconds?: number;
88
+ /** Ledgers ahead of `latestLedger` to expire the auth signature at (default 60). */
89
+ signatureExpirationLedgerOffset?: number;
90
+ allowHttp?: boolean;
91
+ }
92
+ /**
93
+ * Sign and submit a single passkey-authorized smart-wallet transaction — the
94
+ * general primitive behind every smart-wallet action (payment, contract call,
95
+ * add/remove signer). The full dance:
96
+ *
97
+ * 1. recording sim → assemble (discovers the wallet's auth requirement);
98
+ * 2. sign the wallet auth entry with the passkey (smart-wallet Signatures map),
99
+ * binding the expiration ledger the contract re-derives;
100
+ * 3. enforcing re-sim of the SIGNED tx — recording auth never runs the custom
101
+ * account's `__check_auth`, so it misses the signer-storage reads and
102
+ * under-counts instructions; the enforcing pass yields the true footprint +
103
+ * resources, and doubles as a client-side proof the auth is accepted;
104
+ * 4. pay the fee from the classic source and submit via the pluggable adapter.
105
+ *
106
+ * tx.fee + sorobanData are outside the auth preimage, so re-assembling with the
107
+ * enforcing resources never invalidates the signature. Throws a typed KitError on
108
+ * any simulation/validation failure.
109
+ */
110
+ declare function sendSmartWalletTx(options: SendSmartWalletTxOptions): Promise<SubmitResult>;
111
+
112
+ export { type BuildAddSignerOptions as B, type Secp256r1SignerSpec as S, type BuildRemoveSignerOptions as a, type SendSmartWalletTxOptions as b, type SignerStorage as c, buildAddSignerOperation as d, buildRemoveSignerOperation as e, buildSecp256r1Signer as f, sendSmartWalletTx as s };