@pollar/core 0.9.1-rc.0 → 0.10.0-rc.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.
- package/dist/index.d.mts +2275 -1426
- package/dist/index.d.ts +2275 -1426
- package/dist/index.js +498 -137
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +498 -137
- package/dist/index.mjs.map +1 -1
- package/dist/index.rn.d.mts +2 -2
- package/dist/index.rn.d.ts +2 -2
- package/dist/index.rn.js +475 -136
- package/dist/index.rn.js.map +1 -1
- package/dist/index.rn.mjs +475 -136
- package/dist/index.rn.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { S as Storage, O as OnStorageDegrade } from './types-DqgJIJBl.js';
|
|
2
2
|
export { a as StorageDegradeReason } from './types-DqgJIJBl.js';
|
|
3
|
-
import { V as VisibilityProvider } from './types-Dyky8g0p.js';
|
|
4
3
|
import * as openapi_fetch from 'openapi-fetch';
|
|
4
|
+
import { V as VisibilityProvider } from './types-Dyky8g0p.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Log levels in increasing verbosity. Setting a level emits that level and
|
|
@@ -53,1386 +53,89 @@ declare class StellarClient {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
/**
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* like `alg` / `use` / `kid`.
|
|
59
|
-
*/
|
|
60
|
-
interface PublicEcJwk {
|
|
61
|
-
kty: 'EC';
|
|
62
|
-
crv: 'P-256';
|
|
63
|
-
/** Base64url-encoded big-endian X coordinate (32 bytes). */
|
|
64
|
-
x: string;
|
|
65
|
-
/** Base64url-encoded big-endian Y coordinate (32 bytes). */
|
|
66
|
-
y: string;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Manages the per-session ECDSA P-256 keypair used to sign DPoP proofs.
|
|
70
|
-
*
|
|
71
|
-
* Implementations:
|
|
72
|
-
* - `WebCryptoKeyManager` (web): non-extractable `CryptoKey` persisted in
|
|
73
|
-
* IndexedDB. Private key bytes never leave the browser's crypto context.
|
|
74
|
-
* - `NobleKeyManager` (React Native): private scalar bytes stored through an
|
|
75
|
-
* injected `Storage` adapter (Keychain / SecureStore). Pure-JS ECDSA via
|
|
76
|
-
* `@noble/curves`.
|
|
77
|
-
*/
|
|
78
|
-
interface KeyManager {
|
|
79
|
-
/**
|
|
80
|
-
* Load an existing key for this session or generate a new one. Idempotent.
|
|
81
|
-
* Must be called before `getPublicJwk`, `getThumbprint`, or `sign`.
|
|
82
|
-
*/
|
|
83
|
-
init(): Promise<void>;
|
|
84
|
-
/**
|
|
85
|
-
* Destroy the key. Removes it from persistent storage and clears any
|
|
86
|
-
* cached state. Used on logout.
|
|
87
|
-
*/
|
|
88
|
-
reset(): Promise<void>;
|
|
89
|
-
/**
|
|
90
|
-
* The public JWK that goes into the DPoP proof header. Returns a fresh
|
|
91
|
-
* object every call (callers may mutate without affecting the manager).
|
|
92
|
-
*/
|
|
93
|
-
getPublicJwk(): Promise<PublicEcJwk>;
|
|
94
|
-
/**
|
|
95
|
-
* RFC 7638 JWK thumbprint, base64url(SHA-256(canonical JWK)). The server
|
|
96
|
-
* compares this to the access token's `cnf.jkt` claim.
|
|
97
|
-
*/
|
|
98
|
-
getThumbprint(): Promise<string>;
|
|
99
|
-
/**
|
|
100
|
-
* Sign the given bytes with ECDSA-P256-SHA256. Returns 64-byte raw r||s
|
|
101
|
-
* (IEEE P1363 / JOSE format), NOT DER. Suitable for direct base64url
|
|
102
|
-
* encoding into the JWS signature segment.
|
|
103
|
-
*/
|
|
104
|
-
sign(payload: Uint8Array): Promise<Uint8Array>;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
declare enum WalletType {
|
|
108
|
-
FREIGHTER = "freighter",
|
|
109
|
-
ALBEDO = "albedo"
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* A wallet identifier. Accepts the internal `WalletType` enum values
|
|
113
|
-
* (`'freighter'`, `'albedo'`) plus any opaque string id used by external
|
|
114
|
-
* adapter packages (e.g. Stellar Wallets Kit ids like `'xbull'`, `'lobstr'`).
|
|
115
|
-
* The `(string & {})` keeps autocomplete on the enum values without rejecting
|
|
116
|
-
* arbitrary strings.
|
|
117
|
-
*/
|
|
118
|
-
type WalletId = WalletType | (string & {});
|
|
119
|
-
interface ConnectWalletResponse {
|
|
120
|
-
address: string;
|
|
121
|
-
}
|
|
122
|
-
interface SignTransactionOptions {
|
|
123
|
-
network?: string;
|
|
124
|
-
networkPassphrase?: string;
|
|
125
|
-
accountToSign?: string;
|
|
126
|
-
}
|
|
127
|
-
interface SignAuthEntryOptions {
|
|
128
|
-
accountToSign?: string;
|
|
129
|
-
}
|
|
130
|
-
interface SignTransactionResponse {
|
|
131
|
-
signedTxXdr: string;
|
|
132
|
-
}
|
|
133
|
-
interface SignAuthEntryResponse {
|
|
134
|
-
signedAuthEntry: string;
|
|
135
|
-
}
|
|
136
|
-
interface WalletAdapter {
|
|
137
|
-
type: WalletId;
|
|
138
|
-
isAvailable(): Promise<boolean>;
|
|
139
|
-
connect(): Promise<ConnectWalletResponse>;
|
|
140
|
-
disconnect(): Promise<void>;
|
|
141
|
-
getPublicKey(): Promise<string | null>;
|
|
142
|
-
signTransaction(xdr: string, options?: SignTransactionOptions): Promise<SignTransactionResponse>;
|
|
143
|
-
signAuthEntry(entryXdr: string, options?: SignAuthEntryOptions): Promise<SignAuthEntryResponse>;
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Resolves a {@link WalletAdapter} for a given wallet id. Injected through
|
|
147
|
-
* `PollarClientConfig.walletAdapter` so wallet implementations (Stellar
|
|
148
|
-
* Wallets Kit, custom modules, etc.) can live outside `@pollar/core`.
|
|
56
|
+
* This file was auto-generated by openapi-typescript.
|
|
57
|
+
* Do not make direct changes to the file.
|
|
149
58
|
*/
|
|
150
|
-
type WalletAdapterResolver = (id: WalletId) => WalletAdapter | Promise<WalletAdapter>;
|
|
151
|
-
|
|
152
|
-
declare class FreighterAdapter implements WalletAdapter {
|
|
153
|
-
readonly type = WalletType.FREIGHTER;
|
|
154
|
-
isAvailable(): Promise<boolean>;
|
|
155
|
-
connect(): Promise<ConnectWalletResponse>;
|
|
156
|
-
disconnect(): Promise<void>;
|
|
157
|
-
getPublicKey(): Promise<string | null>;
|
|
158
|
-
getNetwork(): Promise<string>;
|
|
159
|
-
signTransaction(xdr: string, options?: SignTransactionOptions): Promise<SignTransactionResponse>;
|
|
160
|
-
signAuthEntry(entryXdr: string, options?: SignAuthEntryOptions): Promise<SignAuthEntryResponse>;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
/** Albedo's own network vocabulary (it only understands these two values). */
|
|
164
|
-
type AlbedoNetwork = 'public' | 'testnet';
|
|
165
|
-
declare class AlbedoAdapter implements WalletAdapter {
|
|
166
|
-
private readonly network;
|
|
167
|
-
readonly type = WalletType.ALBEDO;
|
|
168
|
-
/**
|
|
169
|
-
* Network used for `connect` and `signAuthEntry` (which carry no per-call
|
|
170
|
-
* network) and as the fallback for `signTransaction`. Defaults to `'testnet'`
|
|
171
|
-
* to preserve the previous behavior when constructed with no argument.
|
|
172
|
-
*/
|
|
173
|
-
constructor(network?: AlbedoNetwork);
|
|
174
|
-
isAvailable(): Promise<boolean>;
|
|
175
|
-
connect(): Promise<ConnectWalletResponse>;
|
|
176
|
-
disconnect(): Promise<void>;
|
|
177
|
-
getPublicKey(): Promise<string | null>;
|
|
178
|
-
getNetwork(): Promise<string>;
|
|
179
|
-
signTransaction(xdr: string, options?: SignTransactionOptions): Promise<SignTransactionResponse>;
|
|
180
|
-
signAuthEntry(entryXdr: string, _options?: SignAuthEntryOptions): Promise<SignAuthEntryResponse>;
|
|
181
|
-
}
|
|
182
59
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
60
|
+
interface paths {
|
|
61
|
+
"/health": {
|
|
62
|
+
parameters: {
|
|
63
|
+
query?: never;
|
|
64
|
+
header?: never;
|
|
65
|
+
path?: never;
|
|
66
|
+
cookie?: never;
|
|
67
|
+
};
|
|
68
|
+
/** Health check */
|
|
69
|
+
get: operations["getHealth"];
|
|
70
|
+
put?: never;
|
|
71
|
+
post?: never;
|
|
72
|
+
delete?: never;
|
|
73
|
+
options?: never;
|
|
74
|
+
head?: never;
|
|
75
|
+
patch?: never;
|
|
76
|
+
trace?: never;
|
|
198
77
|
};
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
78
|
+
"/auth/session": {
|
|
79
|
+
parameters: {
|
|
80
|
+
query?: never;
|
|
81
|
+
header?: never;
|
|
82
|
+
path?: never;
|
|
83
|
+
cookie?: never;
|
|
84
|
+
};
|
|
85
|
+
get?: never;
|
|
86
|
+
put?: never;
|
|
87
|
+
/**
|
|
88
|
+
* Create a client session
|
|
89
|
+
* @description Creates a pending client session that will be linked to a user after authentication.
|
|
90
|
+
*/
|
|
91
|
+
post: operations["postAuthSession"];
|
|
92
|
+
delete?: never;
|
|
93
|
+
options?: never;
|
|
94
|
+
head?: never;
|
|
95
|
+
patch?: never;
|
|
96
|
+
trace?: never;
|
|
202
97
|
};
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
98
|
+
"/auth/session/status/{clientSessionId}": {
|
|
99
|
+
parameters: {
|
|
100
|
+
query?: never;
|
|
101
|
+
header?: never;
|
|
102
|
+
path?: never;
|
|
103
|
+
cookie?: never;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Stream client session status
|
|
107
|
+
* @description Server-Sent Events stream that emits session state every 500 ms. Closes when the session is consumed or expires.
|
|
108
|
+
*/
|
|
109
|
+
get: operations["getAuthSessionStatusByClientSessionId"];
|
|
110
|
+
put?: never;
|
|
111
|
+
post?: never;
|
|
112
|
+
delete?: never;
|
|
113
|
+
options?: never;
|
|
114
|
+
head?: never;
|
|
115
|
+
patch?: never;
|
|
116
|
+
trace?: never;
|
|
211
117
|
};
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
} | null;
|
|
118
|
+
"/auth/session/status/{clientSessionId}/poll": {
|
|
119
|
+
parameters: {
|
|
120
|
+
query?: never;
|
|
121
|
+
header?: never;
|
|
122
|
+
path?: never;
|
|
123
|
+
cookie?: never;
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Poll client session status (non-streaming)
|
|
127
|
+
* @description One-shot JSON variant of the SSE status stream, for clients without fetch response-body streaming (React Native). Returns the current `{status, user.ready}` immediately. Poll until `status` reaches a ready/consumed state.
|
|
128
|
+
*/
|
|
129
|
+
get: operations["getAuthSessionStatusByClientSessionIdPoll"];
|
|
130
|
+
put?: never;
|
|
131
|
+
post?: never;
|
|
132
|
+
delete?: never;
|
|
133
|
+
options?: never;
|
|
134
|
+
head?: never;
|
|
135
|
+
patch?: never;
|
|
136
|
+
trace?: never;
|
|
232
137
|
};
|
|
233
|
-
|
|
234
|
-
interface PollarClientConfig {
|
|
235
|
-
stellarNetwork?: StellarNetwork;
|
|
236
|
-
baseUrl?: string;
|
|
237
|
-
apiKey: string;
|
|
238
|
-
/**
|
|
239
|
-
* Pluggable storage. Defaults to `defaultStorage()` on web (localStorage
|
|
240
|
-
* with memory fallback). On RN you must inject one of the adapters from
|
|
241
|
-
* `@pollar/core/adapters/expo` or `@pollar/core/adapters/react-native-keychain`.
|
|
242
|
-
*/
|
|
243
|
-
storage?: Storage;
|
|
244
|
-
/**
|
|
245
|
-
* Pluggable DPoP key manager. Defaults to `defaultKeyManager(storage,
|
|
246
|
-
* apiKey)`: WebCrypto in browsers, `@noble/curves` in RN.
|
|
247
|
-
*/
|
|
248
|
-
keyManager?: KeyManager;
|
|
249
|
-
/**
|
|
250
|
-
* Minimum severity the SDK logs. `silent` disables all SDK logging; the rest
|
|
251
|
-
* emit that level and everything more important (`error` < `warn` < `info` <
|
|
252
|
-
* `debug`). State-transition chatter (auth/tx/network) is at `debug`.
|
|
253
|
-
* Defaults to `'info'`.
|
|
254
|
-
*/
|
|
255
|
-
logLevel?: LogLevel;
|
|
256
|
-
/**
|
|
257
|
-
* Sink the SDK writes logs to. Defaults to the global `console`. Inject your
|
|
258
|
-
* own (pino, Sentry breadcrumbs, a test spy…) to route SDK logs anywhere.
|
|
259
|
-
* Filtering by `logLevel` still applies on top of whatever you pass.
|
|
260
|
-
*/
|
|
261
|
-
logger?: PollarLogger;
|
|
262
|
-
/**
|
|
263
|
-
* Notified when persistent storage silently degrades to in-memory mode
|
|
264
|
-
* (Safari private browsing quota errors, sandboxed iframes, etc.). Useful
|
|
265
|
-
* for telemetry — the SDK keeps working but sessions won't survive reload.
|
|
266
|
-
*/
|
|
267
|
-
onStorageDegrade?: OnStorageDegrade;
|
|
268
|
-
/**
|
|
269
|
-
* Resolves a {@link WalletAdapter} for a given wallet id. If omitted, the
|
|
270
|
-
* SDK falls back to its built-in `FreighterAdapter` / `AlbedoAdapter`,
|
|
271
|
-
* which only know `WalletType.FREIGHTER` and `WalletType.ALBEDO`. Inject
|
|
272
|
-
* `@pollar/stellar-wallets-kit-adapter` (or your own resolver) to support
|
|
273
|
-
* additional wallets without bundling those dependencies into `@pollar/core`.
|
|
274
|
-
*/
|
|
275
|
-
walletAdapter?: WalletAdapterResolver;
|
|
276
|
-
/**
|
|
277
|
-
* Maximum time (ms) the SDK waits for a `walletAdapter` resolver to return.
|
|
278
|
-
* Guards against a broken extension bridge (e.g. Freighter content-script
|
|
279
|
-
* down) hanging the login flow forever. The resolver only constructs the
|
|
280
|
-
* adapter object — it does NOT include the user-facing approval step — so
|
|
281
|
-
* a few seconds is plenty. Defaults to 5000.
|
|
282
|
-
*/
|
|
283
|
-
walletResolverTimeoutMs?: number;
|
|
284
|
-
/**
|
|
285
|
-
* Optional human-friendly label sent at /auth/login time and recorded on
|
|
286
|
-
* the server-side refresh-token row so the user can identify it in the
|
|
287
|
-
* "active sessions" UI (e.g. "iPhone — Safari", "Mac — Chrome 126").
|
|
288
|
-
* If unset, the server-recorded `user_agent` header is the fallback.
|
|
289
|
-
*/
|
|
290
|
-
deviceLabel?: string;
|
|
291
|
-
/**
|
|
292
|
-
* Foreground-detection signal for the silent-refresh scheduler. When the
|
|
293
|
-
* app is hidden / backgrounded, scheduled refreshes are skipped (saves
|
|
294
|
-
* network + sidesteps browser/RN background timer throttling); they run
|
|
295
|
-
* the moment visibility comes back. Defaults to a web provider in the
|
|
296
|
-
* browser (`visibilitychange` + BFCache + focus) and a noop elsewhere.
|
|
297
|
-
* React Native consumers should inject an `AppState`-backed provider —
|
|
298
|
-
* use `createAppStateVisibilityProvider` from
|
|
299
|
-
* `@pollar/core/adapters/react-native-appstate`.
|
|
300
|
-
*/
|
|
301
|
-
visibilityProvider?: VisibilityProvider;
|
|
302
|
-
/**
|
|
303
|
-
* If set, the silent-refresh scheduler stops issuing proactive refreshes
|
|
304
|
-
* after this many milliseconds of no client-side HTTP activity. The
|
|
305
|
-
* session is not cleared — the next user action triggers a request that
|
|
306
|
-
* either reuses a still-valid access token or hits 401 → reactive
|
|
307
|
-
* refresh (transparent if the RT is still valid). Defaults to
|
|
308
|
-
* `undefined` = refresh forever as long as the app is visible.
|
|
309
|
-
*/
|
|
310
|
-
maxIdleMs?: number;
|
|
311
|
-
/**
|
|
312
|
-
* Strategy for opening the hosted OAuth URL during
|
|
313
|
-
* `login({ provider: 'google' | 'github' })`. Defaults to a browser popup
|
|
314
|
-
* on web. React Native consumers MUST provide one (typically wrapping
|
|
315
|
-
* `expo-web-browser`'s `openAuthSessionAsync`), since `window.open` does
|
|
316
|
-
* not exist there. The SDK still drives the rest of the flow by polling the
|
|
317
|
-
* auth-session status, so the opener only needs to surface the URL — it does
|
|
318
|
-
* NOT need to capture the redirect payload.
|
|
319
|
-
*/
|
|
320
|
-
openAuthUrl?: AuthUrlOpener;
|
|
321
|
-
/**
|
|
322
|
-
* Value sent to the backend as `redirect_uri` for hosted OAuth (where the
|
|
323
|
-
* provider returns the user afterwards). Defaults to `window.location.origin`
|
|
324
|
-
* on web. On React Native set this to your app's deep link / scheme — the
|
|
325
|
-
* same URL you pass to `WebBrowser.openAuthSessionAsync`.
|
|
326
|
-
*/
|
|
327
|
-
oauthRedirectUri?: string;
|
|
328
|
-
/**
|
|
329
|
-
* The passkey (WebAuthn) ceremony for "Smart Wallet" login, injected by the
|
|
330
|
-
* runtime layer (`@pollar/react` implements it with `@simplewebauthn/browser`).
|
|
331
|
-
* `@pollar/core` stays runtime-agnostic and never touches `navigator.credentials`
|
|
332
|
-
* directly. Required to use `loginSmartWallet()`. Browser-only for now;
|
|
333
|
-
* React Native needs a native passkey provider.
|
|
334
|
-
*/
|
|
335
|
-
passkey?: PasskeyCeremony;
|
|
336
|
-
/**
|
|
337
|
-
* Signs smart-account (C-address) transactions with the user's passkey.
|
|
338
|
-
* Required to send from a smart wallet. Injected by `@pollar/react`;
|
|
339
|
-
* browser-only for now.
|
|
340
|
-
*/
|
|
341
|
-
passkeySign?: PasskeySigner;
|
|
342
|
-
}
|
|
343
|
-
/**
|
|
344
|
-
* Runs the device WebAuthn ceremony for a server-issued challenge and returns
|
|
345
|
-
* the result to forward to the backend: a registration response for a new user
|
|
346
|
-
* (`create()`) or an authentication assertion for a returning one (`get()`).
|
|
347
|
-
* `mode` tells the ceremony which to run: `'login'` runs `get()` only (returning
|
|
348
|
-
* user) and `'register'` runs `create()` only (new wallet) — the caller picks via
|
|
349
|
-
* the "Log in" / "Create wallet" buttons, so there's no ambiguous autodetect that
|
|
350
|
-
* could create a wallet when the user merely cancelled a login prompt. `response`
|
|
351
|
-
* is the browser's PublicKeyCredential serialized to JSON — forwarded verbatim to
|
|
352
|
-
* `/auth/passkey/{register,login}`.
|
|
353
|
-
*/
|
|
354
|
-
type PasskeyMode = 'login' | 'register';
|
|
355
|
-
type PasskeyCeremony = (ctx: {
|
|
356
|
-
challenge: string;
|
|
357
|
-
mode: PasskeyMode;
|
|
358
|
-
}) => Promise<{
|
|
359
|
-
kind: 'login';
|
|
360
|
-
response: unknown;
|
|
361
|
-
} | {
|
|
362
|
-
kind: 'register';
|
|
363
|
-
response: unknown;
|
|
364
|
-
}>;
|
|
365
|
-
/**
|
|
366
|
-
* Signs a smart-account transaction's auth digest with the user's passkey
|
|
367
|
-
* (a WebAuthn `get()` whose challenge is the raw digest). Returns the PUBLIC
|
|
368
|
-
* assertion fields (base64url) for the server to assemble into the Soroban auth
|
|
369
|
-
* entry — no secret leaves the device. Injected by the runtime layer
|
|
370
|
-
* (`@pollar/react`); `@pollar/core` never touches `navigator.credentials`.
|
|
371
|
-
*/
|
|
372
|
-
type PasskeySigner = (ctx: {
|
|
373
|
-
/** base64url WebAuthn credential id to sign with. */
|
|
374
|
-
credentialId: string;
|
|
375
|
-
/** hex-encoded auth digest to use as the WebAuthn challenge. */
|
|
376
|
-
challenge: string;
|
|
377
|
-
}) => Promise<{
|
|
378
|
-
authenticatorData: string;
|
|
379
|
-
clientDataJSON: string;
|
|
380
|
-
signature: string;
|
|
381
|
-
}>;
|
|
382
|
-
/**
|
|
383
|
-
* Strategy for opening the hosted OAuth URL. The SDK mints the per-login auth
|
|
384
|
-
* session lazily inside `getUrl()` (call it once; the first call creates the
|
|
385
|
-
* `clientSessionId` and returns the full URL, or `null` if session creation
|
|
386
|
-
* failed). Open the resolved URL however the platform allows — a popup on web,
|
|
387
|
-
* `WebBrowser.openAuthSessionAsync(url, redirectUri)` on React Native — and
|
|
388
|
-
* resolve once the user-facing browser step is done or dismissed. You do NOT
|
|
389
|
-
* need to capture the redirect payload: the SDK polls the auth-session status
|
|
390
|
-
* until the backend marks it READY.
|
|
391
|
-
*/
|
|
392
|
-
type AuthUrlOpener = (ctx: AuthOpenContext) => void | Promise<void>;
|
|
393
|
-
interface AuthOpenContext {
|
|
394
|
-
provider: 'google' | 'github';
|
|
395
|
-
/**
|
|
396
|
-
* Mints the auth session (once) and returns the full hosted-OAuth URL, or
|
|
397
|
-
* `null` if session creation failed. On web, call it AFTER reserving the
|
|
398
|
-
* popup window so popup blockers (which only honor `window.open` inside the
|
|
399
|
-
* original user-gesture tick) don't swallow it.
|
|
400
|
-
*/
|
|
401
|
-
getUrl: () => Promise<string | null>;
|
|
402
|
-
/** The redirect target passed to the backend as `redirect_uri`. */
|
|
403
|
-
redirectUri: string;
|
|
404
|
-
signal: AbortSignal;
|
|
405
|
-
}
|
|
406
|
-
/**
|
|
407
|
-
* One row in the active-sessions list (returned by `PollarClient.listSessions()`).
|
|
408
|
-
* Mirrors the sdk-api `SessionsListContent` schema.
|
|
409
|
-
*/
|
|
410
|
-
interface SessionInfo {
|
|
411
|
-
familyId: string;
|
|
412
|
-
createdAt: string;
|
|
413
|
-
lastUsedAt: string | null;
|
|
414
|
-
userAgent: string | null;
|
|
415
|
-
ipHash: string | null;
|
|
416
|
-
deviceLabel: string | null;
|
|
417
|
-
current: boolean;
|
|
418
|
-
expiresAt: string;
|
|
419
|
-
}
|
|
420
|
-
/**
|
|
421
|
-
* Observable state for the active-sessions list. Lives on the client (like
|
|
422
|
-
* {@link TxHistoryState} / {@link WalletBalanceState}) so UI layers can
|
|
423
|
-
* subscribe via `onSessionsStateChange` and stay pure readers instead of
|
|
424
|
-
* holding the loading state locally.
|
|
425
|
-
*/
|
|
426
|
-
type SessionsState = {
|
|
427
|
-
step: 'idle';
|
|
428
|
-
} | {
|
|
429
|
-
step: 'loading';
|
|
430
|
-
} | {
|
|
431
|
-
step: 'loaded';
|
|
432
|
-
sessions: SessionInfo[];
|
|
433
|
-
} | {
|
|
434
|
-
step: 'error';
|
|
435
|
-
message: string;
|
|
436
|
-
};
|
|
437
|
-
type TxBuildBody = NonNullable<paths['/tx/build']['post']['requestBody']>['content']['application/json'];
|
|
438
|
-
type TxBuildResponse = paths['/tx/build']['post']['responses'][200]['content']['application/json'];
|
|
439
|
-
type TxSignAndSendBody = NonNullable<paths['/tx/sign-and-send']['post']['requestBody']>['content']['application/json'];
|
|
440
|
-
type TxSignSendResponse = paths['/tx/sign-and-send']['post']['responses'][200]['content']['application/json'];
|
|
441
|
-
type TxSignBody = NonNullable<paths['/tx/sign']['post']['requestBody']>['content']['application/json'];
|
|
442
|
-
type TxSignResponse = paths['/tx/sign']['post']['responses'][200]['content']['application/json'];
|
|
443
|
-
type TxSignContent = TxSignResponse['content'];
|
|
444
|
-
type TxSubmitSignedBody = NonNullable<paths['/tx/submit']['post']['requestBody']>['content']['application/json'];
|
|
445
|
-
type TxBuildSignSubmitBody = NonNullable<paths['/tx/build-sign-submit']['post']['requestBody']>['content']['application/json'];
|
|
446
|
-
type TxBuildSignSubmitResponse = paths['/tx/build-sign-submit']['post']['responses'][200]['content']['application/json'];
|
|
447
|
-
type TxBuildSignSubmitContent = TxBuildSignSubmitResponse['content'];
|
|
448
|
-
type PollarLoginOptions = {
|
|
449
|
-
provider: 'google';
|
|
450
|
-
} | {
|
|
451
|
-
provider: 'github';
|
|
452
|
-
} | {
|
|
453
|
-
provider: 'email';
|
|
454
|
-
email: string;
|
|
455
|
-
} | {
|
|
456
|
-
provider: 'wallet';
|
|
457
|
-
type: WalletId;
|
|
458
|
-
};
|
|
459
|
-
type TxBuildContent = TxBuildResponse['content'];
|
|
460
|
-
/**
|
|
461
|
-
* Phases the SDK can be in across the build → sign → submit lifecycle.
|
|
462
|
-
*
|
|
463
|
-
* **Granular** steps (`building`, `signing`, `submitting`) are emitted when
|
|
464
|
-
* the SDK can directly observe that phase — i.e. when each is a separate
|
|
465
|
-
* client-driven call (`buildTx`, `signTx`, `submitTx`, external-wallet
|
|
466
|
-
* `signAndSubmitTx`).
|
|
467
|
-
*
|
|
468
|
-
* **Compound** steps (`signing-submitting`, `building-signing-submitting`)
|
|
469
|
-
* are emitted when multiple phases collapse into a single opaque backend
|
|
470
|
-
* round-trip (`signAndSubmitTx` custodial → `/tx/sign-and-send`, and `runTx`
|
|
471
|
-
* / `buildAndSignAndSubmitTx` custodial → `/tx/build-sign-submit`). The SDK
|
|
472
|
-
* can't see when one phase ends and the next begins inside that request, so
|
|
473
|
-
* it honestly reports a single fused state instead of fabricating
|
|
474
|
-
* transitions.
|
|
475
|
-
*
|
|
476
|
-
* **Terminal states** (`success`, `error`) and the post-Horizon-ack pending
|
|
477
|
-
* state (`submitted`) are shared across all paths.
|
|
478
|
-
*
|
|
479
|
-
* On `error`, the `phase` discriminator tells the consumer *where* the
|
|
480
|
-
* failure happened so modal UIs can offer "retry from this step" buttons.
|
|
481
|
-
*/
|
|
482
|
-
type TransactionState = {
|
|
483
|
-
step: 'idle';
|
|
484
|
-
} | {
|
|
485
|
-
step: 'building';
|
|
486
|
-
} | {
|
|
487
|
-
step: 'built';
|
|
488
|
-
buildData: TxBuildContent;
|
|
489
|
-
} | {
|
|
490
|
-
step: 'signing';
|
|
491
|
-
buildData?: TxBuildContent;
|
|
492
|
-
} | {
|
|
493
|
-
step: 'signed';
|
|
494
|
-
buildData?: TxBuildContent;
|
|
495
|
-
signedXdr: string;
|
|
496
|
-
submissionToken?: string;
|
|
497
|
-
} | {
|
|
498
|
-
step: 'submitting';
|
|
499
|
-
buildData?: TxBuildContent;
|
|
500
|
-
signedXdr?: string;
|
|
501
|
-
} | {
|
|
502
|
-
step: 'signing-submitting';
|
|
503
|
-
buildData?: TxBuildContent;
|
|
504
|
-
} | {
|
|
505
|
-
step: 'building-signing-submitting';
|
|
506
|
-
} | {
|
|
507
|
-
step: 'submitted';
|
|
508
|
-
buildData?: TxBuildContent;
|
|
509
|
-
hash: string;
|
|
510
|
-
} | {
|
|
511
|
-
step: 'success';
|
|
512
|
-
buildData?: TxBuildContent;
|
|
513
|
-
hash: string;
|
|
514
|
-
} | {
|
|
515
|
-
step: 'error';
|
|
516
|
-
phase: TxErrorPhase;
|
|
517
|
-
details?: string;
|
|
518
|
-
buildData?: TxBuildContent;
|
|
519
|
-
signedXdr?: string;
|
|
520
|
-
};
|
|
521
|
-
/**
|
|
522
|
-
* Identifies which phase failed when `TransactionState.step === 'error'`.
|
|
523
|
-
* Compound phase names (`signing-submitting`, `building-signing-submitting`)
|
|
524
|
-
* appear here when the failure happened inside an atomic backend call where
|
|
525
|
-
* the SDK can't isolate the failing sub-phase.
|
|
526
|
-
*/
|
|
527
|
-
type TxErrorPhase = 'building' | 'signing' | 'submitting' | 'signing-submitting' | 'building-signing-submitting';
|
|
528
|
-
/**
|
|
529
|
-
* Per-call outcomes returned by `buildTx`, `signTx`, `submitTx`,
|
|
530
|
-
* `signAndSubmitTx`, and `buildAndSignAndSubmitTx`. These are additive to
|
|
531
|
-
* `TransactionState` — the same operations still drive the state machine for
|
|
532
|
-
* modal-style UIs, but headless callers can `await` the method and inspect
|
|
533
|
-
* the returned outcome directly instead of subscribing to state changes.
|
|
534
|
-
*/
|
|
535
|
-
type BuildOutcome = {
|
|
536
|
-
status: 'built';
|
|
537
|
-
buildData: TxBuildContent;
|
|
538
|
-
} | {
|
|
539
|
-
status: 'error';
|
|
540
|
-
details?: string;
|
|
541
|
-
};
|
|
542
|
-
type SignOutcome = {
|
|
543
|
-
status: 'signed';
|
|
544
|
-
signedXdr: string;
|
|
545
|
-
submissionToken?: string;
|
|
546
|
-
expiresAt?: number;
|
|
547
|
-
} | {
|
|
548
|
-
status: 'error';
|
|
549
|
-
details?: string;
|
|
550
|
-
};
|
|
551
|
-
type SubmitOutcome = {
|
|
552
|
-
status: 'success';
|
|
553
|
-
hash: string;
|
|
554
|
-
buildData?: TxBuildContent;
|
|
555
|
-
} | {
|
|
556
|
-
status: 'pending';
|
|
557
|
-
hash: string;
|
|
558
|
-
buildData?: TxBuildContent;
|
|
559
|
-
} | {
|
|
560
|
-
status: 'error';
|
|
561
|
-
hash?: string;
|
|
562
|
-
details?: string;
|
|
563
|
-
resultCode?: string;
|
|
564
|
-
buildData?: TxBuildContent;
|
|
565
|
-
};
|
|
566
|
-
/**
|
|
567
|
-
* Result of {@link PollarClient.setTrustline}. Like {@link SubmitOutcome} but the
|
|
568
|
-
* `hash` is optional: the sponsored, server-orchestrated path completes without
|
|
569
|
-
* surfacing a transaction hash to the client, whereas the self-paid path returns
|
|
570
|
-
* the underlying submit outcome (hash included).
|
|
571
|
-
*/
|
|
572
|
-
type TrustlineOutcome = {
|
|
573
|
-
status: 'success';
|
|
574
|
-
hash?: string;
|
|
575
|
-
} | {
|
|
576
|
-
status: 'pending';
|
|
577
|
-
hash?: string;
|
|
578
|
-
} | {
|
|
579
|
-
status: 'error';
|
|
580
|
-
details?: string;
|
|
581
|
-
};
|
|
582
|
-
declare const AUTH_ERROR_CODES: {
|
|
583
|
-
readonly SESSION_CREATE_FAILED: "SESSION_CREATE_FAILED";
|
|
584
|
-
readonly SESSION_EXPIRED: "SESSION_EXPIRED";
|
|
585
|
-
readonly SESSION_INVALID: "SESSION_INVALID";
|
|
586
|
-
readonly EMAIL_SEND_FAILED: "EMAIL_SEND_FAILED";
|
|
587
|
-
readonly EMAIL_VERIFY_FAILED: "EMAIL_VERIFY_FAILED";
|
|
588
|
-
readonly EMAIL_CODE_EXPIRED: "EMAIL_CODE_EXPIRED";
|
|
589
|
-
readonly EMAIL_CODE_INVALID: "EMAIL_CODE_INVALID";
|
|
590
|
-
readonly AUTH_FAILED: "AUTH_FAILED";
|
|
591
|
-
readonly WALLET_CONNECT_FAILED: "WALLET_CONNECT_FAILED";
|
|
592
|
-
readonly WALLET_AUTH_FAILED: "WALLET_AUTH_FAILED";
|
|
593
|
-
readonly WALLET_RESOLVER_TIMEOUT: "WALLET_RESOLVER_TIMEOUT";
|
|
594
|
-
readonly PASSKEY_FAILED: "PASSKEY_FAILED";
|
|
595
|
-
readonly UNEXPECTED_ERROR: "UNEXPECTED_ERROR";
|
|
596
|
-
};
|
|
597
|
-
type AuthErrorCode = (typeof AUTH_ERROR_CODES)[keyof typeof AUTH_ERROR_CODES];
|
|
598
|
-
type AuthState = {
|
|
599
|
-
step: 'idle';
|
|
600
|
-
} | {
|
|
601
|
-
step: 'creating_session';
|
|
602
|
-
} | {
|
|
603
|
-
step: 'entering_email';
|
|
604
|
-
clientSessionId: string;
|
|
605
|
-
} | {
|
|
606
|
-
step: 'sending_email';
|
|
607
|
-
email: string;
|
|
608
|
-
} | {
|
|
609
|
-
step: 'entering_code';
|
|
610
|
-
clientSessionId: string;
|
|
611
|
-
email: string;
|
|
612
|
-
} | {
|
|
613
|
-
step: 'verifying_email_code';
|
|
614
|
-
clientSessionId: string;
|
|
615
|
-
email: string;
|
|
616
|
-
} | {
|
|
617
|
-
step: 'opening_oauth';
|
|
618
|
-
provider: 'google' | 'github';
|
|
619
|
-
} | {
|
|
620
|
-
step: 'connecting_wallet';
|
|
621
|
-
walletType: WalletId;
|
|
622
|
-
} | {
|
|
623
|
-
step: 'wallet_not_installed';
|
|
624
|
-
walletType: WalletId;
|
|
625
|
-
} | {
|
|
626
|
-
step: 'authenticating_wallet';
|
|
627
|
-
} | {
|
|
628
|
-
step: 'creating_passkey';
|
|
629
|
-
} | {
|
|
630
|
-
step: 'deploying_smart_account';
|
|
631
|
-
} | {
|
|
632
|
-
step: 'authenticating';
|
|
633
|
-
} | {
|
|
634
|
-
step: 'authenticated';
|
|
635
|
-
session: PollarPersistedSession;
|
|
636
|
-
/**
|
|
637
|
-
* `false` while the session is restored optimistically from storage and
|
|
638
|
-
* not yet revalidated with the server; `true` after a fresh login/refresh
|
|
639
|
-
* or a successful `/auth/session/resume`. Gate sensitive actions on this.
|
|
640
|
-
*/
|
|
641
|
-
verified: boolean;
|
|
642
|
-
} | {
|
|
643
|
-
step: 'error';
|
|
644
|
-
previousStep: string;
|
|
645
|
-
message: string;
|
|
646
|
-
errorCode: AuthErrorCode;
|
|
647
|
-
clientSessionId?: string;
|
|
648
|
-
email?: string;
|
|
649
|
-
};
|
|
650
|
-
type NetworkState = {
|
|
651
|
-
step: 'idle';
|
|
652
|
-
} | {
|
|
653
|
-
step: 'connected';
|
|
654
|
-
network: StellarNetwork;
|
|
655
|
-
};
|
|
656
|
-
declare class PollarFlowError extends Error {
|
|
657
|
-
readonly code: "INVALID_FLOW";
|
|
658
|
-
constructor(message: string);
|
|
659
|
-
}
|
|
660
|
-
type WalletBalanceContent = paths['/wallet/balance']['get']['responses'][200]['content']['application/json']['content'];
|
|
661
|
-
type WalletBalanceRecord = WalletBalanceContent['balances'][number];
|
|
662
|
-
type WalletBalanceState = {
|
|
663
|
-
step: 'idle';
|
|
664
|
-
} | {
|
|
665
|
-
step: 'loading';
|
|
666
|
-
} | {
|
|
667
|
-
step: 'loaded';
|
|
668
|
-
data: WalletBalanceContent;
|
|
669
|
-
} | {
|
|
670
|
-
step: 'error';
|
|
671
|
-
message: string;
|
|
672
|
-
};
|
|
673
|
-
type WalletAssetsContent = paths['/wallet/assets']['get']['responses'][200]['content']['application/json']['content'];
|
|
674
|
-
type EnabledAssetRecord = WalletAssetsContent['assets'][number];
|
|
675
|
-
type EnabledAssetsState = {
|
|
676
|
-
step: 'idle';
|
|
677
|
-
} | {
|
|
678
|
-
step: 'loading';
|
|
679
|
-
} | {
|
|
680
|
-
step: 'loaded';
|
|
681
|
-
data: WalletAssetsContent;
|
|
682
|
-
} | {
|
|
683
|
-
step: 'error';
|
|
684
|
-
message: string;
|
|
685
|
-
};
|
|
686
|
-
type TxHistoryRecord = paths['/tx/history']['get']['responses'][200]['content']['application/json']['content']['records'][number];
|
|
687
|
-
type TxHistoryParams = NonNullable<paths['/tx/history']['get']['parameters']['query']>;
|
|
688
|
-
type TxHistoryContent = paths['/tx/history']['get']['responses'][200]['content']['application/json']['content'];
|
|
689
|
-
type TxHistoryState = {
|
|
690
|
-
step: 'idle';
|
|
691
|
-
} | {
|
|
692
|
-
step: 'loading';
|
|
693
|
-
params: TxHistoryParams;
|
|
694
|
-
} | {
|
|
695
|
-
step: 'loaded';
|
|
696
|
-
params: TxHistoryParams;
|
|
697
|
-
data: TxHistoryContent;
|
|
698
|
-
} | {
|
|
699
|
-
step: 'error';
|
|
700
|
-
params: TxHistoryParams;
|
|
701
|
-
message: string;
|
|
702
|
-
};
|
|
703
|
-
type KycLevel = 'basic' | 'intermediate' | 'enhanced';
|
|
704
|
-
type KycStatus = 'none' | 'pending' | 'approved' | 'rejected';
|
|
705
|
-
type KycFlow = 'iframe' | 'form' | 'redirect';
|
|
706
|
-
type KycProvider = paths['/kyc/providers']['get']['responses'][200]['content']['application/json']['content']['providers'][number];
|
|
707
|
-
type KycStartBody = NonNullable<paths['/kyc/start']['post']['requestBody']>['content']['application/json'];
|
|
708
|
-
type KycStartResponse = paths['/kyc/start']['post']['responses'][200]['content']['application/json']['content'];
|
|
709
|
-
type RampsQuoteQuery = NonNullable<paths['/ramps/quote']['get']['parameters']['query']>;
|
|
710
|
-
type RampQuote = paths['/ramps/quote']['get']['responses'][200]['content']['application/json']['content']['quotes'][number];
|
|
711
|
-
type RampsQuoteResponse = paths['/ramps/quote']['get']['responses'][200]['content']['application/json']['content'];
|
|
712
|
-
type RampsOnrampBody = NonNullable<paths['/ramps/onramp']['post']['requestBody']>['content']['application/json'];
|
|
713
|
-
type RampsOnrampResponse = paths['/ramps/onramp']['post']['responses'][200]['content']['application/json']['content'];
|
|
714
|
-
type RampsOfframpBody = NonNullable<paths['/ramps/offramp']['post']['requestBody']>['content']['application/json'];
|
|
715
|
-
type RampsOfframpResponse = paths['/ramps/offramp']['post']['responses'][200]['content']['application/json']['content'];
|
|
716
|
-
type RampsTransactionResponse = paths['/ramps/transaction/{txId}']['get']['responses'][200]['content']['application/json']['content'];
|
|
717
|
-
type RampTxStatus = RampsTransactionResponse['status'];
|
|
718
|
-
type RampDirection = RampsTransactionResponse['direction'];
|
|
719
|
-
type PaymentInstructions = RampsOnrampResponse['paymentInstructions'];
|
|
720
|
-
type DistributionRule = paths['/distribution/rules']['get']['responses'][200]['content']['application/json']['content']['rules'][number];
|
|
721
|
-
type RulePeriod = DistributionRule['period'];
|
|
722
|
-
type DistributionClaimBody = NonNullable<paths['/distribution/claim']['post']['requestBody']>['content']['application/json'];
|
|
723
|
-
type DistributionClaimContent = paths['/distribution/claim']['post']['responses'][200]['content']['application/json']['content'];
|
|
724
|
-
type DistributionRulesState = {
|
|
725
|
-
step: 'idle';
|
|
726
|
-
} | {
|
|
727
|
-
step: 'loading';
|
|
728
|
-
} | {
|
|
729
|
-
step: 'loaded';
|
|
730
|
-
rules: DistributionRule[];
|
|
731
|
-
} | {
|
|
732
|
-
step: 'error';
|
|
733
|
-
message: string;
|
|
734
|
-
};
|
|
735
|
-
type AdapterFn<TParams = unknown> = (params: TParams) => Promise<{
|
|
736
|
-
unsignedTransaction: string;
|
|
737
|
-
}>;
|
|
738
|
-
type PollarAdapter = Record<string, AdapterFn<any>>;
|
|
739
|
-
interface PollarAdapters {
|
|
740
|
-
[key: string]: PollarAdapter;
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
declare class PollarClient {
|
|
744
|
-
readonly apiKey: string;
|
|
745
|
-
readonly id: string;
|
|
746
|
-
readonly basePath: string;
|
|
747
|
-
private readonly _api;
|
|
748
|
-
private readonly _log;
|
|
749
|
-
private readonly _storage;
|
|
750
|
-
private readonly _keyManager;
|
|
751
|
-
/** Resolves once `keyManager.init()` and the initial session restore complete. */
|
|
752
|
-
private readonly _initialized;
|
|
753
|
-
/**
|
|
754
|
-
* Per-API-key storage namespace. Computed asynchronously inside
|
|
755
|
-
* `_initialize()` because SHA-256 lives behind `crypto.subtle.digest`.
|
|
756
|
-
* Accessing `apiKeyHash` before `await client.ready()` throws.
|
|
757
|
-
*/
|
|
758
|
-
private _apiKeyHash;
|
|
759
|
-
/**
|
|
760
|
-
* Short SHA-256-derived namespace for this client's persisted state.
|
|
761
|
-
* Available after `await client.ready()` (or any awaited method); throws
|
|
762
|
-
* if read before initialization completes.
|
|
763
|
-
*/
|
|
764
|
-
get apiKeyHash(): string;
|
|
765
|
-
private _session;
|
|
766
|
-
private _profile;
|
|
767
|
-
/** Last `DPoP-Nonce` we saw from a server response. Carried into the next proof. */
|
|
768
|
-
private _dpopNonce;
|
|
769
|
-
/**
|
|
770
|
-
* Snapshot of each in-flight request's body, taken in `onRequest` before
|
|
771
|
-
* `fetch()` consumes the stream. Needed because `Request.clone()` throws
|
|
772
|
-
* once the body is disturbed, so the auto-retry path (DPoP nonce challenge
|
|
773
|
-
* / 401 refresh) must rebuild the request from scratch instead of cloning.
|
|
774
|
-
*/
|
|
775
|
-
private _requestBodyCache;
|
|
776
|
-
/** Singleton in-flight refresh — concurrent 401s coalesce into one /auth/refresh call. */
|
|
777
|
-
private _refreshPromise;
|
|
778
|
-
private _storageEventHandler;
|
|
779
|
-
/** Optional UI label sent to the server at /auth/login so the sessions UI
|
|
780
|
-
* can show a recognizable device name. Set via PollarClientConfig.deviceLabel. */
|
|
781
|
-
private readonly _deviceLabel;
|
|
782
|
-
private readonly _visibilityProvider;
|
|
783
|
-
private readonly _maxIdleMs;
|
|
784
|
-
/** Updated by the request middleware. Read by the silent-refresh scheduler
|
|
785
|
-
* to skip proactive refreshes after `maxIdleMs` of no HTTP activity. */
|
|
786
|
-
private _lastRequestAt;
|
|
787
|
-
private _refreshTimer;
|
|
788
|
-
private _visibilityUnsubscribe;
|
|
789
|
-
private _transactionState;
|
|
790
|
-
private _transactionStateListeners;
|
|
791
|
-
private _txHistoryState;
|
|
792
|
-
private _txHistoryStateListeners;
|
|
793
|
-
private _sessionsState;
|
|
794
|
-
private _sessionsStateListeners;
|
|
795
|
-
private _walletBalanceState;
|
|
796
|
-
private _walletBalanceStateListeners;
|
|
797
|
-
private _enabledAssetsState;
|
|
798
|
-
private _enabledAssetsStateListeners;
|
|
799
|
-
private _authState;
|
|
800
|
-
private _authStateListeners;
|
|
801
|
-
private _networkState;
|
|
802
|
-
private _networkStateListeners;
|
|
803
|
-
/**
|
|
804
|
-
* Latched once the storage adapter degrades. We dedupe (the adapter only
|
|
805
|
-
* fires once anyway) and use it to replay state to late-subscribers — same
|
|
806
|
-
* pattern as `onAuthStateChange` replaying `_authState` on subscribe.
|
|
807
|
-
* Only populated when the SDK constructed the default storage adapter; if
|
|
808
|
-
* the consumer passes `config.storage`, they own degradation notifications.
|
|
809
|
-
*/
|
|
810
|
-
private _storageDegraded;
|
|
811
|
-
private _storageDegradeListeners;
|
|
812
|
-
private _walletAdapter;
|
|
813
|
-
private readonly _walletAdapterResolver;
|
|
814
|
-
private readonly _walletResolverTimeoutMs;
|
|
815
|
-
private readonly _passkey;
|
|
816
|
-
private readonly _passkeySign;
|
|
817
|
-
private _loginController;
|
|
818
|
-
/** Aborts an in-flight `/auth/session/resume` on destroy() or re-trigger. */
|
|
819
|
-
private _resumeController;
|
|
820
|
-
/** Platform strategy for opening the hosted-OAuth URL (popup on web; injected on RN). */
|
|
821
|
-
private readonly _openAuthUrl;
|
|
822
|
-
/** `redirect_uri` sent to the backend for hosted OAuth. */
|
|
823
|
-
private readonly _oauthRedirectUri;
|
|
824
|
-
constructor(config: PollarClientConfig);
|
|
825
|
-
/** Awaitable handle for the initial keypair + session restore. */
|
|
826
|
-
ready(): Promise<void>;
|
|
827
|
-
private _initialize;
|
|
828
|
-
/** Detach the cross-tab storage listener and abort any in-flight login. */
|
|
829
|
-
destroy(): void;
|
|
830
|
-
private _wireMiddlewares;
|
|
831
|
-
/**
|
|
832
|
-
* Logs the final outcome of an SDK API call exactly once: successes (`2xx`) at
|
|
833
|
-
* `debug` (method + path + status, no body), failures (`4xx`/`5xx`) at `error`
|
|
834
|
-
* with the redacted request body and the response error body. Returns the
|
|
835
|
-
* response so it can be chained at the middleware's return points. The error
|
|
836
|
-
* body is read off a synchronous `clone()` so it never disturbs the body the
|
|
837
|
-
* caller consumes.
|
|
838
|
-
*/
|
|
839
|
-
private _logHttp;
|
|
840
|
-
/** Reads the redacted request body + JSON response body and logs at `error`. */
|
|
841
|
-
private _logHttpError;
|
|
842
|
-
/** Strips origin + `/v1` version prefix from a request URL for compact logs. */
|
|
843
|
-
private _httpPath;
|
|
844
|
-
private _buildProofForRequest;
|
|
845
|
-
private _retryRequest;
|
|
846
|
-
/**
|
|
847
|
-
* Coalesce concurrent refresh attempts. The first caller does the work;
|
|
848
|
-
* everyone else awaits the same promise and sees the new tokens.
|
|
849
|
-
*/
|
|
850
|
-
refresh(): Promise<void>;
|
|
851
|
-
private _doRefresh;
|
|
852
|
-
/**
|
|
853
|
-
* Arm a single setTimeout to fire shortly before the current access token
|
|
854
|
-
* expires. Idempotent — clearing any previous timer first. Safe to call
|
|
855
|
-
* from any session-write site (initial login, restore-from-storage, after
|
|
856
|
-
* a successful rotation). No-op if there's no session in memory.
|
|
857
|
-
*
|
|
858
|
-
* Browser/RN background-tab throttling makes long-running setTimeouts
|
|
859
|
-
* unreliable on their own; the `visibilitychange` listener compensates by
|
|
860
|
-
* re-invoking `_maybeProactiveRefresh` whenever the app comes back to the
|
|
861
|
-
* foreground, catching any timer that fired late or never fired at all.
|
|
862
|
-
*/
|
|
863
|
-
private _scheduleNextRefresh;
|
|
864
|
-
/**
|
|
865
|
-
* Decide whether to actually run a refresh right now. Called both from the
|
|
866
|
-
* scheduler timer and from the visibility-change listener.
|
|
867
|
-
*
|
|
868
|
-
* Skip if:
|
|
869
|
-
* - no session / no RT (nothing to refresh)
|
|
870
|
-
* - app is hidden — wait for the visibility listener to re-trigger us
|
|
871
|
-
* - `maxIdleMs` configured and no client request since that window — let
|
|
872
|
-
* the next reactive 401-refresh handle it whenever the user comes back
|
|
873
|
-
* - the AT still has more than `REFRESH_SKEW_SECONDS` of life — reschedule
|
|
874
|
-
*
|
|
875
|
-
* Otherwise call `refresh()`, which uses the existing in-flight singleton
|
|
876
|
-
* so we never collide with a reactive 401-triggered refresh. On failure,
|
|
877
|
-
* `_doRefresh` already calls `_clearSession`, so auth-state listeners see
|
|
878
|
-
* `step:'idle'` — no extra event dispatch needed here.
|
|
879
|
-
*/
|
|
880
|
-
private _maybeProactiveRefresh;
|
|
881
|
-
private _clearRefreshTimer;
|
|
882
|
-
getAuthState(): AuthState;
|
|
883
|
-
onAuthStateChange(cb: (state: AuthState) => void): () => void;
|
|
884
|
-
/**
|
|
885
|
-
* Subscribe to persistent-storage degradation (Safari private mode,
|
|
886
|
-
* sandboxed iframes, quota errors, etc.). The SDK keeps running off
|
|
887
|
-
* in-memory storage after degrade, but sessions won't survive reload — a
|
|
888
|
-
* host UI typically wants to show "your session won't be saved" so the
|
|
889
|
-
* user isn't blindsided after a refresh.
|
|
890
|
-
*
|
|
891
|
-
* Fires at most once per client lifetime (the underlying adapter dedupes).
|
|
892
|
-
* Late subscribers receive the latched state synchronously on subscribe.
|
|
893
|
-
*
|
|
894
|
-
* Only fires when the SDK constructs the default storage adapter. If you
|
|
895
|
-
* pass a custom `config.storage`, wire your own notification path through
|
|
896
|
-
* that adapter's API — the SDK has no hook into it.
|
|
897
|
-
*/
|
|
898
|
-
onStorageDegrade(cb: OnStorageDegrade): () => void;
|
|
899
|
-
private _dispatchStorageDegrade;
|
|
900
|
-
/** PII (email, names, avatar, providers). Held in memory only — never persisted. */
|
|
901
|
-
getUserProfile(): PollarUserProfile | null;
|
|
902
|
-
login(options: PollarLoginOptions): void;
|
|
903
|
-
beginEmailLogin(): void;
|
|
904
|
-
sendEmailCode(email: string): void;
|
|
905
|
-
verifyEmailCode(code: string): void;
|
|
906
|
-
loginWallet(type: WalletId): void;
|
|
907
|
-
/**
|
|
908
|
-
* "Smart Wallet" login: runs the passkey (WebAuthn) `get()` ceremony for a
|
|
909
|
-
* returning user and signs them in. Use {@link createSmartWallet} for a new
|
|
910
|
-
* user. Requires the `passkey` ceremony to be configured (e.g. via
|
|
911
|
-
* `@pollar/react`).
|
|
912
|
-
*/
|
|
913
|
-
loginSmartWallet(): void;
|
|
914
|
-
/**
|
|
915
|
-
* "Smart Wallet" registration: runs the passkey (WebAuthn) `create()` ceremony
|
|
916
|
-
* for a new user and deploys a sponsored smart-account C-address. Use
|
|
917
|
-
* {@link loginSmartWallet} for a returning user. Requires the `passkey`
|
|
918
|
-
* ceremony to be configured (e.g. via `@pollar/react`).
|
|
919
|
-
*/
|
|
920
|
-
createSmartWallet(): void;
|
|
921
|
-
cancelLogin(): void;
|
|
922
|
-
/**
|
|
923
|
-
* Revoke the current session server-side, then clear local storage.
|
|
924
|
-
*
|
|
925
|
-
* Server revocation is best-effort: if the POST fails (offline, server
|
|
926
|
-
* down), local state is wiped regardless. The orphan refresh token then
|
|
927
|
-
* remains unused until its natural expiry. The in-flight access token
|
|
928
|
-
* stays valid until its own TTL elapses (≤10 min for DPoP-bound tokens).
|
|
929
|
-
*
|
|
930
|
-
* Pass `everywhere: true` to revoke every active session for this user
|
|
931
|
-
* across all devices.
|
|
932
|
-
*/
|
|
933
|
-
logout(options?: {
|
|
934
|
-
everywhere?: boolean;
|
|
935
|
-
}): Promise<void>;
|
|
936
|
-
/** Convenience: revoke every active session for this user (all devices). */
|
|
937
|
-
logoutEverywhere(): Promise<void>;
|
|
938
|
-
/**
|
|
939
|
-
* List active sessions for the authenticated user. Returns one entry per
|
|
940
|
-
* refresh-token family with the metadata captured at issuance time. The
|
|
941
|
-
* `current` flag identifies which entry corresponds to this client.
|
|
942
|
-
*/
|
|
943
|
-
listSessions(): Promise<SessionInfo[]>;
|
|
944
|
-
getSessionsState(): SessionsState;
|
|
945
|
-
onSessionsStateChange(cb: (state: SessionsState) => void): () => void;
|
|
946
|
-
/**
|
|
947
|
-
* Fire-and-forget variant of {@link listSessions} that drives the observable
|
|
948
|
-
* `SessionsState` store instead of returning the array. UI layers subscribe
|
|
949
|
-
* via `onSessionsStateChange` and stay pure readers — mirrors `fetchTxHistory`.
|
|
950
|
-
*/
|
|
951
|
-
fetchSessions(): Promise<void>;
|
|
952
|
-
/**
|
|
953
|
-
* Revoke a specific refresh-token family (a single device session). Use
|
|
954
|
-
* `listSessions` to enumerate the familyIds. Revoking the current session
|
|
955
|
-
* does NOT clear local state — call `logout()` for that case.
|
|
956
|
-
*/
|
|
957
|
-
revokeSession(familyId: string): Promise<void>;
|
|
958
|
-
getNetwork(): StellarNetwork;
|
|
959
|
-
getNetworkState(): NetworkState;
|
|
960
|
-
/**
|
|
961
|
-
* The client's level-gated logger (built from `logLevel` / `logger`). Exposed
|
|
962
|
-
* so the runtime layer (`@pollar/react`) can route its own logs through the
|
|
963
|
-
* same level and sink instead of calling `console` directly.
|
|
964
|
-
*/
|
|
965
|
-
getLogger(): PollarLogger;
|
|
966
|
-
setNetwork(network: StellarNetwork): void;
|
|
967
|
-
onNetworkStateChange(cb: (state: NetworkState) => void): () => void;
|
|
968
|
-
getTransactionState(): TransactionState | null;
|
|
969
|
-
onTransactionStateChange(cb: (state: TransactionState) => void): () => void;
|
|
970
|
-
getTxHistoryState(): TxHistoryState;
|
|
971
|
-
onTxHistoryStateChange(cb: (state: TxHistoryState) => void): () => void;
|
|
972
|
-
fetchTxHistory(params?: TxHistoryParams): Promise<void>;
|
|
973
|
-
getWalletBalanceState(): WalletBalanceState;
|
|
974
|
-
onWalletBalanceStateChange(cb: (state: WalletBalanceState) => void): () => void;
|
|
975
|
-
/**
|
|
976
|
-
* Refreshes the balances of the authenticated user's OWN wallet. The wallet
|
|
977
|
-
* and network are resolved server-side from the session — no arguments. Drives
|
|
978
|
-
* `walletBalanceState`. For an arbitrary wallet, use {@link getWalletBalance}.
|
|
979
|
-
*/
|
|
980
|
-
refreshBalance(): Promise<void>;
|
|
981
|
-
/**
|
|
982
|
-
* General-purpose balance lookup for ANY wallet on ANY network — not scoped
|
|
983
|
-
* to this application. Enumerates the account's real on-chain holdings via
|
|
984
|
-
* Horizon (server-side) and returns the data directly (no reactive state).
|
|
985
|
-
* `network` defaults to the client's current network.
|
|
986
|
-
*/
|
|
987
|
-
getWalletBalance(publicKey: string, network?: StellarNetwork): Promise<WalletBalanceContent>;
|
|
988
|
-
getEnabledAssetsState(): EnabledAssetsState;
|
|
989
|
-
onEnabledAssetsStateChange(cb: (state: EnabledAssetsState) => void): () => void;
|
|
990
|
-
/**
|
|
991
|
-
* Loads the application's enabled assets paired with the authenticated
|
|
992
|
-
* wallet's on-chain trustline state — so the SDK knows which trustlines still
|
|
993
|
-
* need to be added. Wallet and network are resolved server-side from the
|
|
994
|
-
* session. Drives `enabledAssetsState`; mirrors {@link refreshBalance}.
|
|
995
|
-
*/
|
|
996
|
-
refreshAssets(): Promise<void>;
|
|
997
|
-
/**
|
|
998
|
-
* Establishes (omit `limit`) or removes (`limit: '0'`) a trustline for an asset.
|
|
999
|
-
*
|
|
1000
|
-
* Routing mirrors how the platform pays for the reserve:
|
|
1001
|
-
* - **Sponsored custodial** (`opts.sponsored` true, internal wallet) → the
|
|
1002
|
-
* server orchestrates a sponsored `changeTrust`: the app's wallets cover the
|
|
1003
|
-
* 0.5 XLM reserve and the fee, so the user pays nothing. Pass the asset's
|
|
1004
|
-
* `sponsored` flag (from {@link refreshAssets}) straight through.
|
|
1005
|
-
* - **Self-paid** (external/adapter wallet, sponsorship disabled, or a custom
|
|
1006
|
-
* asset not configured in the app) → a plain `change_trust` transaction the
|
|
1007
|
-
* user's own wallet signs and pays for, via {@link runTx}.
|
|
1008
|
-
*
|
|
1009
|
-
* Does not refresh on its own — callers should `refreshAssets()` afterwards.
|
|
1010
|
-
*/
|
|
1011
|
-
setTrustline(asset: {
|
|
1012
|
-
code: string;
|
|
1013
|
-
issuer: string;
|
|
1014
|
-
}, opts?: {
|
|
1015
|
-
limit?: string;
|
|
1016
|
-
sponsored?: boolean;
|
|
1017
|
-
}): Promise<TrustlineOutcome>;
|
|
1018
|
-
/**
|
|
1019
|
-
* Builds an unsigned XDR. Drives `_setTransactionState` for modal-style UIs
|
|
1020
|
-
* AND returns a {@link BuildOutcome} so headless callers can `await` and
|
|
1021
|
-
* inspect the result without subscribing to state changes.
|
|
1022
|
-
*/
|
|
1023
|
-
buildTx(operation: TxBuildBody['operation'], params: TxBuildBody['params'], options?: TxBuildBody['options']): Promise<BuildOutcome>;
|
|
1024
|
-
getWalletType(): WalletId | null;
|
|
1025
|
-
/**
|
|
1026
|
-
* Signs the given unsigned XDR and returns the signed XDR.
|
|
1027
|
-
*
|
|
1028
|
-
* - External wallets: signs locally via the wallet adapter.
|
|
1029
|
-
* - Custodial wallets: posts to `/tx/sign`. The backend signs (through
|
|
1030
|
-
* wallet-service or the app's customer-managed adapter) and returns the
|
|
1031
|
-
* signed XDR plus an `idempotencyKey` the caller should echo back to
|
|
1032
|
-
* `submitTx`.
|
|
1033
|
-
*
|
|
1034
|
-
* Drives `_setTransactionState`: emits `signing` while in flight and
|
|
1035
|
-
* `signed` on success (or `error[phase: 'signing']` on failure). `buildData`
|
|
1036
|
-
* is threaded through if the consumer previously called `buildTx`.
|
|
1037
|
-
*/
|
|
1038
|
-
signTx(unsignedXdr: string): Promise<SignOutcome>;
|
|
1039
|
-
/**
|
|
1040
|
-
* Submits a signed XDR via `/tx/submit` regardless of wallet type
|
|
1041
|
-
* (custodial or external). Routing through sdk-api gives us:
|
|
1042
|
-
* - End-to-end tx_records persistence with full phase lifecycle so the
|
|
1043
|
-
* developer dashboard can show every tx (both custodial and external
|
|
1044
|
-
* wallet flows) at `/apps/:id/monitor/transactions`.
|
|
1045
|
-
* - Idempotency tracking via `submissionToken` (returned by `signTx`).
|
|
1046
|
-
* - A single response shape (SUCCESS / PENDING / FAILED) shared by both
|
|
1047
|
-
* flows — previously external wallets could only return SUCCESS or
|
|
1048
|
-
* error since the direct-to-Horizon path was synchronous.
|
|
1049
|
-
*
|
|
1050
|
-
* The extra hop adds ~50–150 ms vs. the legacy direct-Horizon path; the
|
|
1051
|
-
* persistence + observability win is worth it.
|
|
1052
|
-
*
|
|
1053
|
-
* Drives `_setTransactionState`: emits `submitting` while in flight,
|
|
1054
|
-
* `submitted` on Horizon ack (pending), `success` on ledger confirmation,
|
|
1055
|
-
* or `error[phase: 'submitting']` on failure.
|
|
1056
|
-
*/
|
|
1057
|
-
submitTx(signedXdr: string, opts?: {
|
|
1058
|
-
submissionToken?: string;
|
|
1059
|
-
}): Promise<SubmitOutcome>;
|
|
1060
|
-
/**
|
|
1061
|
-
* Signs and submits in one logical step. Returns a {@link SubmitOutcome}.
|
|
1062
|
-
*
|
|
1063
|
-
* - **External wallets**: composes `signTx` + `submitTx` client-side. State
|
|
1064
|
-
* machine sees the full granular sequence `signing → signed → submitting
|
|
1065
|
-
* → success` because the underlying methods each emit.
|
|
1066
|
-
* - **Custodial wallets**: atomic `/tx/sign-and-send` round-trip. State
|
|
1067
|
-
* machine emits the compound `signing-submitting` step (the SDK can't
|
|
1068
|
-
* observe when one phase ends and the next begins inside that single
|
|
1069
|
-
* backend call) and then transitions to `submitted` (Horizon ack only) or
|
|
1070
|
-
* `success` (ledger-confirmed), or `error[phase: 'signing-submitting']`.
|
|
1071
|
-
*/
|
|
1072
|
-
signAndSubmitTx(unsignedXdr?: string): Promise<SubmitOutcome>;
|
|
1073
|
-
/**
|
|
1074
|
-
* One-shot: build → sign → submit, returning the final {@link SubmitOutcome}.
|
|
1075
|
-
*
|
|
1076
|
-
* - **External wallets**: composes `buildTx` + `signAndSubmitTx` client-side.
|
|
1077
|
-
* State machine sees the full granular sequence (`building → built →
|
|
1078
|
-
* signing → signed → submitting → success`) because each composed call
|
|
1079
|
-
* emits its own transitions.
|
|
1080
|
-
* - **Custodial wallets**: single round-trip to `/tx/build-sign-submit`. The
|
|
1081
|
-
* signed XDR never leaves the backend. State machine emits the compound
|
|
1082
|
-
* `building-signing-submitting` step (the SDK can't observe individual
|
|
1083
|
-
* phase boundaries inside one atomic call) and then transitions to
|
|
1084
|
-
* `submitted` / `success` / `error[phase: 'building-signing-submitting']`.
|
|
1085
|
-
*
|
|
1086
|
-
* If you need granular UI feedback for custodial flows (separate
|
|
1087
|
-
* "Building…", "Signing…", "Submitting…" indicators), call `buildTx`,
|
|
1088
|
-
* `signTx`, and `submitTx` separately instead.
|
|
1089
|
-
*/
|
|
1090
|
-
buildAndSignAndSubmitTx(operation: TxBuildBody['operation'], params: TxBuildBody['params'], options?: TxBuildBody['options']): Promise<SubmitOutcome>;
|
|
1091
|
-
/** Alias for {@link buildAndSignAndSubmitTx} — shorter "just do the thing" name. */
|
|
1092
|
-
runTx(operation: TxBuildBody['operation'], params: TxBuildBody['params'], options?: TxBuildBody['options']): Promise<SubmitOutcome>;
|
|
1093
|
-
/**
|
|
1094
|
-
* Smart-wallet (passkey / C-address) transaction: build (server prepares the
|
|
1095
|
-
* SAC transfer + returns the auth digest) → sign the digest with the passkey
|
|
1096
|
-
* → submit (server assembles the signed auth entry and broadcasts; the
|
|
1097
|
-
* sponsor pays the fee). State machine: building → built → signing →
|
|
1098
|
-
* submitting → success.
|
|
1099
|
-
*/
|
|
1100
|
-
private _runSmartTx;
|
|
1101
|
-
/**
|
|
1102
|
-
* Steps 2–3 of the smart-wallet flow: sign the prepared auth digest with the
|
|
1103
|
-
* passkey, then submit. Shared by `_runSmartTx` (atomic) and `signAndSubmitTx`
|
|
1104
|
-
* (split flow, when a smart build is already on the state machine).
|
|
1105
|
-
*/
|
|
1106
|
-
private _signSubmitSmart;
|
|
1107
|
-
getAppConfig(): Promise<unknown>;
|
|
1108
|
-
getKycStatus(providerId?: string): Promise<{
|
|
1109
|
-
status: KycStatus;
|
|
1110
|
-
level?: KycLevel | undefined;
|
|
1111
|
-
providerId: string;
|
|
1112
|
-
expiresAt?: string;
|
|
1113
|
-
}>;
|
|
1114
|
-
getKycProviders(country: string): Promise<{
|
|
1115
|
-
providers: KycProvider[];
|
|
1116
|
-
}>;
|
|
1117
|
-
startKyc(body: KycStartBody): Promise<KycStartResponse>;
|
|
1118
|
-
resolveKyc(providerId: string, level?: KycLevel): Promise<{
|
|
1119
|
-
alreadyApproved: boolean;
|
|
1120
|
-
} & Partial<{
|
|
1121
|
-
sessionId: string;
|
|
1122
|
-
kycUrl?: string;
|
|
1123
|
-
fields?: {
|
|
1124
|
-
name: string;
|
|
1125
|
-
type: string;
|
|
1126
|
-
required: boolean;
|
|
1127
|
-
}[];
|
|
1128
|
-
}>>;
|
|
1129
|
-
pollKycStatus(providerId: string, opts?: {
|
|
1130
|
-
intervalMs?: number;
|
|
1131
|
-
timeoutMs?: number;
|
|
1132
|
-
}): Promise<KycStatus>;
|
|
1133
|
-
getRampsQuote(query: RampsQuoteQuery): Promise<RampsQuoteResponse>;
|
|
1134
|
-
createOnRamp(body: RampsOnrampBody): Promise<RampsOnrampResponse>;
|
|
1135
|
-
createOffRamp(body: RampsOfframpBody): Promise<RampsOfframpResponse>;
|
|
1136
|
-
getRampTransaction(txId: string): Promise<RampsTransactionResponse>;
|
|
1137
|
-
pollRampTransaction(txId: string, opts?: {
|
|
1138
|
-
intervalMs?: number;
|
|
1139
|
-
timeoutMs?: number;
|
|
1140
|
-
}): Promise<RampTxStatus>;
|
|
1141
|
-
listDistributionRules(): Promise<DistributionRule[]>;
|
|
1142
|
-
claimDistributionRule(body: DistributionClaimBody): Promise<DistributionClaimContent>;
|
|
1143
|
-
private _setTxHistoryState;
|
|
1144
|
-
private _setSessionsState;
|
|
1145
|
-
private _setWalletBalanceState;
|
|
1146
|
-
private _setEnabledAssetsState;
|
|
1147
|
-
private _newController;
|
|
1148
|
-
private _flowDeps;
|
|
1149
|
-
/**
|
|
1150
|
-
* Resolves a wallet adapter for the requested id. Uses the consumer's
|
|
1151
|
-
* injected `walletAdapter` resolver when present; otherwise falls back to
|
|
1152
|
-
* the built-in `FreighterAdapter` / `AlbedoAdapter`. Throws if the id is
|
|
1153
|
-
* unknown and no resolver is configured.
|
|
1154
|
-
*/
|
|
1155
|
-
private _resolveWalletAdapter;
|
|
1156
|
-
private _handleFlowError;
|
|
1157
|
-
private _restoreSession;
|
|
1158
|
-
/**
|
|
1159
|
-
* Validate the restored session against the server and repopulate the
|
|
1160
|
-
* in-memory profile (PII is never persisted, so it's null after a cold
|
|
1161
|
-
* reload). Goes through the normal authed client, so it coalesces with any
|
|
1162
|
-
* in-flight refresh (onRequest awaits `_refreshPromise`) and, being a GET,
|
|
1163
|
-
* is auto-retried after a 401-triggered refresh.
|
|
1164
|
-
*
|
|
1165
|
-
* - 200 → store profile, mark the session `verified`.
|
|
1166
|
-
* - 401 → the refresh-on-401 path already ran; if the family was
|
|
1167
|
-
* revoked, refresh failed and `_clearSession()` took us to
|
|
1168
|
-
* idle. Nothing to do here — don't double-handle.
|
|
1169
|
-
* - network error → stay optimistic (do NOT log out); revalidated later on
|
|
1170
|
-
* `visibilitychange` or first use.
|
|
1171
|
-
*/
|
|
1172
|
-
private _resume;
|
|
1173
|
-
private _storeSession;
|
|
1174
|
-
private _clearSession;
|
|
1175
|
-
private _networkPassphrase;
|
|
1176
|
-
private _setNetworkState;
|
|
1177
|
-
private _setAuthState;
|
|
1178
|
-
private _setTransactionState;
|
|
1179
|
-
/**
|
|
1180
|
-
* Threads `buildData` through state transitions. When the user has already
|
|
1181
|
-
* called `buildTx`, every subsequent state (signing, signed, submitting,
|
|
1182
|
-
* submitted, success, error) should carry the build summary so modal UIs
|
|
1183
|
-
* can keep showing "Send 5 USDC to G..." through the whole flow.
|
|
1184
|
-
*/
|
|
1185
|
-
private _currentBuildData;
|
|
1186
|
-
}
|
|
1187
|
-
|
|
1188
|
-
/**
|
|
1189
|
-
* Version of this `@pollar/core` build (e.g. `'0.8.2'`). Falls back to `'dev'`
|
|
1190
|
-
* when running unbundled.
|
|
1191
|
-
*
|
|
1192
|
-
* Named per-package on purpose: importing it alongside `@pollar/react`'s
|
|
1193
|
-
* `POLLAR_REACT_VERSION` never collides, so an app can report both versions in
|
|
1194
|
-
* a single bug-report / diagnostics line.
|
|
1195
|
-
*/
|
|
1196
|
-
declare const POLLAR_CORE_VERSION: string;
|
|
1197
|
-
|
|
1198
|
-
/**
|
|
1199
|
-
* In-memory storage backed by a `Map`. Always available, never throws.
|
|
1200
|
-
* Used as the default fallback for SSR, private browsing, sandboxed iframes
|
|
1201
|
-
* without `allow-same-origin`, or any environment where `localStorage` is
|
|
1202
|
-
* unusable.
|
|
1203
|
-
*/
|
|
1204
|
-
declare function createMemoryAdapter(): Storage;
|
|
1205
|
-
interface LocalStorageAdapterOptions {
|
|
1206
|
-
/**
|
|
1207
|
-
* Optional callback invoked the first time the adapter degrades to its
|
|
1208
|
-
* in-memory fallback (e.g. quota exceeded, throwing `localStorage`).
|
|
1209
|
-
*/
|
|
1210
|
-
onDegrade?: OnStorageDegrade;
|
|
1211
|
-
/**
|
|
1212
|
-
* Logger for the one-shot degrade warning. Defaults to the global `console`;
|
|
1213
|
-
* `PollarClient` passes its level-gated logger so `logLevel` applies here too.
|
|
1214
|
-
*/
|
|
1215
|
-
logger?: PollarLogger;
|
|
1216
|
-
}
|
|
1217
|
-
/**
|
|
1218
|
-
* `localStorage`-backed adapter that wraps every operation in try/catch and
|
|
1219
|
-
* silently degrades to an in-memory fallback for the rest of the process
|
|
1220
|
-
* lifetime on any throw. A single warning is logged when the degrade happens.
|
|
1221
|
-
*
|
|
1222
|
-
* Why every op (not just the probe): Safari private mode and sandboxed iframes
|
|
1223
|
-
* may expose `localStorage` but throw `QuotaExceededError` / `SecurityError`
|
|
1224
|
-
* on the first write — a successful probe at construction time isn't enough.
|
|
1225
|
-
*
|
|
1226
|
-
* Tokens persisted here are DPoP-bound to a non-extractable WebCrypto
|
|
1227
|
-
* keypair, so XSS exposure is limited to a signing-oracle attack (the key
|
|
1228
|
-
* itself never leaves the browser's crypto subsystem). Consumers who need
|
|
1229
|
-
* stricter isolation can inject a custom `Storage` adapter — e.g. one that
|
|
1230
|
-
* proxies to an httpOnly cookie on a host origin.
|
|
1231
|
-
*/
|
|
1232
|
-
declare function createLocalStorageAdapter(options?: LocalStorageAdapterOptions): Storage;
|
|
1233
|
-
|
|
1234
|
-
/**
|
|
1235
|
-
* Returns `localStorage`-backed storage when it works, otherwise an in-memory
|
|
1236
|
-
* fallback. The probe writes-reads-removes a sentinel; any throw, value
|
|
1237
|
-
* mismatch, or missing `localStorage` (SSR / disabled storage) falls back.
|
|
1238
|
-
*
|
|
1239
|
-
* Run-time degrade still happens inside `createLocalStorageAdapter` — see its
|
|
1240
|
-
* docstring for the rationale.
|
|
1241
|
-
*/
|
|
1242
|
-
declare function defaultStorage(options?: LocalStorageAdapterOptions): Storage;
|
|
1243
|
-
|
|
1244
|
-
/**
|
|
1245
|
-
* Construct the default `KeyManager` for the current runtime. Throws if no
|
|
1246
|
-
* factory has been registered — that only happens if `@pollar/core` was
|
|
1247
|
-
* imported in a way that bypassed the entry-point module (a bundler or
|
|
1248
|
-
* test setup bug).
|
|
1249
|
-
*/
|
|
1250
|
-
declare function defaultKeyManager(storage: Storage, apiKey: string): KeyManager;
|
|
1251
|
-
|
|
1252
|
-
declare class WebCryptoKeyManager implements KeyManager {
|
|
1253
|
-
private readonly apiKey;
|
|
1254
|
-
private apiKeyHash;
|
|
1255
|
-
private keyPair;
|
|
1256
|
-
private publicJwk;
|
|
1257
|
-
private thumbprint;
|
|
1258
|
-
/**
|
|
1259
|
-
* Cached in-flight init. Lets `init()` be called concurrently (or implicitly
|
|
1260
|
-
* from `getPublicJwk` / `sign`) without doing the work twice. Cleared on
|
|
1261
|
-
* failure so callers can retry, and cleared on `reset()`.
|
|
1262
|
-
*/
|
|
1263
|
-
private _initPromise;
|
|
1264
|
-
constructor(apiKey: string);
|
|
1265
|
-
/**
|
|
1266
|
-
* Idempotent and safe under concurrency. The first call kicks off the real
|
|
1267
|
-
* init; subsequent (and concurrent) calls return the same in-flight promise.
|
|
1268
|
-
* Other methods (`getPublicJwk`, `getThumbprint`, `sign`) auto-await this so
|
|
1269
|
-
* the manager is self-healing if `init()` was never explicitly invoked.
|
|
1270
|
-
*/
|
|
1271
|
-
init(): Promise<void>;
|
|
1272
|
-
private _doInit;
|
|
1273
|
-
/**
|
|
1274
|
-
* Derive the public JWK from a `CryptoKey`. Prefers the `'raw'` export (the
|
|
1275
|
-
* 65-byte uncompressed point `0x04 || X(32) || Y(32)`) and base64url-encodes
|
|
1276
|
-
* the coordinates ourselves — that sidesteps polyfills whose `exportKey('jwk')`
|
|
1277
|
-
* emits non-base64url `x`/`y` (standard base64, `=` padding, or — as seen with
|
|
1278
|
-
* `react-native-quick-crypto` — a stray `.`). Real browsers and most polyfills
|
|
1279
|
-
* support `'raw'` for public EC keys.
|
|
1280
|
-
*
|
|
1281
|
-
* Falls back to the `'jwk'` export (normalized via `canonicalEcJwk`) if `'raw'`
|
|
1282
|
-
* is unsupported or returns an unexpected shape, so this can't regress on a
|
|
1283
|
-
* runtime that only implements the JWK path. Both routes yield identical
|
|
1284
|
-
* coordinate bytes, so the `cnf.jkt` thumbprint is unchanged either way.
|
|
1285
|
-
*/
|
|
1286
|
-
private _exportPublicJwk;
|
|
1287
|
-
reset(): Promise<void>;
|
|
1288
|
-
getPublicJwk(): Promise<PublicEcJwk>;
|
|
1289
|
-
getThumbprint(): Promise<string>;
|
|
1290
|
-
sign(payload: Uint8Array): Promise<Uint8Array>;
|
|
1291
|
-
}
|
|
1292
|
-
|
|
1293
|
-
/**
|
|
1294
|
-
* Compute the RFC 7638 JWK thumbprint for an EC P-256 public JWK.
|
|
1295
|
-
*
|
|
1296
|
-
* Algorithm (RFC 7638 §3):
|
|
1297
|
-
* 1. Build a JSON object containing ONLY the required members of the JWK,
|
|
1298
|
-
* ordered lexicographically by member name (Unicode code point).
|
|
1299
|
-
* For EC keys, that's exactly {crv, kty, x, y}.
|
|
1300
|
-
* 2. Serialize to UTF-8 with no whitespace and no line breaks.
|
|
1301
|
-
* 3. Hash with SHA-256.
|
|
1302
|
-
* 4. Base64url-encode the hash (no padding).
|
|
1303
|
-
*
|
|
1304
|
-
* Common bugs guarded against:
|
|
1305
|
-
* - Including extra fields (`alg`, `use`, `kid`, `ext`, `key_ops`).
|
|
1306
|
-
* - Wrong member ordering (must be lex by Unicode code point).
|
|
1307
|
-
* - Padded base64 instead of base64url unpadded.
|
|
1308
|
-
* - Using `JSON.stringify(jwk)` of an arbitrary-key-order object — we build
|
|
1309
|
-
* a fresh literal in canonical order to make the order explicit and not
|
|
1310
|
-
* rely on V8's insertion-order semantics.
|
|
1311
|
-
*/
|
|
1312
|
-
declare function computeJwkThumbprint(jwk: PublicEcJwk): Promise<string>;
|
|
1313
|
-
/**
|
|
1314
|
-
* Strip a JWK to only the four required EC public members and normalize the
|
|
1315
|
-
* coordinates to unpadded base64url. Useful when the input came from
|
|
1316
|
-
* `crypto.subtle.exportKey('jwk', publicKey)` which adds `ext` / `key_ops`
|
|
1317
|
-
* (and, under some RN polyfills, non-base64url coordinates). Returns a fresh
|
|
1318
|
-
* object — never mutates input.
|
|
1319
|
-
*/
|
|
1320
|
-
declare function canonicalEcJwk(jwk: {
|
|
1321
|
-
kty?: string;
|
|
1322
|
-
crv?: string;
|
|
1323
|
-
x?: string;
|
|
1324
|
-
y?: string;
|
|
1325
|
-
}): PublicEcJwk;
|
|
1326
|
-
|
|
1327
|
-
/**
|
|
1328
|
-
* RFC 9449 DPoP proof builder.
|
|
1329
|
-
*
|
|
1330
|
-
* Produces a compact JWS that the consumer attaches as the `DPoP` HTTP
|
|
1331
|
-
* header. The header `jwk` is the public part of the SDK's per-session
|
|
1332
|
-
* keypair; the server verifies the signature, validates the `htm` / `htu` /
|
|
1333
|
-
* `iat` / `jti` / optional `nonce` / optional `ath` claims, and matches the
|
|
1334
|
-
* proof's JWK thumbprint against the access token's `cnf.jkt` claim.
|
|
1335
|
-
*
|
|
1336
|
-
* Server-issued nonce flow (RFC 9449 §8/§9): the server may respond with
|
|
1337
|
-
* `WWW-Authenticate: DPoP ... error="use_dpop_nonce"` plus a `DPoP-Nonce`
|
|
1338
|
-
* header. The client should re-build the proof with the new nonce and retry.
|
|
1339
|
-
* `buildProof` accepts an optional nonce; the SDK client tracks it across
|
|
1340
|
-
* requests and feeds it back here.
|
|
1341
|
-
*
|
|
1342
|
-
* The last seen `DPoP-Nonce` is stored verbatim and embedded in the next
|
|
1343
|
-
* proof. The server validates it as an HMAC token, so an attacker who
|
|
1344
|
-
* injects an arbitrary nonce cannot escalate — verification fails and the
|
|
1345
|
-
* server replies with a fresh nonce on the next request.
|
|
1346
|
-
*/
|
|
1347
|
-
interface BuildProofArgs {
|
|
1348
|
-
/** HTTP method, e.g. `"GET"`. Will be uppercased before signing. */
|
|
1349
|
-
htm: string;
|
|
1350
|
-
/**
|
|
1351
|
-
* HTTP target URI. Will be normalized per RFC 3986 §6.2 (lowercase scheme
|
|
1352
|
-
* + host, default port elided, query+fragment+userinfo stripped, path
|
|
1353
|
-
* dot-segments resolved, trailing slash preserved exactly as provided).
|
|
1354
|
-
*/
|
|
1355
|
-
htu: string;
|
|
1356
|
-
/**
|
|
1357
|
-
* Access token to bind the proof to (its base64url(SHA-256) goes in the
|
|
1358
|
-
* `ath` claim). Omit for proofs sent to the token endpoint per RFC 9449
|
|
1359
|
-
* §5 / §6.1 (those proofs MUST NOT include `ath`).
|
|
1360
|
-
*/
|
|
1361
|
-
accessToken?: string;
|
|
1362
|
-
/**
|
|
1363
|
-
* Server-issued DPoP nonce, if the server has previously challenged this
|
|
1364
|
-
* client with `WWW-Authenticate: DPoP ... error="use_dpop_nonce"`. RFC
|
|
1365
|
-
* 9449 §8.
|
|
1366
|
-
*/
|
|
1367
|
-
nonce?: string;
|
|
1368
|
-
}
|
|
1369
|
-
/**
|
|
1370
|
-
* Build a DPoP proof JWS for the given request. Returns the compact-form
|
|
1371
|
-
* JWS string (`<header>.<payload>.<signature>`).
|
|
1372
|
-
*/
|
|
1373
|
-
declare function buildProof(args: BuildProofArgs, keyManager: KeyManager): Promise<string>;
|
|
1374
|
-
/**
|
|
1375
|
-
* Normalize an HTTP URI for use as the `htu` claim.
|
|
1376
|
-
*
|
|
1377
|
-
* RFC 9449 §4.3 + RFC 3986 §6.2:
|
|
1378
|
-
* - lowercase scheme + host
|
|
1379
|
-
* - elide default port (`:443` for https, `:80` for http)
|
|
1380
|
-
* - strip userinfo (never appears in `htu`)
|
|
1381
|
-
* - strip query + fragment
|
|
1382
|
-
* - apply path dot-segment removal (handled by the URL constructor)
|
|
1383
|
-
* - **preserve trailing slash exactly** — `/foo` and `/foo/` are distinct
|
|
1384
|
-
* paths per RFC 3986 §6 and must round-trip identically.
|
|
1385
|
-
* - preserve IPv6 brackets in host
|
|
1386
|
-
*
|
|
1387
|
-
* Both client and server must apply the same normalization so the `htu`
|
|
1388
|
-
* claim matches deterministically.
|
|
1389
|
-
*/
|
|
1390
|
-
declare function normalizeHtu(rawUrl: string): string;
|
|
1391
|
-
|
|
1392
|
-
/**
|
|
1393
|
-
* This file was auto-generated by openapi-typescript.
|
|
1394
|
-
* Do not make direct changes to the file.
|
|
1395
|
-
*/
|
|
1396
|
-
|
|
1397
|
-
interface paths {
|
|
1398
|
-
"/health": {
|
|
1399
|
-
parameters: {
|
|
1400
|
-
query?: never;
|
|
1401
|
-
header?: never;
|
|
1402
|
-
path?: never;
|
|
1403
|
-
cookie?: never;
|
|
1404
|
-
};
|
|
1405
|
-
/** Health check */
|
|
1406
|
-
get: operations["getHealth"];
|
|
1407
|
-
put?: never;
|
|
1408
|
-
post?: never;
|
|
1409
|
-
delete?: never;
|
|
1410
|
-
options?: never;
|
|
1411
|
-
head?: never;
|
|
1412
|
-
patch?: never;
|
|
1413
|
-
trace?: never;
|
|
1414
|
-
};
|
|
1415
|
-
"/auth/session": {
|
|
1416
|
-
parameters: {
|
|
1417
|
-
query?: never;
|
|
1418
|
-
header?: never;
|
|
1419
|
-
path?: never;
|
|
1420
|
-
cookie?: never;
|
|
1421
|
-
};
|
|
1422
|
-
get?: never;
|
|
1423
|
-
put?: never;
|
|
1424
|
-
/**
|
|
1425
|
-
* Create a client session
|
|
1426
|
-
* @description Creates a pending client session that will be linked to a user after authentication.
|
|
1427
|
-
*/
|
|
1428
|
-
post: operations["postAuthSession"];
|
|
1429
|
-
delete?: never;
|
|
1430
|
-
options?: never;
|
|
1431
|
-
head?: never;
|
|
1432
|
-
patch?: never;
|
|
1433
|
-
trace?: never;
|
|
1434
|
-
};
|
|
1435
|
-
"/auth/session/status/{clientSessionId}": {
|
|
138
|
+
"/auth/google": {
|
|
1436
139
|
parameters: {
|
|
1437
140
|
query?: never;
|
|
1438
141
|
header?: never;
|
|
@@ -1440,10 +143,10 @@ interface paths {
|
|
|
1440
143
|
cookie?: never;
|
|
1441
144
|
};
|
|
1442
145
|
/**
|
|
1443
|
-
*
|
|
1444
|
-
* @description
|
|
146
|
+
* Redirect to Google OAuth
|
|
147
|
+
* @description Redirects the user to the Google OAuth consent screen.
|
|
1445
148
|
*/
|
|
1446
|
-
get: operations["
|
|
149
|
+
get: operations["getAuthGoogle"];
|
|
1447
150
|
put?: never;
|
|
1448
151
|
post?: never;
|
|
1449
152
|
delete?: never;
|
|
@@ -1452,7 +155,7 @@ interface paths {
|
|
|
1452
155
|
patch?: never;
|
|
1453
156
|
trace?: never;
|
|
1454
157
|
};
|
|
1455
|
-
"/auth/
|
|
158
|
+
"/auth/github": {
|
|
1456
159
|
parameters: {
|
|
1457
160
|
query?: never;
|
|
1458
161
|
header?: never;
|
|
@@ -1460,10 +163,10 @@ interface paths {
|
|
|
1460
163
|
cookie?: never;
|
|
1461
164
|
};
|
|
1462
165
|
/**
|
|
1463
|
-
*
|
|
1464
|
-
* @description
|
|
166
|
+
* Redirect to GitHub OAuth
|
|
167
|
+
* @description Redirects the user to the GitHub OAuth consent screen.
|
|
1465
168
|
*/
|
|
1466
|
-
get: operations["
|
|
169
|
+
get: operations["getAuthGithub"];
|
|
1467
170
|
put?: never;
|
|
1468
171
|
post?: never;
|
|
1469
172
|
delete?: never;
|
|
@@ -1472,7 +175,7 @@ interface paths {
|
|
|
1472
175
|
patch?: never;
|
|
1473
176
|
trace?: never;
|
|
1474
177
|
};
|
|
1475
|
-
"/auth/
|
|
178
|
+
"/auth/oidc": {
|
|
1476
179
|
parameters: {
|
|
1477
180
|
query?: never;
|
|
1478
181
|
header?: never;
|
|
@@ -1480,10 +183,10 @@ interface paths {
|
|
|
1480
183
|
cookie?: never;
|
|
1481
184
|
};
|
|
1482
185
|
/**
|
|
1483
|
-
* Redirect to
|
|
1484
|
-
* @description Redirects the user to the
|
|
186
|
+
* Redirect to Authentik OIDC
|
|
187
|
+
* @description Redirects the user to the Authentik authorization endpoint (PKCE, per-app).
|
|
1485
188
|
*/
|
|
1486
|
-
get: operations["
|
|
189
|
+
get: operations["getAuthOidc"];
|
|
1487
190
|
put?: never;
|
|
1488
191
|
post?: never;
|
|
1489
192
|
delete?: never;
|
|
@@ -1492,47 +195,41 @@ interface paths {
|
|
|
1492
195
|
patch?: never;
|
|
1493
196
|
trace?: never;
|
|
1494
197
|
};
|
|
1495
|
-
"/auth/
|
|
198
|
+
"/auth/email": {
|
|
1496
199
|
parameters: {
|
|
1497
200
|
query?: never;
|
|
1498
201
|
header?: never;
|
|
1499
202
|
path?: never;
|
|
1500
203
|
cookie?: never;
|
|
1501
204
|
};
|
|
1502
|
-
|
|
1503
|
-
* Redirect to GitHub OAuth
|
|
1504
|
-
* @description Redirects the user to the GitHub OAuth consent screen.
|
|
1505
|
-
*/
|
|
1506
|
-
get: operations["getAuthGithub"];
|
|
205
|
+
get?: never;
|
|
1507
206
|
put?: never;
|
|
1508
|
-
|
|
207
|
+
/** Send email verification code */
|
|
208
|
+
post: operations["postAuthEmail"];
|
|
1509
209
|
delete?: never;
|
|
1510
210
|
options?: never;
|
|
1511
211
|
head?: never;
|
|
1512
212
|
patch?: never;
|
|
1513
213
|
trace?: never;
|
|
1514
214
|
};
|
|
1515
|
-
"/auth/
|
|
215
|
+
"/auth/email/verify-code": {
|
|
1516
216
|
parameters: {
|
|
1517
217
|
query?: never;
|
|
1518
218
|
header?: never;
|
|
1519
219
|
path?: never;
|
|
1520
220
|
cookie?: never;
|
|
1521
221
|
};
|
|
1522
|
-
|
|
1523
|
-
* Redirect to Authentik OIDC
|
|
1524
|
-
* @description Redirects the user to the Authentik authorization endpoint (PKCE, per-app).
|
|
1525
|
-
*/
|
|
1526
|
-
get: operations["getAuthOidc"];
|
|
222
|
+
get?: never;
|
|
1527
223
|
put?: never;
|
|
1528
|
-
|
|
224
|
+
/** Verify email code */
|
|
225
|
+
post: operations["postAuthEmailVerifyCode"];
|
|
1529
226
|
delete?: never;
|
|
1530
227
|
options?: never;
|
|
1531
228
|
head?: never;
|
|
1532
229
|
patch?: never;
|
|
1533
230
|
trace?: never;
|
|
1534
231
|
};
|
|
1535
|
-
"/auth/
|
|
232
|
+
"/auth/wallet/challenge": {
|
|
1536
233
|
parameters: {
|
|
1537
234
|
query?: never;
|
|
1538
235
|
header?: never;
|
|
@@ -1541,15 +238,18 @@ interface paths {
|
|
|
1541
238
|
};
|
|
1542
239
|
get?: never;
|
|
1543
240
|
put?: never;
|
|
1544
|
-
/**
|
|
1545
|
-
|
|
241
|
+
/**
|
|
242
|
+
* Issue a SEP-10 wallet challenge
|
|
243
|
+
* @description Returns a server-signed SEP-10 challenge transaction (XDR) bound to the client session. The wallet counter-signs it to prove key control, then posts it to /auth/wallet (or /auth/external).
|
|
244
|
+
*/
|
|
245
|
+
post: operations["postAuthWalletChallenge"];
|
|
1546
246
|
delete?: never;
|
|
1547
247
|
options?: never;
|
|
1548
248
|
head?: never;
|
|
1549
249
|
patch?: never;
|
|
1550
250
|
trace?: never;
|
|
1551
251
|
};
|
|
1552
|
-
"/auth/
|
|
252
|
+
"/auth/wallet": {
|
|
1553
253
|
parameters: {
|
|
1554
254
|
query?: never;
|
|
1555
255
|
header?: never;
|
|
@@ -1558,15 +258,18 @@ interface paths {
|
|
|
1558
258
|
};
|
|
1559
259
|
get?: never;
|
|
1560
260
|
put?: never;
|
|
1561
|
-
/**
|
|
1562
|
-
|
|
261
|
+
/**
|
|
262
|
+
* Authenticate with a Stellar wallet
|
|
263
|
+
* @description Verifies the SEP-10 counter-signed challenge (from /auth/wallet/challenge) and sets the session ready. During rollout an unsigned legacy request is still accepted unless SDK_WALLET_REQUIRE_SIGNATURE is enabled.
|
|
264
|
+
*/
|
|
265
|
+
post: operations["postAuthWallet"];
|
|
1563
266
|
delete?: never;
|
|
1564
267
|
options?: never;
|
|
1565
268
|
head?: never;
|
|
1566
269
|
patch?: never;
|
|
1567
270
|
trace?: never;
|
|
1568
271
|
};
|
|
1569
|
-
"/auth/
|
|
272
|
+
"/auth/external": {
|
|
1570
273
|
parameters: {
|
|
1571
274
|
query?: never;
|
|
1572
275
|
header?: never;
|
|
@@ -1575,8 +278,11 @@ interface paths {
|
|
|
1575
278
|
};
|
|
1576
279
|
get?: never;
|
|
1577
280
|
put?: never;
|
|
1578
|
-
/**
|
|
1579
|
-
|
|
281
|
+
/**
|
|
282
|
+
* Authenticate via a custom external provider
|
|
283
|
+
* @description For custom login providers (Privy, Magic, …) that authenticate the user client-side and surface a Stellar wallet. Control is proven with the same SEP-10 counter-signed challenge (from /auth/wallet/challenge); Pollar needs nothing of the provider itself.
|
|
284
|
+
*/
|
|
285
|
+
post: operations["postAuthExternal"];
|
|
1580
286
|
delete?: never;
|
|
1581
287
|
options?: never;
|
|
1582
288
|
head?: never;
|
|
@@ -1860,6 +566,26 @@ interface paths {
|
|
|
1860
566
|
patch?: never;
|
|
1861
567
|
trace?: never;
|
|
1862
568
|
};
|
|
569
|
+
"/tx/sign-auth-entry": {
|
|
570
|
+
parameters: {
|
|
571
|
+
query?: never;
|
|
572
|
+
header?: never;
|
|
573
|
+
path?: never;
|
|
574
|
+
cookie?: never;
|
|
575
|
+
};
|
|
576
|
+
get?: never;
|
|
577
|
+
put?: never;
|
|
578
|
+
/**
|
|
579
|
+
* Sign a Soroban authorization entry (custodial)
|
|
580
|
+
* @description Signs a single SorobanAuthorizationEntry with the user's custodial key. Use when a developer's own contract is the transaction source (it sponsors the gas) and only needs the user's address-credentials authorization, not a full signed envelope. sdk-api enforces the app's per-contract/function allowlist and a short validity-ledger window BEFORE signing — an entry touching any contract or function not allowlisted, or with too long an expiration, is rejected. External (user-controlled) wallets sign auth entries client-side and do not call this endpoint.
|
|
581
|
+
*/
|
|
582
|
+
post: operations["postTxSignAuthEntry"];
|
|
583
|
+
delete?: never;
|
|
584
|
+
options?: never;
|
|
585
|
+
head?: never;
|
|
586
|
+
patch?: never;
|
|
587
|
+
trace?: never;
|
|
588
|
+
};
|
|
1863
589
|
"/tx/submit": {
|
|
1864
590
|
parameters: {
|
|
1865
591
|
query?: never;
|
|
@@ -2308,6 +1034,8 @@ interface operations {
|
|
|
2308
1034
|
/** @constant */
|
|
2309
1035
|
success: false;
|
|
2310
1036
|
code: string;
|
|
1037
|
+
message?: string;
|
|
1038
|
+
resultCode?: string;
|
|
2311
1039
|
};
|
|
2312
1040
|
};
|
|
2313
1041
|
};
|
|
@@ -2321,6 +1049,8 @@ interface operations {
|
|
|
2321
1049
|
/** @constant */
|
|
2322
1050
|
success: false;
|
|
2323
1051
|
code: string;
|
|
1052
|
+
message?: string;
|
|
1053
|
+
resultCode?: string;
|
|
2324
1054
|
};
|
|
2325
1055
|
};
|
|
2326
1056
|
};
|
|
@@ -2334,6 +1064,8 @@ interface operations {
|
|
|
2334
1064
|
/** @constant */
|
|
2335
1065
|
success: false;
|
|
2336
1066
|
code: string;
|
|
1067
|
+
message?: string;
|
|
1068
|
+
resultCode?: string;
|
|
2337
1069
|
};
|
|
2338
1070
|
};
|
|
2339
1071
|
};
|
|
@@ -2407,6 +1139,8 @@ interface operations {
|
|
|
2407
1139
|
/** @constant */
|
|
2408
1140
|
success: false;
|
|
2409
1141
|
code: string;
|
|
1142
|
+
message?: string;
|
|
1143
|
+
resultCode?: string;
|
|
2410
1144
|
};
|
|
2411
1145
|
};
|
|
2412
1146
|
};
|
|
@@ -2420,6 +1154,8 @@ interface operations {
|
|
|
2420
1154
|
/** @constant */
|
|
2421
1155
|
success: false;
|
|
2422
1156
|
code: string;
|
|
1157
|
+
message?: string;
|
|
1158
|
+
resultCode?: string;
|
|
2423
1159
|
};
|
|
2424
1160
|
};
|
|
2425
1161
|
};
|
|
@@ -2455,6 +1191,8 @@ interface operations {
|
|
|
2455
1191
|
/** @constant */
|
|
2456
1192
|
success: false;
|
|
2457
1193
|
code: string;
|
|
1194
|
+
message?: string;
|
|
1195
|
+
resultCode?: string;
|
|
2458
1196
|
};
|
|
2459
1197
|
};
|
|
2460
1198
|
};
|
|
@@ -2468,6 +1206,8 @@ interface operations {
|
|
|
2468
1206
|
/** @constant */
|
|
2469
1207
|
success: false;
|
|
2470
1208
|
code: string;
|
|
1209
|
+
message?: string;
|
|
1210
|
+
resultCode?: string;
|
|
2471
1211
|
};
|
|
2472
1212
|
};
|
|
2473
1213
|
};
|
|
@@ -2481,6 +1221,8 @@ interface operations {
|
|
|
2481
1221
|
/** @constant */
|
|
2482
1222
|
success: false;
|
|
2483
1223
|
code: string;
|
|
1224
|
+
message?: string;
|
|
1225
|
+
resultCode?: string;
|
|
2484
1226
|
};
|
|
2485
1227
|
};
|
|
2486
1228
|
};
|
|
@@ -2494,6 +1236,8 @@ interface operations {
|
|
|
2494
1236
|
/** @constant */
|
|
2495
1237
|
success: false;
|
|
2496
1238
|
code: string;
|
|
1239
|
+
message?: string;
|
|
1240
|
+
resultCode?: string;
|
|
2497
1241
|
};
|
|
2498
1242
|
};
|
|
2499
1243
|
};
|
|
@@ -2529,6 +1273,8 @@ interface operations {
|
|
|
2529
1273
|
/** @constant */
|
|
2530
1274
|
success: false;
|
|
2531
1275
|
code: string;
|
|
1276
|
+
message?: string;
|
|
1277
|
+
resultCode?: string;
|
|
2532
1278
|
};
|
|
2533
1279
|
};
|
|
2534
1280
|
};
|
|
@@ -2542,6 +1288,8 @@ interface operations {
|
|
|
2542
1288
|
/** @constant */
|
|
2543
1289
|
success: false;
|
|
2544
1290
|
code: string;
|
|
1291
|
+
message?: string;
|
|
1292
|
+
resultCode?: string;
|
|
2545
1293
|
};
|
|
2546
1294
|
};
|
|
2547
1295
|
};
|
|
@@ -2555,6 +1303,8 @@ interface operations {
|
|
|
2555
1303
|
/** @constant */
|
|
2556
1304
|
success: false;
|
|
2557
1305
|
code: string;
|
|
1306
|
+
message?: string;
|
|
1307
|
+
resultCode?: string;
|
|
2558
1308
|
};
|
|
2559
1309
|
};
|
|
2560
1310
|
};
|
|
@@ -2568,6 +1318,8 @@ interface operations {
|
|
|
2568
1318
|
/** @constant */
|
|
2569
1319
|
success: false;
|
|
2570
1320
|
code: string;
|
|
1321
|
+
message?: string;
|
|
1322
|
+
resultCode?: string;
|
|
2571
1323
|
};
|
|
2572
1324
|
};
|
|
2573
1325
|
};
|
|
@@ -2590,7 +1342,199 @@ interface operations {
|
|
|
2590
1342
|
headers: {
|
|
2591
1343
|
[name: string]: unknown;
|
|
2592
1344
|
};
|
|
2593
|
-
content?: never;
|
|
1345
|
+
content?: never;
|
|
1346
|
+
};
|
|
1347
|
+
/** @description Validation error */
|
|
1348
|
+
400: {
|
|
1349
|
+
headers: {
|
|
1350
|
+
[name: string]: unknown;
|
|
1351
|
+
};
|
|
1352
|
+
content: {
|
|
1353
|
+
"application/json": {
|
|
1354
|
+
/** @constant */
|
|
1355
|
+
success: false;
|
|
1356
|
+
code: string;
|
|
1357
|
+
message?: string;
|
|
1358
|
+
resultCode?: string;
|
|
1359
|
+
};
|
|
1360
|
+
};
|
|
1361
|
+
};
|
|
1362
|
+
/** @description Unauthorized */
|
|
1363
|
+
401: {
|
|
1364
|
+
headers: {
|
|
1365
|
+
[name: string]: unknown;
|
|
1366
|
+
};
|
|
1367
|
+
content: {
|
|
1368
|
+
"application/json": {
|
|
1369
|
+
/** @constant */
|
|
1370
|
+
success: false;
|
|
1371
|
+
code: string;
|
|
1372
|
+
message?: string;
|
|
1373
|
+
resultCode?: string;
|
|
1374
|
+
};
|
|
1375
|
+
};
|
|
1376
|
+
};
|
|
1377
|
+
/** @description Not found */
|
|
1378
|
+
404: {
|
|
1379
|
+
headers: {
|
|
1380
|
+
[name: string]: unknown;
|
|
1381
|
+
};
|
|
1382
|
+
content: {
|
|
1383
|
+
"application/json": {
|
|
1384
|
+
/** @constant */
|
|
1385
|
+
success: false;
|
|
1386
|
+
code: string;
|
|
1387
|
+
message?: string;
|
|
1388
|
+
resultCode?: string;
|
|
1389
|
+
};
|
|
1390
|
+
};
|
|
1391
|
+
};
|
|
1392
|
+
};
|
|
1393
|
+
};
|
|
1394
|
+
postAuthEmail: {
|
|
1395
|
+
parameters: {
|
|
1396
|
+
query?: never;
|
|
1397
|
+
header?: never;
|
|
1398
|
+
path?: never;
|
|
1399
|
+
cookie?: never;
|
|
1400
|
+
};
|
|
1401
|
+
requestBody: {
|
|
1402
|
+
content: {
|
|
1403
|
+
"application/json": {
|
|
1404
|
+
clientSessionId: string;
|
|
1405
|
+
/** Format: email */
|
|
1406
|
+
email: string;
|
|
1407
|
+
};
|
|
1408
|
+
};
|
|
1409
|
+
};
|
|
1410
|
+
responses: {
|
|
1411
|
+
/** @description Code sent */
|
|
1412
|
+
200: {
|
|
1413
|
+
headers: {
|
|
1414
|
+
[name: string]: unknown;
|
|
1415
|
+
};
|
|
1416
|
+
content: {
|
|
1417
|
+
"application/json": {
|
|
1418
|
+
/** @constant */
|
|
1419
|
+
code: "SDK_EMAIL_CODE_SENT";
|
|
1420
|
+
/** @constant */
|
|
1421
|
+
success: true;
|
|
1422
|
+
content: {
|
|
1423
|
+
clientSessionId: string;
|
|
1424
|
+
email: string;
|
|
1425
|
+
};
|
|
1426
|
+
};
|
|
1427
|
+
};
|
|
1428
|
+
};
|
|
1429
|
+
/** @description Validation error */
|
|
1430
|
+
400: {
|
|
1431
|
+
headers: {
|
|
1432
|
+
[name: string]: unknown;
|
|
1433
|
+
};
|
|
1434
|
+
content: {
|
|
1435
|
+
"application/json": {
|
|
1436
|
+
/** @constant */
|
|
1437
|
+
success: false;
|
|
1438
|
+
code: string;
|
|
1439
|
+
message?: string;
|
|
1440
|
+
resultCode?: string;
|
|
1441
|
+
};
|
|
1442
|
+
};
|
|
1443
|
+
};
|
|
1444
|
+
/** @description Unauthorized */
|
|
1445
|
+
401: {
|
|
1446
|
+
headers: {
|
|
1447
|
+
[name: string]: unknown;
|
|
1448
|
+
};
|
|
1449
|
+
content: {
|
|
1450
|
+
"application/json": {
|
|
1451
|
+
/** @constant */
|
|
1452
|
+
success: false;
|
|
1453
|
+
code: string;
|
|
1454
|
+
message?: string;
|
|
1455
|
+
resultCode?: string;
|
|
1456
|
+
};
|
|
1457
|
+
};
|
|
1458
|
+
};
|
|
1459
|
+
/** @description Forbidden */
|
|
1460
|
+
403: {
|
|
1461
|
+
headers: {
|
|
1462
|
+
[name: string]: unknown;
|
|
1463
|
+
};
|
|
1464
|
+
content: {
|
|
1465
|
+
"application/json": {
|
|
1466
|
+
/** @constant */
|
|
1467
|
+
success: false;
|
|
1468
|
+
code: string;
|
|
1469
|
+
message?: string;
|
|
1470
|
+
resultCode?: string;
|
|
1471
|
+
};
|
|
1472
|
+
};
|
|
1473
|
+
};
|
|
1474
|
+
/** @description Not found */
|
|
1475
|
+
404: {
|
|
1476
|
+
headers: {
|
|
1477
|
+
[name: string]: unknown;
|
|
1478
|
+
};
|
|
1479
|
+
content: {
|
|
1480
|
+
"application/json": {
|
|
1481
|
+
/** @constant */
|
|
1482
|
+
success: false;
|
|
1483
|
+
code: string;
|
|
1484
|
+
message?: string;
|
|
1485
|
+
resultCode?: string;
|
|
1486
|
+
};
|
|
1487
|
+
};
|
|
1488
|
+
};
|
|
1489
|
+
/** @description Gone (expired) */
|
|
1490
|
+
410: {
|
|
1491
|
+
headers: {
|
|
1492
|
+
[name: string]: unknown;
|
|
1493
|
+
};
|
|
1494
|
+
content: {
|
|
1495
|
+
"application/json": {
|
|
1496
|
+
/** @constant */
|
|
1497
|
+
success: false;
|
|
1498
|
+
code: string;
|
|
1499
|
+
message?: string;
|
|
1500
|
+
resultCode?: string;
|
|
1501
|
+
};
|
|
1502
|
+
};
|
|
1503
|
+
};
|
|
1504
|
+
};
|
|
1505
|
+
};
|
|
1506
|
+
postAuthEmailVerifyCode: {
|
|
1507
|
+
parameters: {
|
|
1508
|
+
query?: never;
|
|
1509
|
+
header?: never;
|
|
1510
|
+
path?: never;
|
|
1511
|
+
cookie?: never;
|
|
1512
|
+
};
|
|
1513
|
+
requestBody: {
|
|
1514
|
+
content: {
|
|
1515
|
+
"application/json": {
|
|
1516
|
+
clientSessionId: string;
|
|
1517
|
+
code: string;
|
|
1518
|
+
};
|
|
1519
|
+
};
|
|
1520
|
+
};
|
|
1521
|
+
responses: {
|
|
1522
|
+
/** @description Code verified */
|
|
1523
|
+
200: {
|
|
1524
|
+
headers: {
|
|
1525
|
+
[name: string]: unknown;
|
|
1526
|
+
};
|
|
1527
|
+
content: {
|
|
1528
|
+
"application/json": {
|
|
1529
|
+
/** @constant */
|
|
1530
|
+
code: "SDK_EMAIL_CODE_VERIFIED";
|
|
1531
|
+
/** @constant */
|
|
1532
|
+
success: true;
|
|
1533
|
+
content: {
|
|
1534
|
+
clientSessionId: string;
|
|
1535
|
+
};
|
|
1536
|
+
};
|
|
1537
|
+
};
|
|
2594
1538
|
};
|
|
2595
1539
|
/** @description Validation error */
|
|
2596
1540
|
400: {
|
|
@@ -2602,6 +1546,8 @@ interface operations {
|
|
|
2602
1546
|
/** @constant */
|
|
2603
1547
|
success: false;
|
|
2604
1548
|
code: string;
|
|
1549
|
+
message?: string;
|
|
1550
|
+
resultCode?: string;
|
|
2605
1551
|
};
|
|
2606
1552
|
};
|
|
2607
1553
|
};
|
|
@@ -2615,6 +1561,23 @@ interface operations {
|
|
|
2615
1561
|
/** @constant */
|
|
2616
1562
|
success: false;
|
|
2617
1563
|
code: string;
|
|
1564
|
+
message?: string;
|
|
1565
|
+
resultCode?: string;
|
|
1566
|
+
};
|
|
1567
|
+
};
|
|
1568
|
+
};
|
|
1569
|
+
/** @description Forbidden */
|
|
1570
|
+
403: {
|
|
1571
|
+
headers: {
|
|
1572
|
+
[name: string]: unknown;
|
|
1573
|
+
};
|
|
1574
|
+
content: {
|
|
1575
|
+
"application/json": {
|
|
1576
|
+
/** @constant */
|
|
1577
|
+
success: false;
|
|
1578
|
+
code: string;
|
|
1579
|
+
message?: string;
|
|
1580
|
+
resultCode?: string;
|
|
2618
1581
|
};
|
|
2619
1582
|
};
|
|
2620
1583
|
};
|
|
@@ -2628,12 +1591,29 @@ interface operations {
|
|
|
2628
1591
|
/** @constant */
|
|
2629
1592
|
success: false;
|
|
2630
1593
|
code: string;
|
|
1594
|
+
message?: string;
|
|
1595
|
+
resultCode?: string;
|
|
1596
|
+
};
|
|
1597
|
+
};
|
|
1598
|
+
};
|
|
1599
|
+
/** @description Gone (expired) */
|
|
1600
|
+
410: {
|
|
1601
|
+
headers: {
|
|
1602
|
+
[name: string]: unknown;
|
|
1603
|
+
};
|
|
1604
|
+
content: {
|
|
1605
|
+
"application/json": {
|
|
1606
|
+
/** @constant */
|
|
1607
|
+
success: false;
|
|
1608
|
+
code: string;
|
|
1609
|
+
message?: string;
|
|
1610
|
+
resultCode?: string;
|
|
2631
1611
|
};
|
|
2632
1612
|
};
|
|
2633
1613
|
};
|
|
2634
1614
|
};
|
|
2635
1615
|
};
|
|
2636
|
-
|
|
1616
|
+
postAuthWalletChallenge: {
|
|
2637
1617
|
parameters: {
|
|
2638
1618
|
query?: never;
|
|
2639
1619
|
header?: never;
|
|
@@ -2644,13 +1624,12 @@ interface operations {
|
|
|
2644
1624
|
content: {
|
|
2645
1625
|
"application/json": {
|
|
2646
1626
|
clientSessionId: string;
|
|
2647
|
-
|
|
2648
|
-
email: string;
|
|
1627
|
+
walletAddress: string;
|
|
2649
1628
|
};
|
|
2650
1629
|
};
|
|
2651
1630
|
};
|
|
2652
1631
|
responses: {
|
|
2653
|
-
/** @description
|
|
1632
|
+
/** @description Challenge issued */
|
|
2654
1633
|
200: {
|
|
2655
1634
|
headers: {
|
|
2656
1635
|
[name: string]: unknown;
|
|
@@ -2658,12 +1637,12 @@ interface operations {
|
|
|
2658
1637
|
content: {
|
|
2659
1638
|
"application/json": {
|
|
2660
1639
|
/** @constant */
|
|
2661
|
-
code: "
|
|
1640
|
+
code: "SDK_WALLET_CHALLENGE_CREATED";
|
|
2662
1641
|
/** @constant */
|
|
2663
1642
|
success: true;
|
|
2664
1643
|
content: {
|
|
2665
1644
|
clientSessionId: string;
|
|
2666
|
-
|
|
1645
|
+
challengeXdr: string;
|
|
2667
1646
|
};
|
|
2668
1647
|
};
|
|
2669
1648
|
};
|
|
@@ -2678,6 +1657,8 @@ interface operations {
|
|
|
2678
1657
|
/** @constant */
|
|
2679
1658
|
success: false;
|
|
2680
1659
|
code: string;
|
|
1660
|
+
message?: string;
|
|
1661
|
+
resultCode?: string;
|
|
2681
1662
|
};
|
|
2682
1663
|
};
|
|
2683
1664
|
};
|
|
@@ -2691,6 +1672,8 @@ interface operations {
|
|
|
2691
1672
|
/** @constant */
|
|
2692
1673
|
success: false;
|
|
2693
1674
|
code: string;
|
|
1675
|
+
message?: string;
|
|
1676
|
+
resultCode?: string;
|
|
2694
1677
|
};
|
|
2695
1678
|
};
|
|
2696
1679
|
};
|
|
@@ -2704,6 +1687,8 @@ interface operations {
|
|
|
2704
1687
|
/** @constant */
|
|
2705
1688
|
success: false;
|
|
2706
1689
|
code: string;
|
|
1690
|
+
message?: string;
|
|
1691
|
+
resultCode?: string;
|
|
2707
1692
|
};
|
|
2708
1693
|
};
|
|
2709
1694
|
};
|
|
@@ -2717,6 +1702,8 @@ interface operations {
|
|
|
2717
1702
|
/** @constant */
|
|
2718
1703
|
success: false;
|
|
2719
1704
|
code: string;
|
|
1705
|
+
message?: string;
|
|
1706
|
+
resultCode?: string;
|
|
2720
1707
|
};
|
|
2721
1708
|
};
|
|
2722
1709
|
};
|
|
@@ -2730,12 +1717,14 @@ interface operations {
|
|
|
2730
1717
|
/** @constant */
|
|
2731
1718
|
success: false;
|
|
2732
1719
|
code: string;
|
|
1720
|
+
message?: string;
|
|
1721
|
+
resultCode?: string;
|
|
2733
1722
|
};
|
|
2734
1723
|
};
|
|
2735
1724
|
};
|
|
2736
1725
|
};
|
|
2737
1726
|
};
|
|
2738
|
-
|
|
1727
|
+
postAuthWallet: {
|
|
2739
1728
|
parameters: {
|
|
2740
1729
|
query?: never;
|
|
2741
1730
|
header?: never;
|
|
@@ -2746,12 +1735,13 @@ interface operations {
|
|
|
2746
1735
|
content: {
|
|
2747
1736
|
"application/json": {
|
|
2748
1737
|
clientSessionId: string;
|
|
2749
|
-
|
|
1738
|
+
walletAddress: string;
|
|
1739
|
+
signedChallengeXdr?: string;
|
|
2750
1740
|
};
|
|
2751
1741
|
};
|
|
2752
1742
|
};
|
|
2753
1743
|
responses: {
|
|
2754
|
-
/** @description
|
|
1744
|
+
/** @description Wallet authenticated */
|
|
2755
1745
|
200: {
|
|
2756
1746
|
headers: {
|
|
2757
1747
|
[name: string]: unknown;
|
|
@@ -2759,11 +1749,12 @@ interface operations {
|
|
|
2759
1749
|
content: {
|
|
2760
1750
|
"application/json": {
|
|
2761
1751
|
/** @constant */
|
|
2762
|
-
code: "
|
|
1752
|
+
code: "SDK_WALLET_AUTHENTICATED";
|
|
2763
1753
|
/** @constant */
|
|
2764
1754
|
success: true;
|
|
2765
1755
|
content: {
|
|
2766
1756
|
clientSessionId: string;
|
|
1757
|
+
walletAddress: string;
|
|
2767
1758
|
};
|
|
2768
1759
|
};
|
|
2769
1760
|
};
|
|
@@ -2778,6 +1769,8 @@ interface operations {
|
|
|
2778
1769
|
/** @constant */
|
|
2779
1770
|
success: false;
|
|
2780
1771
|
code: string;
|
|
1772
|
+
message?: string;
|
|
1773
|
+
resultCode?: string;
|
|
2781
1774
|
};
|
|
2782
1775
|
};
|
|
2783
1776
|
};
|
|
@@ -2791,6 +1784,8 @@ interface operations {
|
|
|
2791
1784
|
/** @constant */
|
|
2792
1785
|
success: false;
|
|
2793
1786
|
code: string;
|
|
1787
|
+
message?: string;
|
|
1788
|
+
resultCode?: string;
|
|
2794
1789
|
};
|
|
2795
1790
|
};
|
|
2796
1791
|
};
|
|
@@ -2804,6 +1799,8 @@ interface operations {
|
|
|
2804
1799
|
/** @constant */
|
|
2805
1800
|
success: false;
|
|
2806
1801
|
code: string;
|
|
1802
|
+
message?: string;
|
|
1803
|
+
resultCode?: string;
|
|
2807
1804
|
};
|
|
2808
1805
|
};
|
|
2809
1806
|
};
|
|
@@ -2817,6 +1814,8 @@ interface operations {
|
|
|
2817
1814
|
/** @constant */
|
|
2818
1815
|
success: false;
|
|
2819
1816
|
code: string;
|
|
1817
|
+
message?: string;
|
|
1818
|
+
resultCode?: string;
|
|
2820
1819
|
};
|
|
2821
1820
|
};
|
|
2822
1821
|
};
|
|
@@ -2830,12 +1829,14 @@ interface operations {
|
|
|
2830
1829
|
/** @constant */
|
|
2831
1830
|
success: false;
|
|
2832
1831
|
code: string;
|
|
1832
|
+
message?: string;
|
|
1833
|
+
resultCode?: string;
|
|
2833
1834
|
};
|
|
2834
1835
|
};
|
|
2835
1836
|
};
|
|
2836
1837
|
};
|
|
2837
1838
|
};
|
|
2838
|
-
|
|
1839
|
+
postAuthExternal: {
|
|
2839
1840
|
parameters: {
|
|
2840
1841
|
query?: never;
|
|
2841
1842
|
header?: never;
|
|
@@ -2846,12 +1847,14 @@ interface operations {
|
|
|
2846
1847
|
content: {
|
|
2847
1848
|
"application/json": {
|
|
2848
1849
|
clientSessionId: string;
|
|
1850
|
+
provider: string;
|
|
2849
1851
|
walletAddress: string;
|
|
1852
|
+
signedChallengeXdr: string;
|
|
2850
1853
|
};
|
|
2851
1854
|
};
|
|
2852
1855
|
};
|
|
2853
1856
|
responses: {
|
|
2854
|
-
/** @description
|
|
1857
|
+
/** @description External provider authenticated */
|
|
2855
1858
|
200: {
|
|
2856
1859
|
headers: {
|
|
2857
1860
|
[name: string]: unknown;
|
|
@@ -2859,12 +1862,13 @@ interface operations {
|
|
|
2859
1862
|
content: {
|
|
2860
1863
|
"application/json": {
|
|
2861
1864
|
/** @constant */
|
|
2862
|
-
code: "
|
|
1865
|
+
code: "SDK_EXTERNAL_AUTHENTICATED";
|
|
2863
1866
|
/** @constant */
|
|
2864
1867
|
success: true;
|
|
2865
1868
|
content: {
|
|
2866
1869
|
clientSessionId: string;
|
|
2867
1870
|
walletAddress: string;
|
|
1871
|
+
provider: string;
|
|
2868
1872
|
};
|
|
2869
1873
|
};
|
|
2870
1874
|
};
|
|
@@ -2879,6 +1883,8 @@ interface operations {
|
|
|
2879
1883
|
/** @constant */
|
|
2880
1884
|
success: false;
|
|
2881
1885
|
code: string;
|
|
1886
|
+
message?: string;
|
|
1887
|
+
resultCode?: string;
|
|
2882
1888
|
};
|
|
2883
1889
|
};
|
|
2884
1890
|
};
|
|
@@ -2892,6 +1898,8 @@ interface operations {
|
|
|
2892
1898
|
/** @constant */
|
|
2893
1899
|
success: false;
|
|
2894
1900
|
code: string;
|
|
1901
|
+
message?: string;
|
|
1902
|
+
resultCode?: string;
|
|
2895
1903
|
};
|
|
2896
1904
|
};
|
|
2897
1905
|
};
|
|
@@ -2905,6 +1913,8 @@ interface operations {
|
|
|
2905
1913
|
/** @constant */
|
|
2906
1914
|
success: false;
|
|
2907
1915
|
code: string;
|
|
1916
|
+
message?: string;
|
|
1917
|
+
resultCode?: string;
|
|
2908
1918
|
};
|
|
2909
1919
|
};
|
|
2910
1920
|
};
|
|
@@ -2918,6 +1928,8 @@ interface operations {
|
|
|
2918
1928
|
/** @constant */
|
|
2919
1929
|
success: false;
|
|
2920
1930
|
code: string;
|
|
1931
|
+
message?: string;
|
|
1932
|
+
resultCode?: string;
|
|
2921
1933
|
};
|
|
2922
1934
|
};
|
|
2923
1935
|
};
|
|
@@ -2931,6 +1943,8 @@ interface operations {
|
|
|
2931
1943
|
/** @constant */
|
|
2932
1944
|
success: false;
|
|
2933
1945
|
code: string;
|
|
1946
|
+
message?: string;
|
|
1947
|
+
resultCode?: string;
|
|
2934
1948
|
};
|
|
2935
1949
|
};
|
|
2936
1950
|
};
|
|
@@ -2979,6 +1993,8 @@ interface operations {
|
|
|
2979
1993
|
/** @constant */
|
|
2980
1994
|
success: false;
|
|
2981
1995
|
code: string;
|
|
1996
|
+
message?: string;
|
|
1997
|
+
resultCode?: string;
|
|
2982
1998
|
};
|
|
2983
1999
|
};
|
|
2984
2000
|
};
|
|
@@ -2992,6 +2008,8 @@ interface operations {
|
|
|
2992
2008
|
/** @constant */
|
|
2993
2009
|
success: false;
|
|
2994
2010
|
code: string;
|
|
2011
|
+
message?: string;
|
|
2012
|
+
resultCode?: string;
|
|
2995
2013
|
};
|
|
2996
2014
|
};
|
|
2997
2015
|
};
|
|
@@ -3005,6 +2023,8 @@ interface operations {
|
|
|
3005
2023
|
/** @constant */
|
|
3006
2024
|
success: false;
|
|
3007
2025
|
code: string;
|
|
2026
|
+
message?: string;
|
|
2027
|
+
resultCode?: string;
|
|
3008
2028
|
};
|
|
3009
2029
|
};
|
|
3010
2030
|
};
|
|
@@ -3018,6 +2038,8 @@ interface operations {
|
|
|
3018
2038
|
/** @constant */
|
|
3019
2039
|
success: false;
|
|
3020
2040
|
code: string;
|
|
2041
|
+
message?: string;
|
|
2042
|
+
resultCode?: string;
|
|
3021
2043
|
};
|
|
3022
2044
|
};
|
|
3023
2045
|
};
|
|
@@ -3031,6 +2053,8 @@ interface operations {
|
|
|
3031
2053
|
/** @constant */
|
|
3032
2054
|
success: false;
|
|
3033
2055
|
code: string;
|
|
2056
|
+
message?: string;
|
|
2057
|
+
resultCode?: string;
|
|
3034
2058
|
};
|
|
3035
2059
|
};
|
|
3036
2060
|
};
|
|
@@ -3082,6 +2106,8 @@ interface operations {
|
|
|
3082
2106
|
/** @constant */
|
|
3083
2107
|
success: false;
|
|
3084
2108
|
code: string;
|
|
2109
|
+
message?: string;
|
|
2110
|
+
resultCode?: string;
|
|
3085
2111
|
};
|
|
3086
2112
|
};
|
|
3087
2113
|
};
|
|
@@ -3095,6 +2121,8 @@ interface operations {
|
|
|
3095
2121
|
/** @constant */
|
|
3096
2122
|
success: false;
|
|
3097
2123
|
code: string;
|
|
2124
|
+
message?: string;
|
|
2125
|
+
resultCode?: string;
|
|
3098
2126
|
};
|
|
3099
2127
|
};
|
|
3100
2128
|
};
|
|
@@ -3108,6 +2136,8 @@ interface operations {
|
|
|
3108
2136
|
/** @constant */
|
|
3109
2137
|
success: false;
|
|
3110
2138
|
code: string;
|
|
2139
|
+
message?: string;
|
|
2140
|
+
resultCode?: string;
|
|
3111
2141
|
};
|
|
3112
2142
|
};
|
|
3113
2143
|
};
|
|
@@ -3121,6 +2151,8 @@ interface operations {
|
|
|
3121
2151
|
/** @constant */
|
|
3122
2152
|
success: false;
|
|
3123
2153
|
code: string;
|
|
2154
|
+
message?: string;
|
|
2155
|
+
resultCode?: string;
|
|
3124
2156
|
};
|
|
3125
2157
|
};
|
|
3126
2158
|
};
|
|
@@ -3134,6 +2166,8 @@ interface operations {
|
|
|
3134
2166
|
/** @constant */
|
|
3135
2167
|
success: false;
|
|
3136
2168
|
code: string;
|
|
2169
|
+
message?: string;
|
|
2170
|
+
resultCode?: string;
|
|
3137
2171
|
};
|
|
3138
2172
|
};
|
|
3139
2173
|
};
|
|
@@ -3185,6 +2219,8 @@ interface operations {
|
|
|
3185
2219
|
/** @constant */
|
|
3186
2220
|
success: false;
|
|
3187
2221
|
code: string;
|
|
2222
|
+
message?: string;
|
|
2223
|
+
resultCode?: string;
|
|
3188
2224
|
};
|
|
3189
2225
|
};
|
|
3190
2226
|
};
|
|
@@ -3198,6 +2234,8 @@ interface operations {
|
|
|
3198
2234
|
/** @constant */
|
|
3199
2235
|
success: false;
|
|
3200
2236
|
code: string;
|
|
2237
|
+
message?: string;
|
|
2238
|
+
resultCode?: string;
|
|
3201
2239
|
};
|
|
3202
2240
|
};
|
|
3203
2241
|
};
|
|
@@ -3211,6 +2249,8 @@ interface operations {
|
|
|
3211
2249
|
/** @constant */
|
|
3212
2250
|
success: false;
|
|
3213
2251
|
code: string;
|
|
2252
|
+
message?: string;
|
|
2253
|
+
resultCode?: string;
|
|
3214
2254
|
};
|
|
3215
2255
|
};
|
|
3216
2256
|
};
|
|
@@ -3224,6 +2264,8 @@ interface operations {
|
|
|
3224
2264
|
/** @constant */
|
|
3225
2265
|
success: false;
|
|
3226
2266
|
code: string;
|
|
2267
|
+
message?: string;
|
|
2268
|
+
resultCode?: string;
|
|
3227
2269
|
};
|
|
3228
2270
|
};
|
|
3229
2271
|
};
|
|
@@ -3237,6 +2279,8 @@ interface operations {
|
|
|
3237
2279
|
/** @constant */
|
|
3238
2280
|
success: false;
|
|
3239
2281
|
code: string;
|
|
2282
|
+
message?: string;
|
|
2283
|
+
resultCode?: string;
|
|
3240
2284
|
};
|
|
3241
2285
|
};
|
|
3242
2286
|
};
|
|
@@ -3293,6 +2337,7 @@ interface operations {
|
|
|
3293
2337
|
wallet: {
|
|
3294
2338
|
/** @enum {string} */
|
|
3295
2339
|
type: "custodial" | "smart" | "external";
|
|
2340
|
+
provider?: string;
|
|
3296
2341
|
publicKey: string | null;
|
|
3297
2342
|
address: string | null;
|
|
3298
2343
|
existsOnStellar?: boolean;
|
|
@@ -3335,6 +2380,8 @@ interface operations {
|
|
|
3335
2380
|
/** @constant */
|
|
3336
2381
|
success: false;
|
|
3337
2382
|
code: string;
|
|
2383
|
+
message?: string;
|
|
2384
|
+
resultCode?: string;
|
|
3338
2385
|
};
|
|
3339
2386
|
};
|
|
3340
2387
|
};
|
|
@@ -3348,6 +2395,8 @@ interface operations {
|
|
|
3348
2395
|
/** @constant */
|
|
3349
2396
|
success: false;
|
|
3350
2397
|
code: string;
|
|
2398
|
+
message?: string;
|
|
2399
|
+
resultCode?: string;
|
|
3351
2400
|
};
|
|
3352
2401
|
};
|
|
3353
2402
|
};
|
|
@@ -3361,6 +2410,8 @@ interface operations {
|
|
|
3361
2410
|
/** @constant */
|
|
3362
2411
|
success: false;
|
|
3363
2412
|
code: string;
|
|
2413
|
+
message?: string;
|
|
2414
|
+
resultCode?: string;
|
|
3364
2415
|
};
|
|
3365
2416
|
};
|
|
3366
2417
|
};
|
|
@@ -3374,6 +2425,8 @@ interface operations {
|
|
|
3374
2425
|
/** @constant */
|
|
3375
2426
|
success: false;
|
|
3376
2427
|
code: string;
|
|
2428
|
+
message?: string;
|
|
2429
|
+
resultCode?: string;
|
|
3377
2430
|
};
|
|
3378
2431
|
};
|
|
3379
2432
|
};
|
|
@@ -3387,6 +2440,8 @@ interface operations {
|
|
|
3387
2440
|
/** @constant */
|
|
3388
2441
|
success: false;
|
|
3389
2442
|
code: string;
|
|
2443
|
+
message?: string;
|
|
2444
|
+
resultCode?: string;
|
|
3390
2445
|
};
|
|
3391
2446
|
};
|
|
3392
2447
|
};
|
|
@@ -3438,6 +2493,8 @@ interface operations {
|
|
|
3438
2493
|
/** @constant */
|
|
3439
2494
|
success: false;
|
|
3440
2495
|
code: string;
|
|
2496
|
+
message?: string;
|
|
2497
|
+
resultCode?: string;
|
|
3441
2498
|
};
|
|
3442
2499
|
};
|
|
3443
2500
|
};
|
|
@@ -3451,6 +2508,8 @@ interface operations {
|
|
|
3451
2508
|
/** @constant */
|
|
3452
2509
|
success: false;
|
|
3453
2510
|
code: string;
|
|
2511
|
+
message?: string;
|
|
2512
|
+
resultCode?: string;
|
|
3454
2513
|
};
|
|
3455
2514
|
};
|
|
3456
2515
|
};
|
|
@@ -3464,6 +2523,8 @@ interface operations {
|
|
|
3464
2523
|
/** @constant */
|
|
3465
2524
|
success: false;
|
|
3466
2525
|
code: string;
|
|
2526
|
+
message?: string;
|
|
2527
|
+
resultCode?: string;
|
|
3467
2528
|
};
|
|
3468
2529
|
};
|
|
3469
2530
|
};
|
|
@@ -3477,6 +2538,8 @@ interface operations {
|
|
|
3477
2538
|
/** @constant */
|
|
3478
2539
|
success: false;
|
|
3479
2540
|
code: string;
|
|
2541
|
+
message?: string;
|
|
2542
|
+
resultCode?: string;
|
|
3480
2543
|
};
|
|
3481
2544
|
};
|
|
3482
2545
|
};
|
|
@@ -3490,6 +2553,8 @@ interface operations {
|
|
|
3490
2553
|
/** @constant */
|
|
3491
2554
|
success: false;
|
|
3492
2555
|
code: string;
|
|
2556
|
+
message?: string;
|
|
2557
|
+
resultCode?: string;
|
|
3493
2558
|
};
|
|
3494
2559
|
};
|
|
3495
2560
|
};
|
|
@@ -3537,6 +2602,8 @@ interface operations {
|
|
|
3537
2602
|
/** @constant */
|
|
3538
2603
|
success: false;
|
|
3539
2604
|
code: string;
|
|
2605
|
+
message?: string;
|
|
2606
|
+
resultCode?: string;
|
|
3540
2607
|
};
|
|
3541
2608
|
};
|
|
3542
2609
|
};
|
|
@@ -3587,6 +2654,8 @@ interface operations {
|
|
|
3587
2654
|
/** @constant */
|
|
3588
2655
|
success: false;
|
|
3589
2656
|
code: string;
|
|
2657
|
+
message?: string;
|
|
2658
|
+
resultCode?: string;
|
|
3590
2659
|
};
|
|
3591
2660
|
};
|
|
3592
2661
|
};
|
|
@@ -3645,6 +2714,8 @@ interface operations {
|
|
|
3645
2714
|
/** @constant */
|
|
3646
2715
|
success: false;
|
|
3647
2716
|
code: string;
|
|
2717
|
+
message?: string;
|
|
2718
|
+
resultCode?: string;
|
|
3648
2719
|
};
|
|
3649
2720
|
};
|
|
3650
2721
|
};
|
|
@@ -3688,6 +2759,8 @@ interface operations {
|
|
|
3688
2759
|
/** @constant */
|
|
3689
2760
|
success: false;
|
|
3690
2761
|
code: string;
|
|
2762
|
+
message?: string;
|
|
2763
|
+
resultCode?: string;
|
|
3691
2764
|
};
|
|
3692
2765
|
};
|
|
3693
2766
|
};
|
|
@@ -3701,6 +2774,8 @@ interface operations {
|
|
|
3701
2774
|
/** @constant */
|
|
3702
2775
|
success: false;
|
|
3703
2776
|
code: string;
|
|
2777
|
+
message?: string;
|
|
2778
|
+
resultCode?: string;
|
|
3704
2779
|
};
|
|
3705
2780
|
};
|
|
3706
2781
|
};
|
|
@@ -3759,6 +2834,8 @@ interface operations {
|
|
|
3759
2834
|
/** @constant */
|
|
3760
2835
|
success: false;
|
|
3761
2836
|
code: string;
|
|
2837
|
+
message?: string;
|
|
2838
|
+
resultCode?: string;
|
|
3762
2839
|
};
|
|
3763
2840
|
};
|
|
3764
2841
|
};
|
|
@@ -3772,6 +2849,8 @@ interface operations {
|
|
|
3772
2849
|
/** @constant */
|
|
3773
2850
|
success: false;
|
|
3774
2851
|
code: string;
|
|
2852
|
+
message?: string;
|
|
2853
|
+
resultCode?: string;
|
|
3775
2854
|
};
|
|
3776
2855
|
};
|
|
3777
2856
|
};
|
|
@@ -3785,6 +2864,8 @@ interface operations {
|
|
|
3785
2864
|
/** @constant */
|
|
3786
2865
|
success: false;
|
|
3787
2866
|
code: string;
|
|
2867
|
+
message?: string;
|
|
2868
|
+
resultCode?: string;
|
|
3788
2869
|
};
|
|
3789
2870
|
};
|
|
3790
2871
|
};
|
|
@@ -3820,6 +2901,8 @@ interface operations {
|
|
|
3820
2901
|
/** @constant */
|
|
3821
2902
|
success: false;
|
|
3822
2903
|
code: string;
|
|
2904
|
+
message?: string;
|
|
2905
|
+
resultCode?: string;
|
|
3823
2906
|
};
|
|
3824
2907
|
};
|
|
3825
2908
|
};
|
|
@@ -4078,6 +3161,8 @@ interface operations {
|
|
|
4078
3161
|
/** @constant */
|
|
4079
3162
|
success: false;
|
|
4080
3163
|
code: string;
|
|
3164
|
+
message?: string;
|
|
3165
|
+
resultCode?: string;
|
|
4081
3166
|
};
|
|
4082
3167
|
};
|
|
4083
3168
|
};
|
|
@@ -4091,6 +3176,8 @@ interface operations {
|
|
|
4091
3176
|
/** @constant */
|
|
4092
3177
|
success: false;
|
|
4093
3178
|
code: string;
|
|
3179
|
+
message?: string;
|
|
3180
|
+
resultCode?: string;
|
|
4094
3181
|
};
|
|
4095
3182
|
};
|
|
4096
3183
|
};
|
|
@@ -4104,6 +3191,8 @@ interface operations {
|
|
|
4104
3191
|
/** @constant */
|
|
4105
3192
|
success: false;
|
|
4106
3193
|
code: string;
|
|
3194
|
+
message?: string;
|
|
3195
|
+
resultCode?: string;
|
|
4107
3196
|
};
|
|
4108
3197
|
};
|
|
4109
3198
|
};
|
|
@@ -4159,6 +3248,8 @@ interface operations {
|
|
|
4159
3248
|
/** @constant */
|
|
4160
3249
|
success: false;
|
|
4161
3250
|
code: string;
|
|
3251
|
+
message?: string;
|
|
3252
|
+
resultCode?: string;
|
|
4162
3253
|
};
|
|
4163
3254
|
};
|
|
4164
3255
|
};
|
|
@@ -4172,6 +3263,8 @@ interface operations {
|
|
|
4172
3263
|
/** @constant */
|
|
4173
3264
|
success: false;
|
|
4174
3265
|
code: string;
|
|
3266
|
+
message?: string;
|
|
3267
|
+
resultCode?: string;
|
|
4175
3268
|
};
|
|
4176
3269
|
};
|
|
4177
3270
|
};
|
|
@@ -4185,6 +3278,8 @@ interface operations {
|
|
|
4185
3278
|
/** @constant */
|
|
4186
3279
|
success: false;
|
|
4187
3280
|
code: string;
|
|
3281
|
+
message?: string;
|
|
3282
|
+
resultCode?: string;
|
|
4188
3283
|
};
|
|
4189
3284
|
};
|
|
4190
3285
|
};
|
|
@@ -4198,6 +3293,8 @@ interface operations {
|
|
|
4198
3293
|
/** @constant */
|
|
4199
3294
|
success: false;
|
|
4200
3295
|
code: string;
|
|
3296
|
+
message?: string;
|
|
3297
|
+
resultCode?: string;
|
|
4201
3298
|
};
|
|
4202
3299
|
};
|
|
4203
3300
|
};
|
|
@@ -4251,6 +3348,8 @@ interface operations {
|
|
|
4251
3348
|
/** @constant */
|
|
4252
3349
|
success: false;
|
|
4253
3350
|
code: string;
|
|
3351
|
+
message?: string;
|
|
3352
|
+
resultCode?: string;
|
|
4254
3353
|
};
|
|
4255
3354
|
};
|
|
4256
3355
|
};
|
|
@@ -4264,6 +3363,8 @@ interface operations {
|
|
|
4264
3363
|
/** @constant */
|
|
4265
3364
|
success: false;
|
|
4266
3365
|
code: string;
|
|
3366
|
+
message?: string;
|
|
3367
|
+
resultCode?: string;
|
|
4267
3368
|
};
|
|
4268
3369
|
};
|
|
4269
3370
|
};
|
|
@@ -4277,6 +3378,107 @@ interface operations {
|
|
|
4277
3378
|
/** @constant */
|
|
4278
3379
|
success: false;
|
|
4279
3380
|
code: string;
|
|
3381
|
+
message?: string;
|
|
3382
|
+
resultCode?: string;
|
|
3383
|
+
};
|
|
3384
|
+
};
|
|
3385
|
+
};
|
|
3386
|
+
/** @description Signing error */
|
|
3387
|
+
502: {
|
|
3388
|
+
headers: {
|
|
3389
|
+
[name: string]: unknown;
|
|
3390
|
+
};
|
|
3391
|
+
content: {
|
|
3392
|
+
"application/json": {
|
|
3393
|
+
/** @constant */
|
|
3394
|
+
success: false;
|
|
3395
|
+
code: string;
|
|
3396
|
+
message?: string;
|
|
3397
|
+
resultCode?: string;
|
|
3398
|
+
};
|
|
3399
|
+
};
|
|
3400
|
+
};
|
|
3401
|
+
};
|
|
3402
|
+
};
|
|
3403
|
+
postTxSignAuthEntry: {
|
|
3404
|
+
parameters: {
|
|
3405
|
+
query?: never;
|
|
3406
|
+
header?: never;
|
|
3407
|
+
path?: never;
|
|
3408
|
+
cookie?: never;
|
|
3409
|
+
};
|
|
3410
|
+
requestBody: {
|
|
3411
|
+
content: {
|
|
3412
|
+
"application/json": {
|
|
3413
|
+
/** @enum {string} */
|
|
3414
|
+
network: "testnet" | "mainnet";
|
|
3415
|
+
publicKey?: string;
|
|
3416
|
+
address?: string;
|
|
3417
|
+
entryXdr: string;
|
|
3418
|
+
validUntilLedger: number;
|
|
3419
|
+
};
|
|
3420
|
+
};
|
|
3421
|
+
};
|
|
3422
|
+
responses: {
|
|
3423
|
+
/** @description Base64 XDR of the signed auth entry */
|
|
3424
|
+
200: {
|
|
3425
|
+
headers: {
|
|
3426
|
+
[name: string]: unknown;
|
|
3427
|
+
};
|
|
3428
|
+
content: {
|
|
3429
|
+
"application/json": {
|
|
3430
|
+
/** @constant */
|
|
3431
|
+
code: "SDK_TX_AUTH_ENTRY_SIGNED";
|
|
3432
|
+
/** @constant */
|
|
3433
|
+
success: true;
|
|
3434
|
+
content: {
|
|
3435
|
+
signedAuthEntry: string;
|
|
3436
|
+
};
|
|
3437
|
+
};
|
|
3438
|
+
};
|
|
3439
|
+
};
|
|
3440
|
+
/** @description Validation error */
|
|
3441
|
+
400: {
|
|
3442
|
+
headers: {
|
|
3443
|
+
[name: string]: unknown;
|
|
3444
|
+
};
|
|
3445
|
+
content: {
|
|
3446
|
+
"application/json": {
|
|
3447
|
+
/** @constant */
|
|
3448
|
+
success: false;
|
|
3449
|
+
code: string;
|
|
3450
|
+
message?: string;
|
|
3451
|
+
resultCode?: string;
|
|
3452
|
+
};
|
|
3453
|
+
};
|
|
3454
|
+
};
|
|
3455
|
+
/** @description Unauthorized */
|
|
3456
|
+
401: {
|
|
3457
|
+
headers: {
|
|
3458
|
+
[name: string]: unknown;
|
|
3459
|
+
};
|
|
3460
|
+
content: {
|
|
3461
|
+
"application/json": {
|
|
3462
|
+
/** @constant */
|
|
3463
|
+
success: false;
|
|
3464
|
+
code: string;
|
|
3465
|
+
message?: string;
|
|
3466
|
+
resultCode?: string;
|
|
3467
|
+
};
|
|
3468
|
+
};
|
|
3469
|
+
};
|
|
3470
|
+
/** @description Policy denial (contract/function not allowlisted, expiration too long) */
|
|
3471
|
+
403: {
|
|
3472
|
+
headers: {
|
|
3473
|
+
[name: string]: unknown;
|
|
3474
|
+
};
|
|
3475
|
+
content: {
|
|
3476
|
+
"application/json": {
|
|
3477
|
+
/** @constant */
|
|
3478
|
+
success: false;
|
|
3479
|
+
code: string;
|
|
3480
|
+
message?: string;
|
|
3481
|
+
resultCode?: string;
|
|
4280
3482
|
};
|
|
4281
3483
|
};
|
|
4282
3484
|
};
|
|
@@ -4290,6 +3492,8 @@ interface operations {
|
|
|
4290
3492
|
/** @constant */
|
|
4291
3493
|
success: false;
|
|
4292
3494
|
code: string;
|
|
3495
|
+
message?: string;
|
|
3496
|
+
resultCode?: string;
|
|
4293
3497
|
};
|
|
4294
3498
|
};
|
|
4295
3499
|
};
|
|
@@ -4355,6 +3559,8 @@ interface operations {
|
|
|
4355
3559
|
/** @constant */
|
|
4356
3560
|
success: false;
|
|
4357
3561
|
code: string;
|
|
3562
|
+
message?: string;
|
|
3563
|
+
resultCode?: string;
|
|
4358
3564
|
};
|
|
4359
3565
|
};
|
|
4360
3566
|
};
|
|
@@ -4368,6 +3574,8 @@ interface operations {
|
|
|
4368
3574
|
/** @constant */
|
|
4369
3575
|
success: false;
|
|
4370
3576
|
code: string;
|
|
3577
|
+
message?: string;
|
|
3578
|
+
resultCode?: string;
|
|
4371
3579
|
};
|
|
4372
3580
|
};
|
|
4373
3581
|
};
|
|
@@ -4381,6 +3589,8 @@ interface operations {
|
|
|
4381
3589
|
/** @constant */
|
|
4382
3590
|
success: false;
|
|
4383
3591
|
code: string;
|
|
3592
|
+
message?: string;
|
|
3593
|
+
resultCode?: string;
|
|
4384
3594
|
};
|
|
4385
3595
|
};
|
|
4386
3596
|
};
|
|
@@ -4638,6 +3848,8 @@ interface operations {
|
|
|
4638
3848
|
/** @constant */
|
|
4639
3849
|
success: false;
|
|
4640
3850
|
code: string;
|
|
3851
|
+
message?: string;
|
|
3852
|
+
resultCode?: string;
|
|
4641
3853
|
};
|
|
4642
3854
|
};
|
|
4643
3855
|
};
|
|
@@ -4651,6 +3863,8 @@ interface operations {
|
|
|
4651
3863
|
/** @constant */
|
|
4652
3864
|
success: false;
|
|
4653
3865
|
code: string;
|
|
3866
|
+
message?: string;
|
|
3867
|
+
resultCode?: string;
|
|
4654
3868
|
};
|
|
4655
3869
|
};
|
|
4656
3870
|
};
|
|
@@ -4664,6 +3878,8 @@ interface operations {
|
|
|
4664
3878
|
/** @constant */
|
|
4665
3879
|
success: false;
|
|
4666
3880
|
code: string;
|
|
3881
|
+
message?: string;
|
|
3882
|
+
resultCode?: string;
|
|
4667
3883
|
};
|
|
4668
3884
|
};
|
|
4669
3885
|
};
|
|
@@ -4713,6 +3929,8 @@ interface operations {
|
|
|
4713
3929
|
/** @constant */
|
|
4714
3930
|
success: false;
|
|
4715
3931
|
code: string;
|
|
3932
|
+
message?: string;
|
|
3933
|
+
resultCode?: string;
|
|
4716
3934
|
};
|
|
4717
3935
|
};
|
|
4718
3936
|
};
|
|
@@ -4726,6 +3944,8 @@ interface operations {
|
|
|
4726
3944
|
/** @constant */
|
|
4727
3945
|
success: false;
|
|
4728
3946
|
code: string;
|
|
3947
|
+
message?: string;
|
|
3948
|
+
resultCode?: string;
|
|
4729
3949
|
};
|
|
4730
3950
|
};
|
|
4731
3951
|
};
|
|
@@ -4789,6 +4009,8 @@ interface operations {
|
|
|
4789
4009
|
/** @constant */
|
|
4790
4010
|
success: false;
|
|
4791
4011
|
code: string;
|
|
4012
|
+
message?: string;
|
|
4013
|
+
resultCode?: string;
|
|
4792
4014
|
};
|
|
4793
4015
|
};
|
|
4794
4016
|
};
|
|
@@ -4802,6 +4024,8 @@ interface operations {
|
|
|
4802
4024
|
/** @constant */
|
|
4803
4025
|
success: false;
|
|
4804
4026
|
code: string;
|
|
4027
|
+
message?: string;
|
|
4028
|
+
resultCode?: string;
|
|
4805
4029
|
};
|
|
4806
4030
|
};
|
|
4807
4031
|
};
|
|
@@ -4850,6 +4074,8 @@ interface operations {
|
|
|
4850
4074
|
/** @constant */
|
|
4851
4075
|
success: false;
|
|
4852
4076
|
code: string;
|
|
4077
|
+
message?: string;
|
|
4078
|
+
resultCode?: string;
|
|
4853
4079
|
};
|
|
4854
4080
|
};
|
|
4855
4081
|
};
|
|
@@ -4863,6 +4089,8 @@ interface operations {
|
|
|
4863
4089
|
/** @constant */
|
|
4864
4090
|
success: false;
|
|
4865
4091
|
code: string;
|
|
4092
|
+
message?: string;
|
|
4093
|
+
resultCode?: string;
|
|
4866
4094
|
};
|
|
4867
4095
|
};
|
|
4868
4096
|
};
|
|
@@ -4876,6 +4104,8 @@ interface operations {
|
|
|
4876
4104
|
/** @constant */
|
|
4877
4105
|
success: false;
|
|
4878
4106
|
code: string;
|
|
4107
|
+
message?: string;
|
|
4108
|
+
resultCode?: string;
|
|
4879
4109
|
};
|
|
4880
4110
|
};
|
|
4881
4111
|
};
|
|
@@ -4889,6 +4119,8 @@ interface operations {
|
|
|
4889
4119
|
/** @constant */
|
|
4890
4120
|
success: false;
|
|
4891
4121
|
code: string;
|
|
4122
|
+
message?: string;
|
|
4123
|
+
resultCode?: string;
|
|
4892
4124
|
};
|
|
4893
4125
|
};
|
|
4894
4126
|
};
|
|
@@ -4966,6 +4198,8 @@ interface operations {
|
|
|
4966
4198
|
/** @constant */
|
|
4967
4199
|
success: false;
|
|
4968
4200
|
code: string;
|
|
4201
|
+
message?: string;
|
|
4202
|
+
resultCode?: string;
|
|
4969
4203
|
};
|
|
4970
4204
|
};
|
|
4971
4205
|
};
|
|
@@ -4979,6 +4213,8 @@ interface operations {
|
|
|
4979
4213
|
/** @constant */
|
|
4980
4214
|
success: false;
|
|
4981
4215
|
code: string;
|
|
4216
|
+
message?: string;
|
|
4217
|
+
resultCode?: string;
|
|
4982
4218
|
};
|
|
4983
4219
|
};
|
|
4984
4220
|
};
|
|
@@ -4992,6 +4228,8 @@ interface operations {
|
|
|
4992
4228
|
/** @constant */
|
|
4993
4229
|
success: false;
|
|
4994
4230
|
code: string;
|
|
4231
|
+
message?: string;
|
|
4232
|
+
resultCode?: string;
|
|
4995
4233
|
};
|
|
4996
4234
|
};
|
|
4997
4235
|
};
|
|
@@ -5047,6 +4285,8 @@ interface operations {
|
|
|
5047
4285
|
/** @constant */
|
|
5048
4286
|
success: false;
|
|
5049
4287
|
code: string;
|
|
4288
|
+
message?: string;
|
|
4289
|
+
resultCode?: string;
|
|
5050
4290
|
};
|
|
5051
4291
|
};
|
|
5052
4292
|
};
|
|
@@ -5060,6 +4300,8 @@ interface operations {
|
|
|
5060
4300
|
/** @constant */
|
|
5061
4301
|
success: false;
|
|
5062
4302
|
code: string;
|
|
4303
|
+
message?: string;
|
|
4304
|
+
resultCode?: string;
|
|
5063
4305
|
};
|
|
5064
4306
|
};
|
|
5065
4307
|
};
|
|
@@ -5115,6 +4357,8 @@ interface operations {
|
|
|
5115
4357
|
/** @constant */
|
|
5116
4358
|
success: false;
|
|
5117
4359
|
code: string;
|
|
4360
|
+
message?: string;
|
|
4361
|
+
resultCode?: string;
|
|
5118
4362
|
};
|
|
5119
4363
|
};
|
|
5120
4364
|
};
|
|
@@ -5128,6 +4372,8 @@ interface operations {
|
|
|
5128
4372
|
/** @constant */
|
|
5129
4373
|
success: false;
|
|
5130
4374
|
code: string;
|
|
4375
|
+
message?: string;
|
|
4376
|
+
resultCode?: string;
|
|
5131
4377
|
};
|
|
5132
4378
|
};
|
|
5133
4379
|
};
|
|
@@ -5191,6 +4437,8 @@ interface operations {
|
|
|
5191
4437
|
/** @constant */
|
|
5192
4438
|
success: false;
|
|
5193
4439
|
code: string;
|
|
4440
|
+
message?: string;
|
|
4441
|
+
resultCode?: string;
|
|
5194
4442
|
};
|
|
5195
4443
|
};
|
|
5196
4444
|
};
|
|
@@ -5204,6 +4452,8 @@ interface operations {
|
|
|
5204
4452
|
/** @constant */
|
|
5205
4453
|
success: false;
|
|
5206
4454
|
code: string;
|
|
4455
|
+
message?: string;
|
|
4456
|
+
resultCode?: string;
|
|
5207
4457
|
};
|
|
5208
4458
|
};
|
|
5209
4459
|
};
|
|
@@ -5217,6 +4467,8 @@ interface operations {
|
|
|
5217
4467
|
/** @constant */
|
|
5218
4468
|
success: false;
|
|
5219
4469
|
code: string;
|
|
4470
|
+
message?: string;
|
|
4471
|
+
resultCode?: string;
|
|
5220
4472
|
};
|
|
5221
4473
|
};
|
|
5222
4474
|
};
|
|
@@ -5276,6 +4528,8 @@ interface operations {
|
|
|
5276
4528
|
/** @constant */
|
|
5277
4529
|
success: false;
|
|
5278
4530
|
code: string;
|
|
4531
|
+
message?: string;
|
|
4532
|
+
resultCode?: string;
|
|
5279
4533
|
};
|
|
5280
4534
|
};
|
|
5281
4535
|
};
|
|
@@ -5289,6 +4543,8 @@ interface operations {
|
|
|
5289
4543
|
/** @constant */
|
|
5290
4544
|
success: false;
|
|
5291
4545
|
code: string;
|
|
4546
|
+
message?: string;
|
|
4547
|
+
resultCode?: string;
|
|
5292
4548
|
};
|
|
5293
4549
|
};
|
|
5294
4550
|
};
|
|
@@ -5337,6 +4593,8 @@ interface operations {
|
|
|
5337
4593
|
/** @constant */
|
|
5338
4594
|
success: false;
|
|
5339
4595
|
code: string;
|
|
4596
|
+
message?: string;
|
|
4597
|
+
resultCode?: string;
|
|
5340
4598
|
};
|
|
5341
4599
|
};
|
|
5342
4600
|
};
|
|
@@ -5350,6 +4608,8 @@ interface operations {
|
|
|
5350
4608
|
/** @constant */
|
|
5351
4609
|
success: false;
|
|
5352
4610
|
code: string;
|
|
4611
|
+
message?: string;
|
|
4612
|
+
resultCode?: string;
|
|
5353
4613
|
};
|
|
5354
4614
|
};
|
|
5355
4615
|
};
|
|
@@ -5363,6 +4623,8 @@ interface operations {
|
|
|
5363
4623
|
/** @constant */
|
|
5364
4624
|
success: false;
|
|
5365
4625
|
code: string;
|
|
4626
|
+
message?: string;
|
|
4627
|
+
resultCode?: string;
|
|
5366
4628
|
};
|
|
5367
4629
|
};
|
|
5368
4630
|
};
|
|
@@ -5412,6 +4674,8 @@ interface operations {
|
|
|
5412
4674
|
/** @constant */
|
|
5413
4675
|
success: false;
|
|
5414
4676
|
code: string;
|
|
4677
|
+
message?: string;
|
|
4678
|
+
resultCode?: string;
|
|
5415
4679
|
};
|
|
5416
4680
|
};
|
|
5417
4681
|
};
|
|
@@ -5425,6 +4689,8 @@ interface operations {
|
|
|
5425
4689
|
/** @constant */
|
|
5426
4690
|
success: false;
|
|
5427
4691
|
code: string;
|
|
4692
|
+
message?: string;
|
|
4693
|
+
resultCode?: string;
|
|
5428
4694
|
};
|
|
5429
4695
|
};
|
|
5430
4696
|
};
|
|
@@ -5480,6 +4746,8 @@ interface operations {
|
|
|
5480
4746
|
/** @constant */
|
|
5481
4747
|
success: false;
|
|
5482
4748
|
code: string;
|
|
4749
|
+
message?: string;
|
|
4750
|
+
resultCode?: string;
|
|
5483
4751
|
};
|
|
5484
4752
|
};
|
|
5485
4753
|
};
|
|
@@ -5493,6 +4761,8 @@ interface operations {
|
|
|
5493
4761
|
/** @constant */
|
|
5494
4762
|
success: false;
|
|
5495
4763
|
code: string;
|
|
4764
|
+
message?: string;
|
|
4765
|
+
resultCode?: string;
|
|
5496
4766
|
};
|
|
5497
4767
|
};
|
|
5498
4768
|
};
|
|
@@ -5506,6 +4776,8 @@ interface operations {
|
|
|
5506
4776
|
/** @constant */
|
|
5507
4777
|
success: false;
|
|
5508
4778
|
code: string;
|
|
4779
|
+
message?: string;
|
|
4780
|
+
resultCode?: string;
|
|
5509
4781
|
};
|
|
5510
4782
|
};
|
|
5511
4783
|
};
|
|
@@ -5564,6 +4836,8 @@ interface operations {
|
|
|
5564
4836
|
/** @constant */
|
|
5565
4837
|
success: false;
|
|
5566
4838
|
code: string;
|
|
4839
|
+
message?: string;
|
|
4840
|
+
resultCode?: string;
|
|
5567
4841
|
};
|
|
5568
4842
|
};
|
|
5569
4843
|
};
|
|
@@ -5577,6 +4851,8 @@ interface operations {
|
|
|
5577
4851
|
/** @constant */
|
|
5578
4852
|
success: false;
|
|
5579
4853
|
code: string;
|
|
4854
|
+
message?: string;
|
|
4855
|
+
resultCode?: string;
|
|
5580
4856
|
};
|
|
5581
4857
|
};
|
|
5582
4858
|
};
|
|
@@ -5639,6 +4915,8 @@ interface operations {
|
|
|
5639
4915
|
/** @constant */
|
|
5640
4916
|
success: false;
|
|
5641
4917
|
code: string;
|
|
4918
|
+
message?: string;
|
|
4919
|
+
resultCode?: string;
|
|
5642
4920
|
};
|
|
5643
4921
|
};
|
|
5644
4922
|
};
|
|
@@ -5652,6 +4930,8 @@ interface operations {
|
|
|
5652
4930
|
/** @constant */
|
|
5653
4931
|
success: false;
|
|
5654
4932
|
code: string;
|
|
4933
|
+
message?: string;
|
|
4934
|
+
resultCode?: string;
|
|
5655
4935
|
};
|
|
5656
4936
|
};
|
|
5657
4937
|
};
|
|
@@ -5665,6 +4945,8 @@ interface operations {
|
|
|
5665
4945
|
/** @constant */
|
|
5666
4946
|
success: false;
|
|
5667
4947
|
code: string;
|
|
4948
|
+
message?: string;
|
|
4949
|
+
resultCode?: string;
|
|
5668
4950
|
};
|
|
5669
4951
|
};
|
|
5670
4952
|
};
|
|
@@ -5724,6 +5006,8 @@ interface operations {
|
|
|
5724
5006
|
/** @constant */
|
|
5725
5007
|
success: false;
|
|
5726
5008
|
code: string;
|
|
5009
|
+
message?: string;
|
|
5010
|
+
resultCode?: string;
|
|
5727
5011
|
};
|
|
5728
5012
|
};
|
|
5729
5013
|
};
|
|
@@ -5737,6 +5021,8 @@ interface operations {
|
|
|
5737
5021
|
/** @constant */
|
|
5738
5022
|
success: false;
|
|
5739
5023
|
code: string;
|
|
5024
|
+
message?: string;
|
|
5025
|
+
resultCode?: string;
|
|
5740
5026
|
};
|
|
5741
5027
|
};
|
|
5742
5028
|
};
|
|
@@ -5750,6 +5036,8 @@ interface operations {
|
|
|
5750
5036
|
/** @constant */
|
|
5751
5037
|
success: false;
|
|
5752
5038
|
code: string;
|
|
5039
|
+
message?: string;
|
|
5040
|
+
resultCode?: string;
|
|
5753
5041
|
};
|
|
5754
5042
|
};
|
|
5755
5043
|
};
|
|
@@ -5802,6 +5090,8 @@ interface operations {
|
|
|
5802
5090
|
/** @constant */
|
|
5803
5091
|
success: false;
|
|
5804
5092
|
code: string;
|
|
5093
|
+
message?: string;
|
|
5094
|
+
resultCode?: string;
|
|
5805
5095
|
};
|
|
5806
5096
|
};
|
|
5807
5097
|
};
|
|
@@ -5815,6 +5105,8 @@ interface operations {
|
|
|
5815
5105
|
/** @constant */
|
|
5816
5106
|
success: false;
|
|
5817
5107
|
code: string;
|
|
5108
|
+
message?: string;
|
|
5109
|
+
resultCode?: string;
|
|
5818
5110
|
};
|
|
5819
5111
|
};
|
|
5820
5112
|
};
|
|
@@ -5828,6 +5120,8 @@ interface operations {
|
|
|
5828
5120
|
/** @constant */
|
|
5829
5121
|
success: false;
|
|
5830
5122
|
code: string;
|
|
5123
|
+
message?: string;
|
|
5124
|
+
resultCode?: string;
|
|
5831
5125
|
};
|
|
5832
5126
|
};
|
|
5833
5127
|
};
|
|
@@ -5880,6 +5174,8 @@ interface operations {
|
|
|
5880
5174
|
/** @constant */
|
|
5881
5175
|
success: false;
|
|
5882
5176
|
code: string;
|
|
5177
|
+
message?: string;
|
|
5178
|
+
resultCode?: string;
|
|
5883
5179
|
};
|
|
5884
5180
|
};
|
|
5885
5181
|
};
|
|
@@ -5930,6 +5226,8 @@ interface operations {
|
|
|
5930
5226
|
/** @constant */
|
|
5931
5227
|
success: false;
|
|
5932
5228
|
code: string;
|
|
5229
|
+
message?: string;
|
|
5230
|
+
resultCode?: string;
|
|
5933
5231
|
};
|
|
5934
5232
|
};
|
|
5935
5233
|
};
|
|
@@ -5943,6 +5241,8 @@ interface operations {
|
|
|
5943
5241
|
/** @constant */
|
|
5944
5242
|
success: false;
|
|
5945
5243
|
code: string;
|
|
5244
|
+
message?: string;
|
|
5245
|
+
resultCode?: string;
|
|
5946
5246
|
};
|
|
5947
5247
|
};
|
|
5948
5248
|
};
|
|
@@ -5956,6 +5256,8 @@ interface operations {
|
|
|
5956
5256
|
/** @constant */
|
|
5957
5257
|
success: false;
|
|
5958
5258
|
code: string;
|
|
5259
|
+
message?: string;
|
|
5260
|
+
resultCode?: string;
|
|
5959
5261
|
};
|
|
5960
5262
|
};
|
|
5961
5263
|
};
|
|
@@ -5969,6 +5271,8 @@ interface operations {
|
|
|
5969
5271
|
/** @constant */
|
|
5970
5272
|
success: false;
|
|
5971
5273
|
code: string;
|
|
5274
|
+
message?: string;
|
|
5275
|
+
resultCode?: string;
|
|
5972
5276
|
};
|
|
5973
5277
|
};
|
|
5974
5278
|
};
|
|
@@ -5976,8 +5280,1553 @@ interface operations {
|
|
|
5976
5280
|
};
|
|
5977
5281
|
}
|
|
5978
5282
|
|
|
5979
|
-
type PollarApiClient = ReturnType<typeof createApiClient>;
|
|
5980
|
-
declare function createApiClient(baseUrl: string): openapi_fetch.Client<paths, `${string}/${string}`>;
|
|
5283
|
+
type PollarApiClient = ReturnType<typeof createApiClient>;
|
|
5284
|
+
declare function createApiClient(baseUrl: string): openapi_fetch.Client<paths, `${string}/${string}`>;
|
|
5285
|
+
|
|
5286
|
+
/**
|
|
5287
|
+
* Public JWK shape for an EC P-256 key. Only the four required members for
|
|
5288
|
+
* RFC 7638 thumbprint computation; never includes private fields or extras
|
|
5289
|
+
* like `alg` / `use` / `kid`.
|
|
5290
|
+
*/
|
|
5291
|
+
interface PublicEcJwk {
|
|
5292
|
+
kty: 'EC';
|
|
5293
|
+
crv: 'P-256';
|
|
5294
|
+
/** Base64url-encoded big-endian X coordinate (32 bytes). */
|
|
5295
|
+
x: string;
|
|
5296
|
+
/** Base64url-encoded big-endian Y coordinate (32 bytes). */
|
|
5297
|
+
y: string;
|
|
5298
|
+
}
|
|
5299
|
+
/**
|
|
5300
|
+
* Manages the per-session ECDSA P-256 keypair used to sign DPoP proofs.
|
|
5301
|
+
*
|
|
5302
|
+
* Implementations:
|
|
5303
|
+
* - `WebCryptoKeyManager` (web): non-extractable `CryptoKey` persisted in
|
|
5304
|
+
* IndexedDB. Private key bytes never leave the browser's crypto context.
|
|
5305
|
+
* - `NobleKeyManager` (React Native): private scalar bytes stored through an
|
|
5306
|
+
* injected `Storage` adapter (Keychain / SecureStore). Pure-JS ECDSA via
|
|
5307
|
+
* `@noble/curves`.
|
|
5308
|
+
*/
|
|
5309
|
+
interface KeyManager {
|
|
5310
|
+
/**
|
|
5311
|
+
* Load an existing key for this session or generate a new one. Idempotent.
|
|
5312
|
+
* Must be called before `getPublicJwk`, `getThumbprint`, or `sign`.
|
|
5313
|
+
*/
|
|
5314
|
+
init(): Promise<void>;
|
|
5315
|
+
/**
|
|
5316
|
+
* Destroy the key. Removes it from persistent storage and clears any
|
|
5317
|
+
* cached state. Used on logout.
|
|
5318
|
+
*/
|
|
5319
|
+
reset(): Promise<void>;
|
|
5320
|
+
/**
|
|
5321
|
+
* The public JWK that goes into the DPoP proof header. Returns a fresh
|
|
5322
|
+
* object every call (callers may mutate without affecting the manager).
|
|
5323
|
+
*/
|
|
5324
|
+
getPublicJwk(): Promise<PublicEcJwk>;
|
|
5325
|
+
/**
|
|
5326
|
+
* RFC 7638 JWK thumbprint, base64url(SHA-256(canonical JWK)). The server
|
|
5327
|
+
* compares this to the access token's `cnf.jkt` claim.
|
|
5328
|
+
*/
|
|
5329
|
+
getThumbprint(): Promise<string>;
|
|
5330
|
+
/**
|
|
5331
|
+
* Sign the given bytes with ECDSA-P256-SHA256. Returns 64-byte raw r||s
|
|
5332
|
+
* (IEEE P1363 / JOSE format), NOT DER. Suitable for direct base64url
|
|
5333
|
+
* encoding into the JWS signature segment.
|
|
5334
|
+
*/
|
|
5335
|
+
sign(payload: Uint8Array): Promise<Uint8Array>;
|
|
5336
|
+
}
|
|
5337
|
+
|
|
5338
|
+
declare enum WalletType {
|
|
5339
|
+
FREIGHTER = "freighter",
|
|
5340
|
+
ALBEDO = "albedo"
|
|
5341
|
+
}
|
|
5342
|
+
/**
|
|
5343
|
+
* A wallet identifier. Accepts the internal `WalletType` enum values
|
|
5344
|
+
* (`'freighter'`, `'albedo'`) plus any opaque string id used by external
|
|
5345
|
+
* adapter packages (e.g. Stellar Wallets Kit ids like `'xbull'`, `'lobstr'`).
|
|
5346
|
+
* The `(string & {})` keeps autocomplete on the enum values without rejecting
|
|
5347
|
+
* arbitrary strings.
|
|
5348
|
+
*/
|
|
5349
|
+
type WalletId = WalletType | (string & {});
|
|
5350
|
+
interface ConnectWalletResponse {
|
|
5351
|
+
address: string;
|
|
5352
|
+
}
|
|
5353
|
+
interface SignTransactionOptions {
|
|
5354
|
+
network?: string;
|
|
5355
|
+
networkPassphrase?: string;
|
|
5356
|
+
accountToSign?: string;
|
|
5357
|
+
}
|
|
5358
|
+
interface SignAuthEntryOptions {
|
|
5359
|
+
accountToSign?: string;
|
|
5360
|
+
}
|
|
5361
|
+
interface SignTransactionResponse {
|
|
5362
|
+
signedTxXdr: string;
|
|
5363
|
+
}
|
|
5364
|
+
interface SignAuthEntryResponse {
|
|
5365
|
+
signedAuthEntry: string;
|
|
5366
|
+
}
|
|
5367
|
+
interface WalletAdapter {
|
|
5368
|
+
type: WalletId;
|
|
5369
|
+
isAvailable(): Promise<boolean>;
|
|
5370
|
+
connect(): Promise<ConnectWalletResponse>;
|
|
5371
|
+
disconnect(): Promise<void>;
|
|
5372
|
+
getPublicKey(): Promise<string | null>;
|
|
5373
|
+
signTransaction(xdr: string, options?: SignTransactionOptions): Promise<SignTransactionResponse>;
|
|
5374
|
+
signAuthEntry(entryXdr: string, options?: SignAuthEntryOptions): Promise<SignAuthEntryResponse>;
|
|
5375
|
+
}
|
|
5376
|
+
/**
|
|
5377
|
+
* Resolves a {@link WalletAdapter} for a given wallet id. Injected through
|
|
5378
|
+
* `PollarClientConfig.walletAdapter` so wallet implementations (Stellar
|
|
5379
|
+
* Wallets Kit, custom modules, etc.) can live outside `@pollar/core`.
|
|
5380
|
+
*/
|
|
5381
|
+
type WalletAdapterResolver = (id: WalletId) => WalletAdapter | Promise<WalletAdapter>;
|
|
5382
|
+
|
|
5383
|
+
declare class FreighterAdapter implements WalletAdapter {
|
|
5384
|
+
readonly type = WalletType.FREIGHTER;
|
|
5385
|
+
isAvailable(): Promise<boolean>;
|
|
5386
|
+
connect(): Promise<ConnectWalletResponse>;
|
|
5387
|
+
disconnect(): Promise<void>;
|
|
5388
|
+
getPublicKey(): Promise<string | null>;
|
|
5389
|
+
getNetwork(): Promise<string>;
|
|
5390
|
+
signTransaction(xdr: string, options?: SignTransactionOptions): Promise<SignTransactionResponse>;
|
|
5391
|
+
signAuthEntry(entryXdr: string, options?: SignAuthEntryOptions): Promise<SignAuthEntryResponse>;
|
|
5392
|
+
}
|
|
5393
|
+
|
|
5394
|
+
/** Albedo's own network vocabulary (it only understands these two values). */
|
|
5395
|
+
type AlbedoNetwork = 'public' | 'testnet';
|
|
5396
|
+
declare class AlbedoAdapter implements WalletAdapter {
|
|
5397
|
+
private readonly network;
|
|
5398
|
+
readonly type = WalletType.ALBEDO;
|
|
5399
|
+
/**
|
|
5400
|
+
* Network used for `connect` and `signAuthEntry` (which carry no per-call
|
|
5401
|
+
* network) and as the fallback for `signTransaction`. Defaults to `'testnet'`
|
|
5402
|
+
* to preserve the previous behavior when constructed with no argument.
|
|
5403
|
+
*/
|
|
5404
|
+
constructor(network?: AlbedoNetwork);
|
|
5405
|
+
isAvailable(): Promise<boolean>;
|
|
5406
|
+
connect(): Promise<ConnectWalletResponse>;
|
|
5407
|
+
disconnect(): Promise<void>;
|
|
5408
|
+
getPublicKey(): Promise<string | null>;
|
|
5409
|
+
getNetwork(): Promise<string>;
|
|
5410
|
+
signTransaction(xdr: string, options?: SignTransactionOptions): Promise<SignTransactionResponse>;
|
|
5411
|
+
signAuthEntry(entryXdr: string, _options?: SignAuthEntryOptions): Promise<SignAuthEntryResponse>;
|
|
5412
|
+
}
|
|
5413
|
+
|
|
5414
|
+
type PollarApplicationConfigResponse = paths['/auth/login']['post']['responses'][200]['content']['application/json'];
|
|
5415
|
+
/** Full `/auth/login` response shape — used in transit but NOT persisted. */
|
|
5416
|
+
type PollarApplicationConfigContent = PollarApplicationConfigResponse['content'];
|
|
5417
|
+
/**
|
|
5418
|
+
* What we actually write to `Storage`. Drops the PII subtree (`data.*`)
|
|
5419
|
+
* which is held in memory only on `PollarClient._profile` after auth.
|
|
5420
|
+
*/
|
|
5421
|
+
interface PollarPersistedSession {
|
|
5422
|
+
clientSessionId: string;
|
|
5423
|
+
userId: string | null;
|
|
5424
|
+
status: string;
|
|
5425
|
+
token: {
|
|
5426
|
+
accessToken: string;
|
|
5427
|
+
refreshToken: string;
|
|
5428
|
+
expiresAt: number;
|
|
5429
|
+
};
|
|
5430
|
+
user: {
|
|
5431
|
+
id?: string;
|
|
5432
|
+
ready: boolean;
|
|
5433
|
+
};
|
|
5434
|
+
wallet: {
|
|
5435
|
+
type: 'internal' | 'smart' | 'external';
|
|
5436
|
+
provider?: string;
|
|
5437
|
+
address: string | null;
|
|
5438
|
+
existsOnStellar?: boolean;
|
|
5439
|
+
createdAt?: number;
|
|
5440
|
+
linkedAt?: number;
|
|
5441
|
+
network?: string;
|
|
5442
|
+
deployTxHash?: string | null;
|
|
5443
|
+
};
|
|
5444
|
+
}
|
|
5445
|
+
/**
|
|
5446
|
+
* Custodial login methods — the providers that map to an `internal` wallet.
|
|
5447
|
+
* Mirrors the backend `AuthProvider` enum minus passkey (→ smart) and
|
|
5448
|
+
* wallet/external (→ external).
|
|
5449
|
+
*/
|
|
5450
|
+
type PollarAuthMethod = 'email' | 'google' | 'github' | 'oidc';
|
|
5451
|
+
/**
|
|
5452
|
+
* The authenticated user's wallet, as a discriminated union over `custody`.
|
|
5453
|
+
* Every authenticated session has exactly one wallet whose custody is fixed at
|
|
5454
|
+
* account creation, so `custody` strictly determines the shape of `provider`:
|
|
5455
|
+
*
|
|
5456
|
+
* - `internal` (platform-custodied G-address) → `provider` is the login
|
|
5457
|
+
* method, or `null` if the session predates provider tracking server-side.
|
|
5458
|
+
* - `smart` (passkey Soroban C-address) → `provider` is always `'passkey'`.
|
|
5459
|
+
* - `external` (user-connected wallet) → `provider` is the on-chain adapter
|
|
5460
|
+
* id (`'freighter'`, `'albedo'`, …), or `null` when no adapter is resolved
|
|
5461
|
+
* (e.g. a restored session whose adapter could not be re-attached).
|
|
5462
|
+
*
|
|
5463
|
+
* Obtained via {@link PollarClient.getWallet}.
|
|
5464
|
+
*/
|
|
5465
|
+
type WalletInfo = {
|
|
5466
|
+
custody: 'internal';
|
|
5467
|
+
address: string;
|
|
5468
|
+
provider: PollarAuthMethod | null;
|
|
5469
|
+
} | {
|
|
5470
|
+
custody: 'smart';
|
|
5471
|
+
address: string;
|
|
5472
|
+
provider: 'passkey';
|
|
5473
|
+
} | {
|
|
5474
|
+
custody: 'external';
|
|
5475
|
+
address: string;
|
|
5476
|
+
provider: WalletId | null;
|
|
5477
|
+
};
|
|
5478
|
+
/** In-memory user profile (kept on `PollarClient`, never persisted). */
|
|
5479
|
+
interface PollarUserProfile {
|
|
5480
|
+
mail: string;
|
|
5481
|
+
first_name: string;
|
|
5482
|
+
last_name: string;
|
|
5483
|
+
avatar: string;
|
|
5484
|
+
providers: {
|
|
5485
|
+
email: {
|
|
5486
|
+
address: string;
|
|
5487
|
+
} | null;
|
|
5488
|
+
google: {
|
|
5489
|
+
id: string;
|
|
5490
|
+
} | null;
|
|
5491
|
+
github: {
|
|
5492
|
+
id: string;
|
|
5493
|
+
} | null;
|
|
5494
|
+
wallet: {
|
|
5495
|
+
address: string;
|
|
5496
|
+
} | null;
|
|
5497
|
+
};
|
|
5498
|
+
}
|
|
5499
|
+
interface PollarClientConfig {
|
|
5500
|
+
stellarNetwork?: StellarNetwork;
|
|
5501
|
+
baseUrl?: string;
|
|
5502
|
+
apiKey: string;
|
|
5503
|
+
/**
|
|
5504
|
+
* Pluggable storage. Defaults to `defaultStorage()` on web (localStorage
|
|
5505
|
+
* with memory fallback). On RN you must inject one of the adapters from
|
|
5506
|
+
* `@pollar/core/adapters/expo` or `@pollar/core/adapters/react-native-keychain`.
|
|
5507
|
+
*/
|
|
5508
|
+
storage?: Storage;
|
|
5509
|
+
/**
|
|
5510
|
+
* Pluggable DPoP key manager. Defaults to `defaultKeyManager(storage,
|
|
5511
|
+
* apiKey)`: WebCrypto in browsers, `@noble/curves` in RN.
|
|
5512
|
+
*/
|
|
5513
|
+
keyManager?: KeyManager;
|
|
5514
|
+
/**
|
|
5515
|
+
* Minimum severity the SDK logs. `silent` disables all SDK logging; the rest
|
|
5516
|
+
* emit that level and everything more important (`error` < `warn` < `info` <
|
|
5517
|
+
* `debug`). State-transition chatter (auth/tx/network) is at `debug`.
|
|
5518
|
+
* Defaults to `'info'`.
|
|
5519
|
+
*/
|
|
5520
|
+
logLevel?: LogLevel;
|
|
5521
|
+
/**
|
|
5522
|
+
* Sink the SDK writes logs to. Defaults to the global `console`. Inject your
|
|
5523
|
+
* own (pino, Sentry breadcrumbs, a test spy…) to route SDK logs anywhere.
|
|
5524
|
+
* Filtering by `logLevel` still applies on top of whatever you pass.
|
|
5525
|
+
*/
|
|
5526
|
+
logger?: PollarLogger;
|
|
5527
|
+
/**
|
|
5528
|
+
* Notified when persistent storage silently degrades to in-memory mode
|
|
5529
|
+
* (Safari private browsing quota errors, sandboxed iframes, etc.). Useful
|
|
5530
|
+
* for telemetry — the SDK keeps working but sessions won't survive reload.
|
|
5531
|
+
*/
|
|
5532
|
+
onStorageDegrade?: OnStorageDegrade;
|
|
5533
|
+
/**
|
|
5534
|
+
* Resolves a {@link WalletAdapter} for a given wallet id. If omitted, the
|
|
5535
|
+
* SDK falls back to its built-in `FreighterAdapter` / `AlbedoAdapter`,
|
|
5536
|
+
* which only know `WalletType.FREIGHTER` and `WalletType.ALBEDO`. Inject
|
|
5537
|
+
* `@pollar/stellar-wallets-kit-adapter` (or your own resolver) to support
|
|
5538
|
+
* additional wallets without bundling those dependencies into `@pollar/core`.
|
|
5539
|
+
*/
|
|
5540
|
+
walletAdapter?: WalletAdapterResolver;
|
|
5541
|
+
/**
|
|
5542
|
+
* Maximum time (ms) the SDK waits for a `walletAdapter` resolver to return.
|
|
5543
|
+
* Guards against a broken extension bridge (e.g. Freighter content-script
|
|
5544
|
+
* down) hanging the login flow forever. The resolver only constructs the
|
|
5545
|
+
* adapter object — it does NOT include the user-facing approval step — so
|
|
5546
|
+
* a few seconds is plenty. Defaults to 5000.
|
|
5547
|
+
*/
|
|
5548
|
+
walletResolverTimeoutMs?: number;
|
|
5549
|
+
/**
|
|
5550
|
+
* Optional human-friendly label sent at /auth/login time and recorded on
|
|
5551
|
+
* the server-side refresh-token row so the user can identify it in the
|
|
5552
|
+
* "active sessions" UI (e.g. "iPhone — Safari", "Mac — Chrome 126").
|
|
5553
|
+
* If unset, the server-recorded `user_agent` header is the fallback.
|
|
5554
|
+
*/
|
|
5555
|
+
deviceLabel?: string;
|
|
5556
|
+
/**
|
|
5557
|
+
* Foreground-detection signal for the silent-refresh scheduler. When the
|
|
5558
|
+
* app is hidden / backgrounded, scheduled refreshes are skipped (saves
|
|
5559
|
+
* network + sidesteps browser/RN background timer throttling); they run
|
|
5560
|
+
* the moment visibility comes back. Defaults to a web provider in the
|
|
5561
|
+
* browser (`visibilitychange` + BFCache + focus) and a noop elsewhere.
|
|
5562
|
+
* React Native consumers should inject an `AppState`-backed provider —
|
|
5563
|
+
* use `createAppStateVisibilityProvider` from
|
|
5564
|
+
* `@pollar/core/adapters/react-native-appstate`.
|
|
5565
|
+
*/
|
|
5566
|
+
visibilityProvider?: VisibilityProvider;
|
|
5567
|
+
/**
|
|
5568
|
+
* If set, the silent-refresh scheduler stops issuing proactive refreshes
|
|
5569
|
+
* after this many milliseconds of no client-side HTTP activity. The
|
|
5570
|
+
* session is not cleared — the next user action triggers a request that
|
|
5571
|
+
* either reuses a still-valid access token or hits 401 → reactive
|
|
5572
|
+
* refresh (transparent if the RT is still valid). Defaults to
|
|
5573
|
+
* `undefined` = refresh forever as long as the app is visible.
|
|
5574
|
+
*/
|
|
5575
|
+
maxIdleMs?: number;
|
|
5576
|
+
/**
|
|
5577
|
+
* Strategy for opening the hosted OAuth URL during
|
|
5578
|
+
* `login({ provider: 'google' | 'github' })`. Defaults to a browser popup
|
|
5579
|
+
* on web. React Native consumers MUST provide one (typically wrapping
|
|
5580
|
+
* `expo-web-browser`'s `openAuthSessionAsync`), since `window.open` does
|
|
5581
|
+
* not exist there. The SDK still drives the rest of the flow by polling the
|
|
5582
|
+
* auth-session status, so the opener only needs to surface the URL — it does
|
|
5583
|
+
* NOT need to capture the redirect payload.
|
|
5584
|
+
*/
|
|
5585
|
+
openAuthUrl?: AuthUrlOpener;
|
|
5586
|
+
/**
|
|
5587
|
+
* Value sent to the backend as `redirect_uri` for hosted OAuth (where the
|
|
5588
|
+
* provider returns the user afterwards). Defaults to `window.location.origin`
|
|
5589
|
+
* on web. On React Native set this to your app's deep link / scheme — the
|
|
5590
|
+
* same URL you pass to `WebBrowser.openAuthSessionAsync`.
|
|
5591
|
+
*/
|
|
5592
|
+
oauthRedirectUri?: string;
|
|
5593
|
+
/**
|
|
5594
|
+
* Custom auth providers (e.g. Privy, Magic). Each is a {@link PollarAuthProvider}
|
|
5595
|
+
* registered by its `id`; `login({ provider: id })` then dispatches to it.
|
|
5596
|
+
* Registered AFTER the built-ins, so an entry whose `id` matches a built-in
|
|
5597
|
+
* (`'google'`, `'github'`, `'email'`) overrides it. Does NOT affect `wallet`,
|
|
5598
|
+
* which keeps its own dedicated flow. Custom providers typically authenticate
|
|
5599
|
+
* with their own SDK and then call `ctx.exchangeExternalToken(...)`, which the
|
|
5600
|
+
* backend validates via `POST /auth/external`.
|
|
5601
|
+
*/
|
|
5602
|
+
providers?: PollarAuthProvider[];
|
|
5603
|
+
/**
|
|
5604
|
+
* The passkey (WebAuthn) ceremony for "Smart Wallet" login, injected by the
|
|
5605
|
+
* runtime layer (`@pollar/react` implements it with `@simplewebauthn/browser`).
|
|
5606
|
+
* `@pollar/core` stays runtime-agnostic and never touches `navigator.credentials`
|
|
5607
|
+
* directly. Required to use `loginSmartWallet()`. Browser-only for now;
|
|
5608
|
+
* React Native needs a native passkey provider.
|
|
5609
|
+
*/
|
|
5610
|
+
passkey?: PasskeyCeremony;
|
|
5611
|
+
/**
|
|
5612
|
+
* Signs smart-account (C-address) transactions with the user's passkey.
|
|
5613
|
+
* Required to send from a smart wallet. Injected by `@pollar/react`;
|
|
5614
|
+
* browser-only for now.
|
|
5615
|
+
*/
|
|
5616
|
+
passkeySign?: PasskeySigner;
|
|
5617
|
+
}
|
|
5618
|
+
/**
|
|
5619
|
+
* Runs the device WebAuthn ceremony for a server-issued challenge and returns
|
|
5620
|
+
* the result to forward to the backend: a registration response for a new user
|
|
5621
|
+
* (`create()`) or an authentication assertion for a returning one (`get()`).
|
|
5622
|
+
* `mode` tells the ceremony which to run: `'login'` runs `get()` only (returning
|
|
5623
|
+
* user) and `'register'` runs `create()` only (new wallet) — the caller picks via
|
|
5624
|
+
* the "Log in" / "Create wallet" buttons, so there's no ambiguous autodetect that
|
|
5625
|
+
* could create a wallet when the user merely cancelled a login prompt. `response`
|
|
5626
|
+
* is the browser's PublicKeyCredential serialized to JSON — forwarded verbatim to
|
|
5627
|
+
* `/auth/passkey/{register,login}`.
|
|
5628
|
+
*/
|
|
5629
|
+
type PasskeyMode = 'login' | 'register';
|
|
5630
|
+
type PasskeyCeremony = (ctx: {
|
|
5631
|
+
challenge: string;
|
|
5632
|
+
mode: PasskeyMode;
|
|
5633
|
+
}) => Promise<{
|
|
5634
|
+
kind: 'login';
|
|
5635
|
+
response: unknown;
|
|
5636
|
+
} | {
|
|
5637
|
+
kind: 'register';
|
|
5638
|
+
response: unknown;
|
|
5639
|
+
}>;
|
|
5640
|
+
/**
|
|
5641
|
+
* Signs a smart-account transaction's auth digest with the user's passkey
|
|
5642
|
+
* (a WebAuthn `get()` whose challenge is the raw digest). Returns the PUBLIC
|
|
5643
|
+
* assertion fields (base64url) for the server to assemble into the Soroban auth
|
|
5644
|
+
* entry — no secret leaves the device. Injected by the runtime layer
|
|
5645
|
+
* (`@pollar/react`); `@pollar/core` never touches `navigator.credentials`.
|
|
5646
|
+
*/
|
|
5647
|
+
type PasskeySigner = (ctx: {
|
|
5648
|
+
/** base64url WebAuthn credential id to sign with. */
|
|
5649
|
+
credentialId: string;
|
|
5650
|
+
/** hex-encoded auth digest to use as the WebAuthn challenge. */
|
|
5651
|
+
challenge: string;
|
|
5652
|
+
}) => Promise<{
|
|
5653
|
+
authenticatorData: string;
|
|
5654
|
+
clientDataJSON: string;
|
|
5655
|
+
signature: string;
|
|
5656
|
+
}>;
|
|
5657
|
+
/**
|
|
5658
|
+
* Strategy for opening the hosted OAuth URL. The SDK mints the per-login auth
|
|
5659
|
+
* session lazily inside `getUrl()` (call it once; the first call creates the
|
|
5660
|
+
* `clientSessionId` and returns the full URL, or `null` if session creation
|
|
5661
|
+
* failed). Open the resolved URL however the platform allows — a popup on web,
|
|
5662
|
+
* `WebBrowser.openAuthSessionAsync(url, redirectUri)` on React Native — and
|
|
5663
|
+
* resolve once the user-facing browser step is done or dismissed. You do NOT
|
|
5664
|
+
* need to capture the redirect payload: the SDK polls the auth-session status
|
|
5665
|
+
* until the backend marks it READY.
|
|
5666
|
+
*/
|
|
5667
|
+
type AuthUrlOpener = (ctx: AuthOpenContext) => void | Promise<void>;
|
|
5668
|
+
interface AuthOpenContext {
|
|
5669
|
+
provider: 'google' | 'github';
|
|
5670
|
+
/**
|
|
5671
|
+
* Mints the auth session (once) and returns the full hosted-OAuth URL, or
|
|
5672
|
+
* `null` if session creation failed. On web, call it AFTER reserving the
|
|
5673
|
+
* popup window so popup blockers (which only honor `window.open` inside the
|
|
5674
|
+
* original user-gesture tick) don't swallow it.
|
|
5675
|
+
*/
|
|
5676
|
+
getUrl: () => Promise<string | null>;
|
|
5677
|
+
/** The redirect target passed to the backend as `redirect_uri`. */
|
|
5678
|
+
redirectUri: string;
|
|
5679
|
+
signal: AbortSignal;
|
|
5680
|
+
}
|
|
5681
|
+
/**
|
|
5682
|
+
* One row in the active-sessions list (returned by `PollarClient.listSessions()`).
|
|
5683
|
+
* Mirrors the sdk-api `SessionsListContent` schema.
|
|
5684
|
+
*/
|
|
5685
|
+
interface SessionInfo {
|
|
5686
|
+
familyId: string;
|
|
5687
|
+
createdAt: string;
|
|
5688
|
+
lastUsedAt: string | null;
|
|
5689
|
+
userAgent: string | null;
|
|
5690
|
+
ipHash: string | null;
|
|
5691
|
+
deviceLabel: string | null;
|
|
5692
|
+
current: boolean;
|
|
5693
|
+
expiresAt: string;
|
|
5694
|
+
}
|
|
5695
|
+
/**
|
|
5696
|
+
* Observable state for the active-sessions list. Lives on the client (like
|
|
5697
|
+
* {@link TxHistoryState} / {@link WalletBalanceState}) so UI layers can
|
|
5698
|
+
* subscribe via `onSessionsStateChange` and stay pure readers instead of
|
|
5699
|
+
* holding the loading state locally.
|
|
5700
|
+
*/
|
|
5701
|
+
type SessionsState = {
|
|
5702
|
+
step: 'idle';
|
|
5703
|
+
} | {
|
|
5704
|
+
step: 'loading';
|
|
5705
|
+
} | {
|
|
5706
|
+
step: 'loaded';
|
|
5707
|
+
sessions: SessionInfo[];
|
|
5708
|
+
} | {
|
|
5709
|
+
step: 'error';
|
|
5710
|
+
message: string;
|
|
5711
|
+
};
|
|
5712
|
+
type TxBuildBody = NonNullable<paths['/tx/build']['post']['requestBody']>['content']['application/json'];
|
|
5713
|
+
type TxBuildResponse = paths['/tx/build']['post']['responses'][200]['content']['application/json'];
|
|
5714
|
+
type TxSignAndSendBody = NonNullable<paths['/tx/sign-and-send']['post']['requestBody']>['content']['application/json'];
|
|
5715
|
+
type TxSignSendResponse = paths['/tx/sign-and-send']['post']['responses'][200]['content']['application/json'];
|
|
5716
|
+
type TxSignBody = NonNullable<paths['/tx/sign']['post']['requestBody']>['content']['application/json'];
|
|
5717
|
+
type TxSignResponse = paths['/tx/sign']['post']['responses'][200]['content']['application/json'];
|
|
5718
|
+
type TxSignContent = TxSignResponse['content'];
|
|
5719
|
+
type TxSubmitSignedBody = NonNullable<paths['/tx/submit']['post']['requestBody']>['content']['application/json'];
|
|
5720
|
+
type TxBuildSignSubmitBody = NonNullable<paths['/tx/build-sign-submit']['post']['requestBody']>['content']['application/json'];
|
|
5721
|
+
type TxBuildSignSubmitResponse = paths['/tx/build-sign-submit']['post']['responses'][200]['content']['application/json'];
|
|
5722
|
+
type TxBuildSignSubmitContent = TxBuildSignSubmitResponse['content'];
|
|
5723
|
+
/**
|
|
5724
|
+
* Discriminated union of every login the SDK understands. Intentionally
|
|
5725
|
+
* **closed**: each custom provider you add (and wire up server-side via
|
|
5726
|
+
* `POST /auth/external`) gets its own member here so `login()` stays fully
|
|
5727
|
+
* typed and `switch (options.provider)` stays exhaustive. To add one, append a
|
|
5728
|
+
* line — e.g. `| { provider: 'privy'; loginMethod?: 'email' | 'sms' }` — and
|
|
5729
|
+
* register a matching {@link PollarAuthProvider} via `PollarClientConfig.providers`.
|
|
5730
|
+
*/
|
|
5731
|
+
type PollarLoginOptions = {
|
|
5732
|
+
provider: 'google';
|
|
5733
|
+
} | {
|
|
5734
|
+
provider: 'github';
|
|
5735
|
+
} | {
|
|
5736
|
+
provider: 'email';
|
|
5737
|
+
email: string;
|
|
5738
|
+
} | {
|
|
5739
|
+
provider: 'wallet';
|
|
5740
|
+
type: WalletId;
|
|
5741
|
+
};
|
|
5742
|
+
/**
|
|
5743
|
+
* Curated, stable facade handed to every {@link PollarAuthProvider}. It exposes
|
|
5744
|
+
* only the primitives a login strategy needs — the shared backbone
|
|
5745
|
+
* (`createSession` → drive the session READY → `authenticate`) plus a couple of
|
|
5746
|
+
* ready-made legs — and deliberately keeps `PollarClient` internals (storage,
|
|
5747
|
+
* wallet-adapter resolution, DPoP key manager) private. This is the public
|
|
5748
|
+
* contract a third-party provider (e.g. Privy) builds against.
|
|
5749
|
+
*/
|
|
5750
|
+
interface AuthProviderContext {
|
|
5751
|
+
/** Aborts when the host calls `cancelLogin()` (or a new login supersedes this one). */
|
|
5752
|
+
readonly signal: AbortSignal;
|
|
5753
|
+
/** Typed `openapi-fetch` client, already wired with DPoP + refresh middleware. */
|
|
5754
|
+
readonly api: PollarApiClient;
|
|
5755
|
+
/** API origin + version prefix (e.g. `https://sdk.api.pollar.xyz/v1`). */
|
|
5756
|
+
readonly basePath: string;
|
|
5757
|
+
readonly apiKey: string;
|
|
5758
|
+
readonly logger: PollarLogger;
|
|
5759
|
+
/** Drive the SDK's auth state machine (the host's `onAuthStateChange` mirrors it). */
|
|
5760
|
+
setAuthState(state: AuthState): void;
|
|
5761
|
+
/** `POST /auth/session` → `clientSessionId` (null on failure; error state already set). */
|
|
5762
|
+
createSession(): Promise<string | null>;
|
|
5763
|
+
/** Poll the session to READY, then `POST /auth/login` and persist the session. The shared backbone. */
|
|
5764
|
+
authenticate(clientSessionId: string): Promise<void>;
|
|
5765
|
+
/**
|
|
5766
|
+
* `POST /auth/wallet/challenge` → the server-signed SEP-10 challenge transaction
|
|
5767
|
+
* (XDR) the wallet must counter-sign to prove key control. Sign it with your
|
|
5768
|
+
* provider's Stellar signer (e.g. Privy), then pass the result to
|
|
5769
|
+
* {@link exchangeExternalToken} as `signedChallengeXdr`. Returns `null` on
|
|
5770
|
+
* failure. Bind the network you sign on to the app's network.
|
|
5771
|
+
*/
|
|
5772
|
+
requestChallenge(clientSessionId: string, walletAddress: string): Promise<string | null>;
|
|
5773
|
+
/**
|
|
5774
|
+
* External-provider leg: `POST /auth/external` with `{ clientSessionId, ...body }`.
|
|
5775
|
+
* The backend proves wallet control via SEP-10, so `body` must carry
|
|
5776
|
+
* `{ provider, walletAddress, signedChallengeXdr }` (the challenge from
|
|
5777
|
+
* {@link requestChallenge}, counter-signed by the wallet). Returns `false` and
|
|
5778
|
+
* sets an error state on failure.
|
|
5779
|
+
*/
|
|
5780
|
+
exchangeExternalToken(clientSessionId: string, body: Record<string, unknown>): Promise<boolean>;
|
|
5781
|
+
/** Built-in hosted-OAuth dance (popup on web, in-app browser on RN). Backs the google/github providers. */
|
|
5782
|
+
startHostedOAuth(provider: 'google' | 'github'): Promise<void>;
|
|
5783
|
+
}
|
|
5784
|
+
/**
|
|
5785
|
+
* A pluggable login strategy. Built-ins (`google`, `github`, `email`) ship as
|
|
5786
|
+
* these; custom ones (Privy, Magic, …) are injected via
|
|
5787
|
+
* `PollarClientConfig.providers`. Note: `wallet` is intentionally NOT a provider
|
|
5788
|
+
* — it yields a persistent `WalletAdapter` reused for signing, a concern
|
|
5789
|
+
* orthogonal to login, so it keeps its own dedicated `loginWallet()` flow.
|
|
5790
|
+
*
|
|
5791
|
+
* - `login` handles the one-shot entry point (`client.login({ provider: id })`).
|
|
5792
|
+
* - `actions` exposes extra named steps for multi-step flows (e.g. email's
|
|
5793
|
+
* send-code / verify-code), invoked via `client.providerAction(id, action, payload)`.
|
|
5794
|
+
*/
|
|
5795
|
+
interface PollarAuthProvider {
|
|
5796
|
+
/** Matches `PollarLoginOptions.provider` and the key in `providerAction`. */
|
|
5797
|
+
readonly id: string;
|
|
5798
|
+
login?(ctx: AuthProviderContext, options: PollarLoginOptions): Promise<void>;
|
|
5799
|
+
actions?: Record<string, (ctx: AuthProviderContext, payload?: unknown) => Promise<void>>;
|
|
5800
|
+
}
|
|
5801
|
+
type TxBuildContent = TxBuildResponse['content'];
|
|
5802
|
+
/**
|
|
5803
|
+
* Phases the SDK can be in across the build → sign → submit lifecycle.
|
|
5804
|
+
*
|
|
5805
|
+
* **Granular** steps (`building`, `signing`, `submitting`) are emitted when
|
|
5806
|
+
* the SDK can directly observe that phase — i.e. when each is a separate
|
|
5807
|
+
* client-driven call (`buildTx`, `signTx`, `submitTx`, external-wallet
|
|
5808
|
+
* `signAndSubmitTx`).
|
|
5809
|
+
*
|
|
5810
|
+
* **Compound** steps (`signing-submitting`, `building-signing-submitting`)
|
|
5811
|
+
* are emitted when multiple phases collapse into a single opaque backend
|
|
5812
|
+
* round-trip (`signAndSubmitTx` custodial → `/tx/sign-and-send`, and `runTx`
|
|
5813
|
+
* / `buildAndSignAndSubmitTx` custodial → `/tx/build-sign-submit`). The SDK
|
|
5814
|
+
* can't see when one phase ends and the next begins inside that request, so
|
|
5815
|
+
* it honestly reports a single fused state instead of fabricating
|
|
5816
|
+
* transitions.
|
|
5817
|
+
*
|
|
5818
|
+
* **Terminal states** (`success`, `error`) and the post-Horizon-ack pending
|
|
5819
|
+
* state (`submitted`) are shared across all paths.
|
|
5820
|
+
*
|
|
5821
|
+
* On `error`, the `phase` discriminator tells the consumer *where* the
|
|
5822
|
+
* failure happened so modal UIs can offer "retry from this step" buttons.
|
|
5823
|
+
*/
|
|
5824
|
+
type TransactionState = {
|
|
5825
|
+
step: 'idle';
|
|
5826
|
+
} | {
|
|
5827
|
+
step: 'building';
|
|
5828
|
+
} | {
|
|
5829
|
+
step: 'built';
|
|
5830
|
+
buildData: TxBuildContent;
|
|
5831
|
+
} | {
|
|
5832
|
+
step: 'signing';
|
|
5833
|
+
buildData?: TxBuildContent;
|
|
5834
|
+
} | {
|
|
5835
|
+
step: 'signed';
|
|
5836
|
+
buildData?: TxBuildContent;
|
|
5837
|
+
signedXdr: string;
|
|
5838
|
+
submissionToken?: string;
|
|
5839
|
+
} | {
|
|
5840
|
+
step: 'submitting';
|
|
5841
|
+
buildData?: TxBuildContent;
|
|
5842
|
+
signedXdr?: string;
|
|
5843
|
+
} | {
|
|
5844
|
+
step: 'signing-submitting';
|
|
5845
|
+
buildData?: TxBuildContent;
|
|
5846
|
+
} | {
|
|
5847
|
+
step: 'building-signing-submitting';
|
|
5848
|
+
} | {
|
|
5849
|
+
step: 'submitted';
|
|
5850
|
+
buildData?: TxBuildContent;
|
|
5851
|
+
hash: string;
|
|
5852
|
+
} | {
|
|
5853
|
+
step: 'success';
|
|
5854
|
+
buildData?: TxBuildContent;
|
|
5855
|
+
hash: string;
|
|
5856
|
+
} | {
|
|
5857
|
+
step: 'error';
|
|
5858
|
+
phase: TxErrorPhase;
|
|
5859
|
+
details?: string;
|
|
5860
|
+
code?: string;
|
|
5861
|
+
message?: string;
|
|
5862
|
+
buildData?: TxBuildContent;
|
|
5863
|
+
signedXdr?: string;
|
|
5864
|
+
};
|
|
5865
|
+
/**
|
|
5866
|
+
* Identifies which phase failed when `TransactionState.step === 'error'`.
|
|
5867
|
+
* Compound phase names (`signing-submitting`, `building-signing-submitting`)
|
|
5868
|
+
* appear here when the failure happened inside an atomic backend call where
|
|
5869
|
+
* the SDK can't isolate the failing sub-phase.
|
|
5870
|
+
*/
|
|
5871
|
+
type TxErrorPhase = 'building' | 'signing' | 'submitting' | 'signing-submitting' | 'building-signing-submitting';
|
|
5872
|
+
/**
|
|
5873
|
+
* Per-call outcomes returned by `buildTx`, `signTx`, `submitTx`,
|
|
5874
|
+
* `signAndSubmitTx`, and `buildAndSignAndSubmitTx`. These are additive to
|
|
5875
|
+
* `TransactionState` — the same operations still drive the state machine for
|
|
5876
|
+
* modal-style UIs, but headless callers can `await` the method and inspect
|
|
5877
|
+
* the returned outcome directly instead of subscribing to state changes.
|
|
5878
|
+
*/
|
|
5879
|
+
type BuildOutcome = {
|
|
5880
|
+
status: 'built';
|
|
5881
|
+
buildData: TxBuildContent;
|
|
5882
|
+
} | {
|
|
5883
|
+
status: 'error';
|
|
5884
|
+
details?: string;
|
|
5885
|
+
};
|
|
5886
|
+
type SignOutcome = {
|
|
5887
|
+
status: 'signed';
|
|
5888
|
+
signedXdr: string;
|
|
5889
|
+
submissionToken?: string;
|
|
5890
|
+
expiresAt?: number;
|
|
5891
|
+
} | {
|
|
5892
|
+
status: 'error';
|
|
5893
|
+
details?: string;
|
|
5894
|
+
code?: string;
|
|
5895
|
+
message?: string;
|
|
5896
|
+
};
|
|
5897
|
+
/**
|
|
5898
|
+
* Result of {@link PollarClient.signAuthEntry}. `signedAuthEntry` is the base64
|
|
5899
|
+
* XDR of the signed `SorobanAuthorizationEntry`, ready to be composed into the
|
|
5900
|
+
* caller's transaction envelope (e.g. by a contract that sponsors the gas).
|
|
5901
|
+
*/
|
|
5902
|
+
type SignAuthEntryOutcome = {
|
|
5903
|
+
status: 'signed';
|
|
5904
|
+
signedAuthEntry: string;
|
|
5905
|
+
} | {
|
|
5906
|
+
status: 'error';
|
|
5907
|
+
details?: string;
|
|
5908
|
+
};
|
|
5909
|
+
type SubmitOutcome = {
|
|
5910
|
+
status: 'success';
|
|
5911
|
+
hash: string;
|
|
5912
|
+
buildData?: TxBuildContent;
|
|
5913
|
+
} | {
|
|
5914
|
+
status: 'pending';
|
|
5915
|
+
hash: string;
|
|
5916
|
+
buildData?: TxBuildContent;
|
|
5917
|
+
} | {
|
|
5918
|
+
status: 'error';
|
|
5919
|
+
hash?: string;
|
|
5920
|
+
details?: string;
|
|
5921
|
+
resultCode?: string;
|
|
5922
|
+
code?: string;
|
|
5923
|
+
message?: string;
|
|
5924
|
+
buildData?: TxBuildContent;
|
|
5925
|
+
};
|
|
5926
|
+
/**
|
|
5927
|
+
* Result of {@link PollarClient.setTrustline}. Like {@link SubmitOutcome} but the
|
|
5928
|
+
* `hash` is optional: the sponsored, server-orchestrated path completes without
|
|
5929
|
+
* surfacing a transaction hash to the client, whereas the self-paid path returns
|
|
5930
|
+
* the underlying submit outcome (hash included).
|
|
5931
|
+
*/
|
|
5932
|
+
type TrustlineOutcome = {
|
|
5933
|
+
status: 'success';
|
|
5934
|
+
hash?: string;
|
|
5935
|
+
} | {
|
|
5936
|
+
status: 'pending';
|
|
5937
|
+
hash?: string;
|
|
5938
|
+
} | {
|
|
5939
|
+
status: 'error';
|
|
5940
|
+
details?: string;
|
|
5941
|
+
};
|
|
5942
|
+
declare const AUTH_ERROR_CODES: {
|
|
5943
|
+
readonly SESSION_CREATE_FAILED: "SESSION_CREATE_FAILED";
|
|
5944
|
+
readonly SESSION_EXPIRED: "SESSION_EXPIRED";
|
|
5945
|
+
readonly SESSION_INVALID: "SESSION_INVALID";
|
|
5946
|
+
readonly EMAIL_SEND_FAILED: "EMAIL_SEND_FAILED";
|
|
5947
|
+
readonly EMAIL_VERIFY_FAILED: "EMAIL_VERIFY_FAILED";
|
|
5948
|
+
readonly EMAIL_CODE_EXPIRED: "EMAIL_CODE_EXPIRED";
|
|
5949
|
+
readonly EMAIL_CODE_INVALID: "EMAIL_CODE_INVALID";
|
|
5950
|
+
readonly AUTH_FAILED: "AUTH_FAILED";
|
|
5951
|
+
readonly WALLET_CONNECT_FAILED: "WALLET_CONNECT_FAILED";
|
|
5952
|
+
readonly WALLET_AUTH_FAILED: "WALLET_AUTH_FAILED";
|
|
5953
|
+
readonly WALLET_RESOLVER_TIMEOUT: "WALLET_RESOLVER_TIMEOUT";
|
|
5954
|
+
readonly EXTERNAL_AUTH_FAILED: "EXTERNAL_AUTH_FAILED";
|
|
5955
|
+
readonly PASSKEY_FAILED: "PASSKEY_FAILED";
|
|
5956
|
+
readonly TX_FAILED: "TX_FAILED";
|
|
5957
|
+
readonly UNEXPECTED_ERROR: "UNEXPECTED_ERROR";
|
|
5958
|
+
};
|
|
5959
|
+
type AuthErrorCode = (typeof AUTH_ERROR_CODES)[keyof typeof AUTH_ERROR_CODES];
|
|
5960
|
+
type AuthState = {
|
|
5961
|
+
step: 'idle';
|
|
5962
|
+
} | {
|
|
5963
|
+
step: 'creating_session';
|
|
5964
|
+
} | {
|
|
5965
|
+
step: 'entering_email';
|
|
5966
|
+
clientSessionId: string;
|
|
5967
|
+
} | {
|
|
5968
|
+
step: 'sending_email';
|
|
5969
|
+
email: string;
|
|
5970
|
+
} | {
|
|
5971
|
+
step: 'entering_code';
|
|
5972
|
+
clientSessionId: string;
|
|
5973
|
+
email: string;
|
|
5974
|
+
} | {
|
|
5975
|
+
step: 'verifying_email_code';
|
|
5976
|
+
clientSessionId: string;
|
|
5977
|
+
email: string;
|
|
5978
|
+
} | {
|
|
5979
|
+
step: 'opening_oauth';
|
|
5980
|
+
provider: 'google' | 'github';
|
|
5981
|
+
} | {
|
|
5982
|
+
step: 'connecting_wallet';
|
|
5983
|
+
walletType: WalletId;
|
|
5984
|
+
} | {
|
|
5985
|
+
step: 'signing_wallet_challenge';
|
|
5986
|
+
walletType: WalletId;
|
|
5987
|
+
} | {
|
|
5988
|
+
step: 'wallet_not_installed';
|
|
5989
|
+
walletType: WalletId;
|
|
5990
|
+
} | {
|
|
5991
|
+
step: 'authenticating_wallet';
|
|
5992
|
+
} | {
|
|
5993
|
+
step: 'creating_passkey';
|
|
5994
|
+
} | {
|
|
5995
|
+
step: 'deploying_smart_account';
|
|
5996
|
+
} | {
|
|
5997
|
+
step: 'authenticating';
|
|
5998
|
+
} | {
|
|
5999
|
+
step: 'authenticated';
|
|
6000
|
+
session: PollarPersistedSession;
|
|
6001
|
+
/**
|
|
6002
|
+
* `false` while the session is restored optimistically from storage and
|
|
6003
|
+
* not yet revalidated with the server; `true` after a fresh login/refresh
|
|
6004
|
+
* or a successful `/auth/session/resume`. Gate sensitive actions on this.
|
|
6005
|
+
*/
|
|
6006
|
+
verified: boolean;
|
|
6007
|
+
} | {
|
|
6008
|
+
step: 'error';
|
|
6009
|
+
previousStep: string;
|
|
6010
|
+
message: string;
|
|
6011
|
+
errorCode: AuthErrorCode;
|
|
6012
|
+
clientSessionId?: string;
|
|
6013
|
+
email?: string;
|
|
6014
|
+
};
|
|
6015
|
+
type NetworkState = {
|
|
6016
|
+
step: 'idle';
|
|
6017
|
+
} | {
|
|
6018
|
+
step: 'connected';
|
|
6019
|
+
network: StellarNetwork;
|
|
6020
|
+
};
|
|
6021
|
+
declare class PollarFlowError extends Error {
|
|
6022
|
+
readonly code: "INVALID_FLOW";
|
|
6023
|
+
constructor(message: string);
|
|
6024
|
+
}
|
|
6025
|
+
type WalletBalanceContent = paths['/wallet/balance']['get']['responses'][200]['content']['application/json']['content'];
|
|
6026
|
+
type WalletBalanceRecord = WalletBalanceContent['balances'][number];
|
|
6027
|
+
type WalletBalanceState = {
|
|
6028
|
+
step: 'idle';
|
|
6029
|
+
} | {
|
|
6030
|
+
step: 'loading';
|
|
6031
|
+
} | {
|
|
6032
|
+
step: 'loaded';
|
|
6033
|
+
data: WalletBalanceContent;
|
|
6034
|
+
} | {
|
|
6035
|
+
step: 'error';
|
|
6036
|
+
message: string;
|
|
6037
|
+
};
|
|
6038
|
+
type WalletAssetsContent = paths['/wallet/assets']['get']['responses'][200]['content']['application/json']['content'];
|
|
6039
|
+
type EnabledAssetRecord = WalletAssetsContent['assets'][number];
|
|
6040
|
+
type EnabledAssetsState = {
|
|
6041
|
+
step: 'idle';
|
|
6042
|
+
} | {
|
|
6043
|
+
step: 'loading';
|
|
6044
|
+
} | {
|
|
6045
|
+
step: 'loaded';
|
|
6046
|
+
data: WalletAssetsContent;
|
|
6047
|
+
} | {
|
|
6048
|
+
step: 'error';
|
|
6049
|
+
message: string;
|
|
6050
|
+
};
|
|
6051
|
+
type TxHistoryRecord = paths['/tx/history']['get']['responses'][200]['content']['application/json']['content']['records'][number];
|
|
6052
|
+
type TxHistoryParams = NonNullable<paths['/tx/history']['get']['parameters']['query']>;
|
|
6053
|
+
type TxHistoryContent = paths['/tx/history']['get']['responses'][200]['content']['application/json']['content'];
|
|
6054
|
+
type TxHistoryState = {
|
|
6055
|
+
step: 'idle';
|
|
6056
|
+
} | {
|
|
6057
|
+
step: 'loading';
|
|
6058
|
+
params: TxHistoryParams;
|
|
6059
|
+
} | {
|
|
6060
|
+
step: 'loaded';
|
|
6061
|
+
params: TxHistoryParams;
|
|
6062
|
+
data: TxHistoryContent;
|
|
6063
|
+
} | {
|
|
6064
|
+
step: 'error';
|
|
6065
|
+
params: TxHistoryParams;
|
|
6066
|
+
message: string;
|
|
6067
|
+
};
|
|
6068
|
+
type KycLevel = 'basic' | 'intermediate' | 'enhanced';
|
|
6069
|
+
type KycStatus = 'none' | 'pending' | 'approved' | 'rejected';
|
|
6070
|
+
type KycFlow = 'iframe' | 'form' | 'redirect';
|
|
6071
|
+
type KycProvider = paths['/kyc/providers']['get']['responses'][200]['content']['application/json']['content']['providers'][number];
|
|
6072
|
+
type KycStartBody = NonNullable<paths['/kyc/start']['post']['requestBody']>['content']['application/json'];
|
|
6073
|
+
type KycStartResponse = paths['/kyc/start']['post']['responses'][200]['content']['application/json']['content'];
|
|
6074
|
+
type RampsQuoteQuery = NonNullable<paths['/ramps/quote']['get']['parameters']['query']>;
|
|
6075
|
+
type RampQuote = paths['/ramps/quote']['get']['responses'][200]['content']['application/json']['content']['quotes'][number];
|
|
6076
|
+
type RampsQuoteResponse = paths['/ramps/quote']['get']['responses'][200]['content']['application/json']['content'];
|
|
6077
|
+
type RampsOnrampBody = NonNullable<paths['/ramps/onramp']['post']['requestBody']>['content']['application/json'];
|
|
6078
|
+
type RampsOnrampResponse = paths['/ramps/onramp']['post']['responses'][200]['content']['application/json']['content'];
|
|
6079
|
+
type RampsOfframpBody = NonNullable<paths['/ramps/offramp']['post']['requestBody']>['content']['application/json'];
|
|
6080
|
+
type RampsOfframpResponse = paths['/ramps/offramp']['post']['responses'][200]['content']['application/json']['content'];
|
|
6081
|
+
type RampsTransactionResponse = paths['/ramps/transaction/{txId}']['get']['responses'][200]['content']['application/json']['content'];
|
|
6082
|
+
type RampTxStatus = RampsTransactionResponse['status'];
|
|
6083
|
+
type RampDirection = RampsTransactionResponse['direction'];
|
|
6084
|
+
type PaymentInstructions = RampsOnrampResponse['paymentInstructions'];
|
|
6085
|
+
type DistributionRule = paths['/distribution/rules']['get']['responses'][200]['content']['application/json']['content']['rules'][number];
|
|
6086
|
+
type RulePeriod = DistributionRule['period'];
|
|
6087
|
+
type DistributionClaimBody = NonNullable<paths['/distribution/claim']['post']['requestBody']>['content']['application/json'];
|
|
6088
|
+
type DistributionClaimContent = paths['/distribution/claim']['post']['responses'][200]['content']['application/json']['content'];
|
|
6089
|
+
type DistributionRulesState = {
|
|
6090
|
+
step: 'idle';
|
|
6091
|
+
} | {
|
|
6092
|
+
step: 'loading';
|
|
6093
|
+
} | {
|
|
6094
|
+
step: 'loaded';
|
|
6095
|
+
rules: DistributionRule[];
|
|
6096
|
+
} | {
|
|
6097
|
+
step: 'error';
|
|
6098
|
+
message: string;
|
|
6099
|
+
};
|
|
6100
|
+
type AdapterFn<TParams = unknown> = (params: TParams) => Promise<{
|
|
6101
|
+
unsignedTransaction: string;
|
|
6102
|
+
}>;
|
|
6103
|
+
type PollarAdapter = Record<string, AdapterFn<any>>;
|
|
6104
|
+
interface PollarAdapters {
|
|
6105
|
+
[key: string]: PollarAdapter;
|
|
6106
|
+
}
|
|
6107
|
+
|
|
6108
|
+
declare class PollarClient {
|
|
6109
|
+
readonly apiKey: string;
|
|
6110
|
+
readonly id: string;
|
|
6111
|
+
readonly basePath: string;
|
|
6112
|
+
private readonly _api;
|
|
6113
|
+
private readonly _log;
|
|
6114
|
+
private readonly _storage;
|
|
6115
|
+
private readonly _keyManager;
|
|
6116
|
+
/** Resolves once `keyManager.init()` and the initial session restore complete. */
|
|
6117
|
+
private readonly _initialized;
|
|
6118
|
+
/**
|
|
6119
|
+
* Per-API-key storage namespace. Computed asynchronously inside
|
|
6120
|
+
* `_initialize()` because SHA-256 lives behind `crypto.subtle.digest`.
|
|
6121
|
+
* Accessing `apiKeyHash` before `await client.ready()` throws.
|
|
6122
|
+
*/
|
|
6123
|
+
private _apiKeyHash;
|
|
6124
|
+
/**
|
|
6125
|
+
* Short SHA-256-derived namespace for this client's persisted state.
|
|
6126
|
+
* Available after `await client.ready()` (or any awaited method); throws
|
|
6127
|
+
* if read before initialization completes.
|
|
6128
|
+
*/
|
|
6129
|
+
get apiKeyHash(): string;
|
|
6130
|
+
private _session;
|
|
6131
|
+
private _profile;
|
|
6132
|
+
/** Last `DPoP-Nonce` we saw from a server response. Carried into the next proof. */
|
|
6133
|
+
private _dpopNonce;
|
|
6134
|
+
/**
|
|
6135
|
+
* Snapshot of each in-flight request's body, taken in `onRequest` before
|
|
6136
|
+
* `fetch()` consumes the stream. Needed because `Request.clone()` throws
|
|
6137
|
+
* once the body is disturbed, so the auto-retry path (DPoP nonce challenge
|
|
6138
|
+
* / 401 refresh) must rebuild the request from scratch instead of cloning.
|
|
6139
|
+
*/
|
|
6140
|
+
private _requestBodyCache;
|
|
6141
|
+
/** Singleton in-flight refresh — concurrent 401s coalesce into one /auth/refresh call. */
|
|
6142
|
+
private _refreshPromise;
|
|
6143
|
+
private _storageEventHandler;
|
|
6144
|
+
/** Optional UI label sent to the server at /auth/login so the sessions UI
|
|
6145
|
+
* can show a recognizable device name. Set via PollarClientConfig.deviceLabel. */
|
|
6146
|
+
private readonly _deviceLabel;
|
|
6147
|
+
private readonly _visibilityProvider;
|
|
6148
|
+
private readonly _maxIdleMs;
|
|
6149
|
+
/** Updated by the request middleware. Read by the silent-refresh scheduler
|
|
6150
|
+
* to skip proactive refreshes after `maxIdleMs` of no HTTP activity. */
|
|
6151
|
+
private _lastRequestAt;
|
|
6152
|
+
private _refreshTimer;
|
|
6153
|
+
private _visibilityUnsubscribe;
|
|
6154
|
+
private _transactionState;
|
|
6155
|
+
private _transactionStateListeners;
|
|
6156
|
+
private _txHistoryState;
|
|
6157
|
+
private _txHistoryStateListeners;
|
|
6158
|
+
private _sessionsState;
|
|
6159
|
+
private _sessionsStateListeners;
|
|
6160
|
+
private _walletBalanceState;
|
|
6161
|
+
private _walletBalanceStateListeners;
|
|
6162
|
+
private _enabledAssetsState;
|
|
6163
|
+
private _enabledAssetsStateListeners;
|
|
6164
|
+
private _authState;
|
|
6165
|
+
private _authStateListeners;
|
|
6166
|
+
private _networkState;
|
|
6167
|
+
private _networkStateListeners;
|
|
6168
|
+
/**
|
|
6169
|
+
* Latched once the storage adapter degrades. We dedupe (the adapter only
|
|
6170
|
+
* fires once anyway) and use it to replay state to late-subscribers — same
|
|
6171
|
+
* pattern as `onAuthStateChange` replaying `_authState` on subscribe.
|
|
6172
|
+
* Only populated when the SDK constructed the default storage adapter; if
|
|
6173
|
+
* the consumer passes `config.storage`, they own degradation notifications.
|
|
6174
|
+
*/
|
|
6175
|
+
private _storageDegraded;
|
|
6176
|
+
private _storageDegradeListeners;
|
|
6177
|
+
private _walletAdapter;
|
|
6178
|
+
private readonly _walletAdapterResolver;
|
|
6179
|
+
private readonly _walletResolverTimeoutMs;
|
|
6180
|
+
private readonly _passkey;
|
|
6181
|
+
private readonly _passkeySign;
|
|
6182
|
+
private _loginController;
|
|
6183
|
+
/** Aborts an in-flight `/auth/session/resume` on destroy() or re-trigger. */
|
|
6184
|
+
private _resumeController;
|
|
6185
|
+
/** Platform strategy for opening the hosted-OAuth URL (popup on web; injected on RN). */
|
|
6186
|
+
private readonly _openAuthUrl;
|
|
6187
|
+
/** `redirect_uri` sent to the backend for hosted OAuth. */
|
|
6188
|
+
private readonly _oauthRedirectUri;
|
|
6189
|
+
/**
|
|
6190
|
+
* Registry of pluggable login strategies, keyed by provider id. Seeded with
|
|
6191
|
+
* the built-ins (`google`, `github`, `email`) and then any `config.providers`
|
|
6192
|
+
* (which can override a built-in by reusing its id). `wallet` is deliberately
|
|
6193
|
+
* absent — it keeps its own dedicated flow. See {@link PollarAuthProvider}.
|
|
6194
|
+
*/
|
|
6195
|
+
private readonly _providers;
|
|
6196
|
+
constructor(config: PollarClientConfig);
|
|
6197
|
+
/** Awaitable handle for the initial keypair + session restore. */
|
|
6198
|
+
ready(): Promise<void>;
|
|
6199
|
+
private _initialize;
|
|
6200
|
+
/** Detach the cross-tab storage listener and abort any in-flight login. */
|
|
6201
|
+
destroy(): void;
|
|
6202
|
+
private _wireMiddlewares;
|
|
6203
|
+
/**
|
|
6204
|
+
* Logs the final outcome of an SDK API call exactly once: successes (`2xx`) at
|
|
6205
|
+
* `debug` (method + path + status, no body), failures (`4xx`/`5xx`) at `error`
|
|
6206
|
+
* with the redacted request body and the response error body. Returns the
|
|
6207
|
+
* response so it can be chained at the middleware's return points. The error
|
|
6208
|
+
* body is read off a synchronous `clone()` so it never disturbs the body the
|
|
6209
|
+
* caller consumes.
|
|
6210
|
+
*/
|
|
6211
|
+
private _logHttp;
|
|
6212
|
+
/** Reads the redacted request body + JSON response body and logs at `error`. */
|
|
6213
|
+
private _logHttpError;
|
|
6214
|
+
/** Strips origin + `/v1` version prefix from a request URL for compact logs. */
|
|
6215
|
+
private _httpPath;
|
|
6216
|
+
private _buildProofForRequest;
|
|
6217
|
+
private _retryRequest;
|
|
6218
|
+
/**
|
|
6219
|
+
* Coalesce concurrent refresh attempts. The first caller does the work;
|
|
6220
|
+
* everyone else awaits the same promise and sees the new tokens.
|
|
6221
|
+
*/
|
|
6222
|
+
refresh(): Promise<void>;
|
|
6223
|
+
private _doRefresh;
|
|
6224
|
+
/**
|
|
6225
|
+
* Arm a single setTimeout to fire shortly before the current access token
|
|
6226
|
+
* expires. Idempotent — clearing any previous timer first. Safe to call
|
|
6227
|
+
* from any session-write site (initial login, restore-from-storage, after
|
|
6228
|
+
* a successful rotation). No-op if there's no session in memory.
|
|
6229
|
+
*
|
|
6230
|
+
* Browser/RN background-tab throttling makes long-running setTimeouts
|
|
6231
|
+
* unreliable on their own; the `visibilitychange` listener compensates by
|
|
6232
|
+
* re-invoking `_maybeProactiveRefresh` whenever the app comes back to the
|
|
6233
|
+
* foreground, catching any timer that fired late or never fired at all.
|
|
6234
|
+
*/
|
|
6235
|
+
private _scheduleNextRefresh;
|
|
6236
|
+
/**
|
|
6237
|
+
* Decide whether to actually run a refresh right now. Called both from the
|
|
6238
|
+
* scheduler timer and from the visibility-change listener.
|
|
6239
|
+
*
|
|
6240
|
+
* Skip if:
|
|
6241
|
+
* - no session / no RT (nothing to refresh)
|
|
6242
|
+
* - app is hidden — wait for the visibility listener to re-trigger us
|
|
6243
|
+
* - `maxIdleMs` configured and no client request since that window — let
|
|
6244
|
+
* the next reactive 401-refresh handle it whenever the user comes back
|
|
6245
|
+
* - the AT still has more than `REFRESH_SKEW_SECONDS` of life — reschedule
|
|
6246
|
+
*
|
|
6247
|
+
* Otherwise call `refresh()`, which uses the existing in-flight singleton
|
|
6248
|
+
* so we never collide with a reactive 401-triggered refresh. On failure,
|
|
6249
|
+
* `_doRefresh` already calls `_clearSession`, so auth-state listeners see
|
|
6250
|
+
* `step:'idle'` — no extra event dispatch needed here.
|
|
6251
|
+
*/
|
|
6252
|
+
private _maybeProactiveRefresh;
|
|
6253
|
+
private _clearRefreshTimer;
|
|
6254
|
+
getAuthState(): AuthState;
|
|
6255
|
+
onAuthStateChange(cb: (state: AuthState) => void): () => void;
|
|
6256
|
+
/**
|
|
6257
|
+
* Subscribe to persistent-storage degradation (Safari private mode,
|
|
6258
|
+
* sandboxed iframes, quota errors, etc.). The SDK keeps running off
|
|
6259
|
+
* in-memory storage after degrade, but sessions won't survive reload — a
|
|
6260
|
+
* host UI typically wants to show "your session won't be saved" so the
|
|
6261
|
+
* user isn't blindsided after a refresh.
|
|
6262
|
+
*
|
|
6263
|
+
* Fires at most once per client lifetime (the underlying adapter dedupes).
|
|
6264
|
+
* Late subscribers receive the latched state synchronously on subscribe.
|
|
6265
|
+
*
|
|
6266
|
+
* Only fires when the SDK constructs the default storage adapter. If you
|
|
6267
|
+
* pass a custom `config.storage`, wire your own notification path through
|
|
6268
|
+
* that adapter's API — the SDK has no hook into it.
|
|
6269
|
+
*/
|
|
6270
|
+
onStorageDegrade(cb: OnStorageDegrade): () => void;
|
|
6271
|
+
private _dispatchStorageDegrade;
|
|
6272
|
+
/** PII (email, names, avatar, providers). Held in memory only — never persisted. */
|
|
6273
|
+
getUserProfile(): PollarUserProfile | null;
|
|
6274
|
+
login(options: PollarLoginOptions): void;
|
|
6275
|
+
/**
|
|
6276
|
+
* Invoke a named secondary step on a registered provider (e.g. email's
|
|
6277
|
+
* `sendCode` / `verifyCode`, or a custom provider's multi-step continuation).
|
|
6278
|
+
* Reuses the in-flight login `AbortController` when one exists so the step
|
|
6279
|
+
* stays cancellable via `cancelLogin()`; otherwise starts a fresh one. The
|
|
6280
|
+
* built-in email steps also have dedicated typed methods
|
|
6281
|
+
* ({@link sendEmailCode} / {@link verifyEmailCode}) — prefer those for email.
|
|
6282
|
+
*/
|
|
6283
|
+
providerAction(provider: string, action: string, payload?: unknown): void;
|
|
6284
|
+
beginEmailLogin(): void;
|
|
6285
|
+
sendEmailCode(email: string): void;
|
|
6286
|
+
verifyEmailCode(code: string): void;
|
|
6287
|
+
loginWallet(type: WalletId): void;
|
|
6288
|
+
/**
|
|
6289
|
+
* "Smart Wallet" login: runs the passkey (WebAuthn) `get()` ceremony for a
|
|
6290
|
+
* returning user and signs them in. Use {@link createSmartWallet} for a new
|
|
6291
|
+
* user. Requires the `passkey` ceremony to be configured (e.g. via
|
|
6292
|
+
* `@pollar/react`).
|
|
6293
|
+
*/
|
|
6294
|
+
loginSmartWallet(): void;
|
|
6295
|
+
/**
|
|
6296
|
+
* "Smart Wallet" registration: runs the passkey (WebAuthn) `create()` ceremony
|
|
6297
|
+
* for a new user and deploys a sponsored smart-account C-address. Use
|
|
6298
|
+
* {@link loginSmartWallet} for a returning user. Requires the `passkey`
|
|
6299
|
+
* ceremony to be configured (e.g. via `@pollar/react`).
|
|
6300
|
+
*/
|
|
6301
|
+
createSmartWallet(): void;
|
|
6302
|
+
cancelLogin(): void;
|
|
6303
|
+
/**
|
|
6304
|
+
* Revoke the current session server-side, then clear local storage.
|
|
6305
|
+
*
|
|
6306
|
+
* Server revocation is best-effort: if the POST fails (offline, server
|
|
6307
|
+
* down), local state is wiped regardless. The orphan refresh token then
|
|
6308
|
+
* remains unused until its natural expiry. The in-flight access token
|
|
6309
|
+
* stays valid until its own TTL elapses (≤10 min for DPoP-bound tokens).
|
|
6310
|
+
*
|
|
6311
|
+
* Pass `everywhere: true` to revoke every active session for this user
|
|
6312
|
+
* across all devices.
|
|
6313
|
+
*/
|
|
6314
|
+
logout(options?: {
|
|
6315
|
+
everywhere?: boolean;
|
|
6316
|
+
}): Promise<void>;
|
|
6317
|
+
/** Convenience: revoke every active session for this user (all devices). */
|
|
6318
|
+
logoutEverywhere(): Promise<void>;
|
|
6319
|
+
/**
|
|
6320
|
+
* List active sessions for the authenticated user. Returns one entry per
|
|
6321
|
+
* refresh-token family with the metadata captured at issuance time. The
|
|
6322
|
+
* `current` flag identifies which entry corresponds to this client.
|
|
6323
|
+
*/
|
|
6324
|
+
listSessions(): Promise<SessionInfo[]>;
|
|
6325
|
+
getSessionsState(): SessionsState;
|
|
6326
|
+
onSessionsStateChange(cb: (state: SessionsState) => void): () => void;
|
|
6327
|
+
/**
|
|
6328
|
+
* Fire-and-forget variant of {@link listSessions} that drives the observable
|
|
6329
|
+
* `SessionsState` store instead of returning the array. UI layers subscribe
|
|
6330
|
+
* via `onSessionsStateChange` and stay pure readers — mirrors `fetchTxHistory`.
|
|
6331
|
+
*/
|
|
6332
|
+
fetchSessions(): Promise<void>;
|
|
6333
|
+
/**
|
|
6334
|
+
* Revoke a specific refresh-token family (a single device session). Use
|
|
6335
|
+
* `listSessions` to enumerate the familyIds. Revoking the current session
|
|
6336
|
+
* does NOT clear local state — call `logout()` for that case.
|
|
6337
|
+
*/
|
|
6338
|
+
revokeSession(familyId: string): Promise<void>;
|
|
6339
|
+
getNetwork(): StellarNetwork;
|
|
6340
|
+
getNetworkState(): NetworkState;
|
|
6341
|
+
/**
|
|
6342
|
+
* The client's level-gated logger (built from `logLevel` / `logger`). Exposed
|
|
6343
|
+
* so the runtime layer (`@pollar/react`) can route its own logs through the
|
|
6344
|
+
* same level and sink instead of calling `console` directly.
|
|
6345
|
+
*/
|
|
6346
|
+
getLogger(): PollarLogger;
|
|
6347
|
+
setNetwork(network: StellarNetwork): void;
|
|
6348
|
+
onNetworkStateChange(cb: (state: NetworkState) => void): () => void;
|
|
6349
|
+
getTransactionState(): TransactionState | null;
|
|
6350
|
+
onTransactionStateChange(cb: (state: TransactionState) => void): () => void;
|
|
6351
|
+
getTxHistoryState(): TxHistoryState;
|
|
6352
|
+
onTxHistoryStateChange(cb: (state: TxHistoryState) => void): () => void;
|
|
6353
|
+
fetchTxHistory(params?: TxHistoryParams): Promise<void>;
|
|
6354
|
+
getWalletBalanceState(): WalletBalanceState;
|
|
6355
|
+
onWalletBalanceStateChange(cb: (state: WalletBalanceState) => void): () => void;
|
|
6356
|
+
/**
|
|
6357
|
+
* Refreshes the balances of the authenticated user's OWN wallet. The wallet
|
|
6358
|
+
* and network are resolved server-side from the session — no arguments. Drives
|
|
6359
|
+
* `walletBalanceState`. For an arbitrary wallet, use {@link getWalletBalance}.
|
|
6360
|
+
*/
|
|
6361
|
+
refreshBalance(): Promise<void>;
|
|
6362
|
+
/**
|
|
6363
|
+
* General-purpose balance lookup for ANY wallet on ANY network — not scoped
|
|
6364
|
+
* to this application. Enumerates the account's real on-chain holdings via
|
|
6365
|
+
* Horizon (server-side) and returns the data directly (no reactive state).
|
|
6366
|
+
* `network` defaults to the client's current network.
|
|
6367
|
+
*/
|
|
6368
|
+
getWalletBalance(publicKey: string, network?: StellarNetwork): Promise<WalletBalanceContent>;
|
|
6369
|
+
getEnabledAssetsState(): EnabledAssetsState;
|
|
6370
|
+
onEnabledAssetsStateChange(cb: (state: EnabledAssetsState) => void): () => void;
|
|
6371
|
+
/**
|
|
6372
|
+
* Loads the application's enabled assets paired with the authenticated
|
|
6373
|
+
* wallet's on-chain trustline state — so the SDK knows which trustlines still
|
|
6374
|
+
* need to be added. Wallet and network are resolved server-side from the
|
|
6375
|
+
* session. Drives `enabledAssetsState`; mirrors {@link refreshBalance}.
|
|
6376
|
+
*/
|
|
6377
|
+
refreshAssets(): Promise<void>;
|
|
6378
|
+
/**
|
|
6379
|
+
* Establishes (omit `limit`) or removes (`limit: '0'`) a trustline for an asset.
|
|
6380
|
+
*
|
|
6381
|
+
* Routing mirrors how the platform pays for the reserve:
|
|
6382
|
+
* - **Sponsored custodial** (`opts.sponsored` true, internal wallet) → the
|
|
6383
|
+
* server orchestrates a sponsored `changeTrust`: the app's wallets cover the
|
|
6384
|
+
* 0.5 XLM reserve and the fee, so the user pays nothing. Pass the asset's
|
|
6385
|
+
* `sponsored` flag (from {@link refreshAssets}) straight through.
|
|
6386
|
+
* - **Self-paid** (external/adapter wallet, sponsorship disabled, or a custom
|
|
6387
|
+
* asset not configured in the app) → a plain `change_trust` transaction the
|
|
6388
|
+
* user's own wallet signs and pays for, via {@link runTx}.
|
|
6389
|
+
*
|
|
6390
|
+
* Does not refresh on its own — callers should `refreshAssets()` afterwards.
|
|
6391
|
+
*/
|
|
6392
|
+
setTrustline(asset: {
|
|
6393
|
+
code: string;
|
|
6394
|
+
issuer: string;
|
|
6395
|
+
}, opts?: {
|
|
6396
|
+
limit?: string;
|
|
6397
|
+
sponsored?: boolean;
|
|
6398
|
+
}): Promise<TrustlineOutcome>;
|
|
6399
|
+
/**
|
|
6400
|
+
* Builds an unsigned XDR. Drives `_setTransactionState` for modal-style UIs
|
|
6401
|
+
* AND returns a {@link BuildOutcome} so headless callers can `await` and
|
|
6402
|
+
* inspect the result without subscribing to state changes.
|
|
6403
|
+
*/
|
|
6404
|
+
buildTx(operation: TxBuildBody['operation'], params: TxBuildBody['params'], options?: TxBuildBody['options']): Promise<BuildOutcome>;
|
|
6405
|
+
getWalletType(): WalletId | null;
|
|
6406
|
+
/**
|
|
6407
|
+
* The authenticated user's wallet as a {@link WalletInfo} discriminated union,
|
|
6408
|
+
* or `null` when there's no session (or the session carries no address yet).
|
|
6409
|
+
*
|
|
6410
|
+
* `custody` strictly determines `provider` (the mapping is 1:1 and fixed at
|
|
6411
|
+
* account creation server-side): `external` reports the connected adapter id
|
|
6412
|
+
* (`getWalletType()`), `smart` is always `'passkey'`, and `internal` reports
|
|
6413
|
+
* the login method the backend recorded (`null` for pre-provider sessions).
|
|
6414
|
+
*/
|
|
6415
|
+
getWallet(): WalletInfo | null;
|
|
6416
|
+
/**
|
|
6417
|
+
* Signs the given unsigned XDR and returns the signed XDR.
|
|
6418
|
+
*
|
|
6419
|
+
* - External wallets: signs locally via the wallet adapter.
|
|
6420
|
+
* - Custodial wallets: posts to `/tx/sign`. The backend signs (through
|
|
6421
|
+
* wallet-service or the app's customer-managed adapter) and returns the
|
|
6422
|
+
* signed XDR plus an `idempotencyKey` the caller should echo back to
|
|
6423
|
+
* `submitTx`.
|
|
6424
|
+
*
|
|
6425
|
+
* Drives `_setTransactionState`: emits `signing` while in flight and
|
|
6426
|
+
* `signed` on success (or `error[phase: 'signing']` on failure). `buildData`
|
|
6427
|
+
* is threaded through if the consumer previously called `buildTx`.
|
|
6428
|
+
*/
|
|
6429
|
+
signTx(unsignedXdr: string): Promise<SignOutcome>;
|
|
6430
|
+
/**
|
|
6431
|
+
* Sign a single Soroban authorization entry (`SorobanAuthorizationEntry`).
|
|
6432
|
+
*
|
|
6433
|
+
* Use this when a contract is the transaction source (e.g. it sponsors the
|
|
6434
|
+
* gas and swaps the fee out of the user's token) and only needs the user's
|
|
6435
|
+
* address-credentials authorization, not a full signed envelope. The signed
|
|
6436
|
+
* entry is returned as base64 XDR for the caller to compose into its tx.
|
|
6437
|
+
*
|
|
6438
|
+
* - External wallets (Freighter/Albedo) sign the entry via the provider.
|
|
6439
|
+
* - Custodial wallets are signed by the backend, which FIRST validates the
|
|
6440
|
+
* entry's invocation tree against the app's contract/function allowlist and
|
|
6441
|
+
* caps the validity window — entries touching a non-allowlisted contract or
|
|
6442
|
+
* function, or expiring too far ahead, are rejected.
|
|
6443
|
+
*
|
|
6444
|
+
* @param entryXdr base64 XDR of the unsigned `SorobanAuthorizationEntry`.
|
|
6445
|
+
* @param options.validUntilLedger absolute ledger the signature expires at
|
|
6446
|
+
* (computed from the network's latest ledger). Ignored on the external-wallet
|
|
6447
|
+
* path, where the provider sets its own expiration.
|
|
6448
|
+
*/
|
|
6449
|
+
signAuthEntry(entryXdr: string, options: {
|
|
6450
|
+
validUntilLedger: number;
|
|
6451
|
+
}): Promise<SignAuthEntryOutcome>;
|
|
6452
|
+
/**
|
|
6453
|
+
* Submits a signed XDR via `/tx/submit` regardless of wallet type
|
|
6454
|
+
* (custodial or external). Routing through sdk-api gives us:
|
|
6455
|
+
* - End-to-end tx_records persistence with full phase lifecycle so the
|
|
6456
|
+
* developer dashboard can show every tx (both custodial and external
|
|
6457
|
+
* wallet flows) at `/apps/:id/monitor/transactions`.
|
|
6458
|
+
* - Idempotency tracking via `submissionToken` (returned by `signTx`).
|
|
6459
|
+
* - A single response shape (SUCCESS / PENDING / FAILED) shared by both
|
|
6460
|
+
* flows — previously external wallets could only return SUCCESS or
|
|
6461
|
+
* error since the direct-to-Horizon path was synchronous.
|
|
6462
|
+
*
|
|
6463
|
+
* The extra hop adds ~50–150 ms vs. the legacy direct-Horizon path; the
|
|
6464
|
+
* persistence + observability win is worth it.
|
|
6465
|
+
*
|
|
6466
|
+
* Drives `_setTransactionState`: emits `submitting` while in flight,
|
|
6467
|
+
* `submitted` on Horizon ack (pending), `success` on ledger confirmation,
|
|
6468
|
+
* or `error[phase: 'submitting']` on failure.
|
|
6469
|
+
*/
|
|
6470
|
+
/**
|
|
6471
|
+
* Normalize a backend API error into { details, code, message }. `code` is the
|
|
6472
|
+
* precise backend ErrorCode (e.g. `TX_FEE_LIMIT_EXCEEDED`) for programmatic
|
|
6473
|
+
* handling; `message` is a friendly string from the error catalog; `details`
|
|
6474
|
+
* is the raw diagnostic. Lets tx flows surface a typed reason instead of an
|
|
6475
|
+
* opaque details string.
|
|
6476
|
+
*/
|
|
6477
|
+
private _resolveTxApiError;
|
|
6478
|
+
submitTx(signedXdr: string, opts?: {
|
|
6479
|
+
submissionToken?: string;
|
|
6480
|
+
}): Promise<SubmitOutcome>;
|
|
6481
|
+
/**
|
|
6482
|
+
* Signs and submits in one logical step. Returns a {@link SubmitOutcome}.
|
|
6483
|
+
*
|
|
6484
|
+
* - **External wallets**: composes `signTx` + `submitTx` client-side. State
|
|
6485
|
+
* machine sees the full granular sequence `signing → signed → submitting
|
|
6486
|
+
* → success` because the underlying methods each emit.
|
|
6487
|
+
* - **Custodial wallets**: atomic `/tx/sign-and-send` round-trip. State
|
|
6488
|
+
* machine emits the compound `signing-submitting` step (the SDK can't
|
|
6489
|
+
* observe when one phase ends and the next begins inside that single
|
|
6490
|
+
* backend call) and then transitions to `submitted` (Horizon ack only) or
|
|
6491
|
+
* `success` (ledger-confirmed), or `error[phase: 'signing-submitting']`.
|
|
6492
|
+
*/
|
|
6493
|
+
signAndSubmitTx(unsignedXdr?: string): Promise<SubmitOutcome>;
|
|
6494
|
+
/**
|
|
6495
|
+
* One-shot: build → sign → submit, returning the final {@link SubmitOutcome}.
|
|
6496
|
+
*
|
|
6497
|
+
* - **External wallets**: composes `buildTx` + `signAndSubmitTx` client-side.
|
|
6498
|
+
* State machine sees the full granular sequence (`building → built →
|
|
6499
|
+
* signing → signed → submitting → success`) because each composed call
|
|
6500
|
+
* emits its own transitions.
|
|
6501
|
+
* - **Custodial wallets**: single round-trip to `/tx/build-sign-submit`. The
|
|
6502
|
+
* signed XDR never leaves the backend. State machine emits the compound
|
|
6503
|
+
* `building-signing-submitting` step (the SDK can't observe individual
|
|
6504
|
+
* phase boundaries inside one atomic call) and then transitions to
|
|
6505
|
+
* `submitted` / `success` / `error[phase: 'building-signing-submitting']`.
|
|
6506
|
+
*
|
|
6507
|
+
* If you need granular UI feedback for custodial flows (separate
|
|
6508
|
+
* "Building…", "Signing…", "Submitting…" indicators), call `buildTx`,
|
|
6509
|
+
* `signTx`, and `submitTx` separately instead.
|
|
6510
|
+
*/
|
|
6511
|
+
buildAndSignAndSubmitTx(operation: TxBuildBody['operation'], params: TxBuildBody['params'], options?: TxBuildBody['options']): Promise<SubmitOutcome>;
|
|
6512
|
+
/** Alias for {@link buildAndSignAndSubmitTx} — shorter "just do the thing" name. */
|
|
6513
|
+
runTx(operation: TxBuildBody['operation'], params: TxBuildBody['params'], options?: TxBuildBody['options']): Promise<SubmitOutcome>;
|
|
6514
|
+
/**
|
|
6515
|
+
* Smart-wallet (passkey / C-address) transaction: build (server prepares the
|
|
6516
|
+
* SAC transfer + returns the auth digest) → sign the digest with the passkey
|
|
6517
|
+
* → submit (server assembles the signed auth entry and broadcasts; the
|
|
6518
|
+
* sponsor pays the fee). State machine: building → built → signing →
|
|
6519
|
+
* submitting → success.
|
|
6520
|
+
*/
|
|
6521
|
+
private _runSmartTx;
|
|
6522
|
+
/**
|
|
6523
|
+
* Steps 2–3 of the smart-wallet flow: sign the prepared auth digest with the
|
|
6524
|
+
* passkey, then submit. Shared by `_runSmartTx` (atomic) and `signAndSubmitTx`
|
|
6525
|
+
* (split flow, when a smart build is already on the state machine).
|
|
6526
|
+
*/
|
|
6527
|
+
private _signSubmitSmart;
|
|
6528
|
+
getAppConfig(): Promise<unknown>;
|
|
6529
|
+
getKycStatus(providerId?: string): Promise<{
|
|
6530
|
+
status: KycStatus;
|
|
6531
|
+
level?: KycLevel | undefined;
|
|
6532
|
+
providerId: string;
|
|
6533
|
+
expiresAt?: string;
|
|
6534
|
+
}>;
|
|
6535
|
+
getKycProviders(country: string): Promise<{
|
|
6536
|
+
providers: KycProvider[];
|
|
6537
|
+
}>;
|
|
6538
|
+
startKyc(body: KycStartBody): Promise<KycStartResponse>;
|
|
6539
|
+
resolveKyc(providerId: string, level?: KycLevel): Promise<{
|
|
6540
|
+
alreadyApproved: boolean;
|
|
6541
|
+
} & Partial<{
|
|
6542
|
+
sessionId: string;
|
|
6543
|
+
kycUrl?: string;
|
|
6544
|
+
fields?: {
|
|
6545
|
+
name: string;
|
|
6546
|
+
type: string;
|
|
6547
|
+
required: boolean;
|
|
6548
|
+
}[];
|
|
6549
|
+
}>>;
|
|
6550
|
+
pollKycStatus(providerId: string, opts?: {
|
|
6551
|
+
intervalMs?: number;
|
|
6552
|
+
timeoutMs?: number;
|
|
6553
|
+
}): Promise<KycStatus>;
|
|
6554
|
+
getRampsQuote(query: RampsQuoteQuery): Promise<RampsQuoteResponse>;
|
|
6555
|
+
createOnRamp(body: RampsOnrampBody): Promise<RampsOnrampResponse>;
|
|
6556
|
+
createOffRamp(body: RampsOfframpBody): Promise<RampsOfframpResponse>;
|
|
6557
|
+
getRampTransaction(txId: string): Promise<RampsTransactionResponse>;
|
|
6558
|
+
pollRampTransaction(txId: string, opts?: {
|
|
6559
|
+
intervalMs?: number;
|
|
6560
|
+
timeoutMs?: number;
|
|
6561
|
+
}): Promise<RampTxStatus>;
|
|
6562
|
+
listDistributionRules(): Promise<DistributionRule[]>;
|
|
6563
|
+
claimDistributionRule(body: DistributionClaimBody): Promise<DistributionClaimContent>;
|
|
6564
|
+
private _setTxHistoryState;
|
|
6565
|
+
private _setSessionsState;
|
|
6566
|
+
private _setWalletBalanceState;
|
|
6567
|
+
private _setEnabledAssetsState;
|
|
6568
|
+
private _newController;
|
|
6569
|
+
/**
|
|
6570
|
+
* Build the {@link AuthProviderContext} facade for one login attempt. Wraps
|
|
6571
|
+
* the internal `FlowDeps` so providers get only the curated primitives —
|
|
6572
|
+
* `createSession`, `authenticate`, `exchangeExternalToken`, `startHostedOAuth`
|
|
6573
|
+
* — while storage / wallet-adapter / key-manager internals stay private. All
|
|
6574
|
+
* legs share the same `signal`, so `cancelLogin()` aborts the whole chain.
|
|
6575
|
+
*/
|
|
6576
|
+
private _providerContext;
|
|
6577
|
+
/**
|
|
6578
|
+
* Generic external-provider exchange leg (`POST /auth/external`). Custom
|
|
6579
|
+
* providers call this (via the context) after their own SDK has authenticated
|
|
6580
|
+
* the user and the wallet has counter-signed the SEP-10 challenge
|
|
6581
|
+
* (`{ provider, walletAddress, signedChallengeXdr }`). On success the session
|
|
6582
|
+
* is marked READY server-side and the provider should then call
|
|
6583
|
+
* `ctx.authenticate(clientSessionId)`. Returns `false` (and sets an error
|
|
6584
|
+
* state) on failure.
|
|
6585
|
+
*/
|
|
6586
|
+
private _exchangeExternalToken;
|
|
6587
|
+
private _flowDeps;
|
|
6588
|
+
/**
|
|
6589
|
+
* Resolves a wallet adapter for the requested id. Uses the consumer's
|
|
6590
|
+
* injected `walletAdapter` resolver when present; otherwise falls back to
|
|
6591
|
+
* the built-in `FreighterAdapter` / `AlbedoAdapter`. Throws if the id is
|
|
6592
|
+
* unknown and no resolver is configured.
|
|
6593
|
+
*/
|
|
6594
|
+
private _resolveWalletAdapter;
|
|
6595
|
+
private _handleFlowError;
|
|
6596
|
+
private _restoreSession;
|
|
6597
|
+
/**
|
|
6598
|
+
* Validate the restored session against the server and repopulate the
|
|
6599
|
+
* in-memory profile (PII is never persisted, so it's null after a cold
|
|
6600
|
+
* reload). Goes through the normal authed client, so it coalesces with any
|
|
6601
|
+
* in-flight refresh (onRequest awaits `_refreshPromise`) and, being a GET,
|
|
6602
|
+
* is auto-retried after a 401-triggered refresh.
|
|
6603
|
+
*
|
|
6604
|
+
* - 200 → store profile, mark the session `verified`.
|
|
6605
|
+
* - 401 → the refresh-on-401 path already ran; if the family was
|
|
6606
|
+
* revoked, refresh failed and `_clearSession()` took us to
|
|
6607
|
+
* idle. Nothing to do here — don't double-handle.
|
|
6608
|
+
* - network error → stay optimistic (do NOT log out); revalidated later on
|
|
6609
|
+
* `visibilitychange` or first use.
|
|
6610
|
+
*/
|
|
6611
|
+
private _resume;
|
|
6612
|
+
private _storeSession;
|
|
6613
|
+
private _clearSession;
|
|
6614
|
+
private _networkPassphrase;
|
|
6615
|
+
private _setNetworkState;
|
|
6616
|
+
private _setAuthState;
|
|
6617
|
+
private _setTransactionState;
|
|
6618
|
+
/**
|
|
6619
|
+
* Threads `buildData` through state transitions. When the user has already
|
|
6620
|
+
* called `buildTx`, every subsequent state (signing, signed, submitting,
|
|
6621
|
+
* submitted, success, error) should carry the build summary so modal UIs
|
|
6622
|
+
* can keep showing "Send 5 USDC to G..." through the whole flow.
|
|
6623
|
+
*/
|
|
6624
|
+
private _currentBuildData;
|
|
6625
|
+
}
|
|
6626
|
+
|
|
6627
|
+
/**
|
|
6628
|
+
* Version of this `@pollar/core` build (e.g. `'0.8.2'`). Falls back to `'dev'`
|
|
6629
|
+
* when running unbundled.
|
|
6630
|
+
*
|
|
6631
|
+
* Named per-package on purpose: importing it alongside `@pollar/react`'s
|
|
6632
|
+
* `POLLAR_REACT_VERSION` never collides, so an app can report both versions in
|
|
6633
|
+
* a single bug-report / diagnostics line.
|
|
6634
|
+
*/
|
|
6635
|
+
declare const POLLAR_CORE_VERSION: string;
|
|
6636
|
+
|
|
6637
|
+
/**
|
|
6638
|
+
* In-memory storage backed by a `Map`. Always available, never throws.
|
|
6639
|
+
* Used as the default fallback for SSR, private browsing, sandboxed iframes
|
|
6640
|
+
* without `allow-same-origin`, or any environment where `localStorage` is
|
|
6641
|
+
* unusable.
|
|
6642
|
+
*/
|
|
6643
|
+
declare function createMemoryAdapter(): Storage;
|
|
6644
|
+
interface LocalStorageAdapterOptions {
|
|
6645
|
+
/**
|
|
6646
|
+
* Optional callback invoked the first time the adapter degrades to its
|
|
6647
|
+
* in-memory fallback (e.g. quota exceeded, throwing `localStorage`).
|
|
6648
|
+
*/
|
|
6649
|
+
onDegrade?: OnStorageDegrade;
|
|
6650
|
+
/**
|
|
6651
|
+
* Logger for the one-shot degrade warning. Defaults to the global `console`;
|
|
6652
|
+
* `PollarClient` passes its level-gated logger so `logLevel` applies here too.
|
|
6653
|
+
*/
|
|
6654
|
+
logger?: PollarLogger;
|
|
6655
|
+
}
|
|
6656
|
+
/**
|
|
6657
|
+
* `localStorage`-backed adapter that wraps every operation in try/catch and
|
|
6658
|
+
* silently degrades to an in-memory fallback for the rest of the process
|
|
6659
|
+
* lifetime on any throw. A single warning is logged when the degrade happens.
|
|
6660
|
+
*
|
|
6661
|
+
* Why every op (not just the probe): Safari private mode and sandboxed iframes
|
|
6662
|
+
* may expose `localStorage` but throw `QuotaExceededError` / `SecurityError`
|
|
6663
|
+
* on the first write — a successful probe at construction time isn't enough.
|
|
6664
|
+
*
|
|
6665
|
+
* Tokens persisted here are DPoP-bound to a non-extractable WebCrypto
|
|
6666
|
+
* keypair, so XSS exposure is limited to a signing-oracle attack (the key
|
|
6667
|
+
* itself never leaves the browser's crypto subsystem). Consumers who need
|
|
6668
|
+
* stricter isolation can inject a custom `Storage` adapter — e.g. one that
|
|
6669
|
+
* proxies to an httpOnly cookie on a host origin.
|
|
6670
|
+
*/
|
|
6671
|
+
declare function createLocalStorageAdapter(options?: LocalStorageAdapterOptions): Storage;
|
|
6672
|
+
|
|
6673
|
+
/**
|
|
6674
|
+
* Returns `localStorage`-backed storage when it works, otherwise an in-memory
|
|
6675
|
+
* fallback. The probe writes-reads-removes a sentinel; any throw, value
|
|
6676
|
+
* mismatch, or missing `localStorage` (SSR / disabled storage) falls back.
|
|
6677
|
+
*
|
|
6678
|
+
* Run-time degrade still happens inside `createLocalStorageAdapter` — see its
|
|
6679
|
+
* docstring for the rationale.
|
|
6680
|
+
*/
|
|
6681
|
+
declare function defaultStorage(options?: LocalStorageAdapterOptions): Storage;
|
|
6682
|
+
|
|
6683
|
+
/**
|
|
6684
|
+
* Construct the default `KeyManager` for the current runtime. Throws if no
|
|
6685
|
+
* factory has been registered — that only happens if `@pollar/core` was
|
|
6686
|
+
* imported in a way that bypassed the entry-point module (a bundler or
|
|
6687
|
+
* test setup bug).
|
|
6688
|
+
*/
|
|
6689
|
+
declare function defaultKeyManager(storage: Storage, apiKey: string): KeyManager;
|
|
6690
|
+
|
|
6691
|
+
declare class WebCryptoKeyManager implements KeyManager {
|
|
6692
|
+
private readonly apiKey;
|
|
6693
|
+
private apiKeyHash;
|
|
6694
|
+
private keyPair;
|
|
6695
|
+
private publicJwk;
|
|
6696
|
+
private thumbprint;
|
|
6697
|
+
/**
|
|
6698
|
+
* Cached in-flight init. Lets `init()` be called concurrently (or implicitly
|
|
6699
|
+
* from `getPublicJwk` / `sign`) without doing the work twice. Cleared on
|
|
6700
|
+
* failure so callers can retry, and cleared on `reset()`.
|
|
6701
|
+
*/
|
|
6702
|
+
private _initPromise;
|
|
6703
|
+
constructor(apiKey: string);
|
|
6704
|
+
/**
|
|
6705
|
+
* Idempotent and safe under concurrency. The first call kicks off the real
|
|
6706
|
+
* init; subsequent (and concurrent) calls return the same in-flight promise.
|
|
6707
|
+
* Other methods (`getPublicJwk`, `getThumbprint`, `sign`) auto-await this so
|
|
6708
|
+
* the manager is self-healing if `init()` was never explicitly invoked.
|
|
6709
|
+
*/
|
|
6710
|
+
init(): Promise<void>;
|
|
6711
|
+
private _doInit;
|
|
6712
|
+
/**
|
|
6713
|
+
* Derive the public JWK from a `CryptoKey`. Prefers the `'raw'` export (the
|
|
6714
|
+
* 65-byte uncompressed point `0x04 || X(32) || Y(32)`) and base64url-encodes
|
|
6715
|
+
* the coordinates ourselves — that sidesteps polyfills whose `exportKey('jwk')`
|
|
6716
|
+
* emits non-base64url `x`/`y` (standard base64, `=` padding, or — as seen with
|
|
6717
|
+
* `react-native-quick-crypto` — a stray `.`). Real browsers and most polyfills
|
|
6718
|
+
* support `'raw'` for public EC keys.
|
|
6719
|
+
*
|
|
6720
|
+
* Falls back to the `'jwk'` export (normalized via `canonicalEcJwk`) if `'raw'`
|
|
6721
|
+
* is unsupported or returns an unexpected shape, so this can't regress on a
|
|
6722
|
+
* runtime that only implements the JWK path. Both routes yield identical
|
|
6723
|
+
* coordinate bytes, so the `cnf.jkt` thumbprint is unchanged either way.
|
|
6724
|
+
*/
|
|
6725
|
+
private _exportPublicJwk;
|
|
6726
|
+
reset(): Promise<void>;
|
|
6727
|
+
getPublicJwk(): Promise<PublicEcJwk>;
|
|
6728
|
+
getThumbprint(): Promise<string>;
|
|
6729
|
+
sign(payload: Uint8Array): Promise<Uint8Array>;
|
|
6730
|
+
}
|
|
6731
|
+
|
|
6732
|
+
/**
|
|
6733
|
+
* Compute the RFC 7638 JWK thumbprint for an EC P-256 public JWK.
|
|
6734
|
+
*
|
|
6735
|
+
* Algorithm (RFC 7638 §3):
|
|
6736
|
+
* 1. Build a JSON object containing ONLY the required members of the JWK,
|
|
6737
|
+
* ordered lexicographically by member name (Unicode code point).
|
|
6738
|
+
* For EC keys, that's exactly {crv, kty, x, y}.
|
|
6739
|
+
* 2. Serialize to UTF-8 with no whitespace and no line breaks.
|
|
6740
|
+
* 3. Hash with SHA-256.
|
|
6741
|
+
* 4. Base64url-encode the hash (no padding).
|
|
6742
|
+
*
|
|
6743
|
+
* Common bugs guarded against:
|
|
6744
|
+
* - Including extra fields (`alg`, `use`, `kid`, `ext`, `key_ops`).
|
|
6745
|
+
* - Wrong member ordering (must be lex by Unicode code point).
|
|
6746
|
+
* - Padded base64 instead of base64url unpadded.
|
|
6747
|
+
* - Using `JSON.stringify(jwk)` of an arbitrary-key-order object — we build
|
|
6748
|
+
* a fresh literal in canonical order to make the order explicit and not
|
|
6749
|
+
* rely on V8's insertion-order semantics.
|
|
6750
|
+
*/
|
|
6751
|
+
declare function computeJwkThumbprint(jwk: PublicEcJwk): Promise<string>;
|
|
6752
|
+
/**
|
|
6753
|
+
* Strip a JWK to only the four required EC public members and normalize the
|
|
6754
|
+
* coordinates to unpadded base64url. Useful when the input came from
|
|
6755
|
+
* `crypto.subtle.exportKey('jwk', publicKey)` which adds `ext` / `key_ops`
|
|
6756
|
+
* (and, under some RN polyfills, non-base64url coordinates). Returns a fresh
|
|
6757
|
+
* object — never mutates input.
|
|
6758
|
+
*/
|
|
6759
|
+
declare function canonicalEcJwk(jwk: {
|
|
6760
|
+
kty?: string;
|
|
6761
|
+
crv?: string;
|
|
6762
|
+
x?: string;
|
|
6763
|
+
y?: string;
|
|
6764
|
+
}): PublicEcJwk;
|
|
6765
|
+
|
|
6766
|
+
/**
|
|
6767
|
+
* RFC 9449 DPoP proof builder.
|
|
6768
|
+
*
|
|
6769
|
+
* Produces a compact JWS that the consumer attaches as the `DPoP` HTTP
|
|
6770
|
+
* header. The header `jwk` is the public part of the SDK's per-session
|
|
6771
|
+
* keypair; the server verifies the signature, validates the `htm` / `htu` /
|
|
6772
|
+
* `iat` / `jti` / optional `nonce` / optional `ath` claims, and matches the
|
|
6773
|
+
* proof's JWK thumbprint against the access token's `cnf.jkt` claim.
|
|
6774
|
+
*
|
|
6775
|
+
* Server-issued nonce flow (RFC 9449 §8/§9): the server may respond with
|
|
6776
|
+
* `WWW-Authenticate: DPoP ... error="use_dpop_nonce"` plus a `DPoP-Nonce`
|
|
6777
|
+
* header. The client should re-build the proof with the new nonce and retry.
|
|
6778
|
+
* `buildProof` accepts an optional nonce; the SDK client tracks it across
|
|
6779
|
+
* requests and feeds it back here.
|
|
6780
|
+
*
|
|
6781
|
+
* The last seen `DPoP-Nonce` is stored verbatim and embedded in the next
|
|
6782
|
+
* proof. The server validates it as an HMAC token, so an attacker who
|
|
6783
|
+
* injects an arbitrary nonce cannot escalate — verification fails and the
|
|
6784
|
+
* server replies with a fresh nonce on the next request.
|
|
6785
|
+
*/
|
|
6786
|
+
interface BuildProofArgs {
|
|
6787
|
+
/** HTTP method, e.g. `"GET"`. Will be uppercased before signing. */
|
|
6788
|
+
htm: string;
|
|
6789
|
+
/**
|
|
6790
|
+
* HTTP target URI. Will be normalized per RFC 3986 §6.2 (lowercase scheme
|
|
6791
|
+
* + host, default port elided, query+fragment+userinfo stripped, path
|
|
6792
|
+
* dot-segments resolved, trailing slash preserved exactly as provided).
|
|
6793
|
+
*/
|
|
6794
|
+
htu: string;
|
|
6795
|
+
/**
|
|
6796
|
+
* Access token to bind the proof to (its base64url(SHA-256) goes in the
|
|
6797
|
+
* `ath` claim). Omit for proofs sent to the token endpoint per RFC 9449
|
|
6798
|
+
* §5 / §6.1 (those proofs MUST NOT include `ath`).
|
|
6799
|
+
*/
|
|
6800
|
+
accessToken?: string;
|
|
6801
|
+
/**
|
|
6802
|
+
* Server-issued DPoP nonce, if the server has previously challenged this
|
|
6803
|
+
* client with `WWW-Authenticate: DPoP ... error="use_dpop_nonce"`. RFC
|
|
6804
|
+
* 9449 §8.
|
|
6805
|
+
*/
|
|
6806
|
+
nonce?: string;
|
|
6807
|
+
}
|
|
6808
|
+
/**
|
|
6809
|
+
* Build a DPoP proof JWS for the given request. Returns the compact-form
|
|
6810
|
+
* JWS string (`<header>.<payload>.<signature>`).
|
|
6811
|
+
*/
|
|
6812
|
+
declare function buildProof(args: BuildProofArgs, keyManager: KeyManager): Promise<string>;
|
|
6813
|
+
/**
|
|
6814
|
+
* Normalize an HTTP URI for use as the `htu` claim.
|
|
6815
|
+
*
|
|
6816
|
+
* RFC 9449 §4.3 + RFC 3986 §6.2:
|
|
6817
|
+
* - lowercase scheme + host
|
|
6818
|
+
* - elide default port (`:443` for https, `:80` for http)
|
|
6819
|
+
* - strip userinfo (never appears in `htu`)
|
|
6820
|
+
* - strip query + fragment
|
|
6821
|
+
* - apply path dot-segment removal (handled by the URL constructor)
|
|
6822
|
+
* - **preserve trailing slash exactly** — `/foo` and `/foo/` are distinct
|
|
6823
|
+
* paths per RFC 3986 §6 and must round-trip identically.
|
|
6824
|
+
* - preserve IPv6 brackets in host
|
|
6825
|
+
*
|
|
6826
|
+
* Both client and server must apply the same normalization so the `htu`
|
|
6827
|
+
* claim matches deterministically.
|
|
6828
|
+
*/
|
|
6829
|
+
declare function normalizeHtu(rawUrl: string): string;
|
|
5981
6830
|
|
|
5982
6831
|
declare function isValidSession(value: unknown, logger?: PollarLogger): value is PollarPersistedSession;
|
|
5983
6832
|
|
|
@@ -6072,4 +6921,4 @@ declare function listDistributionRules(api: PollarApiClient): Promise<Distributi
|
|
|
6072
6921
|
*/
|
|
6073
6922
|
declare function claimDistributionRule(api: PollarApiClient, body: DistributionClaimBody): Promise<DistributionClaimContent>;
|
|
6074
6923
|
|
|
6075
|
-
export { AUTH_ERROR_CODES, type AdapterFn, AlbedoAdapter, type AuthErrorCode, type AuthOpenContext, type AuthState, type AuthUrlOpener, type BuildOutcome, type BuildProofArgs, type ConnectWalletResponse, type DistributionClaimBody, type DistributionClaimContent, type DistributionRule, type DistributionRulesState, type EnabledAssetRecord, type EnabledAssetsState, FreighterAdapter, type KeyManager, type KycFlow, type KycLevel, type KycProvider, type KycStartBody, type KycStartResponse, type KycStatus, type LocalStorageAdapterOptions, type LogLevel, type NetworkState, OnStorageDegrade, POLLAR_CORE_VERSION, type PasskeyCeremony, type PasskeyMode, type PasskeySigner, type PaymentInstructions, type PollarAdapter, type PollarAdapters, type PollarApiClient, type PollarApplicationConfigContent, type PollarApplicationConfigResponse, PollarClient, type PollarClientConfig, PollarFlowError, type PollarLogger, type PollarLoginOptions, type PollarPersistedSession, type PollarUserProfile, type PublicEcJwk, type RampDirection, type RampQuote, type RampTxStatus, type RampsOfframpBody, type RampsOfframpResponse, type RampsOnrampBody, type RampsOnrampResponse, type RampsQuoteQuery, type RampsQuoteResponse, type RampsTransactionResponse, type RulePeriod, type SessionInfo, type SessionsState, type SignAuthEntryOptions, type SignAuthEntryResponse, type SignOutcome, type SignTransactionOptions, type SignTransactionResponse, type StellarBalance, StellarClient, type StellarClientConfig, type StellarNetwork, Storage, type SubmitOutcome, type TransactionState, type TrustlineOutcome, type TxBuildBody, type TxBuildContent, type TxBuildResponse, type TxBuildSignSubmitBody, type TxBuildSignSubmitContent, type TxBuildSignSubmitResponse, type TxErrorPhase, type TxHistoryContent, type TxHistoryParams, type TxHistoryRecord, type TxHistoryState, type TxSignAndSendBody, type TxSignBody, type TxSignContent, type TxSignResponse, type TxSignSendResponse, type TxSubmitSignedBody, type WalletAdapter, type WalletAdapterResolver, type WalletAssetsContent, type WalletBalanceContent, type WalletBalanceRecord, type WalletBalanceState, type WalletId, WalletType, WebCryptoKeyManager, buildProof, canonicalEcJwk, claimDistributionRule, computeJwkThumbprint, createLocalStorageAdapter, createLogger, createMemoryAdapter, createOffRamp, createOnRamp, defaultKeyManager, defaultStorage, getKycProviders, getKycStatus, getRampTransaction, getRampsQuote, isValidSession, listDistributionRules, normalizeHtu, pollKycStatus, pollRampTransaction, type paths as pollarPaths, resolveKyc, startKyc };
|
|
6924
|
+
export { AUTH_ERROR_CODES, type AdapterFn, AlbedoAdapter, type AuthErrorCode, type AuthOpenContext, type AuthProviderContext, type AuthState, type AuthUrlOpener, type BuildOutcome, type BuildProofArgs, type ConnectWalletResponse, type DistributionClaimBody, type DistributionClaimContent, type DistributionRule, type DistributionRulesState, type EnabledAssetRecord, type EnabledAssetsState, FreighterAdapter, type KeyManager, type KycFlow, type KycLevel, type KycProvider, type KycStartBody, type KycStartResponse, type KycStatus, type LocalStorageAdapterOptions, type LogLevel, type NetworkState, OnStorageDegrade, POLLAR_CORE_VERSION, type PasskeyCeremony, type PasskeyMode, type PasskeySigner, type PaymentInstructions, type PollarAdapter, type PollarAdapters, type PollarApiClient, type PollarApplicationConfigContent, type PollarApplicationConfigResponse, type PollarAuthMethod, type PollarAuthProvider, PollarClient, type PollarClientConfig, PollarFlowError, type PollarLogger, type PollarLoginOptions, type PollarPersistedSession, type PollarUserProfile, type PublicEcJwk, type RampDirection, type RampQuote, type RampTxStatus, type RampsOfframpBody, type RampsOfframpResponse, type RampsOnrampBody, type RampsOnrampResponse, type RampsQuoteQuery, type RampsQuoteResponse, type RampsTransactionResponse, type RulePeriod, type SessionInfo, type SessionsState, type SignAuthEntryOptions, type SignAuthEntryOutcome, type SignAuthEntryResponse, type SignOutcome, type SignTransactionOptions, type SignTransactionResponse, type StellarBalance, StellarClient, type StellarClientConfig, type StellarNetwork, Storage, type SubmitOutcome, type TransactionState, type TrustlineOutcome, type TxBuildBody, type TxBuildContent, type TxBuildResponse, type TxBuildSignSubmitBody, type TxBuildSignSubmitContent, type TxBuildSignSubmitResponse, type TxErrorPhase, type TxHistoryContent, type TxHistoryParams, type TxHistoryRecord, type TxHistoryState, type TxSignAndSendBody, type TxSignBody, type TxSignContent, type TxSignResponse, type TxSignSendResponse, type TxSubmitSignedBody, type WalletAdapter, type WalletAdapterResolver, type WalletAssetsContent, type WalletBalanceContent, type WalletBalanceRecord, type WalletBalanceState, type WalletId, type WalletInfo, WalletType, WebCryptoKeyManager, buildProof, canonicalEcJwk, claimDistributionRule, computeJwkThumbprint, createLocalStorageAdapter, createLogger, createMemoryAdapter, createOffRamp, createOnRamp, defaultKeyManager, defaultStorage, getKycProviders, getKycStatus, getRampTransaction, getRampsQuote, isValidSession, listDistributionRules, normalizeHtu, pollKycStatus, pollRampTransaction, type paths as pollarPaths, resolveKyc, startKyc };
|