@learncard/network-plugin 2.13.17 → 2.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/types.ts CHANGED
@@ -111,6 +111,12 @@ import {
111
111
  CredentialActivityStats,
112
112
  BitstringCredentialStatusPurpose,
113
113
  BitstringCredentialStatusEntry,
114
+ AllocateCredentialRefreshInput,
115
+ AllocateCredentialRefreshResult,
116
+ PublishCredentialRefreshInput,
117
+ PublishCredentialRefreshResult,
118
+ GetCredentialRefreshHistoryInput,
119
+ GetCredentialRefreshHistoryResult,
114
120
  } from '@learncard/types';
115
121
  import { Plugin } from '@learncard/core';
116
122
  import { ProofOptions } from '@learncard/didkit-plugin';
@@ -411,6 +417,47 @@ export type LearnCardNetworkPluginMethods = {
411
417
  statusPurposes?: BitstringCredentialStatusPurpose[];
412
418
  listSize?: number;
413
419
  }) => Promise<BitstringCredentialStatusEntry[]>;
420
+
421
+ // Managed Credential Refresh (LC-2117 / LC-2135 / LC-2136)
422
+
423
+ /**
424
+ * Allocates an unguessable managed refresh service for a credential BEFORE it is
425
+ * signed. The returned `refreshService` descriptor must be injected into the
426
+ * unsigned credential so it becomes part of the signed payload; `credentialId`
427
+ * binds the allocation to the credential's stable ID.
428
+ */
429
+ allocateCredentialRefresh: (
430
+ input: AllocateCredentialRefreshInput
431
+ ) => Promise<AllocateCredentialRefreshResult>;
432
+ /**
433
+ * Binds a signed credential to its allocated refresh aggregate. The plaintext VC is
434
+ * verified server-side and persisted only as a holder-encrypted JWE — the issuer
435
+ * and the service never retain a readable copy. When the credential was issued from
436
+ * a boost, pass `boostUri` so the stored instance stays linked INSTANCE_OF the
437
+ * boost for canonical recipient management (including revocation).
438
+ */
439
+ sendRefreshableCredential: (
440
+ refreshId: string,
441
+ credential: VC,
442
+ boostUri?: string,
443
+ skipNotification?: boolean
444
+ ) => Promise<string>;
445
+ /**
446
+ * Publishes a new immutable version of a refreshable credential and atomically
447
+ * advances the refresh head. Issuer-signed mode takes a fully signed VC;
448
+ * signing-authority mode takes updated unsigned claims plus an authorized signing
449
+ * authority.
450
+ */
451
+ publishCredentialRefresh: (
452
+ input: PublishCredentialRefreshInput
453
+ ) => Promise<PublishCredentialRefreshResult>;
454
+ /**
455
+ * Cursor-paginated, metadata-only issuer audit history for a managed refresh.
456
+ * Never includes credential bodies or encrypted payloads.
457
+ */
458
+ getCredentialRefreshHistory: (
459
+ input: GetCredentialRefreshHistoryInput
460
+ ) => Promise<GetCredentialRefreshHistoryResult>;
414
461
  revokeBoostRecipient: (
415
462
  boostUri: string,
416
463
  recipientProfileId: string,
@@ -437,6 +484,16 @@ export type LearnCardNetworkPluginMethods = {
437
484
  skipNotification?: boolean;
438
485
  templateData?: Record<string, unknown>;
439
486
  statusPurposes?: BitstringCredentialStatusPurpose[];
487
+ /**
488
+ * Opt into a managed refresh service. When true, a stable UUID
489
+ * credential ID is generated if the boost template has none, a
490
+ * refresh service is allocated BEFORE signing and injected into the
491
+ * signed credential, and the credential is sent via the dedicated
492
+ * managed-send procedure (holder-encrypted storage only) instead of
493
+ * legacy credential storage. The `encrypt` option is ignored in this
494
+ * mode — managed storage is always holder-only.
495
+ */
496
+ enableRefresh?: boolean;
440
497
  }
441
498
  ) => Promise<string>;
442
499
 
@@ -630,12 +687,21 @@ export type LearnCardNetworkPluginMethods = {
630
687
  ) => Promise<PaginatedInboxCredentialsType>;
631
688
 
632
689
  getInboxCredential: (id: string) => Promise<InboxCredentialType | null>;
690
+ /** Recover and locally decrypt claims for seven days; deduplicate by the stable inbox id. */
691
+ recoverInboxCredentials: (options?: { limit?: number; cursor?: string }) => Promise<{
692
+ records: { id: string; credential: VC; expiresAt: string }[];
693
+ /** Deliveries that could not be decrypted or validated on this page. */
694
+ failed: number;
695
+ hasMore: boolean;
696
+ cursor?: string;
697
+ }>;
633
698
  finalizeInboxCredentials: () => Promise<{
634
699
  processed: number;
635
700
  claimed: number;
636
701
  errors: number;
637
702
  guardianPending: number;
638
703
  verifiableCredentials: VC[];
704
+ deliveries: { id: string; credential: VC }[];
639
705
  }>;
640
706
 
641
707
  // Guardian Approval