@learncard/lca-api-service 1.6.2 → 1.7.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/.env.example +2 -0
- package/AGENTS.md +1 -1
- package/CHANGELOG.md +132 -0
- package/config/config.dev.json +1 -0
- package/config/config.example.json +1 -0
- package/config/config.production.json +1 -0
- package/config/config.scouts.dev.json +1 -0
- package/config/config.scouts.production.json +1 -0
- package/dist/accesslayer/notifications/create.d.ts +2 -1
- package/dist/app.d.ts +70 -8
- package/dist/config/environment.d.ts +6 -0
- package/dist/config/stageConfig.d.ts +4 -0
- package/dist/helpers/analyticsEligibility.d.ts +6 -0
- package/dist/helpers/brainUrl.d.ts +1 -0
- package/dist/helpers/brainUrl.test.d.ts +1 -0
- package/dist/helpers/currentProfile.d.ts +6 -0
- package/dist/helpers/currentProfile.test.d.ts +1 -0
- package/dist/helpers/retryingOnce.d.ts +1 -0
- package/dist/helpers/retryingOnce.test.d.ts +1 -0
- package/dist/index.js +2 -2
- package/dist/models/EscrowHold.d.ts +1 -0
- package/dist/models/EscrowHold.indexes.test.d.ts +1 -0
- package/dist/models/Notification.d.ts +114 -2
- package/dist/models/SigningAuthority.d.ts +1 -1
- package/dist/models/UserKey.d.ts +23 -0
- package/dist/publish-metafile.json +1 -1
- package/dist/routes/credentials.d.ts +1 -1
- package/dist/routes/index.d.ts +5 -0
- package/dist/routes/keys.d.ts +1 -0
- package/dist/routes/notifications.d.ts +65 -4
- package/dist/routes/preferences.test.d.ts +1 -0
- package/dist/routes/signing-authority.d.ts +3 -3
- package/dist/services/escrow-enclave/index.d.ts +2 -0
- package/dist/services/escrow-enclave/logFailure.d.ts +1 -0
- package/dist/types/credentials.d.ts +1 -1
- package/dist/types/notifications.d.ts +118 -2
- package/docs/bedrock-generation.md +7 -6
- package/lambdaApp.test.ts +114 -0
- package/lambdaApp.ts +23 -11
- package/package.json +11 -11
- package/scripts/escrow-lambda-http.ts +74 -0
- package/scripts/verify-escrow-startup.mjs +463 -0
- package/serverless-local.yml +1 -1
- package/serverless.yml +1 -1
- package/src/accesslayer/notifications/create.test.ts +80 -0
- package/src/accesslayer/notifications/create.ts +97 -2
- package/src/config/environment.test.ts +27 -1
- package/src/config/environment.ts +16 -0
- package/src/config/escrowDeployment.test.ts +1 -0
- package/src/docker-entry.ts +1 -2
- package/src/helpers/analyticsEligibility.ts +15 -0
- package/src/helpers/brainUrl.test.ts +13 -0
- package/src/helpers/brainUrl.ts +3 -0
- package/src/helpers/currentProfile.test.ts +55 -0
- package/src/helpers/currentProfile.ts +58 -0
- package/src/helpers/locale.helpers.test.ts +4 -1
- package/src/helpers/locale.helpers.ts +4 -2
- package/src/helpers/retryingOnce.test.ts +33 -0
- package/src/helpers/retryingOnce.ts +18 -0
- package/src/models/EscrowHold.indexes.test.ts +208 -0
- package/src/models/EscrowHold.ts +106 -51
- package/src/models/UserKey.ts +69 -1
- package/src/routes/escrow.ts +30 -12
- package/src/routes/index.ts +5 -8
- package/src/routes/keys.ts +8 -0
- package/src/routes/notifications.ts +34 -1
- package/src/routes/preferences.test.ts +216 -0
- package/src/routes/preferences.ts +54 -4
- package/src/services/escrow-enclave/index.ts +38 -1
- package/src/services/escrow-enclave/logFailure.ts +5 -1
- package/src/services/escrow-enclave/production.test.ts +64 -0
- package/src/services/escrow-enclave/softwareEnclave.test.ts +14 -2
- package/test/jobs/escrowHoldReminders.spec.ts +21 -4
- package/test/keys-escrow.spec.ts +149 -3
- package/test/keys-lifecycle-invariants.spec.ts +235 -0
- package/test/keys-pin-sign-in.spec.ts +34 -2
- package/test/notifications.spec.ts +102 -0
- package/tsconfig.entrypoints.json +1 -1
- package/vitest.config.ts +1 -0
- package/scripts/node24-runtime.cjs +0 -9
- package/scripts/verify-node24-layer.cjs +0 -49
|
@@ -31,10 +31,12 @@ export declare const MongoNotificationValidator: z.ZodObject<{
|
|
|
31
31
|
DEVICE_LINK_REQUEST: "DEVICE_LINK_REQUEST";
|
|
32
32
|
GUARDIAN_APPROVAL_PENDING: "GUARDIAN_APPROVAL_PENDING";
|
|
33
33
|
APP_NOTIFICATION: "APP_NOTIFICATION";
|
|
34
|
+
ANNOUNCEMENT: "ANNOUNCEMENT";
|
|
34
35
|
CREDENTIAL_REVOKED: "CREDENTIAL_REVOKED";
|
|
35
36
|
CREDENTIAL_SUSPENDED: "CREDENTIAL_SUSPENDED";
|
|
36
37
|
CREDENTIAL_UNSUSPENDED: "CREDENTIAL_UNSUSPENDED";
|
|
37
38
|
CREDENTIAL_REFRESHED: "CREDENTIAL_REFRESHED";
|
|
39
|
+
CONSENT_FLOW_CONTRACT_UPDATED: "CONSENT_FLOW_CONTRACT_UPDATED";
|
|
38
40
|
}>;
|
|
39
41
|
to: z.ZodIntersection<z.ZodObject<{
|
|
40
42
|
profileId: z.ZodOptional<z.ZodString>;
|
|
@@ -176,14 +178,120 @@ export declare const MongoNotificationValidator: z.ZodObject<{
|
|
|
176
178
|
}, z.core.$strip>>;
|
|
177
179
|
id: z.ZodString;
|
|
178
180
|
action: z.ZodEnum<{
|
|
179
|
-
update: "update";
|
|
180
|
-
write: "write";
|
|
181
181
|
consent: "consent";
|
|
182
|
+
write: "write";
|
|
183
|
+
update: "update";
|
|
182
184
|
sync: "sync";
|
|
183
185
|
withdraw: "withdraw";
|
|
186
|
+
reconsent: "reconsent";
|
|
184
187
|
}>;
|
|
188
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
189
|
+
relaxed: "relaxed";
|
|
190
|
+
expanded_optional: "expanded_optional";
|
|
191
|
+
requires_consent: "requires_consent";
|
|
192
|
+
}>>;
|
|
185
193
|
date: z.ZodString;
|
|
186
194
|
uris: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
195
|
+
consentedVersion: z.ZodOptional<z.ZodNumber>;
|
|
196
|
+
reconsentDeadline: z.ZodOptional<z.ZodString>;
|
|
197
|
+
newOptionsUntil: z.ZodOptional<z.ZodString>;
|
|
198
|
+
}, z.core.$strip>>;
|
|
199
|
+
contractUri: z.ZodOptional<z.ZodString>;
|
|
200
|
+
contractName: z.ZodOptional<z.ZodString>;
|
|
201
|
+
fromVersion: z.ZodOptional<z.ZodNumber>;
|
|
202
|
+
toVersion: z.ZodOptional<z.ZodNumber>;
|
|
203
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
204
|
+
relaxed: "relaxed";
|
|
205
|
+
expanded_optional: "expanded_optional";
|
|
206
|
+
requires_consent: "requires_consent";
|
|
207
|
+
}>>;
|
|
208
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
209
|
+
diff: z.ZodOptional<z.ZodObject<{
|
|
210
|
+
added: z.ZodArray<z.ZodObject<{
|
|
211
|
+
area: z.ZodEnum<{
|
|
212
|
+
read: "read";
|
|
213
|
+
write: "write";
|
|
214
|
+
}>;
|
|
215
|
+
type: z.ZodEnum<{
|
|
216
|
+
credential: "credential";
|
|
217
|
+
personal: "personal";
|
|
218
|
+
}>;
|
|
219
|
+
key: z.ZodString;
|
|
220
|
+
required: z.ZodBoolean;
|
|
221
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
222
|
+
}, z.core.$strip>>;
|
|
223
|
+
removed: z.ZodArray<z.ZodObject<{
|
|
224
|
+
area: z.ZodEnum<{
|
|
225
|
+
read: "read";
|
|
226
|
+
write: "write";
|
|
227
|
+
}>;
|
|
228
|
+
type: z.ZodEnum<{
|
|
229
|
+
credential: "credential";
|
|
230
|
+
personal: "personal";
|
|
231
|
+
}>;
|
|
232
|
+
key: z.ZodString;
|
|
233
|
+
required: z.ZodBoolean;
|
|
234
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
235
|
+
}, z.core.$strip>>;
|
|
236
|
+
changed: z.ZodArray<z.ZodObject<{
|
|
237
|
+
area: z.ZodEnum<{
|
|
238
|
+
read: "read";
|
|
239
|
+
write: "write";
|
|
240
|
+
}>;
|
|
241
|
+
type: z.ZodEnum<{
|
|
242
|
+
credential: "credential";
|
|
243
|
+
personal: "personal";
|
|
244
|
+
}>;
|
|
245
|
+
key: z.ZodString;
|
|
246
|
+
required: z.ZodBoolean;
|
|
247
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
248
|
+
}, z.core.$strip>>;
|
|
249
|
+
details: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
250
|
+
field: z.ZodEnum<{
|
|
251
|
+
name: "name";
|
|
252
|
+
description: "description";
|
|
253
|
+
image: "image";
|
|
254
|
+
expiresAt: "expiresAt";
|
|
255
|
+
subtitle: "subtitle";
|
|
256
|
+
reasonForAccessing: "reasonForAccessing";
|
|
257
|
+
needsGuardianConsent: "needsGuardianConsent";
|
|
258
|
+
redirectUrl: "redirectUrl";
|
|
259
|
+
frontDoorBoostUri: "frontDoorBoostUri";
|
|
260
|
+
writers: "writers";
|
|
261
|
+
autoboosts: "autoboosts";
|
|
262
|
+
}>;
|
|
263
|
+
before: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean, z.ZodArray<z.ZodString>]>>;
|
|
264
|
+
after: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean, z.ZodArray<z.ZodString>]>>;
|
|
265
|
+
}, z.core.$strip>>>;
|
|
266
|
+
}, z.core.$strip>>;
|
|
267
|
+
reconsentDeadline: z.ZodOptional<z.ZodString>;
|
|
268
|
+
reviewUrl: z.ZodOptional<z.ZodString>;
|
|
269
|
+
preview: z.ZodOptional<z.ZodObject<{
|
|
270
|
+
headline: z.ZodString;
|
|
271
|
+
subhead: z.ZodString;
|
|
272
|
+
rows: z.ZodArray<z.ZodObject<{
|
|
273
|
+
scope: z.ZodObject<{
|
|
274
|
+
area: z.ZodEnum<{
|
|
275
|
+
read: "read";
|
|
276
|
+
write: "write";
|
|
277
|
+
}>;
|
|
278
|
+
type: z.ZodEnum<{
|
|
279
|
+
credential: "credential";
|
|
280
|
+
personal: "personal";
|
|
281
|
+
}>;
|
|
282
|
+
key: z.ZodString;
|
|
283
|
+
required: z.ZodBoolean;
|
|
284
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
285
|
+
}, z.core.$strip>;
|
|
286
|
+
change: z.ZodEnum<{
|
|
287
|
+
added: "added";
|
|
288
|
+
removed: "removed";
|
|
289
|
+
changed: "changed";
|
|
290
|
+
}>;
|
|
291
|
+
label: z.ZodString;
|
|
292
|
+
subtitle: z.ZodString;
|
|
293
|
+
}, z.core.$strip>>;
|
|
294
|
+
primaryLabel: z.ZodString;
|
|
187
295
|
}, z.core.$strip>>;
|
|
188
296
|
inbox: z.ZodOptional<z.ZodObject<{
|
|
189
297
|
issuanceId: z.ZodString;
|
|
@@ -208,6 +316,10 @@ export declare const MongoNotificationValidator: z.ZodObject<{
|
|
|
208
316
|
promptId: z.ZodString;
|
|
209
317
|
counterpartProfileId: z.ZodString;
|
|
210
318
|
}, z.core.$strip>>;
|
|
319
|
+
campaignId: z.ZodOptional<z.ZodString>;
|
|
320
|
+
campaignCreatedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
321
|
+
campaignHasInApp: z.ZodOptional<z.ZodBoolean>;
|
|
322
|
+
campaignTestId: z.ZodOptional<z.ZodUUID>;
|
|
211
323
|
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
212
324
|
}, z.core.$loose>>;
|
|
213
325
|
sent: z.ZodOptional<z.ZodISODateTime>;
|
|
@@ -16,8 +16,8 @@ export declare const MongoSigningAuthorityValidator: z.ZodObject<{
|
|
|
16
16
|
}, z.core.$strip>;
|
|
17
17
|
export declare const SigningAuthorityResponseValidator: z.ZodObject<{
|
|
18
18
|
_id: z.ZodOptional<z.ZodString>;
|
|
19
|
-
ownerDid: z.ZodString;
|
|
20
19
|
name: z.ZodString;
|
|
20
|
+
ownerDid: z.ZodString;
|
|
21
21
|
did: z.ZodString;
|
|
22
22
|
endpoint: z.ZodString;
|
|
23
23
|
}, z.core.$strip>;
|
package/dist/models/UserKey.d.ts
CHANGED
|
@@ -350,6 +350,15 @@ declare const MongoUserKeyBaseValidator: z.ZodObject<{
|
|
|
350
350
|
recoveryEmailVerifiedAt: z.ZodOptional<z.ZodDate>;
|
|
351
351
|
migratedFromWeb3Auth: z.ZodDefault<z.ZodBoolean>;
|
|
352
352
|
migratedAt: z.ZodOptional<z.ZodDate>;
|
|
353
|
+
web3AuthLogin: z.ZodOptional<z.ZodObject<{
|
|
354
|
+
type: z.ZodEnum<{
|
|
355
|
+
firebase: "firebase";
|
|
356
|
+
supertokens: "supertokens";
|
|
357
|
+
keycloak: "keycloak";
|
|
358
|
+
oidc: "oidc";
|
|
359
|
+
}>;
|
|
360
|
+
id: z.ZodString;
|
|
361
|
+
}, z.core.$strip>>;
|
|
353
362
|
sssActivationState: z.ZodOptional<z.ZodEnum<{
|
|
354
363
|
active: "active";
|
|
355
364
|
provisional: "provisional";
|
|
@@ -527,6 +536,15 @@ export declare const MongoUserKeyValidator: z.ZodObject<{
|
|
|
527
536
|
recoveryEmailVerifiedAt: z.ZodOptional<z.ZodDate>;
|
|
528
537
|
migratedFromWeb3Auth: z.ZodDefault<z.ZodBoolean>;
|
|
529
538
|
migratedAt: z.ZodOptional<z.ZodDate>;
|
|
539
|
+
web3AuthLogin: z.ZodOptional<z.ZodObject<{
|
|
540
|
+
type: z.ZodEnum<{
|
|
541
|
+
firebase: "firebase";
|
|
542
|
+
supertokens: "supertokens";
|
|
543
|
+
keycloak: "keycloak";
|
|
544
|
+
oidc: "oidc";
|
|
545
|
+
}>;
|
|
546
|
+
id: z.ZodString;
|
|
547
|
+
}, z.core.$strip>>;
|
|
530
548
|
sssActivationState: z.ZodOptional<z.ZodEnum<{
|
|
531
549
|
active: "active";
|
|
532
550
|
provisional: "provisional";
|
|
@@ -680,6 +698,10 @@ export declare const getUserKeysCollection: () => import("mongodb").Collection<{
|
|
|
680
698
|
recoveryEmail?: string | undefined;
|
|
681
699
|
recoveryEmailVerifiedAt?: Date | undefined;
|
|
682
700
|
migratedAt?: Date | undefined;
|
|
701
|
+
web3AuthLogin?: {
|
|
702
|
+
type: "firebase" | "supertokens" | "keycloak" | "oidc";
|
|
703
|
+
id: string;
|
|
704
|
+
} | undefined;
|
|
683
705
|
sssActivationState?: "active" | "provisional" | undefined;
|
|
684
706
|
provisionalCreatedAt?: Date | undefined;
|
|
685
707
|
securityEpoch?: number | undefined;
|
|
@@ -695,6 +717,7 @@ export declare const upsertUserKey: (contactMethod: ContactMethod, data: Partial
|
|
|
695
717
|
export declare const upsertUserKeyByAuthProvider: (contactMethod: ContactMethod, authProvider: AuthProviderMapping, data: Partial<Omit<MongoUserKeyType, "_id" | "contactMethod" | "createdAt" | "authProviders">>, expectedVersion?: number) => Promise<MongoUserKeyType>;
|
|
696
718
|
export declare const addAuthProviderToUserKey: (contactMethod: ContactMethod, authProvider: AuthProviderMapping) => Promise<void>;
|
|
697
719
|
export declare const addRecoveryMethodToUserKey: (contactMethod: ContactMethod, recoveryMethod: RecoveryMethod) => Promise<void>;
|
|
720
|
+
export declare const isWeb3AuthLogin: (userKey: Pick<MongoUserKeyType, "keyProvider" | "migratedFromWeb3Auth" | "web3AuthLogin" | "authProviders" | "securityEpoch">, authProvider: AuthProviderMapping) => boolean;
|
|
698
721
|
export declare const getSecurityEpoch: (userKey: Pick<MongoUserKeyType, "securityEpoch">) => number;
|
|
699
722
|
export declare const setEscrowBlobByAuthProvider: (authProvider: AuthProviderMapping, blob: Omit<EscrowBlob, "enrollmentEpoch" | "blobHash">, expectedShareVersion: number, pin?: {
|
|
700
723
|
salt: string;
|