@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.
- package/dist/helpers.cjs.development.js +85 -1
- package/dist/helpers.cjs.development.js.map +3 -3
- package/dist/helpers.cjs.production.min.js +5 -5
- package/dist/helpers.cjs.production.min.js.map +4 -4
- package/dist/helpers.d.ts +22 -0
- package/dist/helpers.esm.js +85 -1
- package/dist/helpers.esm.js.map +3 -3
- package/package.json +2 -2
package/dist/helpers.d.ts
CHANGED
|
@@ -410,6 +410,22 @@ declare const JWEValidator: z.ZodObject<{
|
|
|
410
410
|
}, z.core.$strip>>>;
|
|
411
411
|
}, z.core.$strip>;
|
|
412
412
|
export type JWE = z.infer<typeof JWEValidator>;
|
|
413
|
+
declare const BitstringStatusPurposeValidator: z.ZodEnum<{
|
|
414
|
+
revocation: "revocation";
|
|
415
|
+
suspension: "suspension";
|
|
416
|
+
}>;
|
|
417
|
+
export type BitstringStatusPurpose = z.infer<typeof BitstringStatusPurposeValidator>;
|
|
418
|
+
declare const BitstringStatusListEntryValidator: z.ZodObject<{
|
|
419
|
+
id: z.ZodOptional<z.ZodString>;
|
|
420
|
+
type: z.ZodLiteral<"BitstringStatusListEntry">;
|
|
421
|
+
statusPurpose: z.ZodEnum<{
|
|
422
|
+
revocation: "revocation";
|
|
423
|
+
suspension: "suspension";
|
|
424
|
+
}>;
|
|
425
|
+
statusListIndex: z.ZodString;
|
|
426
|
+
statusListCredential: z.ZodString;
|
|
427
|
+
}, z.core.$strip>;
|
|
428
|
+
export type BitstringStatusListEntry = z.infer<typeof BitstringStatusListEntryValidator>;
|
|
413
429
|
declare const Providers: {
|
|
414
430
|
filestack: typeof filestack;
|
|
415
431
|
unsplash: typeof unsplash;
|
|
@@ -574,6 +590,12 @@ export type ImmerArraySlice = {
|
|
|
574
590
|
<State>(setState: Updater<State[]>, index: number, value: State): void;
|
|
575
591
|
};
|
|
576
592
|
export declare const immerArraySlice: ImmerArraySlice;
|
|
593
|
+
export declare const getCredentialStatusArray: (credential: unknown) => Record<string, unknown>[];
|
|
594
|
+
export declare const isBitstringStatusListEntry: (status: unknown) => status is BitstringStatusListEntry;
|
|
595
|
+
export declare const getBitstringStatusListEntries: (credential: unknown) => BitstringStatusListEntry[];
|
|
596
|
+
export declare const getBitstringStatusListEntryForPurpose: (credential: unknown, statusPurpose: BitstringStatusPurpose) => BitstringStatusListEntry | undefined;
|
|
597
|
+
export declare const getBitstringStatusListBit: (bitstring: Uint8Array, index: number) => boolean;
|
|
598
|
+
export declare const setBitstringStatusListBit: (bitstring: Uint8Array, index: number, value: boolean) => void;
|
|
577
599
|
export declare const ImageResizingValidator: z.ZodObject<{
|
|
578
600
|
type: z.ZodLiteral<"resizing">;
|
|
579
601
|
}, z.core.$strip>;
|
package/dist/helpers.esm.js
CHANGED
|
@@ -64,6 +64,8 @@ var require_types_cjs_development = __commonJS({
|
|
|
64
64
|
AgeRatingValidator: /* @__PURE__ */ __name(() => AgeRatingValidator, "AgeRatingValidator"),
|
|
65
65
|
AlignmentTargetTypeValidator: /* @__PURE__ */ __name(() => AlignmentTargetTypeValidator, "AlignmentTargetTypeValidator"),
|
|
66
66
|
AlignmentValidator: /* @__PURE__ */ __name(() => AlignmentValidator, "AlignmentValidator"),
|
|
67
|
+
AllocateCredentialStatusInputValidator: /* @__PURE__ */ __name(() => AllocateCredentialStatusInputValidator, "AllocateCredentialStatusInputValidator"),
|
|
68
|
+
AllocatedBitstringStatusListEntryValidator: /* @__PURE__ */ __name(() => AllocatedBitstringStatusListEntryValidator, "AllocatedBitstringStatusListEntryValidator"),
|
|
67
69
|
AllowConnectionRequestsEnum: /* @__PURE__ */ __name(() => AllowConnectionRequestsEnum, "AllowConnectionRequestsEnum"),
|
|
68
70
|
AppBoostValidator: /* @__PURE__ */ __name(() => AppBoostValidator, "AppBoostValidator"),
|
|
69
71
|
AppEventInputValidator: /* @__PURE__ */ __name(() => AppEventInputValidator, "AppEventInputValidator"),
|
|
@@ -81,6 +83,10 @@ var require_types_cjs_development = __commonJS({
|
|
|
81
83
|
AuthGrantValidator: /* @__PURE__ */ __name(() => AuthGrantValidator, "AuthGrantValidator"),
|
|
82
84
|
AuthSessionError: /* @__PURE__ */ __name(() => AuthSessionError, "AuthSessionError"),
|
|
83
85
|
AutoBoostConfigValidator: /* @__PURE__ */ __name(() => AutoBoostConfigValidator, "AutoBoostConfigValidator"),
|
|
86
|
+
BITSTRING_STATUS_PURPOSES: /* @__PURE__ */ __name(() => BITSTRING_STATUS_PURPOSES, "BITSTRING_STATUS_PURPOSES"),
|
|
87
|
+
BitstringStatusListCredentialSubjectValidator: /* @__PURE__ */ __name(() => BitstringStatusListCredentialSubjectValidator, "BitstringStatusListCredentialSubjectValidator"),
|
|
88
|
+
BitstringStatusListEntryValidator: /* @__PURE__ */ __name(() => BitstringStatusListEntryValidator, "BitstringStatusListEntryValidator"),
|
|
89
|
+
BitstringStatusPurposeValidator: /* @__PURE__ */ __name(() => BitstringStatusPurposeValidator, "BitstringStatusPurposeValidator"),
|
|
84
90
|
BoostPermissionsQueryValidator: /* @__PURE__ */ __name(() => BoostPermissionsQueryValidator, "BoostPermissionsQueryValidator"),
|
|
85
91
|
BoostPermissionsValidator: /* @__PURE__ */ __name(() => BoostPermissionsValidator, "BoostPermissionsValidator"),
|
|
86
92
|
BoostQueryValidator: /* @__PURE__ */ __name(() => BoostQueryValidator, "BoostQueryValidator"),
|
|
@@ -142,6 +148,7 @@ var require_types_cjs_development = __commonJS({
|
|
|
142
148
|
CredentialStatusValidator: /* @__PURE__ */ __name(() => CredentialStatusValidator, "CredentialStatusValidator"),
|
|
143
149
|
CredentialSubjectValidator: /* @__PURE__ */ __name(() => CredentialSubjectValidator, "CredentialSubjectValidator"),
|
|
144
150
|
CriteriaValidator: /* @__PURE__ */ __name(() => CriteriaValidator, "CriteriaValidator"),
|
|
151
|
+
DEFAULT_BITSTRING_STATUS_LIST_SIZE: /* @__PURE__ */ __name(() => DEFAULT_BITSTRING_STATUS_LIST_SIZE, "DEFAULT_BITSTRING_STATUS_LIST_SIZE"),
|
|
145
152
|
DeleteFrameworkInputValidator: /* @__PURE__ */ __name(() => DeleteFrameworkInputValidator, "DeleteFrameworkInputValidator"),
|
|
146
153
|
DeleteSkillInputValidator: /* @__PURE__ */ __name(() => DeleteSkillInputValidator, "DeleteSkillInputValidator"),
|
|
147
154
|
DidDocumentValidator: /* @__PURE__ */ __name(() => DidDocumentValidator, "DidDocumentValidator"),
|
|
@@ -277,6 +284,7 @@ var require_types_cjs_development = __commonJS({
|
|
|
277
284
|
SkillTreeNodeInputValidator: /* @__PURE__ */ __name(() => SkillTreeNodeInputValidator, "SkillTreeNodeInputValidator"),
|
|
278
285
|
SkillTreeNodeValidator: /* @__PURE__ */ __name(() => SkillTreeNodeValidator, "SkillTreeNodeValidator"),
|
|
279
286
|
SkillValidator: /* @__PURE__ */ __name(() => SkillValidator, "SkillValidator"),
|
|
287
|
+
StatusCheckEntryValidator: /* @__PURE__ */ __name(() => StatusCheckEntryValidator, "StatusCheckEntryValidator"),
|
|
280
288
|
StringQuery: /* @__PURE__ */ __name(() => StringQuery, "StringQuery"),
|
|
281
289
|
SummaryCredentialDataValidator: /* @__PURE__ */ __name(() => SummaryCredentialDataValidator, "SummaryCredentialDataValidator"),
|
|
282
290
|
SummaryCredentialKeywordValidator: /* @__PURE__ */ __name(() => SummaryCredentialKeywordValidator, "SummaryCredentialKeywordValidator"),
|
|
@@ -14092,10 +14100,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
14092
14100
|
var ClrCredentialValidator = UnsignedClrCredentialValidator.extend({
|
|
14093
14101
|
proof: ProofValidator.or(ProofValidator.array())
|
|
14094
14102
|
});
|
|
14103
|
+
var StatusCheckEntryValidator = external_exports.object({
|
|
14104
|
+
entryType: external_exports.string(),
|
|
14105
|
+
statusPurpose: external_exports.string(),
|
|
14106
|
+
isSet: external_exports.boolean(),
|
|
14107
|
+
statusListCredential: external_exports.string().optional(),
|
|
14108
|
+
statusListIndex: external_exports.string().optional()
|
|
14109
|
+
});
|
|
14095
14110
|
var VerificationCheckValidator = external_exports.object({
|
|
14096
14111
|
checks: external_exports.string().array(),
|
|
14097
14112
|
warnings: external_exports.string().array(),
|
|
14098
|
-
errors: external_exports.string().array()
|
|
14113
|
+
errors: external_exports.string().array(),
|
|
14114
|
+
status: StatusCheckEntryValidator.array().optional()
|
|
14099
14115
|
});
|
|
14100
14116
|
var VerificationStatusValidator = external_exports.enum(["Success", "Failed", "Error"]);
|
|
14101
14117
|
var VerificationStatusEnum = VerificationStatusValidator.enum;
|
|
@@ -15503,6 +15519,29 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15503
15519
|
__name2(this, "AuthSessionError");
|
|
15504
15520
|
}
|
|
15505
15521
|
};
|
|
15522
|
+
var BITSTRING_STATUS_PURPOSES = ["revocation", "suspension"];
|
|
15523
|
+
var DEFAULT_BITSTRING_STATUS_LIST_SIZE = 131072;
|
|
15524
|
+
var BitstringStatusPurposeValidator = external_exports.enum(BITSTRING_STATUS_PURPOSES);
|
|
15525
|
+
var BitstringStatusListEntryValidator = external_exports.object({
|
|
15526
|
+
id: external_exports.string().optional(),
|
|
15527
|
+
type: external_exports.literal("BitstringStatusListEntry"),
|
|
15528
|
+
statusPurpose: BitstringStatusPurposeValidator,
|
|
15529
|
+
statusListIndex: external_exports.string(),
|
|
15530
|
+
statusListCredential: external_exports.string()
|
|
15531
|
+
});
|
|
15532
|
+
var AllocatedBitstringStatusListEntryValidator = BitstringStatusListEntryValidator.extend({
|
|
15533
|
+
id: external_exports.string()
|
|
15534
|
+
});
|
|
15535
|
+
var BitstringStatusListCredentialSubjectValidator = external_exports.object({
|
|
15536
|
+
id: external_exports.string().optional(),
|
|
15537
|
+
type: external_exports.literal("BitstringStatusList"),
|
|
15538
|
+
statusPurpose: BitstringStatusPurposeValidator,
|
|
15539
|
+
encodedList: external_exports.string()
|
|
15540
|
+
});
|
|
15541
|
+
var AllocateCredentialStatusInputValidator = external_exports.object({
|
|
15542
|
+
statusPurposes: external_exports.array(BitstringStatusPurposeValidator).optional(),
|
|
15543
|
+
listSize: external_exports.number().int().positive().optional()
|
|
15544
|
+
}).default({});
|
|
15506
15545
|
}
|
|
15507
15546
|
});
|
|
15508
15547
|
|
|
@@ -16319,6 +16358,45 @@ var immerArraySlice = /* @__PURE__ */ __name(((setState, index, value) => {
|
|
|
16319
16358
|
return updateSlice(index, value);
|
|
16320
16359
|
}), "immerArraySlice");
|
|
16321
16360
|
|
|
16361
|
+
// src/bitstring-status-list/index.ts
|
|
16362
|
+
var getCredentialStatusArray = /* @__PURE__ */ __name((credential) => {
|
|
16363
|
+
if (!credential || typeof credential !== "object" || Array.isArray(credential)) return [];
|
|
16364
|
+
const status = credential.credentialStatus;
|
|
16365
|
+
if (!status) return [];
|
|
16366
|
+
return Array.isArray(status) ? status : [status];
|
|
16367
|
+
}, "getCredentialStatusArray");
|
|
16368
|
+
var isBitstringStatusListEntry = /* @__PURE__ */ __name((status) => {
|
|
16369
|
+
if (!status || typeof status !== "object") return false;
|
|
16370
|
+
const record = status;
|
|
16371
|
+
return record.type === "BitstringStatusListEntry" && (record.statusPurpose === "revocation" || record.statusPurpose === "suspension") && typeof record.statusListIndex === "string" && typeof record.statusListCredential === "string";
|
|
16372
|
+
}, "isBitstringStatusListEntry");
|
|
16373
|
+
var getBitstringStatusListEntries = /* @__PURE__ */ __name((credential) => {
|
|
16374
|
+
if (!credential || typeof credential !== "object" || Array.isArray(credential)) return [];
|
|
16375
|
+
const record = credential;
|
|
16376
|
+
const statuses = getCredentialStatusArray(record);
|
|
16377
|
+
return [
|
|
16378
|
+
...statuses.filter(isBitstringStatusListEntry),
|
|
16379
|
+
...getBitstringStatusListEntries(record.boostCredential)
|
|
16380
|
+
];
|
|
16381
|
+
}, "getBitstringStatusListEntries");
|
|
16382
|
+
var getBitstringStatusListEntryForPurpose = /* @__PURE__ */ __name((credential, statusPurpose) => getBitstringStatusListEntries(credential).find((entry) => entry.statusPurpose === statusPurpose), "getBitstringStatusListEntryForPurpose");
|
|
16383
|
+
var getBitstringStatusListBit = /* @__PURE__ */ __name((bitstring, index) => {
|
|
16384
|
+
if (!Number.isInteger(index) || index < 0) {
|
|
16385
|
+
throw new Error("Bitstring status list index is out of range");
|
|
16386
|
+
}
|
|
16387
|
+
const byte = bitstring[Math.floor(index / 8)] ?? 0;
|
|
16388
|
+
return (byte & 1 << index % 8) !== 0;
|
|
16389
|
+
}, "getBitstringStatusListBit");
|
|
16390
|
+
var setBitstringStatusListBit = /* @__PURE__ */ __name((bitstring, index, value) => {
|
|
16391
|
+
if (!Number.isInteger(index) || index < 0 || index >= bitstring.length * 8) {
|
|
16392
|
+
throw new Error("Bitstring status list index is out of range");
|
|
16393
|
+
}
|
|
16394
|
+
const byteIndex = Math.floor(index / 8);
|
|
16395
|
+
const mask = 1 << index % 8;
|
|
16396
|
+
const current = bitstring[byteIndex] ?? 0;
|
|
16397
|
+
bitstring[byteIndex] = value ? current | mask : current & ~mask;
|
|
16398
|
+
}, "setBitstringStatusListBit");
|
|
16399
|
+
|
|
16322
16400
|
// src/Utilities.ts
|
|
16323
16401
|
import { z } from "zod";
|
|
16324
16402
|
var ImageResizingValidator = z.object({ type: z.literal("resizing") });
|
|
@@ -16487,6 +16565,10 @@ export {
|
|
|
16487
16565
|
fixUrl4 as fixUrl,
|
|
16488
16566
|
formatNumber,
|
|
16489
16567
|
generateSrcSet4 as generateSrcSet,
|
|
16568
|
+
getBitstringStatusListBit,
|
|
16569
|
+
getBitstringStatusListEntries,
|
|
16570
|
+
getBitstringStatusListEntryForPurpose,
|
|
16571
|
+
getCredentialStatusArray,
|
|
16490
16572
|
getProvider,
|
|
16491
16573
|
getUrlsFromSrcSet,
|
|
16492
16574
|
immerArraySlice,
|
|
@@ -16495,6 +16577,7 @@ export {
|
|
|
16495
16577
|
innerReactOuterImmer,
|
|
16496
16578
|
innerReactOuterReact,
|
|
16497
16579
|
isAppDidWeb,
|
|
16580
|
+
isBitstringStatusListEntry,
|
|
16498
16581
|
isEncrypted,
|
|
16499
16582
|
isHex,
|
|
16500
16583
|
isNotMaybe,
|
|
@@ -16502,5 +16585,6 @@ export {
|
|
|
16502
16585
|
isVC2Format,
|
|
16503
16586
|
quantizeValue,
|
|
16504
16587
|
resizeAndChangeQuality4 as resizeAndChangeQuality,
|
|
16588
|
+
setBitstringStatusListBit,
|
|
16505
16589
|
unwrapBoostCredential
|
|
16506
16590
|
};
|