@learncard/learn-cloud-service 2.5.34 → 2.5.36

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.
Files changed (124) hide show
  1. package/.env.example +24 -12
  2. package/CHANGELOG.md +43 -0
  3. package/bootstrapLambda.test.ts +68 -0
  4. package/config/config.dev.json +8 -0
  5. package/config/config.example.json +8 -0
  6. package/config/config.json +1 -0
  7. package/config/config.production.json +8 -0
  8. package/config/config.scouts.dev.json +3 -0
  9. package/config/config.scouts.production.json +4 -0
  10. package/didWebLambda.test.ts +41 -0
  11. package/didWebLambda.ts +13 -19
  12. package/didWebLambdaApp.ts +23 -0
  13. package/dist/accesslayer/share-content/delete.d.ts +5 -0
  14. package/dist/accesslayer/share-content/delete.d.ts.map +1 -0
  15. package/dist/accesslayer/share-content/index.d.ts +8 -0
  16. package/dist/accesslayer/share-content/index.d.ts.map +1 -0
  17. package/dist/accesslayer/share-content/initialize.d.ts +5 -0
  18. package/dist/accesslayer/share-content/initialize.d.ts.map +1 -0
  19. package/dist/accesslayer/share-content/internal.d.ts +12 -0
  20. package/dist/accesslayer/share-content/internal.d.ts.map +1 -0
  21. package/dist/accesslayer/share-content/put.d.ts +5 -0
  22. package/dist/accesslayer/share-content/put.d.ts.map +1 -0
  23. package/dist/accesslayer/share-content/read.d.ts +7 -0
  24. package/dist/accesslayer/share-content/read.d.ts.map +1 -0
  25. package/dist/accesslayer/share-content/types.d.ts +85 -0
  26. package/dist/accesslayer/share-content/types.d.ts.map +1 -0
  27. package/dist/config/applyDockerStageConfig.d.ts +2 -0
  28. package/dist/config/applyDockerStageConfig.d.ts.map +1 -0
  29. package/dist/config/environment.d.ts +12 -0
  30. package/dist/config/environment.d.ts.map +1 -1
  31. package/dist/config/serverlessFunctionEnv.test.d.ts +2 -0
  32. package/dist/config/serverlessFunctionEnv.test.d.ts.map +1 -0
  33. package/dist/config/stageConfig.d.ts +10 -0
  34. package/dist/config/stageConfig.d.ts.map +1 -0
  35. package/dist/config/stageConfig.test.d.ts +2 -0
  36. package/dist/config/stageConfig.test.d.ts.map +1 -0
  37. package/dist/didkit_wasm_bg.wasm +0 -0
  38. package/dist/docker-entry.d.ts +1 -1
  39. package/dist/docker-entry.d.ts.map +1 -1
  40. package/dist/helpers/share-content-auth/adapters.d.ts +12 -0
  41. package/dist/helpers/share-content-auth/adapters.d.ts.map +1 -0
  42. package/dist/helpers/share-content-auth/canonical.d.ts +15 -0
  43. package/dist/helpers/share-content-auth/canonical.d.ts.map +1 -0
  44. package/dist/helpers/share-content-auth/claims.d.ts +19 -0
  45. package/dist/helpers/share-content-auth/claims.d.ts.map +1 -0
  46. package/dist/helpers/share-content-auth/config.d.ts +12 -0
  47. package/dist/helpers/share-content-auth/config.d.ts.map +1 -0
  48. package/dist/helpers/share-content-auth/index.d.ts +8 -0
  49. package/dist/helpers/share-content-auth/index.d.ts.map +1 -0
  50. package/dist/helpers/share-content-auth/token.d.ts +28 -0
  51. package/dist/helpers/share-content-auth/token.d.ts.map +1 -0
  52. package/dist/helpers/share-content-auth/types.d.ts +70 -0
  53. package/dist/helpers/share-content-auth/types.d.ts.map +1 -0
  54. package/dist/helpers/share-content-auth/verifier.d.ts +9 -0
  55. package/dist/helpers/share-content-auth/verifier.d.ts.map +1 -0
  56. package/dist/index.js +2 -2
  57. package/dist/models/ShareContent.d.ts +160 -0
  58. package/dist/models/ShareContent.d.ts.map +1 -0
  59. package/dist/models/index.d.ts +1 -0
  60. package/dist/models/index.d.ts.map +1 -1
  61. package/dist/share-content/config.d.ts +28 -0
  62. package/dist/share-content/config.d.ts.map +1 -0
  63. package/dist/share-content/index.d.ts +6 -0
  64. package/dist/share-content/index.d.ts.map +1 -0
  65. package/dist/share-content/plugin.d.ts +5 -0
  66. package/dist/share-content/plugin.d.ts.map +1 -0
  67. package/dist/share-content/production.d.ts +15 -0
  68. package/dist/share-content/production.d.ts.map +1 -0
  69. package/dist/share-content/runtime.d.ts +23 -0
  70. package/dist/share-content/runtime.d.ts.map +1 -0
  71. package/dist/share-content/types.d.ts +23 -0
  72. package/dist/share-content/types.d.ts.map +1 -0
  73. package/esbuildPlugins.cjs +1 -0
  74. package/lambda.ts +22 -92
  75. package/lambdaApp.ts +163 -0
  76. package/oidcLambda.test.ts +41 -0
  77. package/oidcLambda.ts +13 -19
  78. package/oidcLambdaApp.ts +23 -0
  79. package/package.json +18 -16
  80. package/serverless-local.yml +3 -1
  81. package/serverless.function-env.cjs +31 -0
  82. package/serverless.yml +31 -22
  83. package/src/accesslayer/share-content/delete.ts +124 -0
  84. package/src/accesslayer/share-content/index.ts +70 -0
  85. package/src/accesslayer/share-content/initialize.ts +24 -0
  86. package/src/accesslayer/share-content/internal.ts +89 -0
  87. package/src/accesslayer/share-content/put.ts +93 -0
  88. package/src/accesslayer/share-content/read.ts +124 -0
  89. package/src/accesslayer/share-content/types.ts +155 -0
  90. package/src/config/applyDockerStageConfig.ts +6 -0
  91. package/src/config/environment.ts +33 -0
  92. package/src/config/serverlessFunctionEnv.test.ts +81 -0
  93. package/src/config/stageConfig.test.ts +26 -0
  94. package/src/config/stageConfig.ts +24 -0
  95. package/src/docker-entry.ts +21 -0
  96. package/src/helpers/share-content-auth/adapters.ts +48 -0
  97. package/src/helpers/share-content-auth/canonical.ts +91 -0
  98. package/src/helpers/share-content-auth/claims.ts +164 -0
  99. package/src/helpers/share-content-auth/config.ts +160 -0
  100. package/src/helpers/share-content-auth/index.ts +59 -0
  101. package/src/helpers/share-content-auth/token.ts +148 -0
  102. package/src/helpers/share-content-auth/types.ts +195 -0
  103. package/src/helpers/share-content-auth/verifier.ts +220 -0
  104. package/src/models/ShareContent.ts +198 -0
  105. package/src/models/index.ts +1 -0
  106. package/src/share-content/config.ts +199 -0
  107. package/src/share-content/index.ts +5 -0
  108. package/src/share-content/plugin.ts +317 -0
  109. package/src/share-content/production.ts +107 -0
  110. package/src/share-content/runtime.ts +90 -0
  111. package/src/share-content/types.ts +59 -0
  112. package/test/share-content-auth.spec.ts +1161 -0
  113. package/test/share-content-config.spec.ts +252 -0
  114. package/test/share-content-didkit.spec.ts +411 -0
  115. package/test/share-content-endpoint.spec.ts +825 -0
  116. package/test/share-content-redis-setup.ts +18 -0
  117. package/test/share-content.spec.ts +681 -0
  118. package/vitest.config.ts +4 -0
  119. package/vitest.share-content-config-unit.config.ts +8 -0
  120. package/vitest.share-content-endpoint.config.ts +21 -0
  121. package/vitest.share-content.config.ts +19 -0
  122. package/xApiLambda.test.ts +41 -0
  123. package/xApiLambda.ts +13 -19
  124. package/xApiLambdaApp.ts +23 -0
