@proofchain/sdk 2.17.0 → 2.20.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/README.md CHANGED
@@ -240,6 +240,110 @@ console.log('Quest completed:', result.quest_completed);
240
240
  | `quick_hit` | Short, easy quests. Auto-enrolls when user triggers a matching event. |
241
241
  | `challenge` | Time-limited or competitive. Auto-enrolls when user triggers a matching event. |
242
242
 
243
+ ### Real-Time Notifications (SSE)
244
+
245
+ Push notifications to your frontend in real-time when quest/reward events happen. Uses Server-Sent Events (SSE) — no WebSocket setup needed.
246
+
247
+ ```typescript
248
+ import { ProofChain } from '@proofchain/sdk';
249
+
250
+ const client = new ProofChain({ apiKey: 'your-api-key' });
251
+
252
+ // Subscribe to notifications for a user
253
+ const unsubscribe = client.notifications.subscribe('user-123', (event) => {
254
+ console.log('Notification:', event.event, event.data);
255
+
256
+ switch (event.event) {
257
+ case 'quest_step_completed':
258
+ showToast(`Step completed: ${event.data.step_name}`);
259
+ break;
260
+
261
+ case 'quest_completed':
262
+ showConfetti();
263
+ showToast(`Quest completed: ${event.data.quest_name}! 🎉`);
264
+ break;
265
+
266
+ case 'badge_earned':
267
+ showBadgeModal({
268
+ name: event.data.reward_name,
269
+ image: event.data.image_url,
270
+ });
271
+ break;
272
+
273
+ case 'reward_claimable':
274
+ showClaimButton(event.data.quest_id);
275
+ break;
276
+
277
+ case 'reward_earned':
278
+ showToast(`Reward earned: ${event.data.reward_name}`);
279
+ break;
280
+ }
281
+ }, {
282
+ onConnect: () => console.log('Connected to notifications'),
283
+ onDisconnect: () => console.log('Disconnected, will auto-reconnect...'),
284
+ onError: (err) => console.error('Notification error:', err),
285
+ autoReconnect: true, // default: true
286
+ reconnectDelay: 3000, // default: 3000ms
287
+ });
288
+
289
+ // Cleanup when component unmounts or user logs out
290
+ unsubscribe();
291
+ ```
292
+
293
+ **React example:**
294
+
295
+ ```tsx
296
+ import { useEffect } from 'react';
297
+ import { ProofChain } from '@proofchain/sdk';
298
+
299
+ function useNotifications(client: ProofChain, userId: string) {
300
+ useEffect(() => {
301
+ const unsub = client.notifications.subscribe(userId, (event) => {
302
+ // Handle notification (show toast, update UI, etc.)
303
+ console.log(event.event, event.data);
304
+ });
305
+ return () => unsub(); // cleanup on unmount
306
+ }, [client, userId]);
307
+ }
308
+ ```
309
+
310
+ **End-user JWT auth (for PWA/frontend without API key):**
311
+
312
+ ```typescript
313
+ const client = ProofChain.forEndUser({
314
+ userToken: auth.getIdToken(),
315
+ tenantId: 'my-tenant-slug',
316
+ });
317
+
318
+ // End-user can only subscribe to their own notifications
319
+ const unsub = client.notifications.subscribe(myUserId, (event) => {
320
+ // ...
321
+ });
322
+ ```
323
+
324
+ **Notification event types:**
325
+
326
+ | Event | When | Data fields |
327
+ |-------|------|-------------|
328
+ | `quest_step_completed` | A quest step is completed | `quest_id`, `quest_name`, `step_index`, `step_name`, `steps_completed`, `total_steps`, `points_earned` |
329
+ | `quest_completed` | A quest is fully completed (auto-award) | `quest_id`, `quest_name`, `points_earned`, `completion_count` |
330
+ | `reward_claimable` | A quest is completed (claimable mode) | `quest_id`, `quest_name`, `points_earned`, `reward_definition_id` |
331
+ | `badge_earned` | A badge reward is distributed | `quest_id`, `quest_name`, `reward_id`, `reward_name`, `reward_type`, `image_url` |
332
+ | `reward_earned` | A non-badge reward is distributed | `quest_id`, `quest_name`, `reward_id`, `reward_name`, `reward_type`, `value`, `image_url` |
333
+
334
+ **Notification payload shape:**
335
+
336
+ ```typescript
337
+ interface NotificationEvent {
338
+ id: string; // unique event ID
339
+ event: string; // event type (see table above)
340
+ data: Record<string, any>; // event-specific data
341
+ tenant_id: string;
342
+ user_id: string;
343
+ timestamp: string; // ISO 8601
344
+ }
345
+ ```
346
+
243
347
  ## Error Handling
244
348
 
