@medialane/sdk 0.198.0 → 0.200.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 (92) hide show
  1. package/README.md +86 -41
  2. package/dist/chains-CmwjZVU7.d.cts +85 -0
  3. package/dist/chains-CmwjZVU7.d.ts +85 -0
  4. package/dist/chunk-3HPMEDYH.cjs +967 -0
  5. package/dist/chunk-3HPMEDYH.cjs.map +1 -0
  6. package/dist/{chunk-3ME5YKTW.js → chunk-5KY6P434.js} +2 -2
  7. package/dist/chunk-5KY6P434.js.map +1 -0
  8. package/dist/chunk-F7W6IWTL.js +660 -0
  9. package/dist/chunk-F7W6IWTL.js.map +1 -0
  10. package/dist/chunk-GIBIHGSV.js +916 -0
  11. package/dist/chunk-GIBIHGSV.js.map +1 -0
  12. package/dist/chunk-GV4A2WNO.js +444 -0
  13. package/dist/chunk-GV4A2WNO.js.map +1 -0
  14. package/dist/{chunk-7EYJC5CB.cjs → chunk-H2NJB3AK.cjs} +2 -2
  15. package/dist/chunk-H2NJB3AK.cjs.map +1 -0
  16. package/dist/chunk-KGAGWULG.js +932 -0
  17. package/dist/chunk-KGAGWULG.js.map +1 -0
  18. package/dist/chunk-MEJ47LC3.cjs +463 -0
  19. package/dist/chunk-MEJ47LC3.cjs.map +1 -0
  20. package/dist/chunk-W76AZ5WC.cjs +376 -0
  21. package/dist/chunk-W76AZ5WC.cjs.map +1 -0
  22. package/dist/chunk-WRBXQPRL.js +323 -0
  23. package/dist/chunk-WRBXQPRL.js.map +1 -0
  24. package/dist/chunk-ZLMIHQWM.cjs +975 -0
  25. package/dist/chunk-ZLMIHQWM.cjs.map +1 -0
  26. package/dist/chunk-ZVANOWIB.cjs +688 -0
  27. package/dist/chunk-ZVANOWIB.cjs.map +1 -0
  28. package/dist/contract/index.cjs +88 -261
  29. package/dist/contract/index.cjs.map +1 -1
  30. package/dist/contract/index.d.cts +139 -4
  31. package/dist/contract/index.d.ts +139 -4
  32. package/dist/contract/index.js +4 -220
  33. package/dist/contract/index.js.map +1 -1
  34. package/dist/evm/index.cjs +3 -3
  35. package/dist/evm/index.d.cts +2 -1
  36. package/dist/evm/index.d.ts +2 -1
  37. package/dist/evm/index.js +1 -1
  38. package/dist/fetch-Cx9Pr7-B.d.cts +3 -0
  39. package/dist/fetch-Cx9Pr7-B.d.ts +3 -0
  40. package/dist/index.cjs +177 -833
  41. package/dist/index.cjs.map +1 -1
  42. package/dist/index.d.cts +54 -132
  43. package/dist/index.d.ts +54 -132
  44. package/dist/index.js +6 -659
  45. package/dist/index.js.map +1 -1
  46. package/dist/passkey-errors-B0HGcjPc.d.ts +981 -0
  47. package/dist/passkey-errors-yndCFeHv.d.cts +981 -0
  48. package/dist/provisioning-CwRkCN8D.d.cts +14 -0
  49. package/dist/provisioning-CwRkCN8D.d.ts +14 -0
  50. package/dist/{provisioning-BUYiU8Tr.d.ts → responses-D3nBY71f.d.cts} +40 -48
  51. package/dist/{provisioning-BUYiU8Tr.d.cts → responses-D3nBY71f.d.ts} +40 -48
  52. package/dist/server/index.cjs +117 -0
  53. package/dist/server/index.cjs.map +1 -0
  54. package/dist/server/index.d.cts +98 -0
  55. package/dist/server/index.d.ts +98 -0
  56. package/dist/server/index.js +4 -0
  57. package/dist/server/index.js.map +1 -0
  58. package/dist/services-B15RJBSW.d.cts +728 -0
  59. package/dist/services-BAnTJhwt.d.ts +728 -0
  60. package/dist/solana/index.cjs +2 -2
  61. package/dist/solana/index.d.cts +2 -1
  62. package/dist/solana/index.d.ts +2 -1
  63. package/dist/solana/index.js +1 -1
  64. package/dist/starknet/index.cjs +898 -1729
  65. package/dist/starknet/index.cjs.map +1 -1
  66. package/dist/starknet/index.d.cts +98 -467
  67. package/dist/starknet/index.d.ts +98 -467
  68. package/dist/starknet/index.js +704 -1680
  69. package/dist/starknet/index.js.map +1 -1
  70. package/dist/stellar/index.cjs +2 -2
  71. package/dist/stellar/index.d.cts +2 -1
  72. package/dist/stellar/index.d.ts +2 -1
  73. package/dist/stellar/index.js +1 -1
  74. package/dist/types-BW6ktwcT.d.ts +71 -0
  75. package/dist/types-BftPOVEJ.d.cts +71 -0
  76. package/dist/wallet/index.cjs +240 -0
  77. package/dist/wallet/index.cjs.map +1 -0
  78. package/dist/wallet/index.d.cts +319 -0
  79. package/dist/wallet/index.d.ts +319 -0
  80. package/dist/wallet/index.js +7 -0
  81. package/dist/wallet/index.js.map +1 -0
  82. package/package.json +13 -2
  83. package/dist/chunk-2R7XBA34.cjs +0 -1938
  84. package/dist/chunk-2R7XBA34.cjs.map +0 -1
  85. package/dist/chunk-3ME5YKTW.js.map +0 -1
  86. package/dist/chunk-6WVUUBFI.js +0 -1853
  87. package/dist/chunk-6WVUUBFI.js.map +0 -1
  88. package/dist/chunk-7EYJC5CB.cjs.map +0 -1
  89. package/dist/errors-CZm-NZK0.d.cts +0 -1754
  90. package/dist/errors-h6H6cj3Q.d.ts +0 -1754
  91. package/dist/types-DC4jNPAF.d.cts +0 -153
  92. package/dist/types-DC4jNPAF.d.ts +0 -153