@@ -0,0 +1,19 @@
1
+ import { type ShareContentAuthorizationClaims, type ShareContentTrustConfig } from './types';
2
+ export declare const SHARE_ID_BYTES = 16;
3
+ export type SignedClaimsResult = {
4
+ ok: true;
5
+ raw: unknown;
6
+ } | {
7
+ ok: false;
8
+ reason: 'MALFORMED_CLAIMS';
9
+ };
10
+ export declare const extractSignedClaims: (payload: Record<string, unknown>) => SignedClaimsResult;
11
+ export type ParseClaimsResult = {
12
+ ok: true;
13
+ claims: ShareContentAuthorizationClaims;
14
+ } | {
15
+ ok: false;
16
+ reason: 'MALFORMED_CLAIMS' | 'UNKNOWN_CLAIM_FIELD' | 'INVALID_CLAIMS' | 'INVALID_SHARE_ID' | 'INVALID_IDENTIFIER' | 'INVALID_JTI' | 'OPERATION_NOT_ALLOWED' | 'PURPOSE_MISMATCH';
17
+ };
18
+ export declare const parseShareContentAuthorizationClaims: (raw: unknown, config: ShareContentTrustConfig) => ParseClaimsResult;
19
+ //# sourceMappingURL=claims.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claims.d.ts","sourceRoot":"","sources":["../../../src/helpers/share-content-auth/claims.ts"],"names":[],"mappings":"AAUA,OAAO,EAGH,KAAK,+BAA+B,EACpC,KAAK,uBAAuB,EAC/B,MAAM,SAAS,CAAC;AAGjB,eAAO,MAAM,cAAc,KAAK,CAAC;AAIjC,MAAM,MAAM,kBAAkB,GAC1B;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,GAAG,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,kBAAkB,CAAA;CAAE,CAAC;AAO3E,eAAO,MAAM,mBAAmB,GAAI,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAG,kBAyBtE,CAAC;AAEF,MAAM,MAAM,iBAAiB,GACvB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,+BAA+B,CAAA;CAAE,GACrD;IACI,EAAE,EAAE,KAAK,CAAC;IACV,MAAM,EACA,kBAAkB,GAClB,qBAAqB,GACrB,gBAAgB,GAChB,kBAAkB,GAClB,oBAAoB,GACpB,aAAa,GACb,uBAAuB,GACvB,kBAAkB,CAAC;CAC5B,CAAC;AAOR,eAAO,MAAM,oCAAoC,GAC7C,KAAK,OAAO,EACZ,QAAQ,uBAAuB,KAChC,iBAmFF,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { ShareContentTrustConfig } from './types';
2
+ export declare const HARD_MAX_TOKEN_TTL_SECONDS = 60;
3
+ export declare const HARD_MAX_CLOCK_SKEW_SECONDS = 60;
4
+ export declare const HARD_MIN_TOKEN_BYTES = 256;
5
+ export declare const HARD_MAX_TOKEN_BYTES = 65536;
6
+ export declare const DEFAULT_MAX_TOKEN_BYTES = 8192;
7
+ export declare const DEFAULT_MIN_JTI_LENGTH = 16;
8
+ export declare const DEFAULT_MAX_JTI_LENGTH = 128;
9
+ export declare const DISABLED_SHARE_CONTENT_TRUST_CONFIG: ShareContentTrustConfig;
10
+ export declare const resolveShareContentTrustConfig: (raw: unknown) => ShareContentTrustConfig;
11
+ export declare const isShareContentTrustConfigActive: (config: ShareContentTrustConfig) => boolean;
12
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/helpers/share-content-auth/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAWvD,eAAO,MAAM,0BAA0B,KAAK,CAAC;AAC7C,eAAO,MAAM,2BAA2B,KAAK,CAAC;AAC9C,eAAO,MAAM,oBAAoB,MAAM,CAAC;AACxC,eAAO,MAAM,oBAAoB,QAAS,CAAC;AAC3C,eAAO,MAAM,uBAAuB,OAAQ,CAAC;AAC7C,eAAO,MAAM,sBAAsB,KAAK,CAAC;AACzC,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAE1C,eAAO,MAAM,mCAAmC,EAAE,uBAWhD,CAAC;AA2CH,eAAO,MAAM,8BAA8B,GAAI,KAAK,OAAO,KAAG,uBA+E7D,CAAC;AAGF,eAAO,MAAM,+BAA+B,GAAI,QAAQ,uBAAuB,KAAG,OAIlC,CAAC"}
@@ -0,0 +1,8 @@
1
+ export * from './types';
2
+ export { SHARE_ID_BYTES, extractSignedClaims, parseShareContentAuthorizationClaims, } from './claims';
3
+ export { DEFAULT_MAX_CANONICAL_DEPTH, DEFAULT_MAX_CANONICAL_REQUEST_BYTES, ShareContentCanonicalizationError, canonicalizeShareContentRequestBody, computeShareContentRequestHash, isBoundedNonce, isCanonicalBase64Url, isOpaqueIdentifier, isPlainObject, isSafeContentVersion, isSafeEpochSecond, isSha256Hex, isShareContentOperation, } from './canonical';
4
+ export { DEFAULT_MAX_JTI_LENGTH, DEFAULT_MAX_TOKEN_BYTES, DEFAULT_MIN_JTI_LENGTH, DISABLED_SHARE_CONTENT_TRUST_CONFIG, HARD_MAX_CLOCK_SKEW_SECONDS, HARD_MAX_TOKEN_BYTES, HARD_MAX_TOKEN_TTL_SECONDS, HARD_MIN_TOKEN_BYTES, isShareContentTrustConfigActive, resolveShareContentTrustConfig, } from './config';
5
+ export { parseCompactJwt, validateShareContentJwtHeader } from './token';
6
+ export { createShareContentAuthorizationVerifier, type CreateShareContentAuthorizationVerifierDependencies, } from './verifier';
7
+ export { createDidkitPresentationVerifier, createSetIfAbsentReplayStore, type LearnCardLike, type SetIfAbsent, } from './adapters';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/helpers/share-content-auth/index.ts"],"names":[],"mappings":"AAeA,cAAc,SAAS,CAAC;AACxB,OAAO,EACH,cAAc,EACd,mBAAmB,EACnB,oCAAoC,GACvC,MAAM,UAAU,CAAC;AAClB,OAAO,EACH,2BAA2B,EAC3B,mCAAmC,EACnC,iCAAiC,EACjC,mCAAmC,EACnC,8BAA8B,EAC9B,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EAClB,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EACjB,WAAW,EACX,uBAAuB,GAC1B,MAAM,aAAa,CAAC;AACrB,OAAO,EACH,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,EACtB,mCAAmC,EACnC,2BAA2B,EAC3B,oBAAoB,EACpB,0BAA0B,EAC1B,oBAAoB,EACpB,+BAA+B,EAC/B,8BAA8B,GACjC,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,eAAe,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAC;AACzE,OAAO,EACH,uCAAuC,EACvC,KAAK,mDAAmD,GAC3D,MAAM,YAAY,CAAC;AACpB,OAAO,EACH,gCAAgC,EAChC,4BAA4B,EAC5B,KAAK,aAAa,EAClB,KAAK,WAAW,GACnB,MAAM,YAAY,CAAC"}
@@ -0,0 +1,28 @@
1
+ import type { ShareContentTrustConfig } from './types';
2
+ export type ParsedCompactJwt = {
3
+ header: Record<string, unknown>;
4
+ payload: Record<string, unknown>;
5
+ signingInput: string;
6
+ signature: string;
7
+ };
8
+ export type ParseCompactJwtResult = {
9
+ ok: true;
10
+ parsed: ParsedCompactJwt;
11
+ } | {
12
+ ok: false;
13
+ reason: 'TOKEN_TOO_LARGE' | 'MALFORMED_TOKEN';
14
+ };
15
+ export declare const parseCompactJwt: (token: unknown, maxBytes: number) => ParseCompactJwtResult;
16
+ export type ValidatedJwtHeader = {
17
+ signerDid: string;
18
+ verificationMethod: string;
19
+ };
20
+ export type ValidateJwtHeaderResult = {
21
+ ok: true;
22
+ value: ValidatedJwtHeader;
23
+ } | {
24
+ ok: false;
25
+ reason: 'UNSUPPORTED_HEADER' | 'UNSUPPORTED_ALGORITHM' | 'MISSING_KID' | 'UNKNOWN_SIGNER' | 'UNKNOWN_VERIFICATION_METHOD';
26
+ };
27
+ export declare const validateShareContentJwtHeader: (header: Record<string, unknown>, config: ShareContentTrustConfig) => ValidateJwtHeaderResult;
28
+ //# sourceMappingURL=token.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../../src/helpers/share-content-auth/token.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAcvD,MAAM,MAAM,gBAAgB,GAAG;IAC3B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAC3B;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,gBAAgB,CAAA;CAAE,GACtC;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,iBAAiB,GAAG,iBAAiB,CAAA;CAAE,CAAC;AAEnE,eAAO,MAAM,eAAe,GAAI,OAAO,OAAO,EAAE,UAAU,MAAM,KAAG,qBA8ClE,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC7B,SAAS,EAAE,MAAM,CAAC;IAElB,kBAAkB,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAC7B;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,kBAAkB,CAAA;CAAE,GACvC;IACI,EAAE,EAAE,KAAK,CAAC;IACV,MAAM,EACA,oBAAoB,GACpB,uBAAuB,GACvB,aAAa,GACb,gBAAgB,GAChB,6BAA6B,CAAC;CACvC,CAAC;AAOR,eAAO,MAAM,6BAA6B,GACtC,QAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,QAAQ,uBAAuB,KAChC,uBA+CF,CAAC"}
@@ -0,0 +1,70 @@
1
+ export declare const SHARE_CONTENT_AUTH_PURPOSE: "lc-share-content/v1";
2
+ export declare const SHARE_CONTENT_OPERATIONS: readonly ["put", "get", "stat", "delete", "readRecovery"];
3
+ export type ShareContentOperation = (typeof SHARE_CONTENT_OPERATIONS)[number];
4
+ export declare const SHARE_CONTENT_CLAIM_FIELDS: readonly ["iss", "aud", "purpose", "namespace", "op", "shareId", "contentVersion", "ownerProfileId", "objectId", "operationId", "requestHash", "iat", "exp", "jti"];
5
+ export type ShareContentClaimField = (typeof SHARE_CONTENT_CLAIM_FIELDS)[number];
6
+ export type ShareContentAuthorizationClaims = {
7
+ iss: string;
8
+ aud: string;
9
+ purpose: typeof SHARE_CONTENT_AUTH_PURPOSE;
10
+ namespace: string;
11
+ op: ShareContentOperation;
12
+ shareId: string;
13
+ contentVersion: number;
14
+ ownerProfileId: string;
15
+ objectId: string;
16
+ operationId: string;
17
+ requestHash: string;
18
+ iat: number;
19
+ exp: number;
20
+ jti: string;
21
+ };
22
+ export type ShareContentAuthorizationRequest = {
23
+ namespace: string;
24
+ op: ShareContentOperation;
25
+ shareId: string;
26
+ contentVersion: number;
27
+ ownerProfileId: string;
28
+ objectId: string;
29
+ operationId: string;
30
+ requestHash: string;
31
+ };
32
+ export type ShareContentAuthorizationContext = {
33
+ signerDid: string;
34
+ verificationMethod: string;
35
+ claims: ShareContentAuthorizationClaims;
36
+ };
37
+ export type PresentationVerificationResult = {
38
+ checks: string[];
39
+ warnings: string[];
40
+ errors: string[];
41
+ };
42
+ export type PresentationVerifier = (token: string) => Promise<PresentationVerificationResult>;
43
+ export type ReplayStore = {
44
+ consumeOnce: (key: string, ttlSeconds: number) => Promise<boolean>;
45
+ };
46
+ export type ShareContentTrustConfig = {
47
+ enabled: boolean;
48
+ audience: string;
49
+ allowedServiceDids: readonly string[];
50
+ allowedVerificationMethods: readonly string[];
51
+ allowedAlgorithms: readonly string[];
52
+ clockSkewSeconds: number;
53
+ maxTokenTtlSeconds: number;
54
+ maxTokenBytes: number;
55
+ minJtiLength: number;
56
+ maxJtiLength: number;
57
+ };
58
+ export type ShareContentAuthorizationRejectionReason = 'DISABLED' | 'INVALID_REQUEST' | 'TOKEN_TOO_LARGE' | 'MALFORMED_TOKEN' | 'UNSUPPORTED_HEADER' | 'UNSUPPORTED_ALGORITHM' | 'MISSING_KID' | 'UNKNOWN_SIGNER' | 'UNKNOWN_VERIFICATION_METHOD' | 'SIGNATURE_INVALID' | 'SIGNER_MISMATCH' | 'MALFORMED_CLAIMS' | 'UNKNOWN_CLAIM_FIELD' | 'INVALID_CLAIMS' | 'INVALID_SHARE_ID' | 'INVALID_IDENTIFIER' | 'INVALID_JTI' | 'AUDIENCE_MISMATCH' | 'PURPOSE_MISMATCH' | 'OPERATION_NOT_ALLOWED' | 'INVALID_TTL' | 'TOKEN_EXPIRED' | 'TOKEN_NOT_YET_VALID' | 'REQUEST_BINDING_MISMATCH' | 'REQUEST_HASH_MISMATCH' | 'REPLAY_DETECTED' | 'REPLAY_STORE_UNAVAILABLE';
59
+ export type ShareContentAuthorizationResult = {
60
+ ok: true;
61
+ context: ShareContentAuthorizationContext;
62
+ } | {
63
+ ok: false;
64
+ reason: ShareContentAuthorizationRejectionReason;
65
+ };
66
+ export type ShareContentAuthorizationVerifier = {
67
+ config: ShareContentTrustConfig;
68
+ authorize: (request: ShareContentAuthorizationRequest, token: string) => Promise<ShareContentAuthorizationResult>;
69
+ };
70
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":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AAiB,GACjB,0BAA0B,CAAC;AAEjC,MAAM,MAAM,+BAA+B,GACrC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,gCAAgC,CAAA;CAAE,GACvD;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,wCAAwC,CAAA;CAAE,CAAC;AAEtE,MAAM,MAAM,iCAAiC,GAAG;IAC5C,MAAM,EAAE,uBAAuB,CAAC;IAChC,SAAS,EAAE,CACP,OAAO,EAAE,gCAAgC,EACzC,KAAK,EAAE,MAAM,KACZ,OAAO,CAAC,+BAA+B,CAAC,CAAC;CACjD,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { type PresentationVerifier, type ReplayStore, type ShareContentAuthorizationVerifier, type ShareContentTrustConfig } from './types';
2
+ export type CreateShareContentAuthorizationVerifierDependencies = {
3
+ config: ShareContentTrustConfig;
4
+ verifyPresentation: PresentationVerifier;
5
+ replayStore: ReplayStore;
6
+ now?: () => number;
7
+ };
8
+ export declare const createShareContentAuthorizationVerifier: (dependencies: CreateShareContentAuthorizationVerifierDependencies) => ShareContentAuthorizationVerifier;
9
+ //# sourceMappingURL=verifier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verifier.d.ts","sourceRoot":"","sources":["../../../src/helpers/share-content-auth/verifier.ts"],"names":[],"mappings":"AAiBA,OAAO,EAGH,KAAK,oBAAoB,EACzB,KAAK,WAAW,EAIhB,KAAK,iCAAiC,EACtC,KAAK,uBAAuB,EAC/B,MAAM,SAAS,CAAC;AAEjB,MAAM,MAAM,mDAAmD,GAAG;IAC9D,MAAM,EAAE,uBAAuB,CAAC;IAEhC,kBAAkB,EAAE,oBAAoB,CAAC;IAEzC,WAAW,EAAE,WAAW,CAAC;IAEzB,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACtB,CAAC;AAyDF,eAAO,MAAM,uCAAuC,GAChD,cAAc,mDAAmD,KAClE,iCA2HF,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/dist/index.js
3
- size: 53188776 bytes
4
- sha256: 321a4cfb7bb7c95df1cf85022ba6c02d9ebe8e6a76f81a3443817acab070ba2d
3
+ size: 53503108 bytes
4
+ sha256: 03a059be37d9873c94b453813b19e4720e22d5204f11248e83c67578612a4679
@@ -0,0 +1,160 @@
1
+ import { z } from 'zod';
2
+ import { type ShareEnvelope, type ShareOwnerRecovery } from '@learncard/types';
3
+ export declare const SHARE_CONTENT_COLLECTION = "share_content";
4
+ export declare const ShareContentNamespaceValidator: z.ZodString;
5
+ export type ShareContentNamespace = z.infer<typeof ShareContentNamespaceValidator>;
6
+ export declare const ShareContentOwnerProfileIdValidator: z.ZodString;
7
+ export type ShareContentOwnerProfileId = z.infer<typeof ShareContentOwnerProfileIdValidator>;
8
+ export declare const ShareContentObjectIdValidator: z.ZodString;
9
+ export type ShareContentObjectId = z.infer<typeof ShareContentObjectIdValidator>;
10
+ export declare const ShareContentOperationIdValidator: z.ZodString;
11
+ export type ShareContentOperationId = z.infer<typeof ShareContentOperationIdValidator>;
12
+ export declare const ShareContentVersionValidator: z.ZodNumber & z.ZodType<number, number, z.core.$ZodTypeInternals<number, number>>;
13
+ export type ShareContentContentVersion = z.infer<typeof ShareContentVersionValidator>;
14
+ export declare const ShareContentHashValidator: z.ZodString;
15
+ export type ShareContentHash = z.infer<typeof ShareContentHashValidator>;
16
+ export declare const ShareContentOwnerRecoveryValidator: z.ZodObject<{
17
+ protected: z.ZodString;
18
+ iv: z.ZodString;
19
+ ciphertext: z.ZodString;
20
+ tag: z.ZodString;
21
+ aad: z.ZodOptional<z.ZodString>;
22
+ recipients: z.ZodOptional<z.ZodArray<z.ZodObject<{
23
+ header: z.ZodObject<{
24
+ alg: z.ZodString;
25
+ iv: z.ZodString;
26
+ tag: z.ZodString;
27
+ epk: z.ZodOptional<z.ZodObject<{
28
+ kty: z.ZodOptional<z.ZodString>;
29
+ crv: z.ZodOptional<z.ZodString>;
30
+ x: z.ZodOptional<z.ZodString>;
31
+ y: z.ZodOptional<z.ZodOptional<z.ZodString>>;
32
+ n: z.ZodOptional<z.ZodOptional<z.ZodString>>;
33
+ d: z.ZodOptional<z.ZodOptional<z.ZodString>>;
34
+ }, z.core.$strip>>;
35
+ kid: z.ZodOptional<z.ZodString>;
36
+ apv: z.ZodOptional<z.ZodString>;
37
+ apu: z.ZodOptional<z.ZodString>;
38
+ }, z.core.$strip>;
39
+ encrypted_key: z.ZodString;
40
+ }, z.core.$strip>>>;
41
+ }, z.core.$strict>;
42
+ export type ShareContentOwnerRecovery = z.infer<typeof ShareContentOwnerRecoveryValidator>;
43
+ export declare const ShareContentObjectBindingValidator: z.ZodObject<{
44
+ namespace: z.ZodString;
45
+ ownerProfileId: z.ZodString;
46
+ shareId: z.ZodString;
47
+ contentVersion: z.ZodNumber & z.ZodType<number, number, z.core.$ZodTypeInternals<number, number>>;
48
+ objectId: z.ZodString;
49
+ operationId: z.ZodString;
50
+ }, z.core.$strict>;
51
+ export type ShareContentObjectBinding = z.infer<typeof ShareContentObjectBindingValidator>;
52
+ export declare const ShareContentPutInputValidator: z.ZodObject<{
53
+ namespace: z.ZodString;
54
+ ownerProfileId: z.ZodString;
55
+ shareId: z.ZodString;
56
+ contentVersion: z.ZodNumber & z.ZodType<number, number, z.core.$ZodTypeInternals<number, number>>;
57
+ objectId: z.ZodString;
58
+ operationId: z.ZodString;
59
+ envelope: z.ZodObject<{
60
+ v: z.ZodLiteral<1>;
61
+ alg: z.ZodLiteral<"A256GCM">;
62
+ iv: z.ZodString;
63
+ ct: z.ZodString;
64
+ }, z.core.$strict>;
65
+ ownerEncryptedRecovery: z.ZodObject<{
66
+ protected: z.ZodString;
67
+ iv: z.ZodString;
68
+ ciphertext: z.ZodString;
69
+ tag: z.ZodString;
70
+ aad: z.ZodOptional<z.ZodString>;
71
+ recipients: z.ZodOptional<z.ZodArray<z.ZodObject<{
72
+ header: z.ZodObject<{
73
+ alg: z.ZodString;
74
+ iv: z.ZodString;
75
+ tag: z.ZodString;
76
+ epk: z.ZodOptional<z.ZodObject<{
77
+ kty: z.ZodOptional<z.ZodString>;
78
+ crv: z.ZodOptional<z.ZodString>;
79
+ x: z.ZodOptional<z.ZodString>;
80
+ y: z.ZodOptional<z.ZodOptional<z.ZodString>>;
81
+ n: z.ZodOptional<z.ZodOptional<z.ZodString>>;
82
+ d: z.ZodOptional<z.ZodOptional<z.ZodString>>;
83
+ }, z.core.$strip>>;
84
+ kid: z.ZodOptional<z.ZodString>;
85
+ apv: z.ZodOptional<z.ZodString>;
86
+ apu: z.ZodOptional<z.ZodString>;
87
+ }, z.core.$strip>;
88
+ encrypted_key: z.ZodString;
89
+ }, z.core.$strip>>>;
90
+ }, z.core.$strict>;
91
+ }, z.core.$strict>;
92
+ export type ShareContentPutInput = z.infer<typeof ShareContentPutInputValidator>;
93
+ export declare const computeShareContentHash: (input: ShareContentPutInput) => string;
94
+ export declare const computeSharePayloadHash: (input: Pick<ShareContentPutInput, "envelope" | "ownerEncryptedRecovery">) => string;
95
+ export declare const measureShareContentPayload: (input: Pick<ShareContentPutInput, "envelope" | "ownerEncryptedRecovery">) => {
96
+ ciphertextBytes: number;
97
+ recoveryBytes: number;
98
+ };
99
+ export declare const MongoShareContentActiveValidator: z.ZodObject<{
100
+ namespace: z.ZodString;
101
+ ownerProfileId: z.ZodString;
102
+ shareId: z.ZodString;
103
+ contentVersion: z.ZodNumber & z.ZodType<number, number, z.core.$ZodTypeInternals<number, number>>;
104
+ objectId: z.ZodString;
105
+ operationId: z.ZodString;
106
+ kind: z.ZodLiteral<"active">;
107
+ contentHash: z.ZodString;
108
+ payloadHash: z.ZodString;
109
+ envelope: z.ZodObject<{
110
+ v: z.ZodLiteral<1>;
111
+ alg: z.ZodLiteral<"A256GCM">;
112
+ iv: z.ZodString;
113
+ ct: z.ZodString;
114
+ }, z.core.$strict>;
115
+ ownerEncryptedRecovery: z.ZodObject<{
116
+ protected: z.ZodString;
117
+ iv: z.ZodString;
118
+ ciphertext: z.ZodString;
119
+ tag: z.ZodString;
120
+ aad: z.ZodOptional<z.ZodString>;
121
+ recipients: z.ZodOptional<z.ZodArray<z.ZodObject<{
122
+ header: z.ZodObject<{
123
+ alg: z.ZodString;
124
+ iv: z.ZodString;
125
+ tag: z.ZodString;
126
+ epk: z.ZodOptional<z.ZodObject<{
127
+ kty: z.ZodOptional<z.ZodString>;
128
+ crv: z.ZodOptional<z.ZodString>;
129
+ x: z.ZodOptional<z.ZodString>;
130
+ y: z.ZodOptional<z.ZodOptional<z.ZodString>>;
131
+ n: z.ZodOptional<z.ZodOptional<z.ZodString>>;
132
+ d: z.ZodOptional<z.ZodOptional<z.ZodString>>;
133
+ }, z.core.$strip>>;
134
+ kid: z.ZodOptional<z.ZodString>;
135
+ apv: z.ZodOptional<z.ZodString>;
136
+ apu: z.ZodOptional<z.ZodString>;
137
+ }, z.core.$strip>;
138
+ encrypted_key: z.ZodString;
139
+ }, z.core.$strip>>>;
140
+ }, z.core.$strict>;
141
+ ciphertextBytes: z.ZodNumber;
142
+ recoveryBytes: z.ZodNumber;
143
+ createdAt: z.ZodDate;
144
+ }, z.core.$strict>;
145
+ export type MongoShareContentActive = z.infer<typeof MongoShareContentActiveValidator>;
146
+ export declare const MongoShareContentTombstoneValidator: z.ZodObject<{
147
+ namespace: z.ZodString;
148
+ ownerProfileId: z.ZodString;
149
+ shareId: z.ZodString;
150
+ contentVersion: z.ZodNumber & z.ZodType<number, number, z.core.$ZodTypeInternals<number, number>>;
151
+ objectId: z.ZodString;
152
+ operationId: z.ZodString;
153
+ kind: z.ZodLiteral<"tombstone">;
154
+ contentHash: z.ZodOptional<z.ZodString>;
155
+ deletedAt: z.ZodDate;
156
+ }, z.core.$strict>;
157
+ export type MongoShareContentTombstone = z.infer<typeof MongoShareContentTombstoneValidator>;
158
+ export type MongoShareContentDocument = MongoShareContentActive | MongoShareContentTombstone;
159
+ export type { ShareEnvelope, ShareOwnerRecovery };
160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;kBASlC,CAAC;AACd,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAC;AAM3F,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAG/B,CAAC;AACZ,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAQjF,eAAO,MAAM,uBAAuB,GAAI,OAAO,oBAAoB,KAAG,MAUhE,CAAC;AAGP,eAAO,MAAM,uBAAuB,GAChC,OAAO,IAAI,CAAC,oBAAoB,EAAE,UAAU,GAAG,wBAAwB,CAAC,KACzE,MAIG,CAAC;AAMP,eAAO,MAAM,0BAA0B,GACnC,OAAO,IAAI,CAAC,oBAAoB,EAAE,UAAU,GAAG,wBAAwB,CAAC,KACzE;IAAE,eAAe,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAWlD,CAAC;AAGF,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBASlC,CAAC;AACZ,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC;AAOvF,eAAO,MAAM,mCAAmC;;;;;;;;;;kBAIrC,CAAC;AACZ,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mCAAmC,CAAC,CAAC;AAG7F,MAAM,MAAM,yBAAyB,GAAG,uBAAuB,GAAG,0BAA0B,CAAC;AAG7F,YAAY,EAAE,aAAa,EAAE,kBAAkB,EAAE,CAAC"}
@@ -1,5 +1,6 @@
1
1
  export * from './Credential';
