@learncard/network-plugin 3.0.0 → 3.1.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/lcn-plugin.cjs.development.cjs +960 -52
- package/dist/lcn-plugin.cjs.development.cjs.map +3 -3
- package/dist/lcn-plugin.cjs.production.min.cjs +22 -22
- package/dist/lcn-plugin.cjs.production.min.cjs.map +3 -3
- package/dist/lcn-plugin.esm.js +961 -52
- package/dist/lcn-plugin.esm.js.map +3 -3
- package/dist/plugin.d.ts.map +1 -1
- package/dist/test/inbox-finalize-crypto.test.d.ts +2 -0
- package/dist/test/inbox-finalize-crypto.test.d.ts.map +1 -0
- package/dist/types.d.ts +99 -18
- package/dist/types.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/plugin.ts +206 -12
- package/src/test/inbox-finalize-crypto.test.ts +61 -0
- package/src/test/index.test.ts +0 -33
- package/src/types.ts +156 -22
package/src/types.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SendContractRequest, ConsentFlowContractRequestForProfile } from '@learncard/types';
|
|
1
2
|
import type { LCNClient } from '@learncard/network-brain-client';
|
|
2
3
|
import {
|
|
3
4
|
LCNProfile,
|
|
@@ -11,6 +12,22 @@ import {
|
|
|
11
12
|
VP,
|
|
12
13
|
SentCredentialInfo,
|
|
13
14
|
JWE,
|
|
15
|
+
CreateShareLinkInput,
|
|
16
|
+
UpdateShareLinkInput,
|
|
17
|
+
ListShareLinksInput,
|
|
18
|
+
PaginatedShareLinks,
|
|
19
|
+
ShareLinkOperationKeyInput,
|
|
20
|
+
ShareLinkOwnerCommitOutput,
|
|
21
|
+
ShareLinkOwnerContentOutput,
|
|
22
|
+
ShareLinkOwnerStatusOutput,
|
|
23
|
+
ShareLinkOwnerRecoveryOutput,
|
|
24
|
+
ShareLinkPublicState,
|
|
25
|
+
ShareLinkPublicContentView,
|
|
26
|
+
PutShareLinkAttachmentChunkInput,
|
|
27
|
+
DeleteShareLinkAttachmentChunksInput,
|
|
28
|
+
GetShareLinkAttachmentChunkInput,
|
|
29
|
+
ShareLinkAttachmentChunkOutput,
|
|
30
|
+
AcknowledgeViewOutput,
|
|
14
31
|
Boost,
|
|
15
32
|
BoostQuery,
|
|
16
33
|
LCNSigningAuthorityForUserType,
|
|
@@ -101,6 +118,9 @@ import {
|
|
|
101
118
|
AppStoreListing,
|
|
102
119
|
AppStoreListingCreateType,
|
|
103
120
|
AppStoreListingUpdateType,
|
|
121
|
+
AppManifest,
|
|
122
|
+
AppManifestVersion,
|
|
123
|
+
AppManifestDiff,
|
|
104
124
|
AppListingStatus,
|
|
105
125
|
PromotionLevel,
|
|
106
126
|
PaginatedAppStoreListings,
|
|
@@ -291,6 +311,55 @@ export type LearnCardNetworkPluginMethods = {
|
|
|
291
311
|
|
|
292
312
|
invalidateInvite: (challenge: string) => Promise<boolean>;
|
|
293
313
|
|
|
314
|
+
/**
|
|
315
|
+
* LC-2187 authenticated owner share-link methods. All owner identity and
|
|
316
|
+
* namespace binding is derived server-side from the authenticated session;
|
|
317
|
+
* no caller-supplied owner/namespace/object authority is accepted.
|
|
318
|
+
*/
|
|
319
|
+
createShareLink: (input: CreateShareLinkInput) => Promise<ShareLinkOwnerCommitOutput>;
|
|
320
|
+
putShareLinkAttachmentChunk: (input: PutShareLinkAttachmentChunkInput) => Promise<{ ok: true }>;
|
|
321
|
+
deleteShareLinkAttachmentChunks: (
|
|
322
|
+
input: DeleteShareLinkAttachmentChunksInput
|
|
323
|
+
) => Promise<{ ok: boolean }>;
|
|
324
|
+
getShareLinkAttachmentChunk: (
|
|
325
|
+
input: GetShareLinkAttachmentChunkInput
|
|
326
|
+
) => Promise<ShareLinkAttachmentChunkOutput>;
|
|
327
|
+
updateShareLink: (input: UpdateShareLinkInput) => Promise<ShareLinkOwnerCommitOutput>;
|
|
328
|
+
revokeShareLink: (input: {
|
|
329
|
+
id: string;
|
|
330
|
+
expectedVersion?: number;
|
|
331
|
+
clientRequestId?: string;
|
|
332
|
+
}) => Promise<ShareLinkOwnerCommitOutput>;
|
|
333
|
+
getShareLink: (id: string) => Promise<ShareLinkOwnerStatusOutput>;
|
|
334
|
+
getShareLinkOperationStatus: (
|
|
335
|
+
input: ShareLinkOperationKeyInput
|
|
336
|
+
) => Promise<ShareLinkOwnerStatusOutput>;
|
|
337
|
+
retryShareLinkOperation: (
|
|
338
|
+
input: ShareLinkOperationKeyInput
|
|
339
|
+
) => Promise<ShareLinkOwnerStatusOutput>;
|
|
340
|
+
getShareLinkRecovery: (id: string) => Promise<ShareLinkOwnerRecoveryOutput>;
|
|
341
|
+
getShareLinkOwnerContent: (id: string) => Promise<ShareLinkOwnerContentOutput>;
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Bounded, newest-first owner share list. Scope (namespace/owner) is derived
|
|
345
|
+
* server-side from the authenticated session; the input carries only a
|
|
346
|
+
* bounded `limit` and an opaque ordering cursor. Ineligible/unknown owners
|
|
347
|
+
* never receive `viewCount`/`lastViewedAt`.
|
|
348
|
+
*/
|
|
349
|
+
listShareLinks: (input: ListShareLinksInput) => Promise<PaginatedShareLinks>;
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* LC-2187 PUBLIC (anonymous) share-link methods. These require no
|
|
353
|
+
* authentication and no profile: namespace/owner are derived server-side
|
|
354
|
+
* from trusted configuration and the committed share. `resolveShareLink`
|
|
355
|
+
* returns metadata only and never counts; `getShareLinkContent` returns the
|
|
356
|
+
* guarded ciphertext envelope plus a uniformly shaped opaque receipt;
|
|
357
|
+
* `acknowledgeShareLinkView` always resolves to `{ ok: true }`.
|
|
358
|
+
*/
|
|
359
|
+
resolveShareLink: (id: string, passcode?: string) => Promise<ShareLinkPublicState>;
|
|
360
|
+
getShareLinkContent: (id: string, passcode?: string) => Promise<ShareLinkPublicContentView>;
|
|
361
|
+
acknowledgeShareLinkView: (receipt: string) => Promise<AcknowledgeViewOutput>;
|
|
362
|
+
|
|
294
363
|
blockProfile: (profileId: string) => Promise<boolean>;
|
|
295
364
|
unblockProfile: (profileId: string) => Promise<boolean>;
|
|
296
365
|
getBlockedProfiles: () => Promise<LCNVisibleProfile[]>;
|
|
@@ -314,7 +383,12 @@ export type LearnCardNetworkPluginMethods = {
|
|
|
314
383
|
getIncomingCredentials: (from?: string) => Promise<SentCredentialInfo[]>;
|
|
315
384
|
deleteCredential: (uri: string) => Promise<boolean>;
|
|
316
385
|
|
|
317
|
-
sendPresentation: (
|
|
386
|
+
sendPresentation: (
|
|
387
|
+
profileId: string,
|
|
388
|
+
vp: VP,
|
|
389
|
+
metadataOrEncrypt?: Record<string, unknown> | boolean,
|
|
390
|
+
encrypt?: boolean
|
|
391
|
+
) => Promise<string>;
|
|
318
392
|
acceptPresentation: (uri: string) => Promise<boolean>;
|
|
319
393
|
getReceivedPresentations: (from?: string) => Promise<SentCredentialInfo[]>;
|
|
320
394
|
getSentPresentations: (to?: string) => Promise<SentCredentialInfo[]>;
|
|
@@ -580,6 +654,7 @@ export type LearnCardNetworkPluginMethods = {
|
|
|
580
654
|
image?: string;
|
|
581
655
|
expiresAt?: string;
|
|
582
656
|
writers?: string[];
|
|
657
|
+
recipients?: string[];
|
|
583
658
|
autoboosts?: AutoBoostConfig[];
|
|
584
659
|
}) => Promise<string>;
|
|
585
660
|
addAutoBoostsToContract: (
|
|
@@ -587,6 +662,8 @@ export type LearnCardNetworkPluginMethods = {
|
|
|
587
662
|
autoboosts: AutoBoostConfig[]
|
|
588
663
|
) => Promise<boolean>;
|
|
589
664
|
removeAutoBoostsFromContract: (contractUri: string, boostUris: string[]) => Promise<boolean>;
|
|
665
|
+
addContractRecipient: (contractUri: string, recipient: string) => Promise<boolean>;
|
|
666
|
+
removeContractRecipient: (contractUri: string, recipient: string) => Promise<boolean>;
|
|
590
667
|
getContract: (uri: string) => Promise<ConsentFlowContractDetails>;
|
|
591
668
|
getContracts: (
|
|
592
669
|
options?: Partial<PaginationOptionsType> & { query?: ConsentFlowContractQuery }
|
|
@@ -617,6 +694,9 @@ export type LearnCardNetworkPluginMethods = {
|
|
|
617
694
|
terms: ConsentFlowTerms;
|
|
618
695
|
expiresAt?: string;
|
|
619
696
|
oneTime?: boolean;
|
|
697
|
+
audienceVersion?: number;
|
|
698
|
+
/** Bind acceptance to the pending referral the learner reviewed. */
|
|
699
|
+
expectedRequestId?: string;
|
|
620
700
|
},
|
|
621
701
|
recipientToken?: string
|
|
622
702
|
) => Promise<{ termsUri: string; redirectUrl?: string }>;
|
|
@@ -629,6 +709,7 @@ export type LearnCardNetworkPluginMethods = {
|
|
|
629
709
|
terms: ConsentFlowTerms;
|
|
630
710
|
expiresAt?: string;
|
|
631
711
|
oneTime?: boolean;
|
|
712
|
+
audienceVersion?: number;
|
|
632
713
|
}
|
|
633
714
|
) => Promise<boolean>;
|
|
634
715
|
withdrawConsent: (uri: string) => Promise<boolean>;
|
|
@@ -649,7 +730,8 @@ export type LearnCardNetworkPluginMethods = {
|
|
|
649
730
|
|
|
650
731
|
syncCredentialsToContract: (
|
|
651
732
|
termsUri: string,
|
|
652
|
-
categories: Record<string, string[]
|
|
733
|
+
categories: Record<string, string[]>,
|
|
734
|
+
audienceVersion?: number
|
|
653
735
|
) => Promise<boolean>;
|
|
654
736
|
|
|
655
737
|
deleteCredentialFromAllContracts: (deletedUris: string[]) => Promise<{
|
|
@@ -657,6 +739,11 @@ export type LearnCardNetworkPluginMethods = {
|
|
|
657
739
|
removedSharedUris: number;
|
|
658
740
|
}>;
|
|
659
741
|
|
|
742
|
+
/** Sends one attributed request; identical pending retries are idempotent. */
|
|
743
|
+
sendContractRequest: (request: SendContractRequest) => Promise<boolean>;
|
|
744
|
+
/** Target-only denial preserves the request and its referral reference. */
|
|
745
|
+
denyContractRequest: (contractUri: string) => Promise<boolean>;
|
|
746
|
+
|
|
660
747
|
sendAiInsightsContractRequest: (
|
|
661
748
|
contractUri: string,
|
|
662
749
|
targetProfileId: string,
|
|
@@ -669,31 +756,25 @@ export type LearnCardNetworkPluginMethods = {
|
|
|
669
756
|
childProfileId?: string
|
|
670
757
|
) => Promise<boolean>;
|
|
671
758
|
|
|
672
|
-
getContractSentRequests: (
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
status: 'pending' | 'accepted' | 'denied' | null;
|
|
676
|
-
readStatus?: 'unseen' | 'seen' | null;
|
|
677
|
-
}[]
|
|
678
|
-
>;
|
|
759
|
+
getContractSentRequests: (
|
|
760
|
+
contractUri: string
|
|
761
|
+
) => Promise<ConsentFlowContractRequestForProfile[]>;
|
|
679
762
|
|
|
680
763
|
getRequestStatusForProfile: (
|
|
681
764
|
targetProfileId: string,
|
|
682
|
-
contractId?: string
|
|
683
|
-
contractUri?: string
|
|
684
|
-
) => Promise<
|
|
685
|
-
profile: LCNProfile;
|
|
686
|
-
status: 'pending' | 'accepted' | 'denied' | null;
|
|
687
|
-
readStatus?: 'unseen' | 'seen' | null;
|
|
688
|
-
} | null>;
|
|
765
|
+
contractId?: string,
|
|
766
|
+
contractUri?: string
|
|
767
|
+
) => Promise<ConsentFlowContractRequestForProfile | null>;
|
|
689
768
|
|
|
690
769
|
getAllContractRequestsForProfile: (targetProfileId: string) => Promise<
|
|
691
|
-
{
|
|
692
|
-
contract: ConsentFlowContract & {
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
770
|
+
(ConsentFlowContractRequestForProfile & {
|
|
771
|
+
contract: ConsentFlowContract & {
|
|
772
|
+
uri: string;
|
|
773
|
+
name?: string;
|
|
774
|
+
image?: string;
|
|
775
|
+
description?: string;
|
|
776
|
+
};
|
|
777
|
+
})[]
|
|
697
778
|
>;
|
|
698
779
|
|
|
699
780
|
getSharedInsightsRequestsForProfile: (targetProfileId: string) => Promise<
|
|
@@ -934,12 +1015,63 @@ export type LearnCardNetworkPluginMethods = {
|
|
|
934
1015
|
deleteAppStoreListing: (listingId: string) => Promise<boolean>;
|
|
935
1016
|
submitAppStoreListingForReview: (listingId: string) => Promise<boolean>;
|
|
936
1017
|
unsubmitAppStoreListing: (listingId: string) => Promise<boolean>;
|
|
1018
|
+
/** Sends held changes to a live app for review; the live listing is unchanged until approval. */
|
|
1019
|
+
submitAppStoreListingUpdate: (listingId: string) => Promise<boolean>;
|
|
1020
|
+
withdrawAppStoreListingUpdate: (listingId: string) => Promise<boolean>;
|
|
1021
|
+
discardAppStoreListingUpdate: (listingId: string) => Promise<boolean>;
|
|
937
1022
|
getListingsForIntegration: (
|
|
938
1023
|
integrationId: string,
|
|
939
1024
|
options?: Partial<PaginationOptionsType>
|
|
940
1025
|
) => Promise<PaginatedAppStoreListings>;
|
|
941
1026
|
countListingsForIntegration: (integrationId: string) => Promise<number>;
|
|
942
1027
|
|
|
1028
|
+
submitAppManifest: (
|
|
1029
|
+
integrationId: string,
|
|
1030
|
+
manifest: AppManifest
|
|
1031
|
+
) => Promise<{
|
|
1032
|
+
version: number;
|
|
1033
|
+
manifestHash: string;
|
|
1034
|
+
diff: AppManifestDiff | null;
|
|
1035
|
+
noop: boolean;
|
|
1036
|
+
}>;
|
|
1037
|
+
getManifestVersions: (
|
|
1038
|
+
integrationId: string,
|
|
1039
|
+
options?: { limit?: number; cursor?: string }
|
|
1040
|
+
) => Promise<{
|
|
1041
|
+
hasMore: boolean;
|
|
1042
|
+
cursor?: string;
|
|
1043
|
+
records: Pick<
|
|
1044
|
+
AppManifestVersion,
|
|
1045
|
+
'id' | 'version' | 'manifestHash' | 'status' | 'createdAt' | 'activatedAt'
|
|
1046
|
+
>[];
|
|
1047
|
+
}>;
|
|
1048
|
+
getManifestVersion: (
|
|
1049
|
+
integrationId: string,
|
|
1050
|
+
version: number
|
|
1051
|
+
) => Promise<AppManifestVersion | undefined>;
|
|
1052
|
+
getManifestDiff: (
|
|
1053
|
+
integrationId: string,
|
|
1054
|
+
toVersion: number,
|
|
1055
|
+
fromVersion?: number
|
|
1056
|
+
) => Promise<AppManifestDiff>;
|
|
1057
|
+
applyManifestVersion: (
|
|
1058
|
+
integrationId: string,
|
|
1059
|
+
version: number,
|
|
1060
|
+
listingId?: string
|
|
1061
|
+
) => Promise<{
|
|
1062
|
+
applied: boolean;
|
|
1063
|
+
/** True when the listing is live and the new version is waiting for review. */
|
|
1064
|
+
pendingReview?: boolean;
|
|
1065
|
+
version: number;
|
|
1066
|
+
reconciled: {
|
|
1067
|
+
templatesUpserted: number;
|
|
1068
|
+
templatesSkipped: number;
|
|
1069
|
+
contractsUpserted: number;
|
|
1070
|
+
contractsSkipped: number;
|
|
1071
|
+
signingAuthorityEnsured: boolean;
|
|
1072
|
+
};
|
|
1073
|
+
}>;
|
|
1074
|
+
|
|
943
1075
|
browseAppStore: (options?: {
|
|
944
1076
|
limit?: number;
|
|
945
1077
|
cursor?: string;
|
|
@@ -983,7 +1115,9 @@ export type LearnCardNetworkPluginMethods = {
|
|
|
983
1115
|
limit?: number;
|
|
984
1116
|
cursor?: string;
|
|
985
1117
|
status?: AppListingStatus;
|
|
1118
|
+
pendingUpdatesOnly?: boolean;
|
|
986
1119
|
}) => Promise<PaginatedAppStoreListings>;
|
|
1120
|
+
adminReviewListingUpdate: (listingId: string, approve: boolean) => Promise<boolean>;
|
|
987
1121
|
|
|
988
1122
|
// App Store Boost Management
|
|
989
1123
|
addBoostToApp: (listingId: string, boostUri: string, templateAlias: string) => Promise<boolean>;
|