spaps-sdk 1.1.1 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -0
- package/dist/index.d.mts +217 -100
- package/dist/index.d.ts +217 -100
- package/dist/index.js +442 -2
- package/dist/index.mjs +440 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# @spaps/sdk
|
|
2
2
|
|
|
3
|
+
<a href="https://www.npmjs.com/package/spaps-sdk"><img alt="npm" src="https://img.shields.io/npm/v/spaps-sdk.svg"></a>
|
|
4
|
+
<img alt="node" src="https://img.shields.io/badge/node-%3E%3D14-brightgreen">
|
|
5
|
+
<img alt="types" src="https://img.shields.io/badge/types-TypeScript-blue">
|
|
6
|
+
|
|
3
7
|
> Sweet Potato Authentication & Payment Service SDK
|
|
4
8
|
|
|
5
9
|
Zero-config client for SPAPS authentication, payments, and permission checking. Works automatically with local development mode.
|
|
@@ -111,6 +115,38 @@ if (spaps.isAuthenticated()) {
|
|
|
111
115
|
}
|
|
112
116
|
```
|
|
113
117
|
|
|
118
|
+
## Local Mode Explained
|
|
119
|
+
|
|
120
|
+
- If `apiUrl` is omitted or points to `localhost`/`127.0.0.1`, the SDK runs in local mode.
|
|
121
|
+
- Local mode integrates seamlessly with the `spaps` CLI (`npx spaps local`), defaulting to `http://localhost:3300`.
|
|
122
|
+
- No API key is required in local mode; tokens and data are managed locally for development.
|
|
123
|
+
|
|
124
|
+
You can check the mode at runtime:
|
|
125
|
+
|
|
126
|
+
```ts
|
|
127
|
+
spaps.isLocalMode(); // true | false
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Environment Variables
|
|
131
|
+
|
|
132
|
+
The SDK can read configuration from environment variables (useful in Next.js and Node):
|
|
133
|
+
|
|
134
|
+
- `SPAPS_API_URL` or `NEXT_PUBLIC_SPAPS_API_URL` — API base URL
|
|
135
|
+
- `SPAPS_API_KEY` — API key for production use
|
|
136
|
+
|
|
137
|
+
Example (Node):
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
export SPAPS_API_URL=https://api.sweetpotato.dev
|
|
141
|
+
export SPAPS_API_KEY=spaps_xxx
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Example (Next.js):
|
|
145
|
+
|
|
146
|
+
```env
|
|
147
|
+
NEXT_PUBLIC_SPAPS_API_URL=https://api.sweetpotato.dev
|
|
148
|
+
```
|
|
149
|
+
|
|
114
150
|
## Features
|
|
115
151
|
|
|
116
152
|
### 🚀 Zero Configuration
|
|
@@ -202,6 +238,30 @@ spaps.isLocalMode() // boolean
|
|
|
202
238
|
await spaps.health()
|
|
203
239
|
```
|
|
204
240
|
|
|
241
|
+
## Types
|
|
242
|
+
|
|
243
|
+
The SDK ships with full TypeScript definitions. For most apps, import types directly from `spaps-sdk`:
|
|
244
|
+
|
|
245
|
+
```ts
|
|
246
|
+
import { SPAPSClient, type User, type Session, type Role } from 'spaps-sdk';
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
For advanced or library use cases, you can also import canonical types from the standalone package:
|
|
250
|
+
|
|
251
|
+
```ts
|
|
252
|
+
import type {
|
|
253
|
+
User,
|
|
254
|
+
Session,
|
|
255
|
+
Role,
|
|
256
|
+
Permission,
|
|
257
|
+
TokenPayload,
|
|
258
|
+
} from 'spaps-types';
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
Notes:
|
|
262
|
+
- `spaps-sdk` re-exports commonly used types for convenience.
|
|
263
|
+
- `spaps-types` is useful when building framework integrations, server middleware, or utilities that need to share types without depending on the SDK runtime.
|
|
264
|
+
|
|
205
265
|
## Import Styles
|
|
206
266
|
|
|
207
267
|
All these work:
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import { CreateProductRequest, Product, UpdateProductRequest, CreatePriceRequest, Price, ProductSyncResult, AuthResponse, User as User$1, CheckoutSession, Subscription, UsageBalance } from 'spaps-types';
|
|
2
|
+
export { AdminPermission, AdminRole, AdminUser, ApiResponse, AuthResponse, CheckoutSession, CreatePriceRequest, CreateProductRequest, Price, Product, ProductSyncResult, Subscription, TokenPair, UpdateProductRequest, UsageBalance, User, UserProfile, UserRole, UserWallet } from 'spaps-types';
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
5
|
* Permission checking utilities for SPAPS SDK
|
|
3
6
|
* Client-side role and permission management
|
|
4
7
|
*/
|
|
5
|
-
interface User
|
|
8
|
+
interface User {
|
|
6
9
|
id: string;
|
|
7
10
|
email?: string;
|
|
8
11
|
wallet_address?: string;
|
|
@@ -35,11 +38,11 @@ declare function getUserRole(identifier?: string, customAdmins?: (string | Admin
|
|
|
35
38
|
/**
|
|
36
39
|
* Check if user has specific permissions
|
|
37
40
|
*/
|
|
38
|
-
declare function hasPermission(user: User
|
|
41
|
+
declare function hasPermission(user: User | null, requiredPermissions: string | string[], customAdmins?: (string | AdminConfig)[]): boolean;
|
|
39
42
|
/**
|
|
40
43
|
* Check if user can access admin features
|
|
41
44
|
*/
|
|
42
|
-
declare function canAccessAdmin(user: User
|
|
45
|
+
declare function canAccessAdmin(user: User | null, customAdmins?: (string | AdminConfig)[]): PermissionCheckResult;
|
|
43
46
|
/**
|
|
44
47
|
* Get role-aware error message
|
|
45
48
|
*/
|
|
@@ -47,7 +50,7 @@ declare function getRoleAwareErrorMessage(requiredRole: string, userRole: string
|
|
|
47
50
|
/**
|
|
48
51
|
* Get user display information with role indicators
|
|
49
52
|
*/
|
|
50
|
-
declare function getUserDisplay(user: User
|
|
53
|
+
declare function getUserDisplay(user: User | null, customAdmins?: (string | AdminConfig)[]): {
|
|
51
54
|
displayName: string;
|
|
52
55
|
role: string;
|
|
53
56
|
badge: string | null;
|
|
@@ -61,17 +64,17 @@ declare class PermissionChecker {
|
|
|
61
64
|
constructor(customAdmins?: (string | AdminConfig)[]);
|
|
62
65
|
isAdmin(identifier: string): boolean;
|
|
63
66
|
getRole(identifier?: string): string;
|
|
64
|
-
hasPermission(user: User
|
|
65
|
-
canAccessAdmin(user: User
|
|
67
|
+
hasPermission(user: User | null, permissions: string | string[]): boolean;
|
|
68
|
+
canAccessAdmin(user: User | null): PermissionCheckResult;
|
|
66
69
|
getErrorMessage(requiredRole: string, userRole: string, action?: string): string;
|
|
67
|
-
getUserDisplay(user: User
|
|
70
|
+
getUserDisplay(user: User | null): {
|
|
68
71
|
displayName: string;
|
|
69
72
|
role: string;
|
|
70
73
|
badge: string | null;
|
|
71
74
|
isAdmin: boolean;
|
|
72
75
|
};
|
|
73
|
-
requiresAuth(user: User
|
|
74
|
-
requiresAdmin(user: User
|
|
76
|
+
requiresAuth(user: User | null): boolean;
|
|
77
|
+
requiresAdmin(user: User | null): boolean;
|
|
75
78
|
addCustomAdmin(admin: string | AdminConfig): void;
|
|
76
79
|
removeCustomAdmin(admin: string | AdminConfig): void;
|
|
77
80
|
}
|
|
@@ -85,100 +88,14 @@ declare const defaultPermissionChecker: PermissionChecker;
|
|
|
85
88
|
* @spaps/sdk - Sweet Potato Authentication & Payment Service SDK
|
|
86
89
|
* Zero-config client for SPAPS authentication and payments
|
|
87
90
|
*/
|
|
91
|
+
|
|
88
92
|
interface SPAPSConfig {
|
|
89
93
|
apiUrl?: string;
|
|
90
94
|
apiKey?: string;
|
|
91
95
|
autoDetect?: boolean;
|
|
92
96
|
timeout?: number;
|
|
93
97
|
}
|
|
94
|
-
|
|
95
|
-
access_token: string;
|
|
96
|
-
refresh_token: string;
|
|
97
|
-
user: User;
|
|
98
|
-
}
|
|
99
|
-
interface User {
|
|
100
|
-
id: string;
|
|
101
|
-
email?: string;
|
|
102
|
-
wallet_address?: string;
|
|
103
|
-
chain_type?: string;
|
|
104
|
-
role: string;
|
|
105
|
-
created_at?: string;
|
|
106
|
-
}
|
|
107
|
-
interface CheckoutSession {
|
|
108
|
-
sessionId: string;
|
|
109
|
-
url: string;
|
|
110
|
-
}
|
|
111
|
-
interface Subscription {
|
|
112
|
-
id: string;
|
|
113
|
-
status: string;
|
|
114
|
-
plan: string;
|
|
115
|
-
current_period_end: string;
|
|
116
|
-
}
|
|
117
|
-
interface UsageBalance {
|
|
118
|
-
balance: number;
|
|
119
|
-
currency: string;
|
|
120
|
-
updated_at: string;
|
|
121
|
-
}
|
|
122
|
-
interface Product {
|
|
123
|
-
id: string;
|
|
124
|
-
name: string;
|
|
125
|
-
description?: string;
|
|
126
|
-
category: string;
|
|
127
|
-
active: boolean;
|
|
128
|
-
images?: string[];
|
|
129
|
-
metadata?: Record<string, string>;
|
|
130
|
-
statement_descriptor?: string;
|
|
131
|
-
unit_label?: string;
|
|
132
|
-
created?: number;
|
|
133
|
-
updated?: number;
|
|
134
|
-
}
|
|
135
|
-
interface Price {
|
|
136
|
-
id: string;
|
|
137
|
-
product: string;
|
|
138
|
-
unit_amount: number;
|
|
139
|
-
currency: string;
|
|
140
|
-
recurring?: {
|
|
141
|
-
interval: 'day' | 'week' | 'month' | 'year';
|
|
142
|
-
interval_count: number;
|
|
143
|
-
};
|
|
144
|
-
nickname?: string;
|
|
145
|
-
active: boolean;
|
|
146
|
-
}
|
|
147
|
-
interface CreateProductRequest {
|
|
148
|
-
name: string;
|
|
149
|
-
description?: string;
|
|
150
|
-
category: string;
|
|
151
|
-
images?: string[];
|
|
152
|
-
metadata?: Record<string, string>;
|
|
153
|
-
active?: boolean;
|
|
154
|
-
statement_descriptor?: string;
|
|
155
|
-
unit_label?: string;
|
|
156
|
-
}
|
|
157
|
-
interface UpdateProductRequest {
|
|
158
|
-
name?: string;
|
|
159
|
-
description?: string;
|
|
160
|
-
category?: string;
|
|
161
|
-
images?: string[];
|
|
162
|
-
metadata?: Record<string, string>;
|
|
163
|
-
active?: boolean;
|
|
164
|
-
statement_descriptor?: string;
|
|
165
|
-
unit_label?: string;
|
|
166
|
-
}
|
|
167
|
-
interface CreatePriceRequest {
|
|
168
|
-
product_id: string;
|
|
169
|
-
unit_amount: number;
|
|
170
|
-
currency: string;
|
|
171
|
-
interval?: 'day' | 'week' | 'month' | 'year';
|
|
172
|
-
interval_count?: number;
|
|
173
|
-
nickname?: string;
|
|
174
|
-
}
|
|
175
|
-
interface ProductSyncResult {
|
|
176
|
-
synced_count: number;
|
|
177
|
-
updated_count: number;
|
|
178
|
-
created_count: number;
|
|
179
|
-
errors: any[];
|
|
180
|
-
sync_time: string;
|
|
181
|
-
}
|
|
98
|
+
|
|
182
99
|
declare class SPAPSClient {
|
|
183
100
|
private client;
|
|
184
101
|
private apiKey?;
|
|
@@ -214,6 +131,18 @@ declare class SPAPSClient {
|
|
|
214
131
|
}>;
|
|
215
132
|
};
|
|
216
133
|
constructor(config?: SPAPSConfig);
|
|
134
|
+
/** Raw API request helper that returns an ApiResponse-like shape */
|
|
135
|
+
request<T = any>(method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH', url: string, data?: any, requiresAuth?: boolean): Promise<{
|
|
136
|
+
success: boolean;
|
|
137
|
+
data?: T;
|
|
138
|
+
error?: {
|
|
139
|
+
code: string;
|
|
140
|
+
message: string;
|
|
141
|
+
details?: any;
|
|
142
|
+
};
|
|
143
|
+
}>;
|
|
144
|
+
/** Health check helper that returns boolean */
|
|
145
|
+
healthCheck(): Promise<boolean>;
|
|
217
146
|
login(email: string, password: string): Promise<{
|
|
218
147
|
data: AuthResponse;
|
|
219
148
|
}>;
|
|
@@ -228,8 +157,178 @@ declare class SPAPSClient {
|
|
|
228
157
|
}>;
|
|
229
158
|
logout(): Promise<void>;
|
|
230
159
|
getUser(): Promise<{
|
|
231
|
-
data: User;
|
|
160
|
+
data: User$1;
|
|
232
161
|
}>;
|
|
162
|
+
auth: {
|
|
163
|
+
/**
|
|
164
|
+
* Verify magic link token without mutating token state.
|
|
165
|
+
* Returns a simple success object from the API.
|
|
166
|
+
*/
|
|
167
|
+
getNonce: (walletAddress: string) => Promise<any>;
|
|
168
|
+
signInWithWallet: (req: {
|
|
169
|
+
wallet_address: string;
|
|
170
|
+
signature: string;
|
|
171
|
+
message: string;
|
|
172
|
+
chain_type?: "solana" | "ethereum" | "bitcoin" | "base";
|
|
173
|
+
username?: string;
|
|
174
|
+
}) => Promise<any>;
|
|
175
|
+
authenticateWallet: (walletAddress: string, signFn: (message: string) => Promise<string> | string, chainType?: "solana" | "ethereum" | "bitcoin" | "base", username?: string) => Promise<any>;
|
|
176
|
+
signInWithPassword: (payload: {
|
|
177
|
+
email: string;
|
|
178
|
+
password: string;
|
|
179
|
+
}) => Promise<any>;
|
|
180
|
+
requestMagicLink: (payload: {
|
|
181
|
+
email: string;
|
|
182
|
+
redirect_url?: string;
|
|
183
|
+
}) => Promise<void>;
|
|
184
|
+
requestPasswordReset: (payload: {
|
|
185
|
+
email: string;
|
|
186
|
+
redirect_url?: string;
|
|
187
|
+
}) => Promise<void>;
|
|
188
|
+
confirmPasswordReset: (payload: {
|
|
189
|
+
token: string;
|
|
190
|
+
new_password: string;
|
|
191
|
+
}) => Promise<void>;
|
|
192
|
+
register: (payload: {
|
|
193
|
+
email: string;
|
|
194
|
+
password: string;
|
|
195
|
+
}) => Promise<any>;
|
|
196
|
+
/**
|
|
197
|
+
* Verify a magic link token. Does not set access/refresh tokens.
|
|
198
|
+
* Consumers should redirect or prompt login based on the returned status.
|
|
199
|
+
*/
|
|
200
|
+
verifyMagicLink: (payload: {
|
|
201
|
+
token: string;
|
|
202
|
+
}) => Promise<{
|
|
203
|
+
success: boolean;
|
|
204
|
+
}>;
|
|
205
|
+
solana: {
|
|
206
|
+
linkWallet: (payload: {
|
|
207
|
+
wallet_address: string;
|
|
208
|
+
signature: string;
|
|
209
|
+
message: string;
|
|
210
|
+
}) => Promise<any>;
|
|
211
|
+
verifySignature: (payload: {
|
|
212
|
+
wallet_address: string;
|
|
213
|
+
signature: string;
|
|
214
|
+
message: string;
|
|
215
|
+
}) => Promise<any>;
|
|
216
|
+
generateMessage: (wallet_address: string) => Promise<any>;
|
|
217
|
+
getWallets: () => Promise<any>;
|
|
218
|
+
networkInfo: () => Promise<any>;
|
|
219
|
+
};
|
|
220
|
+
ethereum: {
|
|
221
|
+
linkWallet: (payload: {
|
|
222
|
+
wallet_address: string;
|
|
223
|
+
signature: string;
|
|
224
|
+
message: string;
|
|
225
|
+
}) => Promise<any>;
|
|
226
|
+
verifySignature: (payload: {
|
|
227
|
+
wallet_address: string;
|
|
228
|
+
signature: string;
|
|
229
|
+
message: string;
|
|
230
|
+
}) => Promise<any>;
|
|
231
|
+
verifyTypedData: (payload: {
|
|
232
|
+
wallet_address: string;
|
|
233
|
+
signature: string;
|
|
234
|
+
typed_data: any;
|
|
235
|
+
}) => Promise<any>;
|
|
236
|
+
generateMessage: (wallet_address: string) => Promise<any>;
|
|
237
|
+
generateTypedData: (wallet_address: string) => Promise<any>;
|
|
238
|
+
getWallets: () => Promise<any>;
|
|
239
|
+
networkInfo: () => Promise<any>;
|
|
240
|
+
balance: (wallet_address: string) => Promise<any>;
|
|
241
|
+
contractCheck: (wallet_address: string, contract_address: string) => Promise<any>;
|
|
242
|
+
};
|
|
243
|
+
refreshToken: (refreshToken: string) => Promise<any>;
|
|
244
|
+
/**
|
|
245
|
+
* Logout and clear tokens. Network errors are intentionally swallowed
|
|
246
|
+
* to avoid trapping users in a bad state during sign‑out flows.
|
|
247
|
+
*/
|
|
248
|
+
logout: () => Promise<void>;
|
|
249
|
+
getCurrentUser: () => Promise<User$1>;
|
|
250
|
+
isAuthenticated: () => boolean;
|
|
251
|
+
};
|
|
252
|
+
payments: {
|
|
253
|
+
createCheckoutSession: (payload: any) => Promise<CheckoutSession>;
|
|
254
|
+
createPaymentCheckout: (params: {
|
|
255
|
+
price_id: string;
|
|
256
|
+
quantity?: number;
|
|
257
|
+
success_url: string;
|
|
258
|
+
cancel_url: string;
|
|
259
|
+
}) => Promise<CheckoutSession>;
|
|
260
|
+
createSubscriptionCheckout: (params: {
|
|
261
|
+
price_id: string;
|
|
262
|
+
success_url: string;
|
|
263
|
+
cancel_url: string;
|
|
264
|
+
trial_period_days?: number;
|
|
265
|
+
}) => Promise<CheckoutSession>;
|
|
266
|
+
getCheckoutSession: (sessionId: string) => Promise<any>;
|
|
267
|
+
listCheckoutSessions: (query?: {
|
|
268
|
+
limit?: number;
|
|
269
|
+
starting_after?: string;
|
|
270
|
+
}) => Promise<any>;
|
|
271
|
+
expireCheckoutSession: (sessionId: string) => Promise<any>;
|
|
272
|
+
listProducts: (query?: {
|
|
273
|
+
category?: string;
|
|
274
|
+
active?: boolean;
|
|
275
|
+
limit?: number;
|
|
276
|
+
starting_after?: string;
|
|
277
|
+
}) => Promise<{
|
|
278
|
+
products: Product[];
|
|
279
|
+
total: number;
|
|
280
|
+
}>;
|
|
281
|
+
getProduct: (productId: string) => Promise<Product>;
|
|
282
|
+
createCustomerPortalSession: (payload: {
|
|
283
|
+
return_url: string;
|
|
284
|
+
}) => Promise<{
|
|
285
|
+
id: string;
|
|
286
|
+
url: string;
|
|
287
|
+
}>;
|
|
288
|
+
createGuestCheckoutSession: (payload: any) => Promise<any>;
|
|
289
|
+
getGuestCheckoutSession: (sessionId: string) => Promise<any>;
|
|
290
|
+
listGuestCheckoutSessions: (query?: {
|
|
291
|
+
limit?: number;
|
|
292
|
+
starting_after?: string;
|
|
293
|
+
}) => Promise<any>;
|
|
294
|
+
convertGuestCheckoutSession: (payload: {
|
|
295
|
+
session_id: string;
|
|
296
|
+
}) => Promise<any>;
|
|
297
|
+
convertGuestCheckout: (payload: {
|
|
298
|
+
session_id: string;
|
|
299
|
+
}) => Promise<any>;
|
|
300
|
+
listAllProductsSuperAdmin: () => Promise<any>;
|
|
301
|
+
updateProductSuperAdmin: (productId: string, updates: any) => Promise<any>;
|
|
302
|
+
deleteProductSuperAdmin: (productId: string) => Promise<any>;
|
|
303
|
+
createProductWithPrice: (payload: any) => Promise<any>;
|
|
304
|
+
createProductWithPriceSuperAdmin: (productId: string, payload: any) => Promise<any>;
|
|
305
|
+
setDefaultPrice: (productId: string, payload: {
|
|
306
|
+
price_id: string;
|
|
307
|
+
}) => Promise<any>;
|
|
308
|
+
setDefaultPriceSuperAdmin: (productId: string, payload: {
|
|
309
|
+
price_id: string;
|
|
310
|
+
}) => Promise<any>;
|
|
311
|
+
createDefaultNewPrice: (productId: string, payload: any) => Promise<any>;
|
|
312
|
+
superAdminListAllProducts: () => Promise<any>;
|
|
313
|
+
superAdminUpdateProduct: (productId: string, updates: any) => Promise<any>;
|
|
314
|
+
superAdminArchiveProduct: (productId: string) => Promise<any>;
|
|
315
|
+
superAdminCreateProductWithPrice: (applicationId: string, payload: any) => Promise<any>;
|
|
316
|
+
superAdminCreatePriceAndSetDefault: (productId: string, payload: any) => Promise<any>;
|
|
317
|
+
superAdminSetDefaultPrice: (productId: string, payload: {
|
|
318
|
+
price_id: string;
|
|
319
|
+
}) => Promise<any>;
|
|
320
|
+
};
|
|
321
|
+
sessions: {
|
|
322
|
+
getCurrent: () => Promise<any>;
|
|
323
|
+
list: (params?: {
|
|
324
|
+
limit?: number;
|
|
325
|
+
starting_after?: string;
|
|
326
|
+
}) => Promise<any>;
|
|
327
|
+
validate: () => Promise<any>;
|
|
328
|
+
revoke: (sessionId: string) => Promise<any>;
|
|
329
|
+
revokeAll: () => Promise<any>;
|
|
330
|
+
touch: () => Promise<any>;
|
|
331
|
+
};
|
|
233
332
|
createCheckoutSession(priceId: string, successUrl: string, cancelUrl?: string): Promise<{
|
|
234
333
|
data: CheckoutSession;
|
|
235
334
|
}>;
|
|
@@ -293,10 +392,28 @@ declare class SPAPSClient {
|
|
|
293
392
|
* Check if current user has admin privileges
|
|
294
393
|
* Note: This requires the user object from authentication
|
|
295
394
|
*/
|
|
296
|
-
isAdmin(user?: User): boolean;
|
|
395
|
+
isAdmin(user?: User$1): boolean;
|
|
297
396
|
health(): Promise<{
|
|
298
397
|
data: any;
|
|
299
398
|
}>;
|
|
300
399
|
}
|
|
301
400
|
|
|
302
|
-
|
|
401
|
+
declare class TokenManager {
|
|
402
|
+
private static readonly ACCESS_TOKEN_KEY;
|
|
403
|
+
private static readonly REFRESH_TOKEN_KEY;
|
|
404
|
+
private static readonly USER_KEY;
|
|
405
|
+
private static getStorage;
|
|
406
|
+
static storeTokens(tokens: AuthResponse): void;
|
|
407
|
+
static getAccessToken(): string | null;
|
|
408
|
+
static getRefreshToken(): string | null;
|
|
409
|
+
static getStoredUser(): User$1 | null;
|
|
410
|
+
static clearTokens(): void;
|
|
411
|
+
static isTokenExpired(token: string): boolean;
|
|
412
|
+
static autoRefreshToken(sdk: SPAPSClient): Promise<boolean>;
|
|
413
|
+
}
|
|
414
|
+
declare class WalletUtils {
|
|
415
|
+
static detectChainType(address: string): 'solana' | 'ethereum' | 'bitcoin' | null;
|
|
416
|
+
static isValidAddress(address: string, chainType?: 'solana' | 'ethereum' | 'bitcoin' | 'base'): boolean;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
export { type AdminConfig, DEFAULT_ADMIN_ACCOUNTS, type PermissionCheckResult, PermissionChecker, SPAPSClient as SPAPS, SPAPSClient, type SPAPSConfig, TokenManager, WalletUtils, canAccessAdmin, createPermissionChecker, SPAPSClient as default, defaultPermissionChecker, getRoleAwareErrorMessage, getUserDisplay, getUserRole, hasPermission, isAdminAccount };
|