@learncard/helpers 1.0.14 → 1.0.15
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 +64 -46
- package/dist/helpers.cjs.development.js.map +3 -3
- package/dist/helpers.cjs.production.min.js +1 -1
- package/dist/helpers.cjs.production.min.js.map +3 -3
- package/dist/helpers.d.ts +142 -10
- package/dist/helpers.esm.js +64 -46
- package/dist/helpers.esm.js.map +3 -3
- package/package.json +2 -2
package/dist/helpers.d.ts
CHANGED
@@ -1,13 +1,136 @@
|
|
1
|
-
// Generated by dts-bundle-generator v6.
|
1
|
+
// Generated by dts-bundle-generator v6.13.0
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
3
|
+
declare const JWEValidator: z.ZodObject<{
|
4
|
+
protected: z.ZodString;
|
5
|
+
iv: z.ZodString;
|
6
|
+
ciphertext: z.ZodString;
|
7
|
+
tag: z.ZodString;
|
8
|
+
aad: z.ZodOptional<z.ZodString>;
|
9
|
+
recipients: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
10
|
+
header: z.ZodObject<{
|
11
|
+
alg: z.ZodString;
|
12
|
+
iv: z.ZodString;
|
13
|
+
tag: z.ZodString;
|
14
|
+
epk: z.ZodOptional<z.ZodObject<{
|
15
|
+
kty: z.ZodOptional<z.ZodString>;
|
16
|
+
crv: z.ZodOptional<z.ZodString>;
|
17
|
+
x: z.ZodOptional<z.ZodString>;
|
18
|
+
y: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
19
|
+
n: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
20
|
+
d: z.ZodOptional<z.ZodString>;
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
22
|
+
kty?: string | undefined;
|
23
|
+
crv?: string | undefined;
|
24
|
+
x?: string | undefined;
|
25
|
+
y?: string | undefined;
|
26
|
+
n?: string | undefined;
|
27
|
+
d?: string | undefined;
|
28
|
+
}, {
|
29
|
+
kty?: string | undefined;
|
30
|
+
crv?: string | undefined;
|
31
|
+
x?: string | undefined;
|
32
|
+
y?: string | undefined;
|
33
|
+
n?: string | undefined;
|
34
|
+
d?: string | undefined;
|
35
|
+
}>>;
|
36
|
+
kid: z.ZodOptional<z.ZodString>;
|
37
|
+
apv: z.ZodOptional<z.ZodString>;
|
38
|
+
apu: z.ZodOptional<z.ZodString>;
|
39
|
+
}, "strip", z.ZodTypeAny, {
|
40
|
+
epk?: {
|
41
|
+
kty?: string | undefined;
|
42
|
+
crv?: string | undefined;
|
43
|
+
x?: string | undefined;
|
44
|
+
y?: string | undefined;
|
45
|
+
n?: string | undefined;
|
46
|
+
d?: string | undefined;
|
47
|
+
} | undefined;
|
48
|
+
kid?: string | undefined;
|
49
|
+
apv?: string | undefined;
|
50
|
+
apu?: string | undefined;
|
51
|
+
alg: string;
|
52
|
+
iv: string;
|
53
|
+
tag: string;
|
54
|
+
}, {
|
55
|
+
epk?: {
|
56
|
+
kty?: string | undefined;
|
57
|
+
crv?: string | undefined;
|
58
|
+
x?: string | undefined;
|
59
|
+
y?: string | undefined;
|
60
|
+
n?: string | undefined;
|
61
|
+
d?: string | undefined;
|
62
|
+
} | undefined;
|
63
|
+
kid?: string | undefined;
|
64
|
+
apv?: string | undefined;
|
65
|
+
apu?: string | undefined;
|
66
|
+
alg: string;
|
67
|
+
iv: string;
|
68
|
+
tag: string;
|
69
|
+
}>;
|
70
|
+
encrypted_key: z.ZodString;
|
71
|
+
}, "strip", z.ZodTypeAny, {
|
72
|
+
header: {
|
73
|
+
epk?: {
|
74
|
+
kty?: string | undefined;
|
75
|
+
crv?: string | undefined;
|
76
|
+
x?: string | undefined;
|
77
|
+
y?: string | undefined;
|
78
|
+
n?: string | undefined;
|
79
|
+
d?: string | undefined;
|
80
|
+
} | undefined;
|
81
|
+
kid?: string | undefined;
|
82
|
+
apv?: string | undefined;
|
83
|
+
apu?: string | undefined;
|
84
|
+
alg: string;
|
85
|
+
iv: string;
|
86
|
+
tag: string;
|
87
|
+
};
|
88
|
+
encrypted_key: string;
|
89
|
+
}, {
|
90
|
+
header: {
|
91
|
+
epk?: {
|
92
|
+
kty?: string | undefined;
|
93
|
+
crv?: string | undefined;
|
94
|
+
x?: string | undefined;
|
95
|
+
y?: string | undefined;
|
96
|
+
n?: string | undefined;
|
97
|
+
d?: string | undefined;
|
98
|
+
} | undefined;
|
99
|
+
kid?: string | undefined;
|
100
|
+
apv?: string | undefined;
|
101
|
+
apu?: string | undefined;
|
102
|
+
alg: string;
|
103
|
+
iv: string;
|
104
|
+
tag: string;
|
105
|
+
};
|
106
|
+
encrypted_key: string;
|
107
|
+
}>, "many">>;
|
108
|
+
}, "strip", z.ZodTypeAny, {
|
109
|
+
aad?: string | undefined;
|
110
|
+
recipients?: {
|
111
|
+
header: {
|
112
|
+
epk?: {
|
113
|
+
kty?: string | undefined;
|
114
|
+
crv?: string | undefined;
|
115
|
+
x?: string | undefined;
|
116
|
+
y?: string | undefined;
|
117
|
+
n?: string | undefined;
|
118
|
+
d?: string | undefined;
|
119
|
+
} | undefined;
|
120
|
+
kid?: string | undefined;
|
121
|
+
apv?: string | undefined;
|
122
|
+
apu?: string | undefined;
|
123
|
+
alg: string;
|
124
|
+
iv: string;
|
125
|
+
tag: string;
|
126
|
+
};
|
127
|
+
encrypted_key: string;
|
128
|
+
}[] | undefined;
|
129
|
+
iv: string;
|
130
|
+
tag: string;
|
131
|
+
protected: string;
|
132
|
+
ciphertext: string;
|
133
|
+
}, {
|
11
134
|
aad?: string | undefined;
|
12
135
|
recipients?: {
|
13
136
|
header: {
|
@@ -32,6 +155,15 @@ export declare const isEncrypted: (item: Record<string, any>) => item is {
|
|
32
155
|
tag: string;
|
33
156
|
protected: string;
|
34
157
|
ciphertext: string;
|
35
|
-
}
|
158
|
+
}>;
|
159
|
+
export type JWE = z.infer<typeof JWEValidator>;
|
160
|
+
/**
|
161
|
+
* Determines whether or not a string is a valid hexadecimal string
|
162
|
+
*
|
163
|
+
* E.g. 'abc123' is valid hex, 'zzz' is not
|
164
|
+
*/
|
165
|
+
export declare const isHex: (str: string) => boolean;
|
166
|
+
/** Determines whether or not an object is an encrypted JWE */
|
167
|
+
export declare const isEncrypted: (item: Record<string, any>) => item is JWE;
|
36
168
|
|
37
169
|
export {};
|
package/dist/helpers.esm.js
CHANGED
@@ -16,7 +16,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
16
16
|
}
|
17
17
|
return to;
|
18
18
|
};
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
|
+
mod
|
22
|
+
));
|
20
23
|
|
21
24
|
// ../learn-card-types/dist/types.cjs.development.js
|
22
25
|
var require_types_cjs_development = __commonJS({
|
@@ -900,11 +903,14 @@ var require_types_cjs_development = __commonJS({
|
|
900
903
|
const parsedType = this._getType(input);
|
901
904
|
if (parsedType !== ZodParsedType.string) {
|
902
905
|
const ctx2 = this._getOrReturnCtx(input);
|
903
|
-
addIssueToContext(
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
906
|
+
addIssueToContext(
|
907
|
+
ctx2,
|
908
|
+
{
|
909
|
+
code: ZodIssueCode.invalid_type,
|
910
|
+
expected: ZodParsedType.string,
|
911
|
+
received: ctx2.parsedType
|
912
|
+
}
|
913
|
+
);
|
908
914
|
return INVALID;
|
909
915
|
}
|
910
916
|
const status = new ParseStatus();
|
@@ -1912,7 +1918,9 @@ var require_types_cjs_development = __commonJS({
|
|
1912
1918
|
const value = ctx.data[key];
|
1913
1919
|
pairs.push({
|
1914
1920
|
key: { status: "valid", value: key },
|
1915
|
-
value: catchall._parse(
|
1921
|
+
value: catchall._parse(
|
1922
|
+
new ParseInputLazyPath(ctx, value, ctx.path, key)
|
1923
|
+
),
|
1916
1924
|
alwaysSet: key in ctx.data
|
1917
1925
|
});
|
1918
1926
|
}
|
@@ -3467,11 +3475,13 @@ var require_types_cjs_development = __commonJS({
|
|
3467
3475
|
type: mod.string().optional(),
|
3468
3476
|
narrative: mod.string().optional()
|
3469
3477
|
});
|
3470
|
-
var ImageValidator = mod.string().or(
|
3471
|
-
|
3472
|
-
|
3473
|
-
|
3474
|
-
|
3478
|
+
var ImageValidator = mod.string().or(
|
3479
|
+
mod.object({
|
3480
|
+
id: mod.string(),
|
3481
|
+
type: mod.string(),
|
3482
|
+
caption: mod.string().optional()
|
3483
|
+
})
|
3484
|
+
);
|
3475
3485
|
var GeoCoordinatesValidator = mod.object({
|
3476
3486
|
type: mod.string().min(1).or(mod.string().array().nonempty()),
|
3477
3487
|
latitude: mod.number(),
|
@@ -3513,29 +3523,31 @@ var require_types_cjs_development = __commonJS({
|
|
3513
3523
|
identifier: mod.string(),
|
3514
3524
|
identifierType: IdentifierTypeValidator
|
3515
3525
|
});
|
3516
|
-
var ProfileValidator = mod.string().or(
|
3517
|
-
|
3518
|
-
|
3519
|
-
|
3520
|
-
|
3521
|
-
|
3522
|
-
|
3523
|
-
|
3524
|
-
|
3525
|
-
|
3526
|
-
|
3527
|
-
|
3528
|
-
|
3529
|
-
|
3530
|
-
|
3531
|
-
|
3532
|
-
|
3533
|
-
|
3534
|
-
|
3535
|
-
|
3536
|
-
|
3537
|
-
|
3538
|
-
|
3526
|
+
var ProfileValidator = mod.string().or(
|
3527
|
+
mod.object({
|
3528
|
+
id: mod.string().optional(),
|
3529
|
+
type: mod.string().or(mod.string().array().nonempty().optional()),
|
3530
|
+
name: mod.string().optional(),
|
3531
|
+
url: mod.string().optional(),
|
3532
|
+
phone: mod.string().optional(),
|
3533
|
+
description: mod.string().optional(),
|
3534
|
+
endorsement: mod.any().array().optional(),
|
3535
|
+
image: ImageValidator.optional(),
|
3536
|
+
email: mod.string().email().optional(),
|
3537
|
+
address: AddressValidator.optional(),
|
3538
|
+
otherIdentifier: IdentifierEntryValidator.array().optional(),
|
3539
|
+
official: mod.string().optional(),
|
3540
|
+
parentOrg: mod.any().optional(),
|
3541
|
+
familyName: mod.string().optional(),
|
3542
|
+
givenName: mod.string().optional(),
|
3543
|
+
additionalName: mod.string().optional(),
|
3544
|
+
patronymicName: mod.string().optional(),
|
3545
|
+
honorificPrefix: mod.string().optional(),
|
3546
|
+
honorificSuffix: mod.string().optional(),
|
3547
|
+
familyNamePrefix: mod.string().optional(),
|
3548
|
+
dateOfBirth: mod.string().optional()
|
3549
|
+
}).catchall(mod.any())
|
3550
|
+
);
|
3539
3551
|
var CredentialSubjectValidator = mod.object({ id: mod.string().optional() }).catchall(mod.any());
|
3540
3552
|
var CredentialStatusValidator = mod.object({ type: mod.string(), id: mod.string() }).catchall(mod.any());
|
3541
3553
|
var CredentialSchemaValidator = mod.object({ id: mod.string(), type: mod.string() }).catchall(mod.any());
|
@@ -3604,15 +3616,17 @@ var require_types_cjs_development = __commonJS({
|
|
3604
3616
|
aad: mod.string().optional(),
|
3605
3617
|
recipients: JWERecipientValidator.array().optional()
|
3606
3618
|
});
|
3607
|
-
var VerificationMethodValidator = mod.string().or(
|
3608
|
-
|
3609
|
-
|
3610
|
-
|
3611
|
-
|
3612
|
-
|
3613
|
-
|
3614
|
-
|
3615
|
-
|
3619
|
+
var VerificationMethodValidator = mod.string().or(
|
3620
|
+
mod.object({
|
3621
|
+
"@context": ContextValidator.optional(),
|
3622
|
+
id: mod.string(),
|
3623
|
+
type: mod.string(),
|
3624
|
+
controller: mod.string(),
|
3625
|
+
publicKeyJwk: JWKValidator.optional(),
|
3626
|
+
publicKeyBase58: mod.string().optional(),
|
3627
|
+
blockChainAccountId: mod.string().optional()
|
3628
|
+
}).catchall(mod.any())
|
3629
|
+
);
|
3616
3630
|
var ServiceValidator = mod.object({
|
3617
3631
|
id: mod.string(),
|
3618
3632
|
type: mod.string().or(mod.string().array().nonempty()),
|
@@ -3810,7 +3824,9 @@ var require_types_cjs_development = __commonJS({
|
|
3810
3824
|
name: mod.string().optional(),
|
3811
3825
|
description: mod.string().optional(),
|
3812
3826
|
image: ImageValidator.optional(),
|
3813
|
-
credentialSubject: AchievementSubjectValidator.or(
|
3827
|
+
credentialSubject: AchievementSubjectValidator.or(
|
3828
|
+
AchievementSubjectValidator.array()
|
3829
|
+
),
|
3814
3830
|
endorsement: UnsignedVCValidator.array().optional(),
|
3815
3831
|
evidence: EvidenceValidator.array().optional()
|
3816
3832
|
});
|
@@ -4039,7 +4055,9 @@ var require_types_cjs_development = __commonJS({
|
|
4039
4055
|
]);
|
4040
4056
|
var ConsentFlowTransactionsQueryValidator = mod.object({
|
4041
4057
|
terms: ConsentFlowTermsQueryValidator.optional(),
|
4042
|
-
action: ConsentFlowTransactionActionValidator.or(
|
4058
|
+
action: ConsentFlowTransactionActionValidator.or(
|
4059
|
+
ConsentFlowTransactionActionValidator.array()
|
4060
|
+
).optional(),
|
4043
4061
|
date: mod.object({ $gt: mod.string() }).or(mod.object({ $lt: mod.string() })).or(mod.object({ $eq: mod.string() })).optional(),
|
4044
4062
|
expiresAt: mod.object({ $gt: mod.string() }).or(mod.object({ $lt: mod.string() })).or(mod.object({ $eq: mod.string() })).optional(),
|
4045
4063
|
oneTime: mod.boolean().optional()
|