@@ -0,0 +1,319 @@
1
+ import { BigNumberish, Call, DeployAccountContractPayload, ProviderInterface, TypedData, Account } from 'starknet';
2
+ import { F as FetchLike } from '../fetch-Cx9Pr7-B.cjs';
3
+ import { bb as CreateWalletManageIntentParams, c as AccountApi } from '../passkey-errors-yndCFeHv.cjs';
4
+ export { bc as DeviceKeyMissingError, bv as PasskeyCancelledError, bw as PasskeyUnsupportedError, bx as PasskeyUnsupportedReason } from '../passkey-errors-yndCFeHv.cjs';
5
+ import '../chains-CmwjZVU7.cjs';
6
+ import 'zod';
7
+ import '../responses-D3nBY71f.cjs';
8
+
9
+ declare function deriveOwnerKeyPair(secret: Uint8Array, recipientId: string): {
10
+ privateKey: string;
11
+ publicKey: string;
12
+ };
13
+
14
+ declare function ownerConstructorCalldata(ownerPubkey: BigNumberish): string[];
15
+ declare function computeAccountAddress(ownerPubkey: BigNumberish, salt?: BigNumberish): string;
16
+
17
+ declare function computeOwnerGuid(ownerPubkey: BigNumberish): string;
18
+ declare function buildAddOwnerCall(accountAddress: string, addOwnerPubkey: BigNumberish): Call;
19
+ declare function buildRemoveOwnerCall(accountAddress: string, removeOwnerPubkey: BigNumberish): Call;
20
+ declare function buildRemoveOwnerByGuidCall(accountAddress: string, ownerGuid: BigNumberish): Call;
21
+
22
+ declare function buildDeployAccountParams(ownerPubkey: BigNumberish, salt?: BigNumberish): DeployAccountContractPayload;
23
+
24
+ declare const SIGNER_TYPE_NAMES: readonly ["Starknet", "Secp256k1", "Secp256r1"];
25
+ type SignerTypeName = (typeof SIGNER_TYPE_NAMES)[number];
26
+ interface GuardianInfo {
27
+ type: SignerTypeName;
28
+ guid: string;
29
+ storedValue: string;
30
+ }
31
+ declare function buildSetFirstGuardianCall(address: string, guardianPubkey: string): Call;
32
+ declare function buildTriggerEscapeOwnerCall(targetAddress: string, newOwnerPubkey: string): Call;
33
+ declare function buildCompleteEscapeOwnerCall(targetAddress: string): Call;
34
+ declare function buildCancelEscapeCall(address: string): Call;
35
+ declare function decodeGuardiansInfo(res: string[]): GuardianInfo[];
36
+ type EscapeTypeName = "None" | "Guardian" | "Owner";
37
+ type EscapeStatusName = "None" | "NotReady" | "Ready" | "Expired";
38
+ interface EscapeInfo {
39
+ readyAt: number;
40
+ escapeType: EscapeTypeName;
41
+ status: EscapeStatusName;
42
+ }
43
+ declare function decodeEscapeAndStatus(res: string[]): EscapeInfo;
44
+ declare function getGuardians(provider: ProviderInterface, address: string): Promise<GuardianInfo[]>;
45
+ declare function getOwners(provider: ProviderInterface, address: string): Promise<GuardianInfo[]>;
46
+ declare function getEscape(provider: ProviderInterface, address: string): Promise<EscapeInfo>;
47
+ declare function getEscapeSecurityPeriod(provider: ProviderInterface, address: string): Promise<number>;
48
+
49
+ declare function deriveAesKey(prfSecret: Uint8Array, hkdfInfo: Uint8Array): Promise<CryptoKey>;
50
+ declare function generateStarkKeyPair(): {
51
+ privateKeyHex: string;
52
+ publicKeyHex: string;
53
+ };
54
+ declare class InvalidStarkPrivateKeyError extends Error {
55
+ constructor(reason: string);
56
+ }
57
+ declare function starkKeyPairFromPrivateKey(input: string): {
58
+ privateKeyHex: string;
59
+ publicKeyHex: string;
60
+ };
61
+ declare function sealPrivateKey(aesKey: CryptoKey, iv: Uint8Array, privateKeyHex: string): Promise<ArrayBuffer>;
62
+ declare function unsealPrivateKey(aesKey: CryptoKey, iv: Uint8Array, ciphertext: BufferSource): Promise<string>;
63
+ declare function signWithPrivateKey(privateKeyHex: string, msgHash: string): [string, string];
64
+
65
+ interface SealedOwner {
66
+ credentialId: string;
67
+ ownerPubKey: string;
68
+ address: string;
69
+ iv: string;
70
+ ciphertext: string;
71
+ lock?: "device";
72
+ }
73
+ interface OwnerSigner {
74
+ address: string;
75
+ signTypedData(typedData: TypedData): Promise<string[]>;
76
+ }
77
+ interface ExecutedTransaction {
78
+ transactionHash: string;
79
+ }
80
+ interface WalletExecutor {
81
+ execute(input: {
82
+ userAddress: string;
83
+ privateKeyHex: string;
84
+ calls: Call[];
85
+ intentIds?: string[];
86
+ }): Promise<ExecutedTransaction>;
87
+ }
88
+ interface ReceiptProviderLike {
89
+ getClassHashAt(address: string): Promise<unknown>;
90
+ }
91
+
92
+ interface OwnerStore {
93
+ load(): SealedOwner | null;
94
+ loadAddress(): string | null;
95
+ save(sealed: SealedOwner): void;
96
+ clear(): void;
97
+ notifyChange(): void;
98
+ onChange(listener: () => void): () => void;
99
+ }
100
+ declare function createOwnerStore(config: {
101
+ storeKey: string;
102
+ changeEvent: string;
103
+ }): OwnerStore;
104
+
105
+ declare class InvalidPairingPayloadError extends Error {
106
+ constructor(message?: string);
107
+ }
108
+ interface PairingPayload {
109
+ publicKey: string;
110
+ label: string;
111
+ }
112
+ declare function encodePairingPayload(payload: PairingPayload): string;
113
+ declare function parsePairingPayload(encoded: string): PairingPayload;
114
+ declare function parseAccountAddress(input: string): string;
115
+
116
+ declare class InvalidRecoveryKeyError extends Error {
117
+ constructor(message?: string);
118
+ }
119
+ interface RecoveryKey {
120
+ walletAddress: string;
121
+ privateKey: string;
122
+ }
123
+ declare function encodeRecoveryKey(key: RecoveryKey): string;
124
+ declare function parseRecoveryKey(input: string): RecoveryKey;
125
+
126
+ type GuardianStatus = {
127
+ kind: "none";
128
+ } | {
129
+ kind: "active";
130
+ guardian: GuardianInfo;
131
+ };
132
+ declare function describeGuardianStatus(guardians: GuardianInfo[]): GuardianStatus;
133
+ type RecoveryAction = "start" | "complete" | "none";
134
+ declare function describeRecoveryAction(escape: EscapeInfo): RecoveryAction;
135
+
136
+ declare function normalizeWalletAddress(address: string): string;
137
+ declare function isValidStarknetAddress(address: string): boolean;
138
+ declare function isDeployed(provider: ReceiptProviderLike, address: string): Promise<boolean>;
139
+
140
+ interface SelfFundFeeEstimate {
141
+ feeRaw: bigint;
142
+ unit: string;
143
+ balanceRaw: bigint | null;
144
+ }
145
+ type SelfFundConsentHandler = (feeEstimate: Promise<SelfFundFeeEstimate | null>) => Promise<boolean>;
146
+ interface SelfFundConsent {
147
+ registerHandler(handler: SelfFundConsentHandler | null): void;
148
+ request(input: {
149
+ address?: string;
150
+ calls?: Call[];
151
+ }): Promise<boolean>;
152
+ }
153
+ declare function createSelfFundConsent(estimateFee: (address: string, calls: Call[]) => Promise<SelfFundFeeEstimate>): SelfFundConsent;
154
+
155
+ interface DeviceKeyStore {
156
+ save(credentialId: string, key: CryptoKey): Promise<void>;
157
+ load(credentialId: string): Promise<CryptoKey | null>;
158
+ }
159
+ declare const indexedDbDeviceKeys: DeviceKeyStore;
160
+
161
+ interface PasskeyConfig {
162
+ appName: string;
163
+ relyingPartyName: string;
164
+ relyingPartyId: () => string;
165
+ prfSalt: Uint8Array<ArrayBuffer>;
166
+ hkdfInfo: Uint8Array<ArrayBuffer>;
167
+ passkeyUser: () => Promise<PublicKeyCredentialUserEntity>;
168
+ knownCredentials: () => PublicKeyCredentialDescriptor[];
169
+ credentials?: CredentialsContainer;
170
+ deviceKeys?: DeviceKeyStore;
171
+ randomBytes?: (length: number) => Uint8Array<ArrayBuffer>;
172
+ }
173
+ interface CreatedOwner {
174
+ sealed: SealedOwner;
175
+ privateKeyHex: string;
176
+ }
177
+ interface PasskeyOwner {
178
+ createOwnerKey(): Promise<CreatedOwner>;
179
+ unlockOwnerKey(sealed: SealedOwner): Promise<string>;
180
+ sealImportedOwnerKey(recovery: RecoveryKey): Promise<SealedOwner>;
181
+ }
182
+ declare function createPasskeyOwner(config: PasskeyConfig): PasskeyOwner;
183
+
184
+ interface SelfFundedDeps {
185
+ provider: () => ProviderInterface;
186
+ }
187
+ declare function accountFor(provider: ProviderInterface, address: string, privateKeyHex: string): Account;
188
+ declare function estimateSelfFundedFee(provider: ProviderInterface, address: string, calls: Call[]): Promise<SelfFundFeeEstimate>;
189
+ declare function selfFundedExecutor(deps: SelfFundedDeps): WalletExecutor;
190
+ interface SponsoredDeps extends SelfFundedDeps {
191
+ proxyUrl: string;
192
+ consent: SelfFundConsent;
193
+ fetchImpl?: FetchLike;
194
+ fallback?: WalletExecutor;
195
+ }
196
+ declare function sponsoredExecutor(deps: SponsoredDeps): WalletExecutor;
197
+
198
+ type DeploymentStep = "creating-passkey" | "deploying";
199
+ interface DeploymentResult {
200
+ sealed: SealedOwner;
201
+ }
202
+ declare function deploySponsored(input: {
203
+ proxyUrl: string;
204
+ provider: ProviderInterface;
205
+ ownerAddress: string;
206
+ ownerPubKey: string;
207
+ privateKeyHex: string;
208
+ salt?: string;
209
+ fetchImpl?: FetchLike;
210
+ }): Promise<ExecutedTransaction>;
211
+ declare function deploySelfFunded(input: {
212
+ provider: ProviderInterface;
213
+ ownerAddress: string;
214
+ ownerPubKey: string;
215
+ privateKeyHex: string;
216
+ }): Promise<ExecutedTransaction>;
217
+ declare function waitUntilDeployed(provider: ProviderInterface, address: string, timeoutMs?: number, sleep?: (ms: number) => Promise<void>): Promise<void>;
218
+ interface DeploymentDeps {
219
+ store: {
220
+ load(): SealedOwner | null;
221
+ save(sealed: SealedOwner): void;
222
+ notifyChange(): void;
223
+ };
224
+ passkey: {
225
+ createOwnerKey(): Promise<{
226
+ sealed: SealedOwner;
227
+ privateKeyHex: string;
228
+ }>;
229
+ unlockOwnerKey(sealed: SealedOwner): Promise<string>;
230
+ };
231
+ provider: () => ProviderInterface;
232
+ deployProxyUrl?: string;
233
+ fetchImpl?: FetchLike;
234
+ deploySponsoredImpl?: typeof deploySponsored;
235
+ deploySelfFundedImpl?: typeof deploySelfFunded;
236
+ waitUntilDeployedImpl?: typeof waitUntilDeployed;
237
+ isDeployedImpl?: typeof isDeployed;
238
+ }
239
+ declare function completeDeployment(deps: DeploymentDeps, onStep: (step: DeploymentStep) => void, options?: {
240
+ forceNew?: boolean;
241
+ }): Promise<DeploymentResult>;
242
+ interface DeploymentCoordinator {
243
+ run(onStep: (step: DeploymentStep) => void, options?: {
244
+ forceNew?: boolean;
245
+ }): Promise<DeploymentResult>;
246
+ isDeploying(): boolean;
247
+ }
248
+ declare function createDeploymentCoordinator(execute: (onStep: (step: DeploymentStep) => void, options: {
249
+ forceNew?: boolean;
250
+ }) => Promise<DeploymentResult>): DeploymentCoordinator;
251
+
252
+ interface DeviceEntry {
253
+ guid: string;
254
+ type: GuardianInfo["type"];
255
+ isThisDevice: boolean;
256
+ }
257
+ declare function describeDevices(owners: GuardianInfo[], thisDevicePubkey: string): DeviceEntry[];
258
+ declare function canRemoveDevice(devices: DeviceEntry[], guid: string): boolean;
259
+ interface MediaWalletConfig {
260
+ store: OwnerStore;
261
+ passkey: PasskeyOwner;
262
+ executor: WalletExecutor;
263
+ provider: () => ProviderInterface;
264
+ unlockTtlMs?: number;
265
+ backendUrl?: string;
266
+ deployProxyUrl?: string;
267
+ fetchImpl?: FetchLike;
268
+ walletIntents?: (params: CreateWalletManageIntentParams) => Promise<{
269
+ id: string;
270
+ calls: Call[];
271
+ }>;
272
+ }
273
+ interface MediaWallet {
274
+ store: OwnerStore;
275
+ passkey: PasskeyOwner;
276
+ lock(address: string): void;
277
+ signerFor(sealed: SealedOwner): {
278
+ address: string;
279
+ signTypedData(data: TypedData): Promise<string[]>;
280
+ execute(calls: Call[], opts?: {
281
+ intentIds?: string[];
282
+ }): Promise<{
283
+ txHash: string;
284
+ }>;
285
+ };
286
+ run(sealed: SealedOwner, calls: Call[], userAddress?: string, intentIds?: string[]): Promise<ExecutedTransaction>;
287
+ getGuardians(address: string): Promise<GuardianInfo[]>;
288
+ getEscape(address: string): Promise<EscapeInfo>;
289
+ getEscapeSecurityPeriod(address: string): Promise<number>;
290
+ setFirstGuardian(sealed: SealedOwner, guardianPubkey: string): Promise<string>;
291
+ triggerEscapeOwner(guardianSealed: SealedOwner, targetAddress: string, newOwnerPubkey: string): Promise<string>;
292
+ completeEscapeOwner(guardianSealed: SealedOwner, targetAddress: string): Promise<string>;
293
+ cancelEscape(sealed: SealedOwner): Promise<string>;
294
+ getOwners(address: string): Promise<GuardianInfo[]>;
295
+ isOwnerOf(accountAddress: string, devicePubkey: string): Promise<boolean>;
296
+ addDevice(sealed: SealedOwner, devicePubkey: string): Promise<string>;
297
+ removeDevice(sealed: SealedOwner, ownerGuid: string): Promise<string>;
298
+ completeDeployment(onStep: (step: DeploymentStep) => void, options?: {
299
+ forceNew?: boolean;
300
+ }): Promise<DeploymentResult>;
301
+ isDeploying(): boolean;
302
+ }
303
+ declare function createMediaWallet(config: MediaWalletConfig): MediaWallet;
304
+
305
+ interface SessionWallet {
306
+ walletAddress: string;
307
+ needsKeySetup: boolean;
308
+ }
309
+ interface SessionWalletClaimDeps {
310
+ createOwnerKey(): Promise<CreatedOwner>;
311
+ loadOwner(): SealedOwner | null;
312
+ saveOwner(sealed: SealedOwner): void;
313
+ removeOwner(sealed: SealedOwner, ownerGuid: string): Promise<unknown>;
314
+ }
315
+ declare function claimSessionWallet(api: {
316
+ account: Pick<AccountApi, "setupWalletKey">;
317
+ }, walletAddress: string, deps: SessionWalletClaimDeps): Promise<void>;
318
+
319
+ export { type CreatedOwner, type DeploymentCoordinator, type DeploymentDeps, type DeploymentResult, type DeploymentStep, type DeviceEntry, type DeviceKeyStore, type EscapeInfo, type EscapeStatusName, type EscapeTypeName, type ExecutedTransaction, type GuardianInfo, type GuardianStatus, InvalidPairingPayloadError, InvalidRecoveryKeyError, InvalidStarkPrivateKeyError, type MediaWallet, type MediaWalletConfig, type OwnerSigner, type OwnerStore, type PairingPayload, type PasskeyConfig, type PasskeyOwner, type ReceiptProviderLike, type RecoveryAction, type RecoveryKey, type SealedOwner, type SelfFundConsent, type SelfFundConsentHandler, type SelfFundFeeEstimate, type SelfFundedDeps, type SessionWallet, type SessionWalletClaimDeps, type SponsoredDeps, type WalletExecutor, accountFor, buildAddOwnerCall, buildCancelEscapeCall, buildCompleteEscapeOwnerCall, buildDeployAccountParams, buildRemoveOwnerByGuidCall, buildRemoveOwnerCall, buildSetFirstGuardianCall, buildTriggerEscapeOwnerCall, canRemoveDevice, claimSessionWallet, completeDeployment, computeAccountAddress, computeOwnerGuid, createDeploymentCoordinator, createMediaWallet, createOwnerStore, createPasskeyOwner, createSelfFundConsent, decodeEscapeAndStatus, decodeGuardiansInfo, deploySelfFunded, deploySponsored, deriveAesKey, deriveOwnerKeyPair, describeDevices, describeGuardianStatus, describeRecoveryAction, encodePairingPayload, encodeRecoveryKey, estimateSelfFundedFee, generateStarkKeyPair, getEscape, getEscapeSecurityPeriod, getGuardians, getOwners, indexedDbDeviceKeys, isDeployed, isValidStarknetAddress, normalizeWalletAddress, ownerConstructorCalldata, parseAccountAddress, parsePairingPayload, parseRecoveryKey, sealPrivateKey, selfFundedExecutor, signWithPrivateKey, sponsoredExecutor, starkKeyPairFromPrivateKey, unsealPrivateKey, waitUntilDeployed };
@@ -0,0 +1,319 @@
1
+ import { BigNumberish, Call, DeployAccountContractPayload, ProviderInterface, TypedData, Account } from 'starknet';
2
+ import { F as FetchLike } from '../fetch-Cx9Pr7-B.js';
3
+ import { bb as CreateWalletManageIntentParams, c as AccountApi } from '../passkey-errors-B0HGcjPc.js';
4
+ export { bc as DeviceKeyMissingError, bv as PasskeyCancelledError, bw as PasskeyUnsupportedError, bx as PasskeyUnsupportedReason } from '../passkey-errors-B0HGcjPc.js';
5
+ import '../chains-CmwjZVU7.js';
6
+ import 'zod';
7
+ import '../responses-D3nBY71f.js';
8
+
9
+ declare function deriveOwnerKeyPair(secret: Uint8Array, recipientId: string): {
10
+ privateKey: string;
11
+ publicKey: string;
12
+ };
13
+
14
+ declare function ownerConstructorCalldata(ownerPubkey: BigNumberish): string[];
15
+ declare function computeAccountAddress(ownerPubkey: BigNumberish, salt?: BigNumberish): string;
16
+
17
+ declare function computeOwnerGuid(ownerPubkey: BigNumberish): string;
18
+ declare function buildAddOwnerCall(accountAddress: string, addOwnerPubkey: BigNumberish): Call;
19
+ declare function buildRemoveOwnerCall(accountAddress: string, removeOwnerPubkey: BigNumberish): Call;
20
+ declare function buildRemoveOwnerByGuidCall(accountAddress: string, ownerGuid: BigNumberish): Call;
21
+
22
+ declare function buildDeployAccountParams(ownerPubkey: BigNumberish, salt?: BigNumberish): DeployAccountContractPayload;
23
+
24
+ declare const SIGNER_TYPE_NAMES: readonly ["Starknet", "Secp256k1", "Secp256r1"];
25
+ type SignerTypeName = (typeof SIGNER_TYPE_NAMES)[number];
26
+ interface GuardianInfo {
27
+ type: SignerTypeName;
28
+ guid: string;
29
+ storedValue: string;
30
+ }
31
+ declare function buildSetFirstGuardianCall(address: string, guardianPubkey: string): Call;
32
+ declare function buildTriggerEscapeOwnerCall(targetAddress: string, newOwnerPubkey: string): Call;
33
+ declare function buildCompleteEscapeOwnerCall(targetAddress: string): Call;
34
+ declare function buildCancelEscapeCall(address: string): Call;
35
+ declare function decodeGuardiansInfo(res: string[]): GuardianInfo[];
36
+ type EscapeTypeName = "None" | "Guardian" | "Owner";
37
+ type EscapeStatusName = "None" | "NotReady" | "Ready" | "Expired";
38
+ interface EscapeInfo {
39
+ readyAt: number;
40
+ escapeType: EscapeTypeName;
41
+ status: EscapeStatusName;
42
+ }
43
+ declare function decodeEscapeAndStatus(res: string[]): EscapeInfo;
44
+ declare function getGuardians(provider: ProviderInterface, address: string): Promise<GuardianInfo[]>;
45
+ declare function getOwners(provider: ProviderInterface, address: string): Promise<GuardianInfo[]>;
46
+ declare function getEscape(provider: ProviderInterface, address: string): Promise<EscapeInfo>;
47
+ declare function getEscapeSecurityPeriod(provider: ProviderInterface, address: string): Promise<number>;
48
+
49
+ declare function deriveAesKey(prfSecret: Uint8Array, hkdfInfo: Uint8Array): Promise<CryptoKey>;
50
+ declare function generateStarkKeyPair(): {
51
+ privateKeyHex: string;
52
+ publicKeyHex: string;
53
+ };
54
+ declare class InvalidStarkPrivateKeyError extends Error {
55
+ constructor(reason: string);
56
+ }
57
+ declare function starkKeyPairFromPrivateKey(input: string): {
58
+ privateKeyHex: string;
59
+ publicKeyHex: string;
60
+ };
61
+ declare function sealPrivateKey(aesKey: CryptoKey, iv: Uint8Array, privateKeyHex: string): Promise<ArrayBuffer>;
62
+ declare function unsealPrivateKey(aesKey: CryptoKey, iv: Uint8Array, ciphertext: BufferSource): Promise<string>;
63
+ declare function signWithPrivateKey(privateKeyHex: string, msgHash: string): [string, string];
64
+
65
+ interface SealedOwner {
66
+ credentialId: string;
67
+ ownerPubKey: string;
68
+ address: string;
69
+ iv: string;
70
+ ciphertext: string;
71
+ lock?: "device";
72
+ }
73
+ interface OwnerSigner {
74
+ address: string;
75
+ signTypedData(typedData: TypedData): Promise<string[]>;
76
+ }
77
+ interface ExecutedTransaction {
78
+ transactionHash: string;
79
+ }
80
+ interface WalletExecutor {
81
+ execute(input: {
82
+ userAddress: string;
83
+ privateKeyHex: string;
84
+ calls: Call[];
85
+ intentIds?: string[];
86
+ }): Promise<ExecutedTransaction>;
87
+ }
88
+ interface ReceiptProviderLike {
89
+ getClassHashAt(address: string): Promise<unknown>;
90
+ }
91
+
92
+ interface OwnerStore {
93
+ load(): SealedOwner | null;
94
+ loadAddress(): string | null;
95
+ save(sealed: SealedOwner): void;
96
+ clear(): void;
97
+ notifyChange(): void;
98
+ onChange(listener: () => void): () => void;
99
+ }
100
+ declare function createOwnerStore(config: {
101
+ storeKey: string;
102
+ changeEvent: string;
103
+ }): OwnerStore;
104
+
105
+ declare class InvalidPairingPayloadError extends Error {
106
+ constructor(message?: string);
107
+ }
108
+ interface PairingPayload {
109
+ publicKey: string;
110
+ label: string;
111
+ }
112
+ declare function encodePairingPayload(payload: PairingPayload): string;
113
+ declare function parsePairingPayload(encoded: string): PairingPayload;
114
+ declare function parseAccountAddress(input: string): string;
115
+
116
+ declare class InvalidRecoveryKeyError extends Error {
117
+ constructor(message?: string);
118
+ }
119
+ interface RecoveryKey {
120
+ walletAddress: string;
121
+ privateKey: string;
122
+ }
123
+ declare function encodeRecoveryKey(key: RecoveryKey): string;
124
+ declare function parseRecoveryKey(input: string): RecoveryKey;
125
+
126
+ type GuardianStatus = {
127
+ kind: "none";
128
+ } | {
129
+ kind: "active";
130
+ guardian: GuardianInfo;
131
+ };
132
+ declare function describeGuardianStatus(guardians: GuardianInfo[]): GuardianStatus;
133
+ type RecoveryAction = "start" | "complete" | "none";
134
+ declare function describeRecoveryAction(escape: EscapeInfo): RecoveryAction;
135
+
136
+ declare function normalizeWalletAddress(address: string): string;
137
+ declare function isValidStarknetAddress(address: string): boolean;
138
+ declare function isDeployed(provider: ReceiptProviderLike, address: string): Promise<boolean>;
139
+
140
+ interface SelfFundFeeEstimate {
141
+ feeRaw: bigint;
142
+ unit: string;
143
+ balanceRaw: bigint | null;
144
+ }
145
+ type SelfFundConsentHandler = (feeEstimate: Promise<SelfFundFeeEstimate | null>) => Promise<boolean>;
146
+ interface SelfFundConsent {
147
+ registerHandler(handler: SelfFundConsentHandler | null): void;
148
+ request(input: {
149
+ address?: string;
150
+ calls?: Call[];
151
+ }): Promise<boolean>;
152
+ }
153
+ declare function createSelfFundConsent(estimateFee: (address: string, calls: Call[]) => Promise<SelfFundFeeEstimate>): SelfFundConsent;
154
+
155
+ interface DeviceKeyStore {
156
+ save(credentialId: string, key: CryptoKey): Promise<void>;
157
+ load(credentialId: string): Promise<CryptoKey | null>;
158
+ }
159
+ declare const indexedDbDeviceKeys: DeviceKeyStore;
160
+
161
+ interface PasskeyConfig {
162
+ appName: string;
163
+ relyingPartyName: string;
164
+ relyingPartyId: () => string;
165
+ prfSalt: Uint8Array<ArrayBuffer>;
166
+ hkdfInfo: Uint8Array<ArrayBuffer>;
167
+ passkeyUser: () => Promise<PublicKeyCredentialUserEntity>;
168
+ knownCredentials: () => PublicKeyCredentialDescriptor[];
169
+ credentials?: CredentialsContainer;
170
+ deviceKeys?: DeviceKeyStore;
171
+ randomBytes?: (length: number) => Uint8Array<ArrayBuffer>;
172
+ }
173
+ interface CreatedOwner {
174
+ sealed: SealedOwner;
175
+ privateKeyHex: string;
176
+ }
177
+ interface PasskeyOwner {
178
+ createOwnerKey(): Promise<CreatedOwner>;
179
+ unlockOwnerKey(sealed: SealedOwner): Promise<string>;
180
+ sealImportedOwnerKey(recovery: RecoveryKey): Promise<SealedOwner>;
181
+ }
182
+ declare function createPasskeyOwner(config: PasskeyConfig): PasskeyOwner;
183
+
184
+ interface SelfFundedDeps {
185
+ provider: () => ProviderInterface;
186
+ }
187
+ declare function accountFor(provider: ProviderInterface, address: string, privateKeyHex: string): Account;
188
+ declare function estimateSelfFundedFee(provider: ProviderInterface, address: string, calls: Call[]): Promise<SelfFundFeeEstimate>;
189
+ declare function selfFundedExecutor(deps: SelfFundedDeps): WalletExecutor;
190
+ interface SponsoredDeps extends SelfFundedDeps {
191
+ proxyUrl: string;
192
+ consent: SelfFundConsent;
193
+ fetchImpl?: FetchLike;
194
+ fallback?: WalletExecutor;
195
+ }
196
+ declare function sponsoredExecutor(deps: SponsoredDeps): WalletExecutor;
197
+
198
+ type DeploymentStep = "creating-passkey" | "deploying";
199
+ interface DeploymentResult {
200
+ sealed: SealedOwner;
201
+ }
202
+ declare function deploySponsored(input: {
203
+ proxyUrl: string;
204
+ provider: ProviderInterface;
205
+ ownerAddress: string;
206
+ ownerPubKey: string;
207
+ privateKeyHex: string;
208
+ salt?: string;
209
+ fetchImpl?: FetchLike;
210
+ }): Promise<ExecutedTransaction>;
211
+ declare function deploySelfFunded(input: {
212
+ provider: ProviderInterface;
213
+ ownerAddress: string;
214
+ ownerPubKey: string;
215
+ privateKeyHex: string;
216
+ }): Promise<ExecutedTransaction>;
217
+ declare function waitUntilDeployed(provider: ProviderInterface, address: string, timeoutMs?: number, sleep?: (ms: number) => Promise<void>): Promise<void>;
218
+ interface DeploymentDeps {
219
+ store: {
220
+ load(): SealedOwner | null;
221
+ save(sealed: SealedOwner): void;
222
+ notifyChange(): void;
223
+ };
224
+ passkey: {
225
+ createOwnerKey(): Promise<{
226
+ sealed: SealedOwner;
227
+ privateKeyHex: string;
228
+ }>;
229
+ unlockOwnerKey(sealed: SealedOwner): Promise<string>;
230
+ };
231
+ provider: () => ProviderInterface;
232
+ deployProxyUrl?: string;
233
+ fetchImpl?: FetchLike;
234
+ deploySponsoredImpl?: typeof deploySponsored;
235
+ deploySelfFundedImpl?: typeof deploySelfFunded;
236
+ waitUntilDeployedImpl?: typeof waitUntilDeployed;
237
+ isDeployedImpl?: typeof isDeployed;
238
+ }
239
+ declare function completeDeployment(deps: DeploymentDeps, onStep: (step: DeploymentStep) => void, options?: {
240
+ forceNew?: boolean;
241
+ }): Promise<DeploymentResult>;
242
+ interface DeploymentCoordinator {
243
+ run(onStep: (step: DeploymentStep) => void, options?: {
244
+ forceNew?: boolean;
245
+ }): Promise<DeploymentResult>;
246
+ isDeploying(): boolean;
247
+ }
248
+ declare function createDeploymentCoordinator(execute: (onStep: (step: DeploymentStep) => void, options: {
249
+ forceNew?: boolean;
250
+ }) => Promise<DeploymentResult>): DeploymentCoordinator;
251
+
252
+ interface DeviceEntry {
253
+ guid: string;
254
+ type: GuardianInfo["type"];
255
+ isThisDevice: boolean;
256
+ }
257
+ declare function describeDevices(owners: GuardianInfo[], thisDevicePubkey: string): DeviceEntry[];
258
+ declare function canRemoveDevice(devices: DeviceEntry[], guid: string): boolean;
259
+ interface MediaWalletConfig {
260
+ store: OwnerStore;
261
+ passkey: PasskeyOwner;
262
+ executor: WalletExecutor;
263
+ provider: () => ProviderInterface;
264
+ unlockTtlMs?: number;
265
+ backendUrl?: string;
266
+ deployProxyUrl?: string;
267
+ fetchImpl?: FetchLike;
268
+ walletIntents?: (params: CreateWalletManageIntentParams) => Promise<{
269
+ id: string;
270
+ calls: Call[];
271
+ }>;
272
+ }
273
+ interface MediaWallet {
274
+ store: OwnerStore;
275
+ passkey: PasskeyOwner;
276
+ lock(address: string): void;
277
+ signerFor(sealed: SealedOwner): {
278
+ address: string;
279
+ signTypedData(data: TypedData): Promise<string[]>;
280
+ execute(calls: Call[], opts?: {
281
+ intentIds?: string[];
282
+ }): Promise<{
283
+ txHash: string;
284
+ }>;
285
+ };
286
+ run(sealed: SealedOwner, calls: Call[], userAddress?: string, intentIds?: string[]): Promise<ExecutedTransaction>;
287
+ getGuardians(address: string): Promise<GuardianInfo[]>;
288
+ getEscape(address: string): Promise<EscapeInfo>;
289
+ getEscapeSecurityPeriod(address: string): Promise<number>;
290
+ setFirstGuardian(sealed: SealedOwner, guardianPubkey: string): Promise<string>;
291
+ triggerEscapeOwner(guardianSealed: SealedOwner, targetAddress: string, newOwnerPubkey: string): Promise<string>;
292
+ completeEscapeOwner(guardianSealed: SealedOwner, targetAddress: string): Promise<string>;
293
+ cancelEscape(sealed: SealedOwner): Promise<string>;
294
+ getOwners(address: string): Promise<GuardianInfo[]>;
295
+ isOwnerOf(accountAddress: string, devicePubkey: string): Promise<boolean>;
296
+ addDevice(sealed: SealedOwner, devicePubkey: string): Promise<string>;
297
+ removeDevice(sealed: SealedOwner, ownerGuid: string): Promise<string>;
298
+ completeDeployment(onStep: (step: DeploymentStep) => void, options?: {
299
+ forceNew?: boolean;
300
+ }): Promise<DeploymentResult>;
301
+ isDeploying(): boolean;
302
+ }
303
+ declare function createMediaWallet(config: MediaWalletConfig): MediaWallet;
304
+
305
+ interface SessionWallet {
306
+ walletAddress: string;
307
+ needsKeySetup: boolean;
308
+ }
309
+ interface SessionWalletClaimDeps {
310
+ createOwnerKey(): Promise<CreatedOwner>;
311
+ loadOwner(): SealedOwner | null;
312
+ saveOwner(sealed: SealedOwner): void;
313
+ removeOwner(sealed: SealedOwner, ownerGuid: string): Promise<unknown>;
314
+ }
315
+ declare function claimSessionWallet(api: {
316
+ account: Pick<AccountApi, "setupWalletKey">;
317
+ }, walletAddress: string, deps: SessionWalletClaimDeps): Promise<void>;
318
+
319
+ export { type CreatedOwner, type DeploymentCoordinator, type DeploymentDeps, type DeploymentResult, type DeploymentStep, type DeviceEntry, type DeviceKeyStore, type EscapeInfo, type EscapeStatusName, type EscapeTypeName, type ExecutedTransaction, type GuardianInfo, type GuardianStatus, InvalidPairingPayloadError, InvalidRecoveryKeyError, InvalidStarkPrivateKeyError, type MediaWallet, type MediaWalletConfig, type OwnerSigner, type OwnerStore, type PairingPayload, type PasskeyConfig, type PasskeyOwner, type ReceiptProviderLike, type RecoveryAction, type RecoveryKey, type SealedOwner, type SelfFundConsent, type SelfFundConsentHandler, type SelfFundFeeEstimate, type SelfFundedDeps, type SessionWallet, type SessionWalletClaimDeps, type SponsoredDeps, type WalletExecutor, accountFor, buildAddOwnerCall, buildCancelEscapeCall, buildCompleteEscapeOwnerCall, buildDeployAccountParams, buildRemoveOwnerByGuidCall, buildRemoveOwnerCall, buildSetFirstGuardianCall, buildTriggerEscapeOwnerCall, canRemoveDevice, claimSessionWallet, completeDeployment, computeAccountAddress, computeOwnerGuid, createDeploymentCoordinator, createMediaWallet, createOwnerStore, createPasskeyOwner, createSelfFundConsent, decodeEscapeAndStatus, decodeGuardiansInfo, deploySelfFunded, deploySponsored, deriveAesKey, deriveOwnerKeyPair, describeDevices, describeGuardianStatus, describeRecoveryAction, encodePairingPayload, encodeRecoveryKey, estimateSelfFundedFee, generateStarkKeyPair, getEscape, getEscapeSecurityPeriod, getGuardians, getOwners, indexedDbDeviceKeys, isDeployed, isValidStarknetAddress, normalizeWalletAddress, ownerConstructorCalldata, parseAccountAddress, parsePairingPayload, parseRecoveryKey, sealPrivateKey, selfFundedExecutor, signWithPrivateKey, sponsoredExecutor, starkKeyPairFromPrivateKey, unsealPrivateKey, waitUntilDeployed };
@@ -0,0 +1,7 @@
1
+ export { InvalidPairingPayloadError, InvalidRecoveryKeyError, InvalidStarkPrivateKeyError, accountFor, buildAddOwnerCall, buildCancelEscapeCall, buildCompleteEscapeOwnerCall, buildDeployAccountParams, buildRemoveOwnerByGuidCall, buildRemoveOwnerCall, buildSetFirstGuardianCall, buildTriggerEscapeOwnerCall, canRemoveDevice, claimSessionWallet, completeDeployment, computeAccountAddress, computeOwnerGuid, createDeploymentCoordinator, createMediaWallet, createOwnerStore, createPasskeyOwner, createSelfFundConsent, decodeEscapeAndStatus, decodeGuardiansInfo, deploySelfFunded, deploySponsored, deriveAesKey, deriveOwnerKeyPair, describeDevices, describeGuardianStatus, describeRecoveryAction, encodePairingPayload, encodeRecoveryKey, estimateSelfFundedFee, generateStarkKeyPair, getEscape, getEscapeSecurityPeriod, getGuardians, getOwners, indexedDbDeviceKeys, isDeployed, isValidStarknetAddress, normalizeWalletAddress, ownerConstructorCalldata, parseAccountAddress, parsePairingPayload, parseRecoveryKey, sealPrivateKey, selfFundedExecutor, signWithPrivateKey, sponsoredExecutor, starkKeyPairFromPrivateKey, unsealPrivateKey, waitUntilDeployed } from '../chunk-GIBIHGSV.js';
2
+ export { DeviceKeyMissingError, PasskeyCancelledError, PasskeyUnsupportedError } from '../chunk-KGAGWULG.js';
3
+ import '../chunk-5KY6P434.js';
4
+ import '../chunk-WRBXQPRL.js';
5
+ import '../chunk-PZ5AY32C.js';
6
+ //# sourceMappingURL=index.js.map
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}