2
2
  export * from './CredentialRecord';
3
3
  export * from './CustomDocument';
4
+ export * from './ShareContent';
4
5
  export * from './User';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { type ShareContentTrustConfig } from '../helpers/share-content-auth';
2
+ import { type ShareContentPluginOptions } from './types';
3
+ export type ShareContentNamespacePolicy = {
4
+ isAllowed: (serviceDid: string, namespace: string) => boolean;
5
+ allowedNamespacesFor: (serviceDid: string) => readonly string[];
6
+ };
7
+ export type ResolvedShareContentConfig = {
8
+ status: 'disabled';
9
+ } | {
10
+ status: 'invalid';
11
+ errors: readonly string[];
12
+ } | {
13
+ status: 'enabled';
14
+ trustConfig: ShareContentTrustConfig;
15
+ namespacePolicy: ShareContentNamespacePolicy;
16
+ };
17
+ export declare const parseShareContentNamespaceBindings: (value: unknown) => Map<string, readonly string[]> | null;
18
+ export declare const resolveShareContentConfig: (raw: unknown) => ResolvedShareContentConfig;
19
+ export declare const getShareContentRawConfig: (environment: {
20
+ SHARE_CONTENT_AUDIENCE?: string;
21
+ SHARE_CONTENT_SERVICE_DIDS?: string;
22
+ SHARE_CONTENT_VERIFICATION_METHODS?: string;
23
+ SHARE_CONTENT_NAMESPACE_BINDINGS?: string;
24
+ }) => Record<string, unknown>;
25
+ export declare const toShareContentPluginOptions: (config: Extract<ResolvedShareContentConfig, {
26
+ status: "enabled";
27
+ }>, dependencies: Pick<ShareContentPluginOptions, "verifier" | "repository">) => ShareContentPluginOptions;
28
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"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,KACzE,yBAID,CAAC"}
@@ -0,0 +1,6 @@
1
+ export * from './types';
2
+ export * from './config';
3
+ export * from './plugin';
4
+ export * from './runtime';
5
+ export * from './production';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/share-content/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { FastifyPluginAsync } from 'fastify';
2
+ import { type ShareContentPluginOptions } from './types';
3
+ export declare const shareContentFastifyPlugin: FastifyPluginAsync<ShareContentPluginOptions>;
4
+ export default shareContentFastifyPlugin;
5
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/share-content/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmB,kBAAkB,EAAgC,MAAM,SAAS,CAAC;AAejG,OAAO,EAGH,KAAK,yBAAyB,EAEjC,MAAM,SAAS,CAAC;AAgPjB,eAAO,MAAM,yBAAyB,EAAE,kBAAkB,CAAC,yBAAyB,CAsDnF,CAAC;AAEF,eAAe,yBAAyB,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { type ShareContentRepository } from '../accesslayer/share-content';
2
+ import { type ReplayStore } from '../helpers/share-content-auth';
3
+ import { type ShareContentRuntime } from './runtime';
4
+ export type ShareContentReplayStoreHandle = {
5
+ store: ReplayStore;
6
+ close: () => Promise<void>;
7
+ };
8
+ export declare const createShareContentRedisReplayStore: (options: {
9
+ host: string;
10
+ port: number;
11
+ }) => ShareContentReplayStoreHandle;
12
+ export declare const createMongoShareContentRepository: () => Promise<ShareContentRepository>;
13
+ export declare const createShareContentRuntimeFromEnvironment: () => Promise<ShareContentRuntime>;
14
+ export declare const assertShareContentEnvironmentConfiguration: () => void;
15
+ //# sourceMappingURL=production.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"production.d.ts","sourceRoot":"","sources":["../../src/share-content/production.ts"],"names":[],"mappings":"AAGA,OAAO,EAGH,KAAK,sBAAsB,EAC9B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAgC,KAAK,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAI7F,OAAO,EAA4B,KAAK,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAY/E,MAAM,MAAM,6BAA6B,GAAG;IACxC,KAAK,EAAE,WAAW,CAAC;IACnB,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,kCAAkC,GAAI,SAAS;IACxD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CAChB,KAAG,6BAkCH,CAAC;AAEF,eAAO,MAAM,iCAAiC,QAAa,OAAO,CAAC,sBAAsB,CAIxF,CAAC;AAcF,eAAO,MAAM,wCAAwC,QAAa,OAAO,CAAC,mBAAmB,CAKvF,CAAC;AAOP,eAAO,MAAM,0CAA0C,QAAO,IAQ7D,CAAC"}
@@ -0,0 +1,23 @@
1
+ import type { FastifyInstance } from 'fastify';
2
+ import type { ShareContentRepository } from '../accesslayer/share-content';
3
+ import { type LearnCardLike, type ReplayStore } from '../helpers/share-content-auth';
4
+ import { type ShareContentPluginOptions } from './types';
5
+ export type ShareContentRuntimeDependencies = {
6
+ getLearnCard: () => Promise<LearnCardLike>;
7
+ createReplayStore: () => {
8
+ store: ReplayStore;
9
+ close: () => Promise<void>;
10
+ };
11
+ getRepository: () => Promise<ShareContentRepository>;
12
+ };
13
+ export type EnabledShareContentRuntime = {
14
+ enabled: true;
15
+ pluginOptions: ShareContentPluginOptions;
16
+ close: () => Promise<void>;
17
+ };
18
+ export type ShareContentRuntime = {
19
+ enabled: false;
20
+ } | EnabledShareContentRuntime;
21
+ export declare const buildShareContentRuntime: (rawConfig: unknown, dependencies: ShareContentRuntimeDependencies) => Promise<ShareContentRuntime>;
22
+ export declare const registerShareContentRoutes: (fastify: FastifyInstance, runtime: EnabledShareContentRuntime) => Promise<void>;
23
+ //# sourceMappingURL=runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/share-content/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAGH,KAAK,aAAa,EAClB,KAAK,WAAW,EACnB,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAA+B,KAAK,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAatF,MAAM,MAAM,+BAA+B,GAAG;IAE1C,YAAY,EAAE,MAAM,OAAO,CAAC,aAAa,CAAC,CAAC;IAE3C,iBAAiB,EAAE,MAAM;QAAE,KAAK,EAAE,WAAW,CAAC;QAAC,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;KAAE,CAAC;IAE5E,aAAa,EAAE,MAAM,OAAO,CAAC,sBAAsB,CAAC,CAAC;CACxD,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACrC,OAAO,EAAE,IAAI,CAAC;IACd,aAAa,EAAE,yBAAyB,CAAC;IAEzC,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAAE,OAAO,EAAE,KAAK,CAAA;CAAE,GAAG,0BAA0B,CAAC;AAElF,eAAO,MAAM,wBAAwB,GACjC,WAAW,OAAO,EAClB,cAAc,+BAA+B,KAC9C,OAAO,CAAC,mBAAmB,CAgC7B,CAAC;AAGF,eAAO,MAAM,0BAA0B,GACnC,SAAS,eAAe,EACxB,SAAS,0BAA0B,KACpC,OAAO,CAAC,IAAI,CAKd,CAAC"}
@@ -0,0 +1,23 @@
1
+ import type { ShareContentRepository } from '../accesslayer/share-content';
2
+ import type { ReplayStore, ShareContentAuthorizationVerifier } from '../helpers/share-content-auth';
3
+ import type { ShareContentNamespacePolicy } from './config';
4
+ export declare const SHARE_CONTENT_PLUGIN_PREFIX = "/internal/share-content";
5
+ export type ShareContentRouteOperation = 'put' | 'get' | 'stat' | 'delete' | 'readRecovery';
6
+ export declare const SHARE_CONTENT_MAX_REQUEST_BYTES: number;
7
+ export declare const SHARE_CONTENT_ERROR_CODES: readonly ["UNAUTHORIZED", "INVALID_INPUT", "PAYLOAD_TOO_LARGE", "NOT_FOUND", "CONFLICT", "UNAVAILABLE"];
8
+ export type ShareContentErrorCode = (typeof SHARE_CONTENT_ERROR_CODES)[number];
9
+ export type ShareContentErrorBody = {
10
+ ok: false;
11
+ error: ShareContentErrorCode;
12
+ };
13
+ export type ShareContentPluginOptions = {
14
+ verifier: ShareContentAuthorizationVerifier;
15
+ repository: ShareContentRepository;
16
+ namespacePolicy: ShareContentNamespacePolicy;
17
+ maxRequestBytes?: number;
18
+ };
19
+ export type ShareContentReplayStoreFactory = () => {
20
+ store: ReplayStore;
21
+ close: () => Promise<void>;
22
+ };
23
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/share-content/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,iCAAiC,EAAE,MAAM,6BAA6B,CAAC;AAElG,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAa5D,eAAO,MAAM,2BAA2B,4BAA4B,CAAC;AAGrE,MAAM,MAAM,0BAA0B,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,cAAc,CAAC;AAG5F,eAAO,MAAM,+BAA+B,QAAc,CAAC;AAM3D,eAAO,MAAM,yBAAyB,yGAO5B,CAAC;AAEX,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/E,MAAM,MAAM,qBAAqB,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,qBAAqB,CAAA;CAAE,CAAC;AAOhF,MAAM,MAAM,yBAAyB,GAAG;IACpC,QAAQ,EAAE,iCAAiC,CAAC;IAC5C,UAAU,EAAE,sBAAsB,CAAC;IACnC,eAAe,EAAE,2BAA2B,CAAC;IAE7C,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAGF,MAAM,MAAM,8BAA8B,GAAG,MAAM;IAC/C,KAAK,EAAE,WAAW,CAAC;IACnB,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B,CAAC"}
@@ -41,6 +41,7 @@ module.exports = [
41
41
  forceCjsSodiumWrapperPlugin,
42
42
  copyDidkitWasmPlugin,
43
43
  sentryEsbuildPlugin({
44
+ telemetry: process.env.SENTRY_BUILD_TELEMETRY !== 'false',
44
45
  authToken: process.env.SENTRY_AUTH_TOKEN,
45
46
  org: process.env.SENTRY_ORG,
46
47
  project: process.env.SENTRY_PROJECT,