245
349
  ```typescript
package/dist/index.d.mts CHANGED
@@ -1840,6 +1840,8 @@ interface RewardDefinition {
1840
1840
  is_active: boolean;
1841
1841
  icon_url?: string;
1842
1842
  badge_color?: string;
1843
+ attest_on_earn: boolean;
1844
+ anchoring_mode: 'none' | 'immediate' | 'batch' | 'on_demand';
1843
1845
  created_at: string;
1844
1846
  }
1845
1847
  interface EarnedReward {
@@ -1851,6 +1853,8 @@ interface EarnedReward {
1851
1853
  status: string;
1852
1854
  nft_token_id?: number;
1853
1855
  nft_tx_hash?: string;
1856
+ attestation_id?: string;
1857
+ attestation_status?: string;
1854
1858
  earned_at: string;
1855
1859
  distributed_at?: string;
1856
1860
  }
@@ -1908,6 +1912,8 @@ interface CreateRewardDefinitionRequest {
1908
1912
  icon_url?: string;
1909
1913
  badge_color?: string;
1910
1914
  is_public?: boolean;
1915
+ attest_on_earn?: boolean;
1916
+ anchoring_mode?: 'none' | 'immediate' | 'batch' | 'on_demand';
1911
1917
  }
1912
1918
  interface ManualRewardRequest {
1913
1919
  definition_id: string;
@@ -1932,6 +1938,38 @@ interface RevokeResult {
1932
1938
  reward_id: string;
1933
1939
  status: string;
1934
1940
  }
1941
+ interface RewardAttestationResult {
1942
+ attestation_id: string;
1943
+ attestation_uid: string;
1944
+ status: string;
1945
+ signature?: string;
1946
+ tx_hash?: string;
1947
+ subject_address: string;
1948
+ reward_id: string;
1949
+ reward_name: string;
1950
+ earned_at: string;
1951
+ created_at: string;
1952
+ }
1953
+ interface AnchorResult {
1954
+ success: boolean;
1955
+ reward_id: string;
1956
+ attestation_id: string;
1957
+ tx_hash: string;
1958
+ status: string;
1959
+ }
1960
+ interface VerifyResult {
1961
+ is_valid: boolean;
1962
+ attestation_uid: string;
1963
+ status: string;
1964
+ subject_address: string;
1965
+ attester_address: string;
1966
+ signature_type: string;
1967
+ on_chain: boolean;
1968
+ tx_hash?: string;
1969
+ reward_id: string;
1970
+ reward_name: string;
1971
+ earned_at?: string;
1972
+ }
1935
1973
  interface ListRewardsOptions {
1936
1974
  is_active?: boolean;
1937
1975
  reward_type?: string;
@@ -2090,6 +2128,60 @@ declare class RewardsClient {
2090
2128
  * List assets for a reward definition
2091
2129
  */
2092
2130
  listAssets(definitionId: string): Promise<RewardAsset[]>;
2131
+ /**
2132
+ * Create a signed attestation for an earned reward.
2133
+ *
2134
+ * Binds the reward to the user's wallet with an EIP-712 signature.
2135
+ * The anchoring mode is determined by the reward definition or tenant config.
2136
+ *
2137
+ * @param earnedRewardId - The earned reward ID to attest
2138
+ * @returns The attestation details including signature and on-chain status
2139
+ *
2140
+ * @example
2141
+ * ```ts
2142
+ * const attestation = await client.rewards.attest('earned-reward-id');
2143
+ * console.log(attestation.attestation_uid, attestation.status);
2144
+ * ```
2145
+ */
2146
+ attest(earnedRewardId: string): Promise<RewardAttestationResult>;
2147
+ /**
2148
+ * Anchor an earned reward's attestation on-chain (on-demand).
2149
+ *
2150
+ * The reward must already have a signed attestation.
2151
+ * Writes the attestation hash to the Base blockchain contract.
2152
+ *
2153
+ * @param earnedRewardId - The earned reward ID whose attestation to anchor
2154
+ *
2155
+ * @example
2156
+ * ```ts
2157
+ * const result = await client.rewards.anchor('earned-reward-id');
2158
+ * console.log('Anchored on-chain:', result.tx_hash);
2159
+ * ```
2160
+ */
2161
+ anchor(earnedRewardId: string): Promise<AnchorResult>;
2162
+ /**
2163
+ * Get the attestation for an earned reward.
2164
+ *
2165
+ * @param earnedRewardId - The earned reward ID
2166
+ */
2167
+ getAttestation(earnedRewardId: string): Promise<RewardAttestationResult>;
2168
+ /**
2169
+ * Verify a reward attestation's signature and on-chain status.
2170
+ *
2171
+ * @param earnedRewardId - The earned reward ID to verify
2172
+ *
2173
+ * @example
2174
+ * ```ts
2175
+ * const result = await client.rewards.verifyAttestation('earned-reward-id');
2176
+ * if (result.is_valid) {
2177
+ * console.log('Reward is cryptographically verified!');
2178
+ * if (result.on_chain) {
2179
+ * console.log('Also anchored on Base:', result.tx_hash);
2180
+ * }
2181
+ * }
2182
+ * ```
2183
+ */
2184
+ verifyAttestation(earnedRewardId: string): Promise<VerifyResult>;
2093
2185
  }
2094
2186
 
2095
2187
  /**
@@ -2117,6 +2209,8 @@ interface Quest {
2117
2209
  starts_at?: string;
2118
2210
  ends_at?: string;
2119
2211
  time_limit_hours?: number;
2212
+ /** When true, auto-expire all in-progress users when ends_at passes. */
2213
+ expire_on_end?: boolean;
2120
2214
  prerequisite_quest_ids: string[];
2121
2215
  max_participants?: number;
2122
2216
  max_completions?: number;
@@ -2125,6 +2219,8 @@ interface Quest {
2125
2219
  reward_mode: 'auto_award' | 'claimable';
2126
2220
  is_public: boolean;
2127
2221
  is_featured: boolean;
2222
+ /** Sort weight for ordering quests (lower = first). Default 0. */
2223
+ display_order: number;
2128
2224
  tags: string[];
2129
2225
  status: 'draft' | 'active' | 'paused' | 'completed' | 'archived';
2130
2226
  steps: QuestStep[];
@@ -2145,6 +2241,10 @@ interface QuestStep {
2145
2241
  criteria?: Record<string, any>;
2146
2242
  required_data_fields?: string[];
2147
2243
  step_points?: number;
2244
+ /** Button text for call-to-action (e.g., "Read Article", "Visit Store") */
2245
+ cta_text?: string;
2246
+ /** URL or deeplink for the call-to-action button */
2247
+ cta_url?: string;
2148
2248
  icon_url?: string;
2149
2249
  is_optional: boolean;
2150
2250
  }
@@ -2153,7 +2253,7 @@ interface UserQuestProgress {
2153
2253
  user_id: string;
2154
2254
  quest_id: string;
2155
2255
  quest_name: string;
2156
- status: 'not_started' | 'in_progress' | 'completed' | 'reward_claimable' | 'reward_pending' | 'reward_issued' | 'expired' | 'abandoned';
2256
+ status: 'not_started' | 'in_progress' | 'completed' | 'claimed' | 'expired';
2157
2257
  started_at?: string;
2158
2258
  completed_at?: string;
2159
2259
  expires_at?: string;
@@ -2180,14 +2280,25 @@ interface StepProgress {
2180
2280
  step_name: string;
2181
2281
  order: number;
2182
2282
  status: 'pending' | 'in_progress' | 'completed' | 'skipped';
2283
+ started_at?: string;
2183
2284
  completed_at?: string;
2184
2285
  event_id?: string;
2185
2286
  }
2287
+ interface StepStartResult {
2288
+ step_index: number;
2289
+ status: 'in_progress' | 'completed';
2290
+ started_at?: string;
2291
+ quest_id: string;
2292
+ quest_name: string;
2293
+ step_name: string;
2294
+ /** Present when step was already completed */
2295
+ message?: string;
2296
+ }
2186
2297
  interface StepCompletionResult {
2187
2298
  step_index: number;
2188
2299
  step_completed: boolean;
2189
2300
  quest_completed: boolean;
2190
- reward_claimable: boolean;
2301
+ can_claim: boolean;
2191
2302
  current_count: number;
2192
2303
  target_count: number;
2193
2304
  points_earned: number;
@@ -2221,6 +2332,8 @@ interface CreateQuestRequest {
2221
2332
  starts_at?: string;
2222
2333
  ends_at?: string;
2223
2334
  time_limit_hours?: number;
2335
+ /** When true, auto-expire all in-progress users when ends_at passes. */
2336
+ expire_on_end?: boolean;
2224
2337
  prerequisite_quest_ids?: string[];
2225
2338
  max_participants?: number;
2226
2339
  max_completions?: number;
@@ -2229,6 +2342,8 @@ interface CreateQuestRequest {
2229
2342
  reward_mode?: 'auto_award' | 'claimable';
2230
2343
  is_public?: boolean;
2231
2344
  is_featured?: boolean;
2345
+ /** Sort weight for ordering quests (lower = first). Default 0. */
2346
+ display_order?: number;
2232
2347
  tags?: string[];
2233
2348
  steps: CreateQuestStepRequest[];
2234
2349
  }
@@ -2242,6 +2357,10 @@ interface CreateQuestStepRequest {
2242
2357
  criteria?: Record<string, any>;
2243
2358
  required_data_fields?: string[];
2244
2359
  step_points?: number;
2360
+ /** Button text for call-to-action (e.g., "Read Article", "Visit Store") */
2361
+ cta_text?: string;
2362
+ /** URL or deeplink for the call-to-action button */
2363
+ cta_url?: string;
2245
2364
  icon_url?: string;
2246
2365
  is_optional?: boolean;
2247
2366
  }
@@ -2321,6 +2440,16 @@ declare class QuestsClient {
2321
2440
  * Get user's progress on a quest
2322
2441
  */
2323
2442
  getUserProgress(questId: string, userId: string): Promise<UserQuestProgress>;
2443
+ /**
2444
+ * Mark a quest step as in-progress (started).
2445
+ *
2446
+ * Call this when the user clicks a CTA link to begin a challenge.
2447
+ * Sets the step to 'in_progress' status so the frontend can show
2448
+ * a pending state while waiting for the completion event to fire.
2449
+ *
2450
+ * Idempotent — safe to call multiple times for the same step.
2451
+ */
2452
+ startStep(questId: string, userId: string, stepIndex: number): Promise<StepStartResult>;
2324
2453
  /**
2325
2454
  * Complete a step manually by step index
2326
2455
  */
@@ -2332,7 +2461,7 @@ declare class QuestsClient {
2332
2461
  /**
2333
2462
  * Claim a completed quest reward.
2334
2463
  * Only applicable for quests with reward_mode='claimable'.
2335
- * Transitions the quest from REWARD_CLAIMABLE to REWARD_PENDING/COMPLETED
2464
+ * Transitions the quest from COMPLETED to CLAIMED
2336
2465
  * and awards points + creates the earned reward.
2337
2466
  */
2338
2467
  claimReward(questId: string, userId: string): Promise<ClaimRewardResult>;
@@ -2979,8 +3108,16 @@ declare class FanpassLeaderboardClient {
2979
3108
  * ```
