@veridex/sdk 1.0.0-beta.15 → 1.0.0-beta.17
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 +1 -1
- package/dist/chains/aptos/index.d.mts +1 -1
- package/dist/chains/aptos/index.d.ts +1 -1
- package/dist/chains/evm/index.d.mts +3 -3
- package/dist/chains/evm/index.d.ts +3 -3
- package/dist/chains/solana/index.d.mts +1 -1
- package/dist/chains/solana/index.d.ts +1 -1
- package/dist/chains/stacks/index.d.mts +559 -0
- package/dist/chains/stacks/index.d.ts +559 -0
- package/dist/chains/stacks/index.js +1207 -0
- package/dist/chains/stacks/index.js.map +1 -0
- package/dist/chains/stacks/index.mjs +1149 -0
- package/dist/chains/stacks/index.mjs.map +1 -0
- package/dist/chains/starknet/index.d.mts +2 -2
- package/dist/chains/starknet/index.d.ts +2 -2
- package/dist/chains/sui/index.d.mts +2 -2
- package/dist/chains/sui/index.d.ts +2 -2
- package/dist/{index-BJlmzSvm.d.ts → index-BXcR_ypI.d.ts} +34 -3
- package/dist/{index-DkrLIDgS.d.mts → index-CYOyIE3b.d.mts} +34 -3
- package/dist/index.d.mts +249 -9
- package/dist/index.d.ts +249 -9
- package/dist/index.js +1675 -152
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1634 -152
- package/dist/index.mjs.map +1 -1
- package/dist/{types-ChIsqCiw.d.mts → types-DE2ICQik.d.mts} +5 -1
- package/dist/{types-ChIsqCiw.d.ts → types-DE2ICQik.d.ts} +5 -1
- package/dist/{types-FJL7j6gQ.d.mts → types-DvFRnIBd.d.mts} +1 -1
- package/dist/{types-FJL7j6gQ.d.ts → types-DvFRnIBd.d.ts} +1 -1
- package/dist/types.d.mts +4 -0
- package/dist/types.d.ts +4 -0
- package/dist/types.js.map +1 -1
- package/package.json +7 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,17 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
import { P as PasskeyManager } from './index-
|
|
4
|
-
export { E as EVMHubClientAdapter, H as HubClient, S as SessionManager } from './index-
|
|
1
|
+
import { W as WalletManagerConfig, P as PasskeyCredential, U as UnifiedIdentity, C as ChainAddress, B as BridgeParams, a as ChainConfig, V as VAA, b as VeridexPayload, c as PreparedTransfer, d as PreparedBridge, e as VeridexConfig, f as ChainClient, T as TransferParams, E as ExecuteParams, D as DispatchResult, g as BridgeResult, h as TransferResult, R as ReceiveAddress, i as VaultInfo, j as VaultCreationResult, I as IdentityState, A as AuthorizedKey, k as AddBackupKeyResult, l as RemoveKeyResult } from './types-DE2ICQik.mjs';
|
|
2
|
+
export { r as ActionPayload, o as BridgeAction, q as ConfigAction, m as ConfigParams, v as CrossChainFees, p as ExecuteAction, t as TestResult, u as TransactionHistoryEntry, n as TransferAction, s as VAASignature } from './types-DE2ICQik.mjs';
|
|
3
|
+
import { P as PasskeyManager, a as PasskeyCredential$1, W as WebAuthnSignature } from './index-CYOyIE3b.mjs';
|
|
4
|
+
export { E as EVMClient, e as EVMClientConfig, c as EVMHubClientAdapter, H as HubClient, b as PasskeyManagerConfig, S as SessionManager, V as VERIDEX_RP_ID, d as detectRpId, s as supportsRelatedOrigins } from './index-CYOyIE3b.mjs';
|
|
5
5
|
import { ethers } from 'ethers';
|
|
6
6
|
import { BridgeParams as BridgeParams$1, ChainConfig as ChainConfig$1 } from './types.mjs';
|
|
7
7
|
export { AddGuardianResult, ApproveRecoveryResult, CancelRecoveryResult, ExecuteRecoveryResult, ExecutionPath, GuardianConfig, InitiateRecoveryResult, QueryProof, QuerySubmissionResult, RecoveryStatus, RegisterSessionParams, RemoveGuardianResult, RevokeSessionParams, SessionKey, SessionValidationResult, SetupGuardiansResult } from './types.mjs';
|
|
8
|
-
|
|
9
|
-
export {
|
|
8
|
+
export { SolanaClient, SolanaClientConfig } from './chains/solana/index.mjs';
|
|
9
|
+
export { AptosClient, AptosClientConfig } from './chains/aptos/index.mjs';
|
|
10
|
+
export { SuiClient, SuiClientConfig } from './chains/sui/index.mjs';
|
|
11
|
+
export { StarknetClient, StarknetClientConfig } from './chains/starknet/index.mjs';
|
|
12
|
+
export { FtPostCondition, NftPostCondition, PostConditionComparison, STACKS_ACTION_TYPES, StacksClient, StacksClientConfig, PostCondition as StacksPostCondition, StxPostCondition, buildSbtcWithdrawalPostConditions, buildExecutePostConditions as buildStacksExecutePostConditions, buildStxDepositPostConditions, buildStxWithdrawalPostConditions, getContractPrincipal as getStacksContractPrincipal, getStacksExplorerAddressUrl, getStacksExplorerTxUrl, getNetworkFromAddress as getStacksNetworkFromAddress, isContractPrincipal as isStacksContractPrincipal, isValidContractName as isValidStacksContractName, isValidStacksPrincipal, isValidStandardPrincipal as isValidStacksStandardPrincipal, parseContractPrincipal as parseStacksContractPrincipal, buildExecuteHash as stacksBuildExecuteHash, buildRegistrationHash as stacksBuildRegistrationHash, buildRevocationHash as stacksBuildRevocationHash, buildSessionRegistrationHash as stacksBuildSessionRegistrationHash, buildWithdrawalHash as stacksBuildWithdrawalHash, compressPublicKey as stacksCompressPublicKey, computeKeyHash as stacksComputeKeyHash, computeKeyHashFromCoords as stacksComputeKeyHashFromCoords, derToCompactSignature as stacksDerToCompactSignature, rsToCompactSignature as stacksRsToCompactSignature, validatePostConditions as validateStacksPostConditions } from './chains/stacks/index.mjs';
|
|
13
|
+
import { S as SessionStorage, a as SessionKey } from './types-DvFRnIBd.mjs';
|
|
14
|
+
export { A as ActionParams, b as SessionConfig, i as SessionError, h as SessionErrorCode, e as SessionEvent, f as SessionEventCallback, d as SessionManagerConfig, c as SessionSignature, g as SessionSignedAction } from './types-DvFRnIBd.mjs';
|
|
10
15
|
export { ACTION_BRIDGE, ACTION_CONFIG, ACTION_EXECUTE, ACTION_TRANSFER, ACTION_TYPES, HUB_ABI, MAINNET_CHAINS, PROTOCOL_VERSION, TESTNET_CHAINS, VAULT_ABI, VAULT_FACTORY_ABI, WORMHOLE_API, WORMHOLE_CHAIN_IDS, WORMHOLE_CHAIN_IDS_FLAT } from './constants.mjs';
|
|
11
16
|
export { base64URLDecode, base64URLEncode, computeKeyHash, encodeSignatureForSolidity, getAddressExplorerUrl, getChainByEvmId, getChainByWormholeId, getTxExplorerUrl, isEvmChain, isValidBytes32, isValidEvmAddress, isValidWormholeChainId, parseDERSignature, retryWithBackoff } from './utils.mjs';
|
|
12
17
|
export { buildChallenge, buildGaslessChallenge, createGaslessMessageHash, createMessageHash, decodeActionPayload, decodeBridgeAction, decodeExecuteAction, decodeTransferAction, encodeAptosTransferAction, encodeBridgeAction, encodeConfigAction, encodeExecuteAction, encodeSolanaTransferAction, encodeSuiTransferAction, encodeTransferAction, encodeVeridexPayload, formatAmount, generateNonce, padTo32Bytes, parseAmount, solanaAddressToBytes32, trimTo20Bytes } from './payload.mjs';
|
|
13
18
|
export { HubStateQuery, HubStateResult, PortfolioChainErrorCode, PortfolioChainResult, PortfolioQuery, PortfolioResult, QueryConfig, QueryHubStateError, QueryHubStateErrorCode, QueryHubStateNetwork, QueryHubStateOptions, QueryNetwork, QueryOperation, QueryOperationType, QueryPortfolioError, QueryPortfolioErrorCode, QueryPortfolioNetwork, QueryPortfolioOptions, QueryRequest, QueryResponse, WORMHOLE_QUERY_CHAIN_IDS, WORMHOLE_QUERY_PROXY_URLS, WORMHOLE_QUERY_RATE_LIMIT_PER_SECOND, queryHubState, queryPortfolio } from './queries/index.mjs';
|
|
14
19
|
export { CONSISTENCY_LEVELS, FetchVAAOptions, GUARDIAN_CONFIG, WaitForSignaturesOptions, emitterToEvmAddress, encodeVAAForSolana, encodeVAAToBytes, evmAddressToBytes32, fetchVAA, fetchVAAByTxHash, fetchVAAByTxHashFallback, getSequenceFromTxReceipt, getWormholeCoreBridge, getWormholeRelayer, getWormholeTokenBridge, hasQuorum, normalizeEmitterAddress, parseVAA, parseVAABytes, parseVeridexPayload, supportsRelayer, validateEmitter, waitForGuardianSignatures } from './wormhole.mjs';
|
|
20
|
+
import '@solana/web3.js';
|
|
21
|
+
import '@aptos-labs/ts-sdk';
|
|
22
|
+
import '@mysten/sui/client';
|
|
23
|
+
import 'starknet';
|
|
15
24
|
import '@wormhole-foundation/wormhole-query-sdk';
|
|
16
25
|
|
|
17
26
|
/**
|
|
@@ -2111,6 +2120,7 @@ declare const CHAIN_NAMES: {
|
|
|
2111
2120
|
readonly APTOS: "aptos";
|
|
2112
2121
|
readonly SUI: "sui";
|
|
2113
2122
|
readonly STARKNET: "starknet";
|
|
2123
|
+
readonly STACKS: "stacks";
|
|
2114
2124
|
readonly NEAR: "near";
|
|
2115
2125
|
readonly SEI: "sei";
|
|
2116
2126
|
};
|
|
@@ -2120,7 +2130,7 @@ interface ChainPreset {
|
|
|
2120
2130
|
/** Human-readable chain name */
|
|
2121
2131
|
displayName: string;
|
|
2122
2132
|
/** Chain type for client selection */
|
|
2123
|
-
type: 'evm' | 'solana' | 'aptos' | 'sui' | 'starknet' | 'near' | 'cosmos';
|
|
2133
|
+
type: 'evm' | 'solana' | 'aptos' | 'sui' | 'starknet' | 'stacks' | 'near' | 'cosmos';
|
|
2124
2134
|
/** Whether this chain can be a hub */
|
|
2125
2135
|
canBeHub: boolean;
|
|
2126
2136
|
/** Testnet configuration */
|
|
@@ -2261,7 +2271,7 @@ interface SessionConfig {
|
|
|
2261
2271
|
*
|
|
2262
2272
|
* // With relayer for gasless transactions
|
|
2263
2273
|
* const gaslessSdk = await createSDK('base', {
|
|
2264
|
-
* relayerUrl: 'https://relayer.veridex.
|
|
2274
|
+
* relayerUrl: 'https://relayer.veridex.network',
|
|
2265
2275
|
* relayerApiKey: 'your-api-key',
|
|
2266
2276
|
* });
|
|
2267
2277
|
* ```
|
|
@@ -2322,6 +2332,236 @@ declare function createMainnetSDK(chain?: ChainName, config?: Omit<SimpleSDKConf
|
|
|
2322
2332
|
*/
|
|
2323
2333
|
declare function createSessionSDK(chain?: ChainName, config?: SimpleSDKConfig): VeridexSDK;
|
|
2324
2334
|
|
|
2335
|
+
/**
|
|
2336
|
+
* Veridex Protocol SDK - Cross-Origin Authentication
|
|
2337
|
+
*
|
|
2338
|
+
* Enables passkey sharing across different domains using WebAuthn Related Origin Requests.
|
|
2339
|
+
*
|
|
2340
|
+
* There are two approaches for cross-domain passkey usage:
|
|
2341
|
+
*
|
|
2342
|
+
* 1. **Related Origin Requests (Recommended)** - W3C Standard
|
|
2343
|
+
* - Host a `.well-known/webauthn` file at veridex.network
|
|
2344
|
+
* - Third-party apps use rpId: 'veridex.network' directly
|
|
2345
|
+
* - Requires browser support for Related Origin Requests
|
|
2346
|
+
* - No popup needed, seamless UX
|
|
2347
|
+
*
|
|
2348
|
+
* 2. **Auth Portal Flow (Fallback)** - Popup/Redirect Pattern
|
|
2349
|
+
* - User is redirected to auth.veridex.network
|
|
2350
|
+
* - Signs with their passkey at veridex.network
|
|
2351
|
+
* - Returns a session token to the third-party app
|
|
2352
|
+
* - Works on all browsers, but requires popup/redirect
|
|
2353
|
+
*
|
|
2354
|
+
* @example Related Origins (Recommended)
|
|
2355
|
+
* ```typescript
|
|
2356
|
+
* import { createCrossOriginAuth } from '@veridex/sdk';
|
|
2357
|
+
*
|
|
2358
|
+
* const auth = createCrossOriginAuth();
|
|
2359
|
+
*
|
|
2360
|
+
* // Check if browser supports Related Origin Requests
|
|
2361
|
+
* if (await auth.supportsRelatedOrigins()) {
|
|
2362
|
+
* // Direct passkey usage with veridex.network rpId
|
|
2363
|
+
* const credential = await auth.authenticate();
|
|
2364
|
+
* } else {
|
|
2365
|
+
* // Fallback to Auth Portal
|
|
2366
|
+
* const session = await auth.authenticateViaPortal();
|
|
2367
|
+
* }
|
|
2368
|
+
* ```
|
|
2369
|
+
*
|
|
2370
|
+
* @example Auth Portal Flow
|
|
2371
|
+
* ```typescript
|
|
2372
|
+
* const auth = createCrossOriginAuth({
|
|
2373
|
+
* authPortalUrl: 'https://auth.veridex.network',
|
|
2374
|
+
* mode: 'popup', // or 'redirect'
|
|
2375
|
+
* });
|
|
2376
|
+
*
|
|
2377
|
+
* const session = await auth.connectWithVeridex();
|
|
2378
|
+
* // session contains: { address, sessionKey, expiresAt }
|
|
2379
|
+
* ```
|
|
2380
|
+
*/
|
|
2381
|
+
|
|
2382
|
+
/** Default auth portal URL */
|
|
2383
|
+
declare const DEFAULT_AUTH_PORTAL_URL = "https://auth.veridex.network";
|
|
2384
|
+
/** Default relayer API URL for server-side session tokens */
|
|
2385
|
+
declare const DEFAULT_RELAYER_URL = "https://amused-kameko-veridex-demo-37453117.koyeb.app/api/v1";
|
|
2386
|
+
/** Message types for postMessage communication */
|
|
2387
|
+
declare const AUTH_MESSAGE_TYPES: {
|
|
2388
|
+
readonly AUTH_REQUEST: "VERIDEX_AUTH_REQUEST";
|
|
2389
|
+
readonly AUTH_RESPONSE: "VERIDEX_AUTH_RESPONSE";
|
|
2390
|
+
readonly AUTH_ERROR: "VERIDEX_AUTH_ERROR";
|
|
2391
|
+
};
|
|
2392
|
+
interface CrossOriginAuthConfig {
|
|
2393
|
+
/** The Veridex RP ID (defaults to veridex.network) */
|
|
2394
|
+
rpId?: string;
|
|
2395
|
+
/** Auth portal URL for popup/redirect flow */
|
|
2396
|
+
authPortalUrl?: string;
|
|
2397
|
+
/** Relayer API URL for server-side session tokens */
|
|
2398
|
+
relayerUrl?: string;
|
|
2399
|
+
/** Authentication mode: popup or redirect */
|
|
2400
|
+
mode?: 'popup' | 'redirect';
|
|
2401
|
+
/** Popup window features */
|
|
2402
|
+
popupFeatures?: string;
|
|
2403
|
+
/** Timeout for auth operations (ms) */
|
|
2404
|
+
timeout?: number;
|
|
2405
|
+
/** Callback URL for redirect mode */
|
|
2406
|
+
redirectUri?: string;
|
|
2407
|
+
}
|
|
2408
|
+
interface CrossOriginSession {
|
|
2409
|
+
/** User's vault address */
|
|
2410
|
+
address: string;
|
|
2411
|
+
/** Session key public key (for signing transactions) */
|
|
2412
|
+
sessionPublicKey: string;
|
|
2413
|
+
/** Session key (encrypted, stored on client) */
|
|
2414
|
+
encryptedSessionKey?: string;
|
|
2415
|
+
/** When the session expires */
|
|
2416
|
+
expiresAt: number;
|
|
2417
|
+
/** Proof of passkey ownership */
|
|
2418
|
+
signature: WebAuthnSignature;
|
|
2419
|
+
/** The credential used */
|
|
2420
|
+
credential: PasskeyCredential$1;
|
|
2421
|
+
/** Server-validated session token ID (from relayer) */
|
|
2422
|
+
serverSessionId?: string;
|
|
2423
|
+
}
|
|
2424
|
+
/** Server-side session token returned by the relayer */
|
|
2425
|
+
interface ServerSessionToken {
|
|
2426
|
+
id: string;
|
|
2427
|
+
keyHash: string;
|
|
2428
|
+
appOrigin: string;
|
|
2429
|
+
permissions: string[];
|
|
2430
|
+
expiresAt: number;
|
|
2431
|
+
createdAt: number;
|
|
2432
|
+
}
|
|
2433
|
+
interface AuthPortalMessage {
|
|
2434
|
+
type: typeof AUTH_MESSAGE_TYPES[keyof typeof AUTH_MESSAGE_TYPES];
|
|
2435
|
+
payload: CrossOriginSession | {
|
|
2436
|
+
error: string;
|
|
2437
|
+
code: string;
|
|
2438
|
+
};
|
|
2439
|
+
origin: string;
|
|
2440
|
+
}
|
|
2441
|
+
/**
|
|
2442
|
+
* Manages cross-origin passkey authentication for third-party apps.
|
|
2443
|
+
*
|
|
2444
|
+
* Third-party developers can use this to enable Veridex passkey authentication
|
|
2445
|
+
* in their own applications without users having to create new passkeys.
|
|
2446
|
+
*/
|
|
2447
|
+
declare class CrossOriginAuth {
|
|
2448
|
+
private config;
|
|
2449
|
+
private passkeyManager;
|
|
2450
|
+
constructor(config?: CrossOriginAuthConfig);
|
|
2451
|
+
/**
|
|
2452
|
+
* Check if the browser supports Related Origin Requests.
|
|
2453
|
+
* This is a WebAuthn Level 3 feature that allows using passkeys across different domains.
|
|
2454
|
+
*/
|
|
2455
|
+
supportsRelatedOrigins(): Promise<boolean>;
|
|
2456
|
+
/**
|
|
2457
|
+
* Check if WebAuthn is supported at all.
|
|
2458
|
+
*/
|
|
2459
|
+
isSupported(): boolean;
|
|
2460
|
+
/**
|
|
2461
|
+
* Authenticate using Related Origin Requests.
|
|
2462
|
+
* This allows using a passkey registered at veridex.network from any origin
|
|
2463
|
+
* listed in the /.well-known/webauthn file.
|
|
2464
|
+
*
|
|
2465
|
+
* @throws If browser doesn't support Related Origin Requests
|
|
2466
|
+
* @throws If the current origin isn't listed in veridex.network's well-known file
|
|
2467
|
+
*/
|
|
2468
|
+
authenticate(challenge?: Uint8Array): Promise<{
|
|
2469
|
+
credential: PasskeyCredential$1;
|
|
2470
|
+
signature: WebAuthnSignature;
|
|
2471
|
+
}>;
|
|
2472
|
+
/**
|
|
2473
|
+
* Register a new passkey with veridex.network as the RP.
|
|
2474
|
+
* This should only be called from veridex.network origins.
|
|
2475
|
+
*/
|
|
2476
|
+
register(username: string, displayName: string): Promise<PasskeyCredential$1>;
|
|
2477
|
+
/**
|
|
2478
|
+
* Authenticate via the Veridex Auth Portal.
|
|
2479
|
+
* Opens a popup or redirects to auth.veridex.network where the user
|
|
2480
|
+
* signs with their passkey, then returns a session to the calling app.
|
|
2481
|
+
*/
|
|
2482
|
+
connectWithVeridex(): Promise<CrossOriginSession>;
|
|
2483
|
+
/**
|
|
2484
|
+
* Popup-based authentication flow.
|
|
2485
|
+
*/
|
|
2486
|
+
private authenticateViaPopup;
|
|
2487
|
+
/**
|
|
2488
|
+
* Redirect-based authentication flow.
|
|
2489
|
+
* Stores state in sessionStorage and redirects to auth portal.
|
|
2490
|
+
*/
|
|
2491
|
+
private initiateRedirectAuth;
|
|
2492
|
+
/**
|
|
2493
|
+
* Complete redirect-based authentication.
|
|
2494
|
+
* Call this on your callback page to extract the session from URL params.
|
|
2495
|
+
*/
|
|
2496
|
+
completeRedirectAuth(): CrossOriginSession | null;
|
|
2497
|
+
/**
|
|
2498
|
+
* Generate a random state string for CSRF protection.
|
|
2499
|
+
*/
|
|
2500
|
+
private generateState;
|
|
2501
|
+
/**
|
|
2502
|
+
* Get the RP ID being used.
|
|
2503
|
+
*/
|
|
2504
|
+
getRpId(): string;
|
|
2505
|
+
/**
|
|
2506
|
+
* Get the auth portal URL.
|
|
2507
|
+
*/
|
|
2508
|
+
getAuthPortalUrl(): string;
|
|
2509
|
+
/**
|
|
2510
|
+
* Create a server-validated session token via the relayer.
|
|
2511
|
+
* Call this after authenticating (via ROR or auth portal) to get a
|
|
2512
|
+
* server-side session that the relayer can verify on subsequent requests.
|
|
2513
|
+
*/
|
|
2514
|
+
createServerSession(session: CrossOriginSession, options?: {
|
|
2515
|
+
permissions?: string[];
|
|
2516
|
+
expiresInMs?: number;
|
|
2517
|
+
}): Promise<ServerSessionToken>;
|
|
2518
|
+
/**
|
|
2519
|
+
* Validate an existing server session token.
|
|
2520
|
+
* Returns the session details if valid, null if expired/revoked.
|
|
2521
|
+
*/
|
|
2522
|
+
validateServerSession(sessionId: string): Promise<ServerSessionToken | null>;
|
|
2523
|
+
/**
|
|
2524
|
+
* Revoke a server session token.
|
|
2525
|
+
*/
|
|
2526
|
+
revokeServerSession(sessionId: string): Promise<boolean>;
|
|
2527
|
+
/**
|
|
2528
|
+
* Full authentication flow: authenticate + create server session.
|
|
2529
|
+
* Automatically detects ROR support and falls back to auth portal.
|
|
2530
|
+
*/
|
|
2531
|
+
authenticateAndCreateSession(options?: {
|
|
2532
|
+
permissions?: string[];
|
|
2533
|
+
expiresInMs?: number;
|
|
2534
|
+
}): Promise<{
|
|
2535
|
+
session: CrossOriginSession;
|
|
2536
|
+
serverSession: ServerSessionToken;
|
|
2537
|
+
}>;
|
|
2538
|
+
}
|
|
2539
|
+
/**
|
|
2540
|
+
* Create a CrossOriginAuth instance for third-party app integration.
|
|
2541
|
+
*
|
|
2542
|
+
* @example
|
|
2543
|
+
* ```typescript
|
|
2544
|
+
* const auth = createCrossOriginAuth();
|
|
2545
|
+
*
|
|
2546
|
+
* // Check for Related Origin support
|
|
2547
|
+
* if (await auth.supportsRelatedOrigins()) {
|
|
2548
|
+
* const { credential, signature } = await auth.authenticate();
|
|
2549
|
+
* } else {
|
|
2550
|
+
* const session = await auth.connectWithVeridex();
|
|
2551
|
+
* }
|
|
2552
|
+
* ```
|
|
2553
|
+
*/
|
|
2554
|
+
declare function createCrossOriginAuth(config?: CrossOriginAuthConfig): CrossOriginAuth;
|
|
2555
|
+
/**
|
|
2556
|
+
* Helper for the auth portal page to send results back to the calling app.
|
|
2557
|
+
* Only used on auth.veridex.network, not in third-party apps.
|
|
2558
|
+
*/
|
|
2559
|
+
declare function sendAuthResponse(session: CrossOriginSession, targetOrigin: string): void;
|
|
2560
|
+
/**
|
|
2561
|
+
* Helper for the auth portal to send an error back to the calling app.
|
|
2562
|
+
*/
|
|
2563
|
+
declare function sendAuthError(error: string, code: string, targetOrigin: string): void;
|
|
2564
|
+
|
|
2325
2565
|
/**
|
|
2326
2566
|
* Veridex Protocol SDK - Chain Detector
|
|
2327
2567
|
*
|
|
@@ -3121,4 +3361,4 @@ type AuthenticateAndPrepareResult = {
|
|
|
3121
3361
|
*/
|
|
3122
3362
|
declare function authenticateAndPrepare(userParams: AuthenticateAndPrepareParams, apiKey: string): Promise<AuthenticateAndPrepareResult>;
|
|
3123
3363
|
|
|
3124
|
-
export { ARBITRUM_SEPOLIA_TOKENS, type ActionDetails, type ActionDisplayType, AddBackupKeyResult, type AuthenticateAndPrepareParams, type AuthenticateAndPrepareResult, AuthorizedKey, BASE_SEPOLIA_TOKENS, BalanceManager, type BalanceManagerConfig, type BridgeDetails, BridgeParams, BridgeResult, CHAIN_DISPLAY_INFO, CHAIN_NAMES, CHAIN_PRESETS, CONFIG_TYPE, ChainAddress, type ChainAddressConfig, ChainClient, ChainConfig, type ChainDeploymentConfig, ChainDetector, type ChainDetectorConfig, type ChainDisplay, type ChainName, type ChainTokenList, type ConfigDetails, type CrossChainConfig, CrossChainManager, type CrossChainProgress, type CrossChainProgressCallback, type CrossChainResult, type CrossChainStatus, DEFAULT_REFRESH_BUFFER, DEFAULT_SESSION_DURATION, type DailySpendingSummary, DispatchResult, type DurationDisplay, ERROR_MESSAGES, ERROR_RANGES, ETHEREUM_SEPOLIA_TOKENS, EVM_ZERO_ADDRESS, type ExecuteDetails, ExecuteParams, type FormattedSpendingLimits, GasSponsor, type GasSponsorConfig, IdentityState, IndexedDBSessionStorage, type KeyPair, LIMIT_PRESETS, type LimitCheckResult, type LimitPreset, type LimitViolationSuggestion, type LimitViolationType, LocalStorageSessionStorage, MAX_SESSION_DURATION, MIN_SESSION_DURATION, type MultiChainVaultResult, NATIVE_TOKEN_ADDRESS, type NativeBalanceCapable, type NetworkType, OPTIMISM_SEPOLIA_TOKENS, PasskeyCredential, PasskeyManager, type PortfolioBalance, PreparedBridge, PreparedTransfer, ReceiveAddress, type RecipientDisplay, type RelayFeeQuote, type RelayRequest, type RelayRoute, type RelayStatus, RelayerClient, type RelayerClientConfig, type RelayerInfo, RemoveKeyResult, type RiskLevel, type RiskWarning, type RiskWarningType, SessionStorage, type SetDailyLimitParams, type SetTransactionLimitParams, type SimpleSDKConfig, type SessionConfig as SimpleSessionConfig, type SpendingLimitChangedEvent, type SpendingLimitConfig, type SpendingLimitEventCallback, type SpendingLimits, SpendingLimitsManager, type SpendingLimitsManagerConfig, type SpendingTransaction, type SponsoredVaultResult, type SponsorshipSource, type SubmitActionResult, type SubmitQueryRequest, type SubmitQueryResult, type SubmitSignedActionRequest, TOKEN_REGISTRY, type TokenBalance, type TokenDisplay, type TokenInfo$1 as TokenInfo, type TrackerConfig, type TransactionAuditEntry, type TransactionCallback, TransactionParser, type TransactionParserConfig, type TransactionState, type TransactionStatus, type TransactionSummary, TransactionTracker, type TransferDetails, TransferParams, TransferResult, UnifiedIdentity, VAA, VERIDEX_ERRORS, VaultCreationResult, VaultInfo, VeridexConfig, type VeridexErrorCode, VeridexPayload, VeridexSDK, WalletManager, WalletManagerConfig, authenticateAndPrepare, calculatePercentage, computeSessionKeyHash, createAuditEntry, createChainDetector, createGasSponsor, createHubSDK, createMainnetSDK, createRelayerClient, createSDK, createSessionSDK, createSessionStorage, createSpendingLimitsManager, createTestnetSDK, createTransactionParser, crossChainManager, decrypt, VeridexSDK as default, deriveEncryptionKey, encrypt, formatDuration, formatLargeAmount, formatTransactionState, generateSecp256k1KeyPair, getAllTokens, getChainConfig, getChainDisplay, getChainName, getChainPreset, getConfigTypeName, getDefaultHub, getErrorCategory, getErrorMessage, getExplorerUrl, getHubChains, getSuggestedAction, getSupportedChainIds, getSupportedChains, getTokenByAddress, getTokenBySymbol, getTokenList, hashAction, isAbiError, isChainSupported, isCoreError, isNativeToken, isQueryError, isQueryExecutionError, isQueryParsingError, isRetryableError, logTransactionSummary, parseVeridexError, signWithSessionKey, validateSessionConfig, verifySessionSignature };
|
|
3364
|
+
export { ARBITRUM_SEPOLIA_TOKENS, AUTH_MESSAGE_TYPES, type ActionDetails, type ActionDisplayType, AddBackupKeyResult, type AuthPortalMessage, type AuthenticateAndPrepareParams, type AuthenticateAndPrepareResult, AuthorizedKey, BASE_SEPOLIA_TOKENS, BalanceManager, type BalanceManagerConfig, type BridgeDetails, BridgeParams, BridgeResult, CHAIN_DISPLAY_INFO, CHAIN_NAMES, CHAIN_PRESETS, CONFIG_TYPE, ChainAddress, type ChainAddressConfig, ChainClient, ChainConfig, type ChainDeploymentConfig, ChainDetector, type ChainDetectorConfig, type ChainDisplay, type ChainName, type ChainTokenList, type ConfigDetails, type CrossChainConfig, CrossChainManager, type CrossChainProgress, type CrossChainProgressCallback, type CrossChainResult, type CrossChainStatus, CrossOriginAuth, type CrossOriginAuthConfig, type CrossOriginSession, DEFAULT_AUTH_PORTAL_URL, DEFAULT_REFRESH_BUFFER, DEFAULT_RELAYER_URL, DEFAULT_SESSION_DURATION, type DailySpendingSummary, DispatchResult, type DurationDisplay, ERROR_MESSAGES, ERROR_RANGES, ETHEREUM_SEPOLIA_TOKENS, EVM_ZERO_ADDRESS, type ExecuteDetails, ExecuteParams, type FormattedSpendingLimits, GasSponsor, type GasSponsorConfig, IdentityState, IndexedDBSessionStorage, type KeyPair, LIMIT_PRESETS, type LimitCheckResult, type LimitPreset, type LimitViolationSuggestion, type LimitViolationType, LocalStorageSessionStorage, MAX_SESSION_DURATION, MIN_SESSION_DURATION, type MultiChainVaultResult, NATIVE_TOKEN_ADDRESS, type NativeBalanceCapable, type NetworkType, OPTIMISM_SEPOLIA_TOKENS, PasskeyCredential$1 as PasskeyCredential, PasskeyManager, type PortfolioBalance, PreparedBridge, PreparedTransfer, ReceiveAddress, type RecipientDisplay, type RelayFeeQuote, type RelayRequest, type RelayRoute, type RelayStatus, RelayerClient, type RelayerClientConfig, type RelayerInfo, RemoveKeyResult, type RiskLevel, type RiskWarning, type RiskWarningType, type ServerSessionToken, SessionStorage, type SetDailyLimitParams, type SetTransactionLimitParams, type SimpleSDKConfig, type SessionConfig as SimpleSessionConfig, type SpendingLimitChangedEvent, type SpendingLimitConfig, type SpendingLimitEventCallback, type SpendingLimits, SpendingLimitsManager, type SpendingLimitsManagerConfig, type SpendingTransaction, type SponsoredVaultResult, type SponsorshipSource, type SubmitActionResult, type SubmitQueryRequest, type SubmitQueryResult, type SubmitSignedActionRequest, TOKEN_REGISTRY, type TokenBalance, type TokenDisplay, type TokenInfo$1 as TokenInfo, type TrackerConfig, type TransactionAuditEntry, type TransactionCallback, TransactionParser, type TransactionParserConfig, type TransactionState, type TransactionStatus, type TransactionSummary, TransactionTracker, type TransferDetails, TransferParams, TransferResult, UnifiedIdentity, VAA, VERIDEX_ERRORS, VaultCreationResult, VaultInfo, VeridexConfig, type VeridexErrorCode, VeridexPayload, VeridexSDK, WalletManager, WalletManagerConfig, WebAuthnSignature, authenticateAndPrepare, calculatePercentage, computeSessionKeyHash, createAuditEntry, createChainDetector, createCrossOriginAuth, createGasSponsor, createHubSDK, createMainnetSDK, createRelayerClient, createSDK, createSessionSDK, createSessionStorage, createSpendingLimitsManager, createTestnetSDK, createTransactionParser, crossChainManager, decrypt, VeridexSDK as default, deriveEncryptionKey, encrypt, formatDuration, formatLargeAmount, formatTransactionState, generateSecp256k1KeyPair, getAllTokens, getChainConfig, getChainDisplay, getChainName, getChainPreset, getConfigTypeName, getDefaultHub, getErrorCategory, getErrorMessage, getExplorerUrl, getHubChains, getSuggestedAction, getSupportedChainIds, getSupportedChains, getTokenByAddress, getTokenBySymbol, getTokenList, hashAction, isAbiError, isChainSupported, isCoreError, isNativeToken, isQueryError, isQueryExecutionError, isQueryParsingError, isRetryableError, logTransactionSummary, parseVeridexError, sendAuthError, sendAuthResponse, signWithSessionKey, validateSessionConfig, verifySessionSignature };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
import { P as PasskeyManager } from './index-
|
|
4
|
-
export { E as EVMHubClientAdapter, H as HubClient, S as SessionManager } from './index-
|
|
1
|
+
import { W as WalletManagerConfig, P as PasskeyCredential, U as UnifiedIdentity, C as ChainAddress, B as BridgeParams, a as ChainConfig, V as VAA, b as VeridexPayload, c as PreparedTransfer, d as PreparedBridge, e as VeridexConfig, f as ChainClient, T as TransferParams, E as ExecuteParams, D as DispatchResult, g as BridgeResult, h as TransferResult, R as ReceiveAddress, i as VaultInfo, j as VaultCreationResult, I as IdentityState, A as AuthorizedKey, k as AddBackupKeyResult, l as RemoveKeyResult } from './types-DE2ICQik.js';
|
|
2
|
+
export { r as ActionPayload, o as BridgeAction, q as ConfigAction, m as ConfigParams, v as CrossChainFees, p as ExecuteAction, t as TestResult, u as TransactionHistoryEntry, n as TransferAction, s as VAASignature } from './types-DE2ICQik.js';
|
|
3
|
+
import { P as PasskeyManager, a as PasskeyCredential$1, W as WebAuthnSignature } from './index-BXcR_ypI.js';
|
|
4
|
+
export { E as EVMClient, e as EVMClientConfig, c as EVMHubClientAdapter, H as HubClient, b as PasskeyManagerConfig, S as SessionManager, V as VERIDEX_RP_ID, d as detectRpId, s as supportsRelatedOrigins } from './index-BXcR_ypI.js';
|
|
5
5
|
import { ethers } from 'ethers';
|
|
6
6
|
import { BridgeParams as BridgeParams$1, ChainConfig as ChainConfig$1 } from './types.js';
|
|
7
7
|
export { AddGuardianResult, ApproveRecoveryResult, CancelRecoveryResult, ExecuteRecoveryResult, ExecutionPath, GuardianConfig, InitiateRecoveryResult, QueryProof, QuerySubmissionResult, RecoveryStatus, RegisterSessionParams, RemoveGuardianResult, RevokeSessionParams, SessionKey, SessionValidationResult, SetupGuardiansResult } from './types.js';
|
|
8
|
-
|
|
9
|
-
export {
|
|
8
|
+
export { SolanaClient, SolanaClientConfig } from './chains/solana/index.js';
|
|
9
|
+
export { AptosClient, AptosClientConfig } from './chains/aptos/index.js';
|
|
10
|
+
export { SuiClient, SuiClientConfig } from './chains/sui/index.js';
|
|
11
|
+
export { StarknetClient, StarknetClientConfig } from './chains/starknet/index.js';
|
|
12
|
+
export { FtPostCondition, NftPostCondition, PostConditionComparison, STACKS_ACTION_TYPES, StacksClient, StacksClientConfig, PostCondition as StacksPostCondition, StxPostCondition, buildSbtcWithdrawalPostConditions, buildExecutePostConditions as buildStacksExecutePostConditions, buildStxDepositPostConditions, buildStxWithdrawalPostConditions, getContractPrincipal as getStacksContractPrincipal, getStacksExplorerAddressUrl, getStacksExplorerTxUrl, getNetworkFromAddress as getStacksNetworkFromAddress, isContractPrincipal as isStacksContractPrincipal, isValidContractName as isValidStacksContractName, isValidStacksPrincipal, isValidStandardPrincipal as isValidStacksStandardPrincipal, parseContractPrincipal as parseStacksContractPrincipal, buildExecuteHash as stacksBuildExecuteHash, buildRegistrationHash as stacksBuildRegistrationHash, buildRevocationHash as stacksBuildRevocationHash, buildSessionRegistrationHash as stacksBuildSessionRegistrationHash, buildWithdrawalHash as stacksBuildWithdrawalHash, compressPublicKey as stacksCompressPublicKey, computeKeyHash as stacksComputeKeyHash, computeKeyHashFromCoords as stacksComputeKeyHashFromCoords, derToCompactSignature as stacksDerToCompactSignature, rsToCompactSignature as stacksRsToCompactSignature, validatePostConditions as validateStacksPostConditions } from './chains/stacks/index.js';
|
|
13
|
+
import { S as SessionStorage, a as SessionKey } from './types-DvFRnIBd.js';
|
|
14
|
+
export { A as ActionParams, b as SessionConfig, i as SessionError, h as SessionErrorCode, e as SessionEvent, f as SessionEventCallback, d as SessionManagerConfig, c as SessionSignature, g as SessionSignedAction } from './types-DvFRnIBd.js';
|
|
10
15
|
export { ACTION_BRIDGE, ACTION_CONFIG, ACTION_EXECUTE, ACTION_TRANSFER, ACTION_TYPES, HUB_ABI, MAINNET_CHAINS, PROTOCOL_VERSION, TESTNET_CHAINS, VAULT_ABI, VAULT_FACTORY_ABI, WORMHOLE_API, WORMHOLE_CHAIN_IDS, WORMHOLE_CHAIN_IDS_FLAT } from './constants.js';
|
|
11
16
|
export { base64URLDecode, base64URLEncode, computeKeyHash, encodeSignatureForSolidity, getAddressExplorerUrl, getChainByEvmId, getChainByWormholeId, getTxExplorerUrl, isEvmChain, isValidBytes32, isValidEvmAddress, isValidWormholeChainId, parseDERSignature, retryWithBackoff } from './utils.js';
|
|
12
17
|
export { buildChallenge, buildGaslessChallenge, createGaslessMessageHash, createMessageHash, decodeActionPayload, decodeBridgeAction, decodeExecuteAction, decodeTransferAction, encodeAptosTransferAction, encodeBridgeAction, encodeConfigAction, encodeExecuteAction, encodeSolanaTransferAction, encodeSuiTransferAction, encodeTransferAction, encodeVeridexPayload, formatAmount, generateNonce, padTo32Bytes, parseAmount, solanaAddressToBytes32, trimTo20Bytes } from './payload.js';
|
|
13
18
|
export { HubStateQuery, HubStateResult, PortfolioChainErrorCode, PortfolioChainResult, PortfolioQuery, PortfolioResult, QueryConfig, QueryHubStateError, QueryHubStateErrorCode, QueryHubStateNetwork, QueryHubStateOptions, QueryNetwork, QueryOperation, QueryOperationType, QueryPortfolioError, QueryPortfolioErrorCode, QueryPortfolioNetwork, QueryPortfolioOptions, QueryRequest, QueryResponse, WORMHOLE_QUERY_CHAIN_IDS, WORMHOLE_QUERY_PROXY_URLS, WORMHOLE_QUERY_RATE_LIMIT_PER_SECOND, queryHubState, queryPortfolio } from './queries/index.js';
|
|
14
19
|
export { CONSISTENCY_LEVELS, FetchVAAOptions, GUARDIAN_CONFIG, WaitForSignaturesOptions, emitterToEvmAddress, encodeVAAForSolana, encodeVAAToBytes, evmAddressToBytes32, fetchVAA, fetchVAAByTxHash, fetchVAAByTxHashFallback, getSequenceFromTxReceipt, getWormholeCoreBridge, getWormholeRelayer, getWormholeTokenBridge, hasQuorum, normalizeEmitterAddress, parseVAA, parseVAABytes, parseVeridexPayload, supportsRelayer, validateEmitter, waitForGuardianSignatures } from './wormhole.js';
|
|
20
|
+
import '@solana/web3.js';
|
|
21
|
+
import '@aptos-labs/ts-sdk';
|
|
22
|
+
import '@mysten/sui/client';
|
|
23
|
+
import 'starknet';
|
|
15
24
|
import '@wormhole-foundation/wormhole-query-sdk';
|
|
16
25
|
|
|
17
26
|
/**
|
|
@@ -2111,6 +2120,7 @@ declare const CHAIN_NAMES: {
|
|
|
2111
2120
|
readonly APTOS: "aptos";
|
|
2112
2121
|
readonly SUI: "sui";
|
|
2113
2122
|
readonly STARKNET: "starknet";
|
|
2123
|
+
readonly STACKS: "stacks";
|
|
2114
2124
|
readonly NEAR: "near";
|
|
2115
2125
|
readonly SEI: "sei";
|
|
2116
2126
|
};
|
|
@@ -2120,7 +2130,7 @@ interface ChainPreset {
|
|
|
2120
2130
|
/** Human-readable chain name */
|
|
2121
2131
|
displayName: string;
|
|
2122
2132
|
/** Chain type for client selection */
|
|
2123
|
-
type: 'evm' | 'solana' | 'aptos' | 'sui' | 'starknet' | 'near' | 'cosmos';
|
|
2133
|
+
type: 'evm' | 'solana' | 'aptos' | 'sui' | 'starknet' | 'stacks' | 'near' | 'cosmos';
|
|
2124
2134
|
/** Whether this chain can be a hub */
|
|
2125
2135
|
canBeHub: boolean;
|
|
2126
2136
|
/** Testnet configuration */
|
|
@@ -2261,7 +2271,7 @@ interface SessionConfig {
|
|
|
2261
2271
|
*
|
|
2262
2272
|
* // With relayer for gasless transactions
|
|
2263
2273
|
* const gaslessSdk = await createSDK('base', {
|
|
2264
|
-
* relayerUrl: 'https://relayer.veridex.
|
|
2274
|
+
* relayerUrl: 'https://relayer.veridex.network',
|
|
2265
2275
|
* relayerApiKey: 'your-api-key',
|
|
2266
2276
|
* });
|
|
2267
2277
|
* ```
|
|
@@ -2322,6 +2332,236 @@ declare function createMainnetSDK(chain?: ChainName, config?: Omit<SimpleSDKConf
|
|
|
2322
2332
|
*/
|
|
2323
2333
|
declare function createSessionSDK(chain?: ChainName, config?: SimpleSDKConfig): VeridexSDK;
|
|
2324
2334
|
|
|
2335
|
+
/**
|
|
2336
|
+
* Veridex Protocol SDK - Cross-Origin Authentication
|
|
2337
|
+
*
|
|
2338
|
+
* Enables passkey sharing across different domains using WebAuthn Related Origin Requests.
|
|
2339
|
+
*
|
|
2340
|
+
* There are two approaches for cross-domain passkey usage:
|
|
2341
|
+
*
|
|
2342
|
+
* 1. **Related Origin Requests (Recommended)** - W3C Standard
|
|
2343
|
+
* - Host a `.well-known/webauthn` file at veridex.network
|
|
2344
|
+
* - Third-party apps use rpId: 'veridex.network' directly
|
|
2345
|
+
* - Requires browser support for Related Origin Requests
|
|
2346
|
+
* - No popup needed, seamless UX
|
|
2347
|
+
*
|
|
2348
|
+
* 2. **Auth Portal Flow (Fallback)** - Popup/Redirect Pattern
|
|
2349
|
+
* - User is redirected to auth.veridex.network
|
|
2350
|
+
* - Signs with their passkey at veridex.network
|
|
2351
|
+
* - Returns a session token to the third-party app
|
|
2352
|
+
* - Works on all browsers, but requires popup/redirect
|
|
2353
|
+
*
|
|
2354
|
+
* @example Related Origins (Recommended)
|
|
2355
|
+
* ```typescript
|
|
2356
|
+
* import { createCrossOriginAuth } from '@veridex/sdk';
|
|
2357
|
+
*
|
|
2358
|
+
* const auth = createCrossOriginAuth();
|
|
2359
|
+
*
|
|
2360
|
+
* // Check if browser supports Related Origin Requests
|
|
2361
|
+
* if (await auth.supportsRelatedOrigins()) {
|
|
2362
|
+
* // Direct passkey usage with veridex.network rpId
|
|
2363
|
+
* const credential = await auth.authenticate();
|
|
2364
|
+
* } else {
|
|
2365
|
+
* // Fallback to Auth Portal
|
|
2366
|
+
* const session = await auth.authenticateViaPortal();
|
|
2367
|
+
* }
|
|
2368
|
+
* ```
|
|
2369
|
+
*
|
|
2370
|
+
* @example Auth Portal Flow
|
|
2371
|
+
* ```typescript
|
|
2372
|
+
* const auth = createCrossOriginAuth({
|
|
2373
|
+
* authPortalUrl: 'https://auth.veridex.network',
|
|
2374
|
+
* mode: 'popup', // or 'redirect'
|
|
2375
|
+
* });
|
|
2376
|
+
*
|
|
2377
|
+
* const session = await auth.connectWithVeridex();
|
|
2378
|
+
* // session contains: { address, sessionKey, expiresAt }
|
|
2379
|
+
* ```
|
|
2380
|
+
*/
|
|
2381
|
+
|
|
2382
|
+
/** Default auth portal URL */
|
|
2383
|
+
declare const DEFAULT_AUTH_PORTAL_URL = "https://auth.veridex.network";
|
|
2384
|
+
/** Default relayer API URL for server-side session tokens */
|
|
2385
|
+
declare const DEFAULT_RELAYER_URL = "https://amused-kameko-veridex-demo-37453117.koyeb.app/api/v1";
|
|
2386
|
+
/** Message types for postMessage communication */
|
|
2387
|
+
declare const AUTH_MESSAGE_TYPES: {
|
|
2388
|
+
readonly AUTH_REQUEST: "VERIDEX_AUTH_REQUEST";
|
|
2389
|
+
readonly AUTH_RESPONSE: "VERIDEX_AUTH_RESPONSE";
|
|
2390
|
+
readonly AUTH_ERROR: "VERIDEX_AUTH_ERROR";
|
|
2391
|
+
};
|
|
2392
|
+
interface CrossOriginAuthConfig {
|
|
2393
|
+
/** The Veridex RP ID (defaults to veridex.network) */
|
|
2394
|
+
rpId?: string;
|
|
2395
|
+
/** Auth portal URL for popup/redirect flow */
|
|
2396
|
+
authPortalUrl?: string;
|
|
2397
|
+
/** Relayer API URL for server-side session tokens */
|
|
2398
|
+
relayerUrl?: string;
|
|
2399
|
+
/** Authentication mode: popup or redirect */
|
|
2400
|
+
mode?: 'popup' | 'redirect';
|
|
2401
|
+
/** Popup window features */
|
|
2402
|
+
popupFeatures?: string;
|
|
2403
|
+
/** Timeout for auth operations (ms) */
|
|
2404
|
+
timeout?: number;
|
|
2405
|
+
/** Callback URL for redirect mode */
|
|
2406
|
+
redirectUri?: string;
|
|
2407
|
+
}
|
|
2408
|
+
interface CrossOriginSession {
|
|
2409
|
+
/** User's vault address */
|
|
2410
|
+
address: string;
|
|
2411
|
+
/** Session key public key (for signing transactions) */
|
|
2412
|
+
sessionPublicKey: string;
|
|
2413
|
+
/** Session key (encrypted, stored on client) */
|
|
2414
|
+
encryptedSessionKey?: string;
|
|
2415
|
+
/** When the session expires */
|
|
2416
|
+
expiresAt: number;
|
|
2417
|
+
/** Proof of passkey ownership */
|
|
2418
|
+
signature: WebAuthnSignature;
|
|
2419
|
+
/** The credential used */
|
|
2420
|
+
credential: PasskeyCredential$1;
|
|
2421
|
+
/** Server-validated session token ID (from relayer) */
|
|
2422
|
+
serverSessionId?: string;
|
|
2423
|
+
}
|
|
2424
|
+
/** Server-side session token returned by the relayer */
|
|
2425
|
+
interface ServerSessionToken {
|
|
2426
|
+
id: string;
|
|
2427
|
+
keyHash: string;
|
|
2428
|
+
appOrigin: string;
|
|
2429
|
+
permissions: string[];
|
|
2430
|
+
expiresAt: number;
|
|
2431
|
+
createdAt: number;
|
|
2432
|
+
}
|
|
2433
|
+
interface AuthPortalMessage {
|
|
2434
|
+
type: typeof AUTH_MESSAGE_TYPES[keyof typeof AUTH_MESSAGE_TYPES];
|
|
2435
|
+
payload: CrossOriginSession | {
|
|
2436
|
+
error: string;
|
|
2437
|
+
code: string;
|
|
2438
|
+
};
|
|
2439
|
+
origin: string;
|
|
2440
|
+
}
|
|
2441
|
+
/**
|
|
2442
|
+
* Manages cross-origin passkey authentication for third-party apps.
|
|
2443
|
+
*
|
|
2444
|
+
* Third-party developers can use this to enable Veridex passkey authentication
|
|
2445
|
+
* in their own applications without users having to create new passkeys.
|
|
2446
|
+
*/
|
|
2447
|
+
declare class CrossOriginAuth {
|
|
2448
|
+
private config;
|
|
2449
|
+
private passkeyManager;
|
|
2450
|
+
constructor(config?: CrossOriginAuthConfig);
|
|
2451
|
+
/**
|
|
2452
|
+
* Check if the browser supports Related Origin Requests.
|
|
2453
|
+
* This is a WebAuthn Level 3 feature that allows using passkeys across different domains.
|
|
2454
|
+
*/
|
|
2455
|
+
supportsRelatedOrigins(): Promise<boolean>;
|
|
2456
|
+
/**
|
|
2457
|
+
* Check if WebAuthn is supported at all.
|
|
2458
|
+
*/
|
|
2459
|
+
isSupported(): boolean;
|
|
2460
|
+
/**
|
|
2461
|
+
* Authenticate using Related Origin Requests.
|
|
2462
|
+
* This allows using a passkey registered at veridex.network from any origin
|
|
2463
|
+
* listed in the /.well-known/webauthn file.
|
|
2464
|
+
*
|
|
2465
|
+
* @throws If browser doesn't support Related Origin Requests
|
|
2466
|
+
* @throws If the current origin isn't listed in veridex.network's well-known file
|
|
2467
|
+
*/
|
|
2468
|
+
authenticate(challenge?: Uint8Array): Promise<{
|
|
2469
|
+
credential: PasskeyCredential$1;
|
|
2470
|
+
signature: WebAuthnSignature;
|
|
2471
|
+
}>;
|
|
2472
|
+
/**
|
|
2473
|
+
* Register a new passkey with veridex.network as the RP.
|
|
2474
|
+
* This should only be called from veridex.network origins.
|
|
2475
|
+
*/
|
|
2476
|
+
register(username: string, displayName: string): Promise<PasskeyCredential$1>;
|
|
2477
|
+
/**
|
|
2478
|
+
* Authenticate via the Veridex Auth Portal.
|
|
2479
|
+
* Opens a popup or redirects to auth.veridex.network where the user
|
|
2480
|
+
* signs with their passkey, then returns a session to the calling app.
|
|
2481
|
+
*/
|
|
2482
|
+
connectWithVeridex(): Promise<CrossOriginSession>;
|
|
2483
|
+
/**
|
|
2484
|
+
* Popup-based authentication flow.
|
|
2485
|
+
*/
|
|
2486
|
+
private authenticateViaPopup;
|
|
2487
|
+
/**
|
|
2488
|
+
* Redirect-based authentication flow.
|
|
2489
|
+
* Stores state in sessionStorage and redirects to auth portal.
|
|
2490
|
+
*/
|
|
2491
|
+
private initiateRedirectAuth;
|
|
2492
|
+
/**
|
|
2493
|
+
* Complete redirect-based authentication.
|
|
2494
|
+
* Call this on your callback page to extract the session from URL params.
|
|
2495
|
+
*/
|
|
2496
|
+
completeRedirectAuth(): CrossOriginSession | null;
|
|
2497
|
+
/**
|
|
2498
|
+
* Generate a random state string for CSRF protection.
|
|
2499
|
+
*/
|
|
2500
|
+
private generateState;
|
|
2501
|
+
/**
|
|
2502
|
+
* Get the RP ID being used.
|
|
2503
|
+
*/
|
|
2504
|
+
getRpId(): string;
|
|
2505
|
+
/**
|
|
2506
|
+
* Get the auth portal URL.
|
|
2507
|
+
*/
|
|
2508
|
+
getAuthPortalUrl(): string;
|
|
2509
|
+
/**
|
|
2510
|
+
* Create a server-validated session token via the relayer.
|
|
2511
|
+
* Call this after authenticating (via ROR or auth portal) to get a
|
|
2512
|
+
* server-side session that the relayer can verify on subsequent requests.
|
|
2513
|
+
*/
|
|
2514
|
+
createServerSession(session: CrossOriginSession, options?: {
|
|
2515
|
+
permissions?: string[];
|
|
2516
|
+
expiresInMs?: number;
|
|
2517
|
+
}): Promise<ServerSessionToken>;
|
|
2518
|
+
/**
|
|
2519
|
+
* Validate an existing server session token.
|
|
2520
|
+
* Returns the session details if valid, null if expired/revoked.
|
|
2521
|
+
*/
|
|
2522
|
+
validateServerSession(sessionId: string): Promise<ServerSessionToken | null>;
|
|
2523
|
+
/**
|
|
2524
|
+
* Revoke a server session token.
|
|
2525
|
+
*/
|
|
2526
|
+
revokeServerSession(sessionId: string): Promise<boolean>;
|
|
2527
|
+
/**
|
|
2528
|
+
* Full authentication flow: authenticate + create server session.
|
|
2529
|
+
* Automatically detects ROR support and falls back to auth portal.
|
|
2530
|
+
*/
|
|
2531
|
+
authenticateAndCreateSession(options?: {
|
|
2532
|
+
permissions?: string[];
|
|
2533
|
+
expiresInMs?: number;
|
|
2534
|
+
}): Promise<{
|
|
2535
|
+
session: CrossOriginSession;
|
|
2536
|
+
serverSession: ServerSessionToken;
|
|
2537
|
+
}>;
|
|
2538
|
+
}
|
|
2539
|
+
/**
|
|
2540
|
+
* Create a CrossOriginAuth instance for third-party app integration.
|
|
2541
|
+
*
|
|
2542
|
+
* @example
|
|
2543
|
+
* ```typescript
|
|
2544
|
+
* const auth = createCrossOriginAuth();
|
|
2545
|
+
*
|
|
2546
|
+
* // Check for Related Origin support
|
|
2547
|
+
* if (await auth.supportsRelatedOrigins()) {
|
|
2548
|
+
* const { credential, signature } = await auth.authenticate();
|
|
2549
|
+
* } else {
|
|
2550
|
+
* const session = await auth.connectWithVeridex();
|
|
2551
|
+
* }
|
|
2552
|
+
* ```
|
|
2553
|
+
*/
|
|
2554
|
+
declare function createCrossOriginAuth(config?: CrossOriginAuthConfig): CrossOriginAuth;
|
|
2555
|
+
/**
|
|
2556
|
+
* Helper for the auth portal page to send results back to the calling app.
|
|
2557
|
+
* Only used on auth.veridex.network, not in third-party apps.
|
|
2558
|
+
*/
|
|
2559
|
+
declare function sendAuthResponse(session: CrossOriginSession, targetOrigin: string): void;
|
|
2560
|
+
/**
|
|
2561
|
+
* Helper for the auth portal to send an error back to the calling app.
|
|
2562
|
+
*/
|
|
2563
|
+
declare function sendAuthError(error: string, code: string, targetOrigin: string): void;
|
|
2564
|
+
|
|
2325
2565
|
/**
|
|
2326
2566
|
* Veridex Protocol SDK - Chain Detector
|
|
2327
2567
|
*
|
|
@@ -3121,4 +3361,4 @@ type AuthenticateAndPrepareResult = {
|
|
|
3121
3361
|
*/
|
|
3122
3362
|
declare function authenticateAndPrepare(userParams: AuthenticateAndPrepareParams, apiKey: string): Promise<AuthenticateAndPrepareResult>;
|
|
3123
3363
|
|
|
3124
|
-
export { ARBITRUM_SEPOLIA_TOKENS, type ActionDetails, type ActionDisplayType, AddBackupKeyResult, type AuthenticateAndPrepareParams, type AuthenticateAndPrepareResult, AuthorizedKey, BASE_SEPOLIA_TOKENS, BalanceManager, type BalanceManagerConfig, type BridgeDetails, BridgeParams, BridgeResult, CHAIN_DISPLAY_INFO, CHAIN_NAMES, CHAIN_PRESETS, CONFIG_TYPE, ChainAddress, type ChainAddressConfig, ChainClient, ChainConfig, type ChainDeploymentConfig, ChainDetector, type ChainDetectorConfig, type ChainDisplay, type ChainName, type ChainTokenList, type ConfigDetails, type CrossChainConfig, CrossChainManager, type CrossChainProgress, type CrossChainProgressCallback, type CrossChainResult, type CrossChainStatus, DEFAULT_REFRESH_BUFFER, DEFAULT_SESSION_DURATION, type DailySpendingSummary, DispatchResult, type DurationDisplay, ERROR_MESSAGES, ERROR_RANGES, ETHEREUM_SEPOLIA_TOKENS, EVM_ZERO_ADDRESS, type ExecuteDetails, ExecuteParams, type FormattedSpendingLimits, GasSponsor, type GasSponsorConfig, IdentityState, IndexedDBSessionStorage, type KeyPair, LIMIT_PRESETS, type LimitCheckResult, type LimitPreset, type LimitViolationSuggestion, type LimitViolationType, LocalStorageSessionStorage, MAX_SESSION_DURATION, MIN_SESSION_DURATION, type MultiChainVaultResult, NATIVE_TOKEN_ADDRESS, type NativeBalanceCapable, type NetworkType, OPTIMISM_SEPOLIA_TOKENS, PasskeyCredential, PasskeyManager, type PortfolioBalance, PreparedBridge, PreparedTransfer, ReceiveAddress, type RecipientDisplay, type RelayFeeQuote, type RelayRequest, type RelayRoute, type RelayStatus, RelayerClient, type RelayerClientConfig, type RelayerInfo, RemoveKeyResult, type RiskLevel, type RiskWarning, type RiskWarningType, SessionStorage, type SetDailyLimitParams, type SetTransactionLimitParams, type SimpleSDKConfig, type SessionConfig as SimpleSessionConfig, type SpendingLimitChangedEvent, type SpendingLimitConfig, type SpendingLimitEventCallback, type SpendingLimits, SpendingLimitsManager, type SpendingLimitsManagerConfig, type SpendingTransaction, type SponsoredVaultResult, type SponsorshipSource, type SubmitActionResult, type SubmitQueryRequest, type SubmitQueryResult, type SubmitSignedActionRequest, TOKEN_REGISTRY, type TokenBalance, type TokenDisplay, type TokenInfo$1 as TokenInfo, type TrackerConfig, type TransactionAuditEntry, type TransactionCallback, TransactionParser, type TransactionParserConfig, type TransactionState, type TransactionStatus, type TransactionSummary, TransactionTracker, type TransferDetails, TransferParams, TransferResult, UnifiedIdentity, VAA, VERIDEX_ERRORS, VaultCreationResult, VaultInfo, VeridexConfig, type VeridexErrorCode, VeridexPayload, VeridexSDK, WalletManager, WalletManagerConfig, authenticateAndPrepare, calculatePercentage, computeSessionKeyHash, createAuditEntry, createChainDetector, createGasSponsor, createHubSDK, createMainnetSDK, createRelayerClient, createSDK, createSessionSDK, createSessionStorage, createSpendingLimitsManager, createTestnetSDK, createTransactionParser, crossChainManager, decrypt, VeridexSDK as default, deriveEncryptionKey, encrypt, formatDuration, formatLargeAmount, formatTransactionState, generateSecp256k1KeyPair, getAllTokens, getChainConfig, getChainDisplay, getChainName, getChainPreset, getConfigTypeName, getDefaultHub, getErrorCategory, getErrorMessage, getExplorerUrl, getHubChains, getSuggestedAction, getSupportedChainIds, getSupportedChains, getTokenByAddress, getTokenBySymbol, getTokenList, hashAction, isAbiError, isChainSupported, isCoreError, isNativeToken, isQueryError, isQueryExecutionError, isQueryParsingError, isRetryableError, logTransactionSummary, parseVeridexError, signWithSessionKey, validateSessionConfig, verifySessionSignature };
|
|
3364
|
+
export { ARBITRUM_SEPOLIA_TOKENS, AUTH_MESSAGE_TYPES, type ActionDetails, type ActionDisplayType, AddBackupKeyResult, type AuthPortalMessage, type AuthenticateAndPrepareParams, type AuthenticateAndPrepareResult, AuthorizedKey, BASE_SEPOLIA_TOKENS, BalanceManager, type BalanceManagerConfig, type BridgeDetails, BridgeParams, BridgeResult, CHAIN_DISPLAY_INFO, CHAIN_NAMES, CHAIN_PRESETS, CONFIG_TYPE, ChainAddress, type ChainAddressConfig, ChainClient, ChainConfig, type ChainDeploymentConfig, ChainDetector, type ChainDetectorConfig, type ChainDisplay, type ChainName, type ChainTokenList, type ConfigDetails, type CrossChainConfig, CrossChainManager, type CrossChainProgress, type CrossChainProgressCallback, type CrossChainResult, type CrossChainStatus, CrossOriginAuth, type CrossOriginAuthConfig, type CrossOriginSession, DEFAULT_AUTH_PORTAL_URL, DEFAULT_REFRESH_BUFFER, DEFAULT_RELAYER_URL, DEFAULT_SESSION_DURATION, type DailySpendingSummary, DispatchResult, type DurationDisplay, ERROR_MESSAGES, ERROR_RANGES, ETHEREUM_SEPOLIA_TOKENS, EVM_ZERO_ADDRESS, type ExecuteDetails, ExecuteParams, type FormattedSpendingLimits, GasSponsor, type GasSponsorConfig, IdentityState, IndexedDBSessionStorage, type KeyPair, LIMIT_PRESETS, type LimitCheckResult, type LimitPreset, type LimitViolationSuggestion, type LimitViolationType, LocalStorageSessionStorage, MAX_SESSION_DURATION, MIN_SESSION_DURATION, type MultiChainVaultResult, NATIVE_TOKEN_ADDRESS, type NativeBalanceCapable, type NetworkType, OPTIMISM_SEPOLIA_TOKENS, PasskeyCredential$1 as PasskeyCredential, PasskeyManager, type PortfolioBalance, PreparedBridge, PreparedTransfer, ReceiveAddress, type RecipientDisplay, type RelayFeeQuote, type RelayRequest, type RelayRoute, type RelayStatus, RelayerClient, type RelayerClientConfig, type RelayerInfo, RemoveKeyResult, type RiskLevel, type RiskWarning, type RiskWarningType, type ServerSessionToken, SessionStorage, type SetDailyLimitParams, type SetTransactionLimitParams, type SimpleSDKConfig, type SessionConfig as SimpleSessionConfig, type SpendingLimitChangedEvent, type SpendingLimitConfig, type SpendingLimitEventCallback, type SpendingLimits, SpendingLimitsManager, type SpendingLimitsManagerConfig, type SpendingTransaction, type SponsoredVaultResult, type SponsorshipSource, type SubmitActionResult, type SubmitQueryRequest, type SubmitQueryResult, type SubmitSignedActionRequest, TOKEN_REGISTRY, type TokenBalance, type TokenDisplay, type TokenInfo$1 as TokenInfo, type TrackerConfig, type TransactionAuditEntry, type TransactionCallback, TransactionParser, type TransactionParserConfig, type TransactionState, type TransactionStatus, type TransactionSummary, TransactionTracker, type TransferDetails, TransferParams, TransferResult, UnifiedIdentity, VAA, VERIDEX_ERRORS, VaultCreationResult, VaultInfo, VeridexConfig, type VeridexErrorCode, VeridexPayload, VeridexSDK, WalletManager, WalletManagerConfig, WebAuthnSignature, authenticateAndPrepare, calculatePercentage, computeSessionKeyHash, createAuditEntry, createChainDetector, createCrossOriginAuth, createGasSponsor, createHubSDK, createMainnetSDK, createRelayerClient, createSDK, createSessionSDK, createSessionStorage, createSpendingLimitsManager, createTestnetSDK, createTransactionParser, crossChainManager, decrypt, VeridexSDK as default, deriveEncryptionKey, encrypt, formatDuration, formatLargeAmount, formatTransactionState, generateSecp256k1KeyPair, getAllTokens, getChainConfig, getChainDisplay, getChainName, getChainPreset, getConfigTypeName, getDefaultHub, getErrorCategory, getErrorMessage, getExplorerUrl, getHubChains, getSuggestedAction, getSupportedChainIds, getSupportedChains, getTokenByAddress, getTokenBySymbol, getTokenList, hashAction, isAbiError, isChainSupported, isCoreError, isNativeToken, isQueryError, isQueryExecutionError, isQueryParsingError, isRetryableError, logTransactionSummary, parseVeridexError, sendAuthError, sendAuthResponse, signWithSessionKey, validateSessionConfig, verifySessionSignature };
|