@learncard/helpers 1.2.17 → 1.3.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.
@@ -66,6 +66,8 @@ var require_types_cjs_development = __commonJS({
66
66
  AgeRatingValidator: /* @__PURE__ */ __name(() => AgeRatingValidator, "AgeRatingValidator"),
67
67
  AlignmentTargetTypeValidator: /* @__PURE__ */ __name(() => AlignmentTargetTypeValidator, "AlignmentTargetTypeValidator"),
68
68
  AlignmentValidator: /* @__PURE__ */ __name(() => AlignmentValidator, "AlignmentValidator"),
69
+ AllocateCredentialStatusInputValidator: /* @__PURE__ */ __name(() => AllocateCredentialStatusInputValidator, "AllocateCredentialStatusInputValidator"),
70
+ AllocatedBitstringStatusListEntryValidator: /* @__PURE__ */ __name(() => AllocatedBitstringStatusListEntryValidator, "AllocatedBitstringStatusListEntryValidator"),
69
71
  AllowConnectionRequestsEnum: /* @__PURE__ */ __name(() => AllowConnectionRequestsEnum, "AllowConnectionRequestsEnum"),
70
72
  AppBoostValidator: /* @__PURE__ */ __name(() => AppBoostValidator, "AppBoostValidator"),
71
73
  AppEventInputValidator: /* @__PURE__ */ __name(() => AppEventInputValidator, "AppEventInputValidator"),
@@ -83,6 +85,10 @@ var require_types_cjs_development = __commonJS({
83
85
  AuthGrantValidator: /* @__PURE__ */ __name(() => AuthGrantValidator, "AuthGrantValidator"),
84
86
  AuthSessionError: /* @__PURE__ */ __name(() => AuthSessionError, "AuthSessionError"),
85
87
  AutoBoostConfigValidator: /* @__PURE__ */ __name(() => AutoBoostConfigValidator, "AutoBoostConfigValidator"),
88
+ BITSTRING_STATUS_PURPOSES: /* @__PURE__ */ __name(() => BITSTRING_STATUS_PURPOSES, "BITSTRING_STATUS_PURPOSES"),
89
+ BitstringStatusListCredentialSubjectValidator: /* @__PURE__ */ __name(() => BitstringStatusListCredentialSubjectValidator, "BitstringStatusListCredentialSubjectValidator"),
90
+ BitstringStatusListEntryValidator: /* @__PURE__ */ __name(() => BitstringStatusListEntryValidator, "BitstringStatusListEntryValidator"),
91
+ BitstringStatusPurposeValidator: /* @__PURE__ */ __name(() => BitstringStatusPurposeValidator, "BitstringStatusPurposeValidator"),
86
92
  BoostPermissionsQueryValidator: /* @__PURE__ */ __name(() => BoostPermissionsQueryValidator, "BoostPermissionsQueryValidator"),
87
93
  BoostPermissionsValidator: /* @__PURE__ */ __name(() => BoostPermissionsValidator, "BoostPermissionsValidator"),
88
94
  BoostQueryValidator: /* @__PURE__ */ __name(() => BoostQueryValidator, "BoostQueryValidator"),
@@ -144,6 +150,7 @@ var require_types_cjs_development = __commonJS({
144
150
  CredentialStatusValidator: /* @__PURE__ */ __name(() => CredentialStatusValidator, "CredentialStatusValidator"),
145
151
  CredentialSubjectValidator: /* @__PURE__ */ __name(() => CredentialSubjectValidator, "CredentialSubjectValidator"),
146
152
  CriteriaValidator: /* @__PURE__ */ __name(() => CriteriaValidator, "CriteriaValidator"),
153
+ DEFAULT_BITSTRING_STATUS_LIST_SIZE: /* @__PURE__ */ __name(() => DEFAULT_BITSTRING_STATUS_LIST_SIZE, "DEFAULT_BITSTRING_STATUS_LIST_SIZE"),
147
154
  DeleteFrameworkInputValidator: /* @__PURE__ */ __name(() => DeleteFrameworkInputValidator, "DeleteFrameworkInputValidator"),
148
155
  DeleteSkillInputValidator: /* @__PURE__ */ __name(() => DeleteSkillInputValidator, "DeleteSkillInputValidator"),
149
156
  DidDocumentValidator: /* @__PURE__ */ __name(() => DidDocumentValidator, "DidDocumentValidator"),
@@ -279,6 +286,7 @@ var require_types_cjs_development = __commonJS({
279
286
  SkillTreeNodeInputValidator: /* @__PURE__ */ __name(() => SkillTreeNodeInputValidator, "SkillTreeNodeInputValidator"),
280
287
  SkillTreeNodeValidator: /* @__PURE__ */ __name(() => SkillTreeNodeValidator, "SkillTreeNodeValidator"),
281
288
  SkillValidator: /* @__PURE__ */ __name(() => SkillValidator, "SkillValidator"),
289
+ StatusCheckEntryValidator: /* @__PURE__ */ __name(() => StatusCheckEntryValidator, "StatusCheckEntryValidator"),
282
290
  StringQuery: /* @__PURE__ */ __name(() => StringQuery, "StringQuery"),
283
291
  SummaryCredentialDataValidator: /* @__PURE__ */ __name(() => SummaryCredentialDataValidator, "SummaryCredentialDataValidator"),
284
292
  SummaryCredentialKeywordValidator: /* @__PURE__ */ __name(() => SummaryCredentialKeywordValidator, "SummaryCredentialKeywordValidator"),
@@ -14094,10 +14102,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
14094
14102
  var ClrCredentialValidator = UnsignedClrCredentialValidator.extend({
14095
14103
  proof: ProofValidator.or(ProofValidator.array())
14096
14104
  });
14105
+ var StatusCheckEntryValidator = external_exports.object({
14106
+ entryType: external_exports.string(),
14107
+ statusPurpose: external_exports.string(),
14108
+ isSet: external_exports.boolean(),
14109
+ statusListCredential: external_exports.string().optional(),
14110
+ statusListIndex: external_exports.string().optional()
14111
+ });
14097
14112
  var VerificationCheckValidator = external_exports.object({
14098
14113
  checks: external_exports.string().array(),
14099
14114
  warnings: external_exports.string().array(),
14100
- errors: external_exports.string().array()
14115
+ errors: external_exports.string().array(),
14116
+ status: StatusCheckEntryValidator.array().optional()
14101
14117
  });
14102
14118
  var VerificationStatusValidator = external_exports.enum(["Success", "Failed", "Error"]);
14103
14119
  var VerificationStatusEnum = VerificationStatusValidator.enum;
@@ -15505,6 +15521,29 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15505
15521
  __name2(this, "AuthSessionError");
15506
15522
  }
15507
15523
  };
15524
+ var BITSTRING_STATUS_PURPOSES = ["revocation", "suspension"];
15525
+ var DEFAULT_BITSTRING_STATUS_LIST_SIZE = 131072;
15526
+ var BitstringStatusPurposeValidator = external_exports.enum(BITSTRING_STATUS_PURPOSES);
15527
+ var BitstringStatusListEntryValidator = external_exports.object({
15528
+ id: external_exports.string().optional(),
15529
+ type: external_exports.literal("BitstringStatusListEntry"),
15530
+ statusPurpose: BitstringStatusPurposeValidator,
15531
+ statusListIndex: external_exports.string(),
15532
+ statusListCredential: external_exports.string()
15533
+ });
15534
+ var AllocatedBitstringStatusListEntryValidator = BitstringStatusListEntryValidator.extend({
15535
+ id: external_exports.string()
15536
+ });
15537
+ var BitstringStatusListCredentialSubjectValidator = external_exports.object({
15538
+ id: external_exports.string().optional(),
15539
+ type: external_exports.literal("BitstringStatusList"),
15540
+ statusPurpose: BitstringStatusPurposeValidator,
15541
+ encodedList: external_exports.string()
15542
+ });
15543
+ var AllocateCredentialStatusInputValidator = external_exports.object({
15544
+ statusPurposes: external_exports.array(BitstringStatusPurposeValidator).optional(),
15545
+ listSize: external_exports.number().int().positive().optional()
15546
+ }).default({});
15508
15547
  }
15509
15548
  });
15510
15549
 
@@ -15544,6 +15583,10 @@ __export(index_exports, {
15544
15583
  fixUrl: () => fixUrl4,
15545
15584
  formatNumber: () => formatNumber,
15546
15585
  generateSrcSet: () => generateSrcSet4,
15586
+ getBitstringStatusListBit: () => getBitstringStatusListBit,
15587
+ getBitstringStatusListEntries: () => getBitstringStatusListEntries,
15588
+ getBitstringStatusListEntryForPurpose: () => getBitstringStatusListEntryForPurpose,
15589
+ getCredentialStatusArray: () => getCredentialStatusArray,
15547
15590
  getProvider: () => getProvider,
15548
15591
  getUrlsFromSrcSet: () => getUrlsFromSrcSet,
15549
15592
  immerArraySlice: () => immerArraySlice,
@@ -15552,6 +15595,7 @@ __export(index_exports, {
15552
15595
  innerReactOuterImmer: () => innerReactOuterImmer,
15553
15596
  innerReactOuterReact: () => innerReactOuterReact,
15554
15597
  isAppDidWeb: () => isAppDidWeb,
15598
+ isBitstringStatusListEntry: () => isBitstringStatusListEntry,
15555
15599
  isEncrypted: () => isEncrypted,
15556
15600
  isHex: () => isHex,
15557
15601
  isNotMaybe: () => isNotMaybe,
@@ -15559,6 +15603,7 @@ __export(index_exports, {
15559
15603
  isVC2Format: () => isVC2Format,
15560
15604
  quantizeValue: () => quantizeValue,
15561
15605
  resizeAndChangeQuality: () => resizeAndChangeQuality4,
15606
+ setBitstringStatusListBit: () => setBitstringStatusListBit,
15562
15607
  unwrapBoostCredential: () => unwrapBoostCredential
15563
15608
  });
15564
15609
  module.exports = __toCommonJS(index_exports);
@@ -16362,6 +16407,45 @@ var immerArraySlice = /* @__PURE__ */ __name(((setState, index, value) => {
16362
16407
  return updateSlice(index, value);
16363
16408
  }), "immerArraySlice");
16364
16409
 
16410
+ // src/bitstring-status-list/index.ts
16411
+ var getCredentialStatusArray = /* @__PURE__ */ __name((credential) => {
16412
+ if (!credential || typeof credential !== "object" || Array.isArray(credential)) return [];
16413
+ const status = credential.credentialStatus;
16414
+ if (!status) return [];
16415
+ return Array.isArray(status) ? status : [status];
16416
+ }, "getCredentialStatusArray");
16417
+ var isBitstringStatusListEntry = /* @__PURE__ */ __name((status) => {
16418
+ if (!status || typeof status !== "object") return false;
16419
+ const record = status;
16420
+ return record.type === "BitstringStatusListEntry" && (record.statusPurpose === "revocation" || record.statusPurpose === "suspension") && typeof record.statusListIndex === "string" && typeof record.statusListCredential === "string";
16421
+ }, "isBitstringStatusListEntry");
16422
+ var getBitstringStatusListEntries = /* @__PURE__ */ __name((credential) => {
16423
+ if (!credential || typeof credential !== "object" || Array.isArray(credential)) return [];
16424
+ const record = credential;
16425
+ const statuses = getCredentialStatusArray(record);
16426
+ return [
16427
+ ...statuses.filter(isBitstringStatusListEntry),
16428
+ ...getBitstringStatusListEntries(record.boostCredential)
16429
+ ];
16430
+ }, "getBitstringStatusListEntries");
16431
+ var getBitstringStatusListEntryForPurpose = /* @__PURE__ */ __name((credential, statusPurpose) => getBitstringStatusListEntries(credential).find((entry) => entry.statusPurpose === statusPurpose), "getBitstringStatusListEntryForPurpose");
16432
+ var getBitstringStatusListBit = /* @__PURE__ */ __name((bitstring, index) => {
16433
+ if (!Number.isInteger(index) || index < 0) {
16434
+ throw new Error("Bitstring status list index is out of range");
16435
+ }
16436
+ const byte = bitstring[Math.floor(index / 8)] ?? 0;
16437
+ return (byte & 1 << index % 8) !== 0;
16438
+ }, "getBitstringStatusListBit");
16439
+ var setBitstringStatusListBit = /* @__PURE__ */ __name((bitstring, index, value) => {
16440
+ if (!Number.isInteger(index) || index < 0 || index >= bitstring.length * 8) {
16441
+ throw new Error("Bitstring status list index is out of range");
16442
+ }
16443
+ const byteIndex = Math.floor(index / 8);
16444
+ const mask = 1 << index % 8;
16445
+ const current = bitstring[byteIndex] ?? 0;
16446
+ bitstring[byteIndex] = value ? current | mask : current & ~mask;
16447
+ }, "setBitstringStatusListBit");
16448
+
16365
16449
  // src/Utilities.ts
16366
16450
  var import_zod = require("zod");
16367
16451
  var ImageResizingValidator = import_zod.z.object({ type: import_zod.z.literal("resizing") });