@swivy/web 0.0.0-stage → 1.0.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.
package/README.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @swivy/web
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Swivy web SDK. Testnet preview; production onboarding is gated on the Swop canary.
|
|
4
|
+
|
|
5
|
+
Public npm distribution is being prepared. Before first publication, use all SDK tarballs
|
|
6
|
+
from one operator-supplied release and verify its SHA256SUMS. After publication:
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
npm install @swivy/web@next
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Use an environment app ID and publishable key for browser/mobile apps. Keep environment
|
|
13
|
+
secret keys on the backend and deployment bootstrap credentials with the deployment operator.
|
|
14
|
+
Choose email or SMS in your environment policy; SMS recovery alone does not enable SMS login.
|
|
15
|
+
Never log login codes, runtime sessions or signing material.
|
|
16
|
+
|
|
17
|
+
Browser apps currently need a same-origin reverse proxy for `/v1/runtime/*`; the API
|
|
18
|
+
does not advertise cross-origin browser access. Backend and native clients can use the API directly.
|
|
19
|
+
|
|
20
|
+
The client exposes `requestSmsCode(phoneNumber)` and `verifySmsCode(challengeId, code)`. Supply phone numbers in E.164 format.
|
|
@@ -0,0 +1,515 @@
|
|
|
1
|
+
import { type AuthenticationResponseJSON, type PublicKeyCredentialCreationOptionsJSON, type PublicKeyCredentialRequestOptionsJSON, type RegistrationResponseJSON } from "@simplewebauthn/browser";
|
|
2
|
+
import type { Chain, CustodyMode, ExecutionResult, LinkedWalletDescriptor, ManagedAccountDescriptor, OfflineTransactionSigningEnvelope, OfflineTransactionSigningResponseEnvelope, SessionGrantDescriptor, SessionGrantScope, TransactionIntent, TypedDataDescriptor, WalletPurpose } from "@swivy/core";
|
|
3
|
+
import { type SwivyLocalWalletShareRecord, type SwivyLocalWalletStorageLike } from "./local-wallet.js";
|
|
4
|
+
export interface SwivyBrowserClientConfig {
|
|
5
|
+
baseUrl: string;
|
|
6
|
+
appId?: string;
|
|
7
|
+
publishableKey?: string;
|
|
8
|
+
environmentId?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Legacy alias for publishableKey while existing apps migrate.
|
|
11
|
+
*/
|
|
12
|
+
apiKey?: string;
|
|
13
|
+
sessionToken?: string;
|
|
14
|
+
sessionPersistence?: SwivySessionPersistenceMode | SwivySessionPersistenceAdapter;
|
|
15
|
+
sessionStorageKey?: string;
|
|
16
|
+
embeddedWalletStorage?: SwivyLocalWalletStorageLike;
|
|
17
|
+
embeddedWalletStorageKeyPrefix?: string;
|
|
18
|
+
offlineSigningPairingSecret?: string;
|
|
19
|
+
offlineSigningPairingKeyId?: string;
|
|
20
|
+
}
|
|
21
|
+
export type SwivyChallengePurpose = "login" | "account_export" | "intent_approval" | "recovery" | "session_delegation" | "wallet_reconstruction";
|
|
22
|
+
export type SwivySessionPersistenceMode = "memory" | "localStorage" | "sessionStorage";
|
|
23
|
+
export interface SwivySessionPersistenceAdapter {
|
|
24
|
+
load(): string | undefined;
|
|
25
|
+
save(token: string): void;
|
|
26
|
+
clear(): void;
|
|
27
|
+
}
|
|
28
|
+
export interface SwivyListAccountsPayload {
|
|
29
|
+
managedAccounts: ManagedAccountDescriptor[];
|
|
30
|
+
linkedWallets: LinkedWalletDescriptor[];
|
|
31
|
+
}
|
|
32
|
+
export interface SwivyWalletToolDescriptor {
|
|
33
|
+
id: string;
|
|
34
|
+
name?: string;
|
|
35
|
+
description?: string;
|
|
36
|
+
status?: "enabled" | "disabled" | string;
|
|
37
|
+
policy?: unknown;
|
|
38
|
+
[key: string]: unknown;
|
|
39
|
+
}
|
|
40
|
+
export interface SwivyWalletToolsPayload {
|
|
41
|
+
tools: SwivyWalletToolDescriptor[];
|
|
42
|
+
}
|
|
43
|
+
export interface SwivyLifiQuotePayload {
|
|
44
|
+
accountId: string;
|
|
45
|
+
fromChain: number;
|
|
46
|
+
toChain: number;
|
|
47
|
+
fromToken: string;
|
|
48
|
+
toToken: string;
|
|
49
|
+
fromAmount: string;
|
|
50
|
+
requestedValueUsd?: number | null;
|
|
51
|
+
toAddress?: string;
|
|
52
|
+
slippage?: number;
|
|
53
|
+
allowBridges?: string[];
|
|
54
|
+
denyBridges?: string[];
|
|
55
|
+
allowExchanges?: string[];
|
|
56
|
+
denyExchanges?: string[];
|
|
57
|
+
}
|
|
58
|
+
export interface SwivyJupiterQuotePayload {
|
|
59
|
+
accountId: string;
|
|
60
|
+
inputMint: string;
|
|
61
|
+
outputMint: string;
|
|
62
|
+
amount: string;
|
|
63
|
+
requestedValueUsd?: number | null;
|
|
64
|
+
slippageBps?: number;
|
|
65
|
+
swapMode?: "ExactIn" | "ExactOut";
|
|
66
|
+
buildTransaction?: boolean;
|
|
67
|
+
dynamicComputeUnitLimit?: boolean;
|
|
68
|
+
dynamicSlippage?: boolean;
|
|
69
|
+
prioritizationFeeLamports?: number | Record<string, unknown>;
|
|
70
|
+
}
|
|
71
|
+
export type SwivySwapQuotePayload = (SwivyLifiQuotePayload & {
|
|
72
|
+
provider: "lifi";
|
|
73
|
+
buildTransaction?: boolean;
|
|
74
|
+
}) | (SwivyJupiterQuotePayload & {
|
|
75
|
+
provider: "jupiter";
|
|
76
|
+
});
|
|
77
|
+
export type SwivyAuthenticateOptions = {
|
|
78
|
+
method?: "email";
|
|
79
|
+
email: string;
|
|
80
|
+
code: string;
|
|
81
|
+
externalUserId?: string;
|
|
82
|
+
} | {
|
|
83
|
+
method: "oidc";
|
|
84
|
+
token: string;
|
|
85
|
+
} | {
|
|
86
|
+
method: "wallet";
|
|
87
|
+
chain: Chain;
|
|
88
|
+
address: string;
|
|
89
|
+
challengeId: string;
|
|
90
|
+
signature: string;
|
|
91
|
+
};
|
|
92
|
+
export interface SwivyWalletLoginRequestOptions {
|
|
93
|
+
chain: Chain;
|
|
94
|
+
address: string;
|
|
95
|
+
connectorType?: string;
|
|
96
|
+
externalUserId?: string;
|
|
97
|
+
}
|
|
98
|
+
export interface SwivyWalletLoginChallenge {
|
|
99
|
+
challengeId: string;
|
|
100
|
+
chain: Chain;
|
|
101
|
+
address: string;
|
|
102
|
+
message: string;
|
|
103
|
+
nonce: string;
|
|
104
|
+
expiresAt: string;
|
|
105
|
+
}
|
|
106
|
+
export interface SwivyWalletLoginVerifyOptions {
|
|
107
|
+
chain: Chain;
|
|
108
|
+
address: string;
|
|
109
|
+
challengeId: string;
|
|
110
|
+
signature: string;
|
|
111
|
+
}
|
|
112
|
+
export interface SwivyWaitForIntentOptions {
|
|
113
|
+
timeoutMs?: number;
|
|
114
|
+
pollIntervalMs?: number;
|
|
115
|
+
signal?: AbortSignal;
|
|
116
|
+
}
|
|
117
|
+
export interface SwivyManagedAccountResolution {
|
|
118
|
+
account: ManagedAccountDescriptor;
|
|
119
|
+
existing: boolean;
|
|
120
|
+
attestation?: unknown;
|
|
121
|
+
}
|
|
122
|
+
export interface SwivyManagedAccountCreateOptions {
|
|
123
|
+
label?: string;
|
|
124
|
+
purpose?: WalletPurpose;
|
|
125
|
+
custodyMode?: CustodyMode;
|
|
126
|
+
splitCustody?: {
|
|
127
|
+
deviceShare: {
|
|
128
|
+
commitment: string;
|
|
129
|
+
encryptedPayload?: string;
|
|
130
|
+
metadata?: Record<string, unknown>;
|
|
131
|
+
};
|
|
132
|
+
recoveryShare?: {
|
|
133
|
+
commitment: string;
|
|
134
|
+
encryptedPayload?: string;
|
|
135
|
+
metadata?: Record<string, unknown>;
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
export interface SwivyBrowserSplitWalletCreateResult extends SwivyManagedAccountResolution {
|
|
140
|
+
recoveryPackage?: string;
|
|
141
|
+
deviceShare: SwivyLocalWalletShareRecord;
|
|
142
|
+
recoveryShare?: SwivyLocalWalletShareRecord;
|
|
143
|
+
}
|
|
144
|
+
export interface SwivyLocalExportOptions {
|
|
145
|
+
recoveryPackage?: string;
|
|
146
|
+
challengeId?: string;
|
|
147
|
+
}
|
|
148
|
+
export interface SwivyOfflineTransactionSigningOptions extends SwivyLocalExportOptions {
|
|
149
|
+
pairingSecret?: string;
|
|
150
|
+
requireSignature?: boolean;
|
|
151
|
+
localApproval?: {
|
|
152
|
+
type: "passkey";
|
|
153
|
+
verifiedAt: string;
|
|
154
|
+
};
|
|
155
|
+
metadata?: Record<string, unknown>;
|
|
156
|
+
}
|
|
157
|
+
export interface SwivyLocalSigningResult {
|
|
158
|
+
accountId: string;
|
|
159
|
+
chain: Chain;
|
|
160
|
+
signature?: string;
|
|
161
|
+
signedPayload?: string;
|
|
162
|
+
signerAddress: string;
|
|
163
|
+
signerPublicKey: string;
|
|
164
|
+
}
|
|
165
|
+
export interface SwivyExportedAccountPayload {
|
|
166
|
+
accountId: string;
|
|
167
|
+
chain: Chain;
|
|
168
|
+
privateKey: string;
|
|
169
|
+
attestation: unknown;
|
|
170
|
+
}
|
|
171
|
+
export interface SwivyRawSignPayload {
|
|
172
|
+
result: ExecutionResult;
|
|
173
|
+
}
|
|
174
|
+
export interface SwivySigningPayload {
|
|
175
|
+
accountId: string;
|
|
176
|
+
chain: Chain;
|
|
177
|
+
challengeId?: string;
|
|
178
|
+
payload: Record<string, unknown>;
|
|
179
|
+
}
|
|
180
|
+
export interface SwivyTypedDataSigningPayload {
|
|
181
|
+
accountId: string;
|
|
182
|
+
challengeId?: string;
|
|
183
|
+
typedData: TypedDataDescriptor;
|
|
184
|
+
}
|
|
185
|
+
export interface SwivyPasskeyRegistrationStartPayload {
|
|
186
|
+
authMethod: {
|
|
187
|
+
id: string;
|
|
188
|
+
type: "passkey";
|
|
189
|
+
label: string;
|
|
190
|
+
active: boolean;
|
|
191
|
+
recoveryCapable: boolean;
|
|
192
|
+
};
|
|
193
|
+
challengeId: string;
|
|
194
|
+
methodType: "passkey";
|
|
195
|
+
options: PublicKeyCredentialCreationOptionsJSON;
|
|
196
|
+
expiresAt: string;
|
|
197
|
+
}
|
|
198
|
+
export interface SwivyPasskeyChallengePayload {
|
|
199
|
+
challengeId: string;
|
|
200
|
+
purpose: SwivyChallengePurpose;
|
|
201
|
+
expiresAt: string;
|
|
202
|
+
methodType: "passkey";
|
|
203
|
+
options: PublicKeyCredentialRequestOptionsJSON;
|
|
204
|
+
}
|
|
205
|
+
export interface SwivyPasskeyApprovalOptions {
|
|
206
|
+
useBrowserAutofill?: boolean;
|
|
207
|
+
verifyBrowserAutofillInput?: boolean;
|
|
208
|
+
}
|
|
209
|
+
export interface SwivyPasskeyApprovalResult {
|
|
210
|
+
challenge: SwivyPasskeyChallengePayload;
|
|
211
|
+
verification: unknown;
|
|
212
|
+
authenticationResponse: AuthenticationResponseJSON;
|
|
213
|
+
}
|
|
214
|
+
export type SwivyWebAuthnOperation = "passkey_registration" | SwivyChallengePurpose;
|
|
215
|
+
export type SwivyWebAuthnErrorCode = "webauthn_not_supported" | "webauthn_wrong_origin" | "webauthn_stale_challenge" | "webauthn_missing_credential" | "webauthn_canceled" | "webauthn_credential_already_registered" | "webauthn_not_allowed" | "webauthn_failed";
|
|
216
|
+
export declare class SwivyWebAuthnError extends Error {
|
|
217
|
+
readonly name = "SwivyWebAuthnError";
|
|
218
|
+
readonly code: SwivyWebAuthnErrorCode;
|
|
219
|
+
readonly operation: SwivyWebAuthnOperation;
|
|
220
|
+
readonly retryable: boolean;
|
|
221
|
+
readonly recoveryHint: string;
|
|
222
|
+
readonly browserErrorName: string | null;
|
|
223
|
+
readonly rawMessage: string | null;
|
|
224
|
+
readonly cause: unknown;
|
|
225
|
+
constructor(params: {
|
|
226
|
+
code: SwivyWebAuthnErrorCode;
|
|
227
|
+
operation: SwivyWebAuthnOperation;
|
|
228
|
+
userMessage: string;
|
|
229
|
+
retryable: boolean;
|
|
230
|
+
recoveryHint: string;
|
|
231
|
+
browserErrorName?: string | null;
|
|
232
|
+
rawMessage?: string | null;
|
|
233
|
+
cause: unknown;
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
export declare function isSwivyWebAuthnError(error: unknown): error is SwivyWebAuthnError;
|
|
237
|
+
export interface SwivyLocalPasskeyOperationOptions extends SwivyPasskeyApprovalOptions {
|
|
238
|
+
recoveryPackage?: string;
|
|
239
|
+
}
|
|
240
|
+
export interface SwivyApprovedLocalOperationResult<T> {
|
|
241
|
+
approval: SwivyPasskeyApprovalResult;
|
|
242
|
+
result: T;
|
|
243
|
+
}
|
|
244
|
+
export interface SwivyRuntimeAuthMethod {
|
|
245
|
+
id: string;
|
|
246
|
+
type: string;
|
|
247
|
+
label: string;
|
|
248
|
+
active: boolean;
|
|
249
|
+
recoveryCapable?: boolean;
|
|
250
|
+
}
|
|
251
|
+
export interface SwivyRuntimeSession {
|
|
252
|
+
sessionToken?: string;
|
|
253
|
+
managedAccounts?: ManagedAccountDescriptor[];
|
|
254
|
+
linkedWallets?: LinkedWalletDescriptor[];
|
|
255
|
+
walletTools?: SwivyWalletToolDescriptor[];
|
|
256
|
+
authMethods?: SwivyRuntimeAuthMethod[];
|
|
257
|
+
environmentPolicy?: {
|
|
258
|
+
allowedChains?: Chain[];
|
|
259
|
+
walletPolicy?: {
|
|
260
|
+
allowManagedAccounts?: boolean;
|
|
261
|
+
allowSplitCustody?: boolean;
|
|
262
|
+
autoCreateManagedAccounts?: boolean;
|
|
263
|
+
defaultCustodyMode?: CustodyMode;
|
|
264
|
+
managedAccountChains?: Chain[];
|
|
265
|
+
};
|
|
266
|
+
offlineSigningPolicy?: {
|
|
267
|
+
enabled?: boolean;
|
|
268
|
+
bluetoothMeshEnabled?: boolean;
|
|
269
|
+
qrFallbackEnabled?: boolean;
|
|
270
|
+
nfcFallbackEnabled?: boolean;
|
|
271
|
+
fileFallbackEnabled?: boolean;
|
|
272
|
+
requireSplitCustody?: boolean;
|
|
273
|
+
requirePasskeyApproval?: boolean;
|
|
274
|
+
allowRecoveryPackageSigning?: boolean;
|
|
275
|
+
maxEnvelopeTtlSeconds?: number | null;
|
|
276
|
+
};
|
|
277
|
+
};
|
|
278
|
+
[key: string]: unknown;
|
|
279
|
+
}
|
|
280
|
+
export interface SwivyPasskeyEnsureResult {
|
|
281
|
+
authMethod: SwivyRuntimeAuthMethod;
|
|
282
|
+
existing: boolean;
|
|
283
|
+
enrollment?: Awaited<ReturnType<SwivyBrowserClient["enrollPasskey"]>>;
|
|
284
|
+
}
|
|
285
|
+
export interface SwivyPreparedLocalWalletResult {
|
|
286
|
+
account: ManagedAccountDescriptor;
|
|
287
|
+
passkey: SwivyPasskeyEnsureResult;
|
|
288
|
+
approval: SwivyPasskeyApprovalResult;
|
|
289
|
+
}
|
|
290
|
+
export declare class SwivyBrowserClient {
|
|
291
|
+
private readonly config;
|
|
292
|
+
sessionToken?: string;
|
|
293
|
+
private readonly sessionTokenListeners;
|
|
294
|
+
private readonly sessionPersistence?;
|
|
295
|
+
private readonly embeddedWalletStorage?;
|
|
296
|
+
private readonly embeddedWalletStorageKeyPrefix;
|
|
297
|
+
constructor(config: SwivyBrowserClientConfig);
|
|
298
|
+
getSessionToken(): string | undefined;
|
|
299
|
+
setSessionToken(token: string | undefined): void;
|
|
300
|
+
clearSessionToken(): void;
|
|
301
|
+
onSessionTokenChange(listener: (token: string | undefined) => void): () => void;
|
|
302
|
+
requestEmailCode(email: string, externalUserId?: string): Promise<any>;
|
|
303
|
+
verifyEmailCode(email: string, code: string, externalUserId?: string): Promise<any>;
|
|
304
|
+
verifyEmailCodeAndBootstrapWallets(email: string, code: string, externalUserId?: string): Promise<SwivyRuntimeSession>;
|
|
305
|
+
/** Create a new account with a passkey only (Privy signupWithPasskey). */
|
|
306
|
+
signupWithPasskey(options?: {
|
|
307
|
+
displayName?: string;
|
|
308
|
+
}): Promise<SwivyRuntimeSession>;
|
|
309
|
+
/** Log in with any passkey registered for this app (Privy loginWithPasskey). */
|
|
310
|
+
loginWithPasskey(options?: {
|
|
311
|
+
useBrowserAutofill?: boolean;
|
|
312
|
+
}): Promise<SwivyRuntimeSession>;
|
|
313
|
+
/** Send a login code by SMS (Privy loginWithSMS, step 1). Phone in E.164, e.g. +14155550123. */
|
|
314
|
+
requestSmsCode(phoneNumber: string): Promise<{
|
|
315
|
+
challengeId: string;
|
|
316
|
+
phoneNumber: string;
|
|
317
|
+
expiresAt: string;
|
|
318
|
+
}>;
|
|
319
|
+
verifySmsCode(challengeId: string, code: string): Promise<SwivyRuntimeSession>;
|
|
320
|
+
exchangeOidcToken(token: string): Promise<any>;
|
|
321
|
+
exchangeOidcTokenAndBootstrapWallets(token: string): Promise<SwivyRuntimeSession>;
|
|
322
|
+
requestWalletLogin(options: SwivyWalletLoginRequestOptions): Promise<SwivyWalletLoginChallenge>;
|
|
323
|
+
verifyWalletLogin(options: SwivyWalletLoginVerifyOptions): Promise<any>;
|
|
324
|
+
verifyWalletLoginAndBootstrapWallets(options: SwivyWalletLoginVerifyOptions): Promise<SwivyRuntimeSession>;
|
|
325
|
+
authenticate(options: SwivyAuthenticateOptions): Promise<SwivyRuntimeSession>;
|
|
326
|
+
hydrateRuntimeSession(): Promise<SwivyRuntimeSession>;
|
|
327
|
+
startTotp(label?: string): Promise<any>;
|
|
328
|
+
verifyTotp(authMethodId: string, code: string): Promise<any>;
|
|
329
|
+
startSmsEnrollment(phoneNumber: string, label?: string): Promise<any>;
|
|
330
|
+
verifySmsEnrollment(authMethodId: string, challengeId: string, code: string): Promise<any>;
|
|
331
|
+
getMe(): Promise<any>;
|
|
332
|
+
createManagedAccount(chain: Chain, options?: string | SwivyManagedAccountCreateOptions): Promise<any>;
|
|
333
|
+
listAccounts(): Promise<SwivyListAccountsPayload>;
|
|
334
|
+
listWalletTools(): Promise<SwivyWalletToolsPayload>;
|
|
335
|
+
createLifiQuote(body: SwivyLifiQuotePayload): Promise<any>;
|
|
336
|
+
createJupiterQuote(body: SwivyJupiterQuotePayload): Promise<any>;
|
|
337
|
+
createSwapQuote(body: SwivySwapQuotePayload): Promise<any>;
|
|
338
|
+
listEmbeddedWallets(): Promise<ManagedAccountDescriptor[]>;
|
|
339
|
+
getManagedAccount(chain: Chain, options?: {
|
|
340
|
+
purpose?: WalletPurpose;
|
|
341
|
+
}): Promise<ManagedAccountDescriptor | null>;
|
|
342
|
+
getEmbeddedWallet(chain: Chain): Promise<ManagedAccountDescriptor | null>;
|
|
343
|
+
ensureManagedAccount(chain: Chain, options?: string | SwivyManagedAccountCreateOptions): Promise<SwivyManagedAccountResolution>;
|
|
344
|
+
ensureEmbeddedWallet(chain: Chain, options?: string | SwivyManagedAccountCreateOptions): Promise<SwivyManagedAccountResolution>;
|
|
345
|
+
bootstrapEmbeddedWallets(payload?: SwivyRuntimeSession): Promise<SwivyRuntimeSession>;
|
|
346
|
+
createChallenge(authMethodId: string, purpose: SwivyChallengePurpose): Promise<any>;
|
|
347
|
+
verifyChallenge(challengeId: string, payload: Record<string, unknown>): Promise<any>;
|
|
348
|
+
isWebAuthnSupported(): Promise<boolean>;
|
|
349
|
+
isPlatformAuthenticatorAvailable(): Promise<boolean>;
|
|
350
|
+
isWebAuthnAutofillSupported(): Promise<boolean>;
|
|
351
|
+
startPasskeyRegistration(label?: string): Promise<SwivyPasskeyRegistrationStartPayload>;
|
|
352
|
+
finishPasskeyRegistration(authMethodId: string, challengeId: string, registrationResponse: RegistrationResponseJSON): Promise<any>;
|
|
353
|
+
enrollPasskey(label?: string, options?: {
|
|
354
|
+
useAutoRegister?: boolean;
|
|
355
|
+
}): Promise<any>;
|
|
356
|
+
ensurePasskey(label?: string, options?: {
|
|
357
|
+
useAutoRegister?: boolean;
|
|
358
|
+
}): Promise<SwivyPasskeyEnsureResult>;
|
|
359
|
+
completePasskeyChallenge(challengeId: string, optionsJSON: PublicKeyCredentialRequestOptionsJSON, operation: SwivyWebAuthnOperation, options?: {
|
|
360
|
+
useBrowserAutofill?: boolean;
|
|
361
|
+
verifyBrowserAutofillInput?: boolean;
|
|
362
|
+
}): Promise<{
|
|
363
|
+
verification: any;
|
|
364
|
+
authenticationResponse: AuthenticationResponseJSON;
|
|
365
|
+
}>;
|
|
366
|
+
approveWithPasskey(authMethodId: string, purpose: SwivyChallengePurpose, options?: SwivyPasskeyApprovalOptions): Promise<SwivyPasskeyApprovalResult>;
|
|
367
|
+
approveWalletReconstructionWithPasskey(authMethodId: string, options?: SwivyPasskeyApprovalOptions): Promise<SwivyPasskeyApprovalResult>;
|
|
368
|
+
prepareLocalWalletWithPasskey(accountId: string, options?: SwivyLocalPasskeyOperationOptions & {
|
|
369
|
+
authMethodId?: string;
|
|
370
|
+
passkeyLabel?: string;
|
|
371
|
+
useAutoRegister?: boolean;
|
|
372
|
+
}): Promise<SwivyPreparedLocalWalletResult>;
|
|
373
|
+
createSigningIntent(body: Record<string, unknown>): Promise<any>;
|
|
374
|
+
createTransactionIntent(body: Record<string, unknown>): Promise<any>;
|
|
375
|
+
getIntent(intentId: string): Promise<any>;
|
|
376
|
+
waitForIntent(intentId: string, options?: SwivyWaitForIntentOptions): Promise<TransactionIntent>;
|
|
377
|
+
createSigningIntentAndWait(body: Record<string, unknown>, options?: SwivyWaitForIntentOptions): Promise<TransactionIntent>;
|
|
378
|
+
signMessageAndWait(body: SwivySigningPayload & {
|
|
379
|
+
payload: {
|
|
380
|
+
message?: string;
|
|
381
|
+
messageHex?: string;
|
|
382
|
+
messageBase64?: string;
|
|
383
|
+
};
|
|
384
|
+
}, options?: SwivyWaitForIntentOptions): Promise<TransactionIntent>;
|
|
385
|
+
signTypedDataAndWait(body: SwivyTypedDataSigningPayload, options?: SwivyWaitForIntentOptions): Promise<TransactionIntent>;
|
|
386
|
+
signTransactionAndWait(body: SwivySigningPayload & {
|
|
387
|
+
payload: {
|
|
388
|
+
transaction?: Record<string, unknown>;
|
|
389
|
+
serializedTransactionBase64?: string;
|
|
390
|
+
};
|
|
391
|
+
}, options?: SwivyWaitForIntentOptions): Promise<TransactionIntent>;
|
|
392
|
+
createTransactionIntentAndWait(body: Record<string, unknown>, options?: SwivyWaitForIntentOptions): Promise<TransactionIntent>;
|
|
393
|
+
executeTransactionAndWait(body: Record<string, unknown>, options?: SwivyWaitForIntentOptions): Promise<TransactionIntent>;
|
|
394
|
+
exportManagedAccount(accountId: string, challengeId: string): Promise<SwivyExportedAccountPayload>;
|
|
395
|
+
rawSign(accountId: string, challengeId: string, payload: Record<string, unknown>): Promise<SwivyRawSignPayload>;
|
|
396
|
+
getAccountCustody(accountId: string): Promise<any>;
|
|
397
|
+
enableSplitCustody(accountId: string, splitCustody: NonNullable<SwivyManagedAccountCreateOptions["splitCustody"]>): Promise<any>;
|
|
398
|
+
createSessionGrant(body: {
|
|
399
|
+
accountId: string;
|
|
400
|
+
publicKey: string;
|
|
401
|
+
label?: string;
|
|
402
|
+
challengeId?: string;
|
|
403
|
+
expiresInSeconds?: number;
|
|
404
|
+
scope?: Partial<SessionGrantScope>;
|
|
405
|
+
}): Promise<{
|
|
406
|
+
sessionGrant: SessionGrantDescriptor;
|
|
407
|
+
}>;
|
|
408
|
+
listSessionGrants(): Promise<{
|
|
409
|
+
sessionGrants: SessionGrantDescriptor[];
|
|
410
|
+
}>;
|
|
411
|
+
revokeSessionGrant(grantId: string): Promise<{
|
|
412
|
+
sessionGrant: SessionGrantDescriptor;
|
|
413
|
+
}>;
|
|
414
|
+
createBrowserSplitWallet(chain: Chain, options?: {
|
|
415
|
+
label?: string;
|
|
416
|
+
}): Promise<SwivyBrowserSplitWalletCreateResult>;
|
|
417
|
+
ensureBrowserSplitWallet(chain: Chain, options?: {
|
|
418
|
+
label?: string;
|
|
419
|
+
}): Promise<SwivyBrowserSplitWalletCreateResult>;
|
|
420
|
+
getServerShare(accountId: string, challengeId: string): Promise<any>;
|
|
421
|
+
hasLocalEmbeddedWallet(accountId: string): boolean;
|
|
422
|
+
clearLocalEmbeddedWallet(accountId: string): void;
|
|
423
|
+
getLocalEmbeddedWalletShare(accountId: string): SwivyLocalWalletShareRecord | null;
|
|
424
|
+
exportEmbeddedWalletLocally(accountId: string, options?: SwivyLocalExportOptions): Promise<{
|
|
425
|
+
accountId: string;
|
|
426
|
+
chain: Chain;
|
|
427
|
+
privateKey: string;
|
|
428
|
+
publicKey: string;
|
|
429
|
+
address: string;
|
|
430
|
+
local: boolean;
|
|
431
|
+
}>;
|
|
432
|
+
exportEmbeddedWalletLocallyWithPasskey(accountId: string, authMethodId: string, options?: SwivyLocalPasskeyOperationOptions): Promise<SwivyApprovedLocalOperationResult<Awaited<ReturnType<SwivyBrowserClient["exportEmbeddedWalletLocally"]>>>>;
|
|
433
|
+
signMessageLocally(body: {
|
|
434
|
+
accountId: string;
|
|
435
|
+
chain: Chain;
|
|
436
|
+
payload: {
|
|
437
|
+
message?: string;
|
|
438
|
+
messageHex?: string;
|
|
439
|
+
messageBase64?: string;
|
|
440
|
+
};
|
|
441
|
+
}, options?: SwivyLocalExportOptions): Promise<SwivyLocalSigningResult>;
|
|
442
|
+
signMessageLocallyWithPasskey(body: {
|
|
443
|
+
accountId: string;
|
|
444
|
+
chain: Chain;
|
|
445
|
+
payload: {
|
|
446
|
+
message?: string;
|
|
447
|
+
messageHex?: string;
|
|
448
|
+
messageBase64?: string;
|
|
449
|
+
};
|
|
450
|
+
}, authMethodId: string, options?: SwivyLocalPasskeyOperationOptions): Promise<SwivyApprovedLocalOperationResult<SwivyLocalSigningResult>>;
|
|
451
|
+
signTypedDataLocally(body: {
|
|
452
|
+
accountId: string;
|
|
453
|
+
typedData: TypedDataDescriptor;
|
|
454
|
+
}, options?: SwivyLocalExportOptions): Promise<SwivyLocalSigningResult>;
|
|
455
|
+
signTypedDataLocallyWithPasskey(body: {
|
|
456
|
+
accountId: string;
|
|
457
|
+
typedData: TypedDataDescriptor;
|
|
458
|
+
}, authMethodId: string, options?: SwivyLocalPasskeyOperationOptions): Promise<SwivyApprovedLocalOperationResult<SwivyLocalSigningResult>>;
|
|
459
|
+
signTransactionLocally(body: {
|
|
460
|
+
accountId: string;
|
|
461
|
+
chain: Chain;
|
|
462
|
+
payload: {
|
|
463
|
+
transaction?: Record<string, unknown>;
|
|
464
|
+
serializedTransactionBase64?: string;
|
|
465
|
+
};
|
|
466
|
+
}, options?: SwivyLocalExportOptions): Promise<SwivyLocalSigningResult>;
|
|
467
|
+
signTransactionLocallyWithPasskey(body: {
|
|
468
|
+
accountId: string;
|
|
469
|
+
chain: Chain;
|
|
470
|
+
payload: {
|
|
471
|
+
transaction?: Record<string, unknown>;
|
|
472
|
+
serializedTransactionBase64?: string;
|
|
473
|
+
};
|
|
474
|
+
}, authMethodId: string, options?: SwivyLocalPasskeyOperationOptions): Promise<SwivyApprovedLocalOperationResult<SwivyLocalSigningResult>>;
|
|
475
|
+
createOfflineTransactionSigningEnvelope(body: {
|
|
476
|
+
accountId: string;
|
|
477
|
+
chain: Chain;
|
|
478
|
+
payload: {
|
|
479
|
+
network?: string | null;
|
|
480
|
+
transaction?: Record<string, unknown>;
|
|
481
|
+
serializedTransactionBase64?: string;
|
|
482
|
+
requestedValueUsd?: number | null;
|
|
483
|
+
};
|
|
484
|
+
expiresAt?: Date | string | null;
|
|
485
|
+
requester?: OfflineTransactionSigningEnvelope["requester"];
|
|
486
|
+
metadata?: Record<string, unknown>;
|
|
487
|
+
}): Promise<OfflineTransactionSigningEnvelope>;
|
|
488
|
+
signOfflineTransactionSigningEnvelope(envelope: OfflineTransactionSigningEnvelope | string, options?: SwivyOfflineTransactionSigningOptions): Promise<OfflineTransactionSigningResponseEnvelope>;
|
|
489
|
+
encodeOfflineSigningEnvelope(envelope: OfflineTransactionSigningEnvelope | OfflineTransactionSigningResponseEnvelope): string;
|
|
490
|
+
decodeOfflineSigningEnvelope(envelope: string): OfflineTransactionSigningEnvelope | OfflineTransactionSigningResponseEnvelope;
|
|
491
|
+
importOfflineTransactionSigningResponse(envelope: OfflineTransactionSigningResponseEnvelope | string, options?: {
|
|
492
|
+
network?: string | null;
|
|
493
|
+
broadcast?: boolean;
|
|
494
|
+
policySnapshotHash?: string | null;
|
|
495
|
+
metadata?: Record<string, unknown>;
|
|
496
|
+
}): Promise<{
|
|
497
|
+
imported: boolean;
|
|
498
|
+
broadcast: unknown | null;
|
|
499
|
+
}>;
|
|
500
|
+
private request;
|
|
501
|
+
private assertWebAuthnSupport;
|
|
502
|
+
private resolveSessionPersistence;
|
|
503
|
+
private resolveEmbeddedWalletStorage;
|
|
504
|
+
private requireEmbeddedWalletStorage;
|
|
505
|
+
private getMissingSplitCustodyChains;
|
|
506
|
+
private attachWalletTools;
|
|
507
|
+
private requireManagedAccountById;
|
|
508
|
+
private loadReconstructionShares;
|
|
509
|
+
private reportLocalSigningActivity;
|
|
510
|
+
private offlineSigningReplayStorageKey;
|
|
511
|
+
private hasSeenOfflineSigningRequest;
|
|
512
|
+
private markOfflineSigningRequestSeen;
|
|
513
|
+
private reportOfflineSigningActivity;
|
|
514
|
+
private delay;
|
|
515
|
+
}
|