2980
3109
  */
2981
3110
 
3111
+ /** Web Push subscription info as returned by the browser Push API. */
3112
+ interface PushSubscriptionJSON {
3113
+ endpoint: string;
3114
+ keys: {
3115
+ p256dh: string;
3116
+ auth: string;
3117
+ };
3118
+ }
2982
3119
  /** Notification event types pushed by the server. */
2983
- type NotificationEventType = 'connected' | 'quest_step_completed' | 'quest_completed' | 'reward_earned' | 'reward_distributed' | 'reward_claimable' | 'points_awarded' | 'badge_earned' | 'level_up';
3120
+ type NotificationEventType = 'connected' | 'quest_step_started' | 'quest_step_completed' | 'quest_completed' | 'reward_earned' | 'reward_distributed' | 'reward_claimable' | 'points_awarded' | 'badge_earned' | 'level_up';
2984
3121
  /** A notification event received from the SSE stream. */
2985
3122
  interface NotificationEvent {
2986
3123
  /** Unique event ID */
@@ -3014,6 +3151,7 @@ interface SubscribeOptions {
3014
3151
  /** Function to call to unsubscribe / close the SSE connection. */
3015
3152
  type Unsubscribe = () => void;
3016
3153
  declare class NotificationsClient {
3154
+ private http;
3017
3155
  private baseUrl;
3018
3156
  private authHeaders;
3019
3157
  constructor(http: HttpClient);
@@ -3034,6 +3172,265 @@ declare class NotificationsClient {
3034
3172
  * @returns Unsubscribe function to close the connection
3035
3173
  */
3036
3174
  subscribe(userId: string, callback: NotificationCallback, options?: SubscribeOptions): Unsubscribe;
3175
+ /**
3176
+ * Get the tenant's VAPID public key for Web Push.
3177
+ *
3178
+ * This key is needed to call `pushManager.subscribe()` in the browser.
3179
+ * Returns null if Web Push is not configured for this tenant.
3180
+ */
3181
+ getVapidKey(): Promise<string | null>;
3182
+ /**
3183
+ * Register a browser push subscription with the server.
3184
+ *
3185
+ * Call this after the user grants notification permission and you
3186
+ * obtain a PushSubscription from `pushManager.subscribe()`.
3187
+ *
3188
+ * @param userId - External user ID
3189
+ * @param subscription - The PushSubscription object (or its JSON)
3190
+ * @returns Subscription ID from the server
3191
+ */
3192
+ registerPush(userId: string, subscription: PushSubscriptionJSON | PushSubscription): Promise<{
3193
+ status: string;
3194
+ subscription_id: string;
3195
+ }>;
3196
+ /**
3197
+ * Remove a push subscription from the server.
3198
+ *
3199
+ * Call this when the user logs out or revokes notification permission.
3200
+ *
3201
+ * @param userId - External user ID
3202
+ * @param endpoint - The push endpoint URL to remove
3203
+ */
3204
+ unregisterPush(userId: string, endpoint: string): Promise<{
3205
+ status: string;
3206
+ }>;
3207
+ /**
3208
+ * High-level helper: request permission, subscribe to push, and register.
3209
+ *
3210
+ * Handles the full Web Push registration flow:
3211
+ * 1. Fetches the VAPID public key from the server
3212
+ * 2. Requests notification permission from the user
3213
+ * 3. Registers a Service Worker (if not already registered)
3214
+ * 4. Subscribes to push via the Push API
3215
+ * 5. Sends the subscription to the server
3216
+ *
3217
+ * @param userId - External user ID
3218
+ * @param serviceWorkerPath - Path to the service worker file (default: '/sw.js')
3219
+ * @returns The PushSubscription, or null if denied/unavailable
3220
+ *
3221
+ * @example
3222
+ * ```typescript
3223
+ * const sub = await client.notifications.requestPermissionAndSubscribe(
3224
+ * 'user-123',
3225
+ * '/proofchain-sw.js'
3226
+ * );
3227
+ * if (sub) {
3228
+ * console.log('Push notifications enabled!');
3229
+ * }
3230
+ * ```
3231
+ */
3232
+ requestPermissionAndSubscribe(userId: string, serviceWorkerPath?: string): Promise<PushSubscription | null>;
3233
+ /**
3234
+ * Generate a basic Service Worker script for handling push notifications.
3235
+ *
3236
+ * Returns JavaScript source code that can be saved as your sw.js file.
3237
+ * The generated worker handles `push` events (shows notification) and
3238
+ * `notificationclick` events (opens the app).
3239
+ *
3240
+ * @param defaultIcon - Optional default icon URL for notifications
3241
+ * @param defaultUrl - URL to open when notification is clicked (default: '/')
3242
+ * @returns Service Worker JavaScript source code as a string
3243
+ *
3244
+ * @example
3245
+ * ```typescript
3246
+ * // Save the output as /public/sw.js in your project
3247
+ * const swCode = client.notifications.generateServiceWorker({
3248
+ * defaultIcon: '/icon-192.png',
3249
+ * defaultUrl: '/',
3250
+ * });
3251
+ * ```
3252
+ */
3253
+ generateServiceWorker(options?: {
3254
+ defaultIcon?: string;
3255
+ defaultUrl?: string;
3256
+ }): string;
3257
+ /** Convert a base64url-encoded VAPID key to a Uint8Array for the Push API. */
3258
+ private _urlBase64ToUint8Array;
3259
+ }
3260
+
3261
+ /**
3262
+ * Identity Credentials API Client
3263
+ *
3264
+ * Manage portable, verifiable credentials for end users.
3265
+ * Credentials are opt-in, issued by tenants, and publicly verifiable.
3266
+ */
3267
+
3268
+ interface CredentialType {
3269
+ id: string;
3270
+ name: string;
3271
+ slug: string;
3272
+ description?: string;
3273
+ category?: string;
3274
+ icon_url?: string;
3275
+ badge_color?: string;
3276
+ display_order: number;
3277
+ schema_definition: Record<string, any>;
3278
+ is_revocable: boolean;
3279
+ default_expiry_days?: number;
3280
+ max_active_per_user: number;
3281
+ auto_renew: boolean;
3282
+ default_visibility: 'public' | 'tenant_only' | 'user_controlled';
3283
+ requires_opt_in: boolean;
3284
+ status: 'draft' | 'active' | 'archived';
3285
+ total_issued: number;
3286
+ total_active: number;
3287
+ created_at: string;
3288
+ }
3289
+ interface IssuedCredential {
3290
+ id: string;
3291
+ credential_type_id: string;
3292
+ credential_type_name: string;
3293
+ credential_type_slug: string;
3294
+ user_id: string;
3295
+ user_external_id?: string;
3296
+ verification_code: string;
3297
+ credential_data: Record<string, any>;
3298
+ issued_by?: string;
3299
+ issue_reason?: string;
3300
+ visibility: 'public' | 'tenant_only' | 'user_controlled';
3301
+ status: 'active' | 'suspended' | 'revoked' | 'expired';
3302
+ is_valid: boolean;
3303
+ expires_at?: string;
3304
+ issued_at: string;
3305
+ verification_count: number;
3306
+ last_verified_at?: string;
3307
+ }
3308
+ interface CredentialVerifyResult {
3309
+ valid: boolean;
3310
+ status: string;
3311
+ credential_type: string;
3312
+ credential_type_slug: string;
3313
+ category?: string;
3314
+ icon_url?: string;
3315
+ badge_color?: string;
3316
+ credential_data: Record<string, any>;
3317
+ issued_at: string;
3318
+ expires_at?: string;
3319
+ issuer: string;
3320
+ verification_count: number;
3321
+ }
3322
+ interface UserCredentialsSummary {
3323
+ credentials_enabled: boolean;
3324
+ total_credentials: number;
3325
+ active_credentials: number;
3326
+ credentials: IssuedCredential[];
3327
+ }
3328
+ interface CreateCredentialTypeRequest {
3329
+ name: string;
3330
+ slug?: string;
3331
+ description?: string;
3332
+ category?: string;
3333
+ icon_url?: string;
3334
+ badge_color?: string;
3335
+ display_order?: number;
3336
+ schema_definition?: Record<string, any>;
3337
+ is_revocable?: boolean;
3338
+ default_expiry_days?: number;
3339
+ max_active_per_user?: number;
3340
+ auto_renew?: boolean;
3341
+ default_visibility?: 'public' | 'tenant_only' | 'user_controlled';
3342
+ requires_opt_in?: boolean;
3343
+ auto_issue_on_quest?: string;
3344
+ auto_issue_on_segment?: string;
3345
+ }
3346
+ interface IssueCredentialRequest {
3347
+ credential_type_id: string;
3348
+ user_id: string;
3349
+ credential_data?: Record<string, any>;
3350
+ issue_reason?: string;
3351
+ visibility?: 'public' | 'tenant_only' | 'user_controlled';
3352
+ expires_at?: string;
3353
+ }
3354
+ interface ListIssuedCredentialsOptions {
3355
+ user_id?: string;
3356
+ credential_type_id?: string;
3357
+ status?: 'active' | 'suspended' | 'revoked' | 'expired';
3358
+ limit?: number;
3359
+ offset?: number;
3360
+ }
3361
+ declare class CredentialsClient {
3362
+ private http;
3363
+ constructor(http: HttpClient);
3364
+ /**
3365
+ * Create a new credential type
3366
+ */
3367
+ createType(request: CreateCredentialTypeRequest): Promise<CredentialType>;
3368
+ /**
3369
+ * List credential types
3370
+ */
3371
+ listTypes(options?: {
3372
+ status?: string;
3373
+ category?: string;
3374
+ }): Promise<CredentialType[]>;
3375
+ /**
3376
+ * Get a specific credential type
3377
+ */
3378
+ getType(typeId: string): Promise<CredentialType>;
3379
+ /**
3380
+ * Update a credential type
3381
+ */
3382
+ updateType(typeId: string, request: CreateCredentialTypeRequest): Promise<CredentialType>;
3383
+ /**
3384
+ * Activate a credential type
3385
+ */
3386
+ activateType(typeId: string): Promise<CredentialType>;
3387
+ /**
3388
+ * Archive a credential type
3389
+ */
3390
+ archiveType(typeId: string): Promise<CredentialType>;
3391
+ /**
3392
+ * Issue a credential to a user
3393
+ */
3394
+ issue(request: IssueCredentialRequest): Promise<IssuedCredential>;
3395
+ /**
3396
+ * List issued credentials
3397
+ */
3398
+ listIssued(options?: ListIssuedCredentialsOptions): Promise<IssuedCredential[]>;
3399
+ /**
3400
+ * Revoke an issued credential
3401
+ */
3402
+ revoke(credentialId: string, reason?: string): Promise<IssuedCredential>;
3403
+ /**
3404
+ * Suspend an issued credential
3405
+ */
3406
+ suspend(credentialId: string, reason?: string): Promise<IssuedCredential>;
3407
+ /**
3408
+ * Reinstate a suspended credential
3409
+ */
3410
+ reinstate(credentialId: string): Promise<IssuedCredential>;
3411
+ /**
3412
+ * Opt a user in to identity credentials (tenant admin)
3413
+ */
3414
+ optInUser(userExternalId: string): Promise<{
3415
+ status: string;
3416
+ credentials_enabled: boolean;
3417
+ }>;
3418
+ /**
3419
+ * Opt a user out of identity credentials (tenant admin)
3420
+ */
3421
+ optOutUser(userExternalId: string): Promise<{
3422
+ status: string;
3423
+ credentials_enabled: boolean;
3424
+ }>;
3425
+ /**
3426
+ * Get all credentials for a user
3427
+ */
3428
+ getUserCredentials(userExternalId: string): Promise<UserCredentialsSummary>;
3429
+ /**
3430
+ * Verify a credential by its verification code.
3431
+ * This is a public endpoint — no authentication required.
3432
+ */
3433
+ verify(verificationCode: string): Promise<CredentialVerifyResult>;
3037
3434
  }
3038
3435
 
3039
3436
  /**
@@ -3232,6 +3629,8 @@ declare class ProofChain {
3232
3629
  fanpassLeaderboard: FanpassLeaderboardClient;
3233
3630
  /** Notifications client for real-time SSE streaming */
3234
3631
  notifications: NotificationsClient;
3632
+ /** Credentials client for portable identity credentials */
3633
+ credentials: CredentialsClient;
3235
3634
  constructor(options: ProofChainOptions);
3236
3635
  /**
3237
3636
  * Create a client for end-user JWT authentication (PWA/frontend use).
@@ -3447,4 +3846,4 @@ declare class TimeoutError extends ProofChainError {
3447
3846
  constructor(message?: string);
3448
3847
  }
3449
3848
 
3450
- export { type Achievement, type ActivitySummaryView, type AddNFTRequest, type ApiKey, type AttestRequest, type AttestationMode, type AttestationResult, AuthenticationError, AuthorizationError, type AvailableView, type Badge, type BatchIngestRequest, type BatchIngestResponse, type BatchVerifyResult, type BlockchainProof, type BlockchainStats, type Certificate, type CertificateVerifyResult, CertificatesResource, type Channel, type ChannelState, type ChannelStatus, ChannelsResource, type ClaimNFTResult, type ClaimRewardResult, type CohortDefinition, type CohortGroupStats, CohortLeaderboardClient, type CohortLeaderboardEntry, type CohortLeaderboardOptions, type CohortLeaderboardResponse, type ComprehensiveWalletInfo, type CreateAchievementRequest, type CreateApiKeyRequest, type CreateBadgeRequest, type CreateChannelRequest, type CreateDataViewRequest, type CreateDualWalletsRequest, type CreateEndUserRequest, type CreateEventRequest, type CreatePassportDefinitionRequest, type CreatePassportRequest, type CreateQuestRequest, type CreateQuestStepRequest, type CreateRewardDefinitionRequest, type CreateSchemaRequest, type CreateTemplateFieldRequest, type CreateTemplateRequest, type CreateWalletRequest as CreateUserWalletRequest, type CreateWalletRequest$1 as CreateWalletRequest, type CreateWebhookRequest, type DataViewColumn, type DataViewComputation, type DataViewDetail, type DataViewExecuteResult, type DataViewInfo, type DataViewListResponse, type DataViewPreviewRequest, type DataViewPreviewResult, type DataViewSummary, DataViewsClient, type DistributeResult, DocumentsResource, type DualWallets, type EarnedReward, type EndUser, EndUserIngestionClient, type EndUserIngestionClientOptions, type EndUserListResponse, EndUsersClient, type Event, type EventBatchProof, type EventMetadata, type EventStatus, EventsResource, type ExecuteSwapRequest, type Facet, type FacetsResponse, type FanProfileView, type FanpassGroupStats, FanpassLeaderboardClient, type FanpassLeaderboardEntry, type FanpassLeaderboardOptions, type FanpassLeaderboardResponse, type FanpassUserComparisonResponse, type FieldValue, type GDPRDeletionRequest, type GDPRDeletionResponse, type GDPRPreviewResponse, type IngestEventRequest, type IngestEventResponse, IngestionClient, type IngestionClientOptions, type IssueCertificateRequest, type LeaderboardUserProfile$1 as LeaderboardUserProfile, type LinkWalletRequest, type ListCertificatesRequest, type ListCohortsOptions, type ListEndUsersOptions, type ListEventsRequest, type ListQuestsOptions, type ListRewardsOptions, type ListSchemasOptions, type ManualRewardRequest, type MergeUsersRequest, type Milestone, type NFT, NetworkError, NotFoundError, type NotificationCallback, type NotificationEvent, type NotificationEventType, NotificationsClient, type Passport, PassportClient, type PassportDefinition, type PassportFieldValue, type PassportHistory, type PassportTemplate, type PassportV2Data, type PassportWithFields, ProofChain, ProofChainError, type ProofChainOptions, type ProofVerifyResult, type Quest, type QuestStep, type QuestWithProgress, QuestsClient, RateLimitError, type RegisterWalletRequest, type RevokeResult, type RewardAsset, type RewardDefinition, type RewardEarned, RewardsClient, type Schema, type SchemaDetail, type SchemaField, type SchemaListResponse, type ValidationError$1 as SchemaValidationError, SchemasClient, type SearchFilters, type SearchQueryRequest, type SearchRequest, SearchResource, type SearchResponse, type SearchResult, type SearchStats, ServerError, type SetProfileRequest, type Settlement, type StepCompletionResult, type StepProgress, type StreamAck, type StreamEventRequest, type SubscribeOptions, type SwapQuote, type SwapQuoteRequest, type SwapResult, type TemplateField, type TenantInfo, TenantResource, type TierDefinition, TimeoutError, type TokenBalance, type TransferRequest, type TransferResult, type Unsubscribe, type UpdateDataViewRequest, type UpdateEndUserRequest, type UpdatePassportRequest, type UpdateWebhookRequest, type UsageStats, type UserAchievement, type UserActivity, type UserActivityResponse, type UserBadge, type UserBreakdownResponse, type UserCohortBreakdownEntry, type UserQuestProgress, type UserReward$1 as UserReward, type UserRewardsResponse, type UserWalletSummary, type UserWithWallets, type UsersWithWalletsResponse, type ValidateDataRequest, ValidationError, type ValidationErrorDetail, type ValidationResult, type VaultFile, type VaultFolder, type VaultListResponse, VaultResource, type VaultStats, type VaultUploadRequest, type VerificationResult, VerifyResource, type ViewColumn, type ViewTemplate, type Wallet, type WalletBalance, WalletClient, type WalletCreationResult, type WalletStats, type Webhook, WebhooksResource };
3849
+ export { type Achievement, type ActivitySummaryView, type AddNFTRequest, type AnchorResult, type ApiKey, type AttestRequest, type AttestationMode, type AttestationResult, AuthenticationError, AuthorizationError, type AvailableView, type Badge, type BatchIngestRequest, type BatchIngestResponse, type BatchVerifyResult, type BlockchainProof, type BlockchainStats, type Certificate, type CertificateVerifyResult, CertificatesResource, type Channel, type ChannelState, type ChannelStatus, ChannelsResource, type ClaimNFTResult, type ClaimRewardResult, type CohortDefinition, type CohortGroupStats, CohortLeaderboardClient, type CohortLeaderboardEntry, type CohortLeaderboardOptions, type CohortLeaderboardResponse, type ComprehensiveWalletInfo, type CreateAchievementRequest, type CreateApiKeyRequest, type CreateBadgeRequest, type CreateChannelRequest, type CreateCredentialTypeRequest, type CreateDataViewRequest, type CreateDualWalletsRequest, type CreateEndUserRequest, type CreateEventRequest, type CreatePassportDefinitionRequest, type CreatePassportRequest, type CreateQuestRequest, type CreateQuestStepRequest, type CreateRewardDefinitionRequest, type CreateSchemaRequest, type CreateTemplateFieldRequest, type CreateTemplateRequest, type CreateWalletRequest as CreateUserWalletRequest, type CreateWalletRequest$1 as CreateWalletRequest, type CreateWebhookRequest, type CredentialType, type CredentialVerifyResult, CredentialsClient, type DataViewColumn, type DataViewComputation, type DataViewDetail, type DataViewExecuteResult, type DataViewInfo, type DataViewListResponse, type DataViewPreviewRequest, type DataViewPreviewResult, type DataViewSummary, DataViewsClient, type DistributeResult, DocumentsResource, type DualWallets, type EarnedReward, type EndUser, EndUserIngestionClient, type EndUserIngestionClientOptions, type EndUserListResponse, EndUsersClient, type Event, type EventBatchProof, type EventMetadata, type EventStatus, EventsResource, type ExecuteSwapRequest, type Facet, type FacetsResponse, type FanProfileView, type FanpassGroupStats, FanpassLeaderboardClient, type FanpassLeaderboardEntry, type FanpassLeaderboardOptions, type FanpassLeaderboardResponse, type FanpassUserComparisonResponse, type FieldValue, type GDPRDeletionRequest, type GDPRDeletionResponse, type GDPRPreviewResponse, type IngestEventRequest, type IngestEventResponse, IngestionClient, type IngestionClientOptions, type IssueCertificateRequest, type IssueCredentialRequest, type IssuedCredential, type LeaderboardUserProfile$1 as LeaderboardUserProfile, type LinkWalletRequest, type ListCertificatesRequest, type ListCohortsOptions, type ListEndUsersOptions, type ListEventsRequest, type ListIssuedCredentialsOptions, type ListQuestsOptions, type ListRewardsOptions, type ListSchemasOptions, type ManualRewardRequest, type MergeUsersRequest, type Milestone, type NFT, NetworkError, NotFoundError, type NotificationCallback, type NotificationEvent, type NotificationEventType, NotificationsClient, type Passport, PassportClient, type PassportDefinition, type PassportFieldValue, type PassportHistory, type PassportTemplate, type PassportV2Data, type PassportWithFields, ProofChain, ProofChainError, type ProofChainOptions, type ProofVerifyResult, type PushSubscriptionJSON, type Quest, type QuestStep, type QuestWithProgress, QuestsClient, RateLimitError, type RegisterWalletRequest, type RevokeResult, type RewardAsset, type RewardAttestationResult, type RewardDefinition, type RewardEarned, type VerifyResult as RewardVerifyResult, RewardsClient, type Schema, type SchemaDetail, type SchemaField, type SchemaListResponse, type ValidationError$1 as SchemaValidationError, SchemasClient, type SearchFilters, type SearchQueryRequest, type SearchRequest, SearchResource, type SearchResponse, type SearchResult, type SearchStats, ServerError, type SetProfileRequest, type Settlement, type StepCompletionResult, type StepProgress, type StepStartResult, type StreamAck, type StreamEventRequest, type SubscribeOptions, type SwapQuote, type SwapQuoteRequest, type SwapResult, type TemplateField, type TenantInfo, TenantResource, type TierDefinition, TimeoutError, type TokenBalance, type TransferRequest, type TransferResult, type Unsubscribe, type UpdateDataViewRequest, type UpdateEndUserRequest, type UpdatePassportRequest, type UpdateWebhookRequest, type UsageStats, type UserAchievement, type UserActivity, type UserActivityResponse, type UserBadge, type UserBreakdownResponse, type UserCohortBreakdownEntry, type UserCredentialsSummary, type UserQuestProgress, type UserReward$1 as UserReward, type UserRewardsResponse, type UserWalletSummary, type UserWithWallets, type UsersWithWalletsResponse, type ValidateDataRequest, ValidationError, type ValidationErrorDetail, type ValidationResult, type VaultFile, type VaultFolder, type VaultListResponse, VaultResource, type VaultStats, type VaultUploadRequest, type VerificationResult, VerifyResource, type ViewColumn, type ViewTemplate, type Wallet, type WalletBalance, WalletClient, type WalletCreationResult, type WalletStats, type Webhook, WebhooksResource };