@preeternal/jws-verifier 0.0.0-stage → 0.0.1-rc.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/CHANGELOG.md +13 -0
- package/LICENSE +21 -0
- package/README.md +85 -2
- package/dist/asn1/ber-reader.d.ts +57 -0
- package/dist/asn1/ber-reader.d.ts.map +1 -0
- package/dist/asn1/ber-reader.js +202 -0
- package/dist/asn1/der-reader.d.ts +68 -0
- package/dist/asn1/der-reader.d.ts.map +1 -0
- package/dist/asn1/der-reader.js +181 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/jws/es256-signature.d.ts +3 -0
- package/dist/jws/es256-signature.d.ts.map +1 -0
- package/dist/jws/es256-signature.js +22 -0
- package/dist/jws/verifier.d.ts +94 -0
- package/dist/jws/verifier.d.ts.map +1 -0
- package/dist/jws/verifier.js +718 -0
- package/dist/ocsp/codec.d.ts +55 -0
- package/dist/ocsp/codec.d.ts.map +1 -0
- package/dist/ocsp/codec.js +465 -0
- package/dist/ocsp/transport.d.ts +6 -0
- package/dist/ocsp/transport.d.ts.map +1 -0
- package/dist/ocsp/transport.js +69 -0
- package/dist/receipt/utility.d.ts +27 -0
- package/dist/receipt/utility.d.ts.map +1 -0
- package/dist/receipt/utility.js +296 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +1 -0
- package/dist/utils/formatting.d.ts +2 -0
- package/dist/utils/formatting.d.ts.map +1 -0
- package/dist/utils/formatting.js +9 -0
- package/dist/x509/certificate-metadata.d.ts +91 -0
- package/dist/x509/certificate-metadata.d.ts.map +1 -0
- package/dist/x509/certificate-metadata.js +588 -0
- package/dist/x509/prepared-certificates.d.ts +22 -0
- package/dist/x509/prepared-certificates.d.ts.map +1 -0
- package/dist/x509/prepared-certificates.js +27 -0
- package/package.json +81 -3
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { PreparedCertificate } from "../x509/prepared-certificates.js";
|
|
2
|
+
export type OcspHashAlgorithm = "sha1" | "sha256" | "sha384" | "sha512";
|
|
3
|
+
export type OcspCertificateStatus = "good" | "revoked" | "unknown";
|
|
4
|
+
export interface OcspCertId {
|
|
5
|
+
readonly hashAlgorithm: OcspHashAlgorithm;
|
|
6
|
+
readonly issuerNameHash: Uint8Array;
|
|
7
|
+
readonly issuerKeyHash: Uint8Array;
|
|
8
|
+
/** Canonical INTEGER contents, including a required sign-protection zero when present. */
|
|
9
|
+
readonly serialNumber: Uint8Array;
|
|
10
|
+
}
|
|
11
|
+
export interface ParsedOcspSingleResponse {
|
|
12
|
+
readonly certId: OcspCertId;
|
|
13
|
+
readonly status: OcspCertificateStatus;
|
|
14
|
+
readonly thisUpdateMs: number;
|
|
15
|
+
readonly nextUpdateMs?: number;
|
|
16
|
+
readonly criticalExtensionOids: readonly string[];
|
|
17
|
+
}
|
|
18
|
+
export type OcspResponderId = {
|
|
19
|
+
readonly kind: "name";
|
|
20
|
+
readonly value: Uint8Array;
|
|
21
|
+
readonly implicit: boolean;
|
|
22
|
+
} | {
|
|
23
|
+
readonly kind: "key";
|
|
24
|
+
readonly value: Uint8Array;
|
|
25
|
+
};
|
|
26
|
+
export interface OcspSignatureAlgorithm {
|
|
27
|
+
readonly hash: OcspHashAlgorithm;
|
|
28
|
+
readonly key: "ec" | "rsa";
|
|
29
|
+
readonly oid: string;
|
|
30
|
+
}
|
|
31
|
+
export interface ParsedBasicOcspResponse {
|
|
32
|
+
readonly tbsResponseData: Uint8Array;
|
|
33
|
+
readonly signatureAlgorithm: OcspSignatureAlgorithm;
|
|
34
|
+
readonly signature: Uint8Array;
|
|
35
|
+
readonly responderId: OcspResponderId;
|
|
36
|
+
readonly producedAtMs: number;
|
|
37
|
+
readonly responses: readonly ParsedOcspSingleResponse[];
|
|
38
|
+
readonly certificates: readonly Uint8Array[];
|
|
39
|
+
readonly criticalExtensionOids: readonly string[];
|
|
40
|
+
}
|
|
41
|
+
export interface ParsedOcspResponse {
|
|
42
|
+
readonly responseStatus: number;
|
|
43
|
+
readonly responseType?: string;
|
|
44
|
+
readonly basic?: ParsedBasicOcspResponse;
|
|
45
|
+
}
|
|
46
|
+
export declare const ocspCertIdFor: (certificate: PreparedCertificate, issuer: PreparedCertificate) => OcspCertId;
|
|
47
|
+
/** Encode the SHA-256 OCSP request used by the verifier. */
|
|
48
|
+
export declare const buildOcspRequest: (certificate: PreparedCertificate, issuer: PreparedCertificate) => Uint8Array;
|
|
49
|
+
/** Parse an OCSPResponse without making a trust decision. */
|
|
50
|
+
export declare const parseOcspResponse: (input: Uint8Array) => ParsedOcspResponse;
|
|
51
|
+
export declare const ocspNameValue: (certificate: PreparedCertificate) => Uint8Array;
|
|
52
|
+
export declare const ocspKeyHash: (certificate: PreparedCertificate) => Uint8Array;
|
|
53
|
+
export declare const ocspBytesEqual: (left: Uint8Array, right: Uint8Array) => boolean;
|
|
54
|
+
export declare const ocspDerRange: (offset: number, length: number) => import("../asn1/der-reader.js").ByteRange;
|
|
55
|
+
//# sourceMappingURL=codec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../source/ocsp/codec.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAW5E,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;AACxE,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;AAEnE,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,aAAa,EAAE,iBAAiB,CAAC;IAC1C,QAAQ,CAAC,cAAc,EAAE,UAAU,CAAC;IACpC,QAAQ,CAAC,aAAa,EAAE,UAAU,CAAC;IACnC,0FAA0F;IAC1F,QAAQ,CAAC,YAAY,EAAE,UAAU,CAAC;CACnC;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;IACvC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,qBAAqB,EAAE,SAAS,MAAM,EAAE,CAAC;CACnD;AAED,MAAM,MAAM,eAAe,GACvB;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,GACjF;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAA;CAAE,CAAC;AAEzD,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;IACjC,QAAQ,CAAC,GAAG,EAAE,IAAI,GAAG,KAAK,CAAC;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,eAAe,EAAE,UAAU,CAAC;IACrC,QAAQ,CAAC,kBAAkB,EAAE,sBAAsB,CAAC;IACpD,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC;IAC/B,QAAQ,CAAC,WAAW,EAAE,eAAe,CAAC;IACtC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,SAAS,wBAAwB,EAAE,CAAC;IACxD,QAAQ,CAAC,YAAY,EAAE,SAAS,UAAU,EAAE,CAAC;IAC7C,QAAQ,CAAC,qBAAqB,EAAE,SAAS,MAAM,EAAE,CAAC;CACnD;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,KAAK,CAAC,EAAE,uBAAuB,CAAC;CAC1C;AAgED,eAAO,MAAM,aAAa,GACxB,aAAa,mBAAmB,EAChC,QAAQ,mBAAmB,KAC1B,UAUC,CAAC;AAEL,4DAA4D;AAC5D,eAAO,MAAM,gBAAgB,GAC3B,aAAa,mBAAmB,EAChC,QAAQ,mBAAmB,KAC1B,UASF,CAAC;AA2bF,6DAA6D;AAC7D,eAAO,MAAM,iBAAiB,GAAI,OAAO,UAAU,KAAG,kBAuCrD,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,aAAa,mBAAmB,KAAG,UAGhE,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,aAAa,mBAAmB,KAAG,UAIlD,CAAC;AAEd,eAAO,MAAM,cAAc,SAvhBD,UAAU,SAAS,UAAU,KAAG,OAuhBlB,CAAC;AACzC,eAAO,MAAM,YAAY,+EAAW,CAAC"}
|
|
@@ -0,0 +1,465 @@
|
|
|
1
|
+
// biome-ignore lint/correctness/noNodejsModules: Hashing is deliberately delegated to native crypto.
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
import { DerParseError, DerReader, derRange } from "../asn1/der-reader.js";
|
|
4
|
+
const universal = 0;
|
|
5
|
+
const contextSpecific = 2;
|
|
6
|
+
const sha1Oid = "1.3.14.3.2.26";
|
|
7
|
+
const sha256Oid = "2.16.840.1.101.3.4.2.1";
|
|
8
|
+
const sha384Oid = "2.16.840.1.101.3.4.2.2";
|
|
9
|
+
const sha512Oid = "2.16.840.1.101.3.4.2.3";
|
|
10
|
+
const basicResponseOid = "1.3.6.1.5.5.7.48.1.1";
|
|
11
|
+
const generalizedTimePattern = /^\d{14}Z$/u;
|
|
12
|
+
const oidBytes = (oid) => {
|
|
13
|
+
const arcs = oid.split(".").map((arc) => BigInt(arc));
|
|
14
|
+
const first = arcs.shift();
|
|
15
|
+
const second = arcs.shift();
|
|
16
|
+
if (first === undefined || second === undefined || first > 2n || (second > 39n && first < 2n)) {
|
|
17
|
+
throw new TypeError(`Invalid OID: ${oid}`);
|
|
18
|
+
}
|
|
19
|
+
const values = [first * 40n + second, ...arcs];
|
|
20
|
+
const output = [];
|
|
21
|
+
for (const value of values) {
|
|
22
|
+
const encoded = [Number(value & 0x7fn)];
|
|
23
|
+
let rest = value >> 7n;
|
|
24
|
+
while (rest > 0n) {
|
|
25
|
+
encoded.unshift(Number(rest & 0x7fn) | 0x80);
|
|
26
|
+
rest >>= 7n;
|
|
27
|
+
}
|
|
28
|
+
output.push(...encoded);
|
|
29
|
+
}
|
|
30
|
+
return Uint8Array.from(output);
|
|
31
|
+
};
|
|
32
|
+
const encodeLength = (length) => {
|
|
33
|
+
if (!Number.isSafeInteger(length) || length < 0)
|
|
34
|
+
throw new RangeError("Invalid DER length");
|
|
35
|
+
if (length < 128)
|
|
36
|
+
return Uint8Array.of(length);
|
|
37
|
+
const bytes = [];
|
|
38
|
+
let value = length;
|
|
39
|
+
while (value > 0) {
|
|
40
|
+
bytes.unshift(value & 0xff);
|
|
41
|
+
value >>>= 8;
|
|
42
|
+
}
|
|
43
|
+
return Uint8Array.from([0x80 | bytes.length, ...bytes]);
|
|
44
|
+
};
|
|
45
|
+
const concat = (...parts) => {
|
|
46
|
+
const output = new Uint8Array(parts.reduce((total, part) => total + part.length, 0));
|
|
47
|
+
let offset = 0;
|
|
48
|
+
for (const part of parts) {
|
|
49
|
+
output.set(part, offset);
|
|
50
|
+
offset += part.length;
|
|
51
|
+
}
|
|
52
|
+
return output;
|
|
53
|
+
};
|
|
54
|
+
const tlv = (tag, value) => concat(Uint8Array.of(tag), encodeLength(value.length), value);
|
|
55
|
+
const sequence = (...values) => tlv(0x30, concat(...values));
|
|
56
|
+
const octetString = (value) => tlv(0x04, value);
|
|
57
|
+
const nullValue = () => Uint8Array.of(0x05, 0x00);
|
|
58
|
+
const objectIdentifier = (oid) => tlv(0x06, oidBytes(oid));
|
|
59
|
+
const bytesEqual = (left, right) => {
|
|
60
|
+
if (left.length !== right.length)
|
|
61
|
+
return false;
|
|
62
|
+
for (let index = 0; index < left.length; index += 1) {
|
|
63
|
+
if (left[index] !== right[index])
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
return true;
|
|
67
|
+
};
|
|
68
|
+
const rangeBytes = (certificate, range) => certificate.der.subarray(range.offset, range.offset + range.length);
|
|
69
|
+
export const ocspCertIdFor = (certificate, issuer) => Object.freeze({
|
|
70
|
+
hashAlgorithm: "sha256",
|
|
71
|
+
issuerNameHash: createHash("sha256")
|
|
72
|
+
.update(rangeBytes(certificate, certificate.metadata.issuer))
|
|
73
|
+
.digest(),
|
|
74
|
+
issuerKeyHash: createHash("sha256")
|
|
75
|
+
.update(rangeBytes(issuer, issuer.metadata.subjectPublicKey.value))
|
|
76
|
+
.digest(),
|
|
77
|
+
serialNumber: new Uint8Array(rangeBytes(certificate, certificate.metadata.serial.value)),
|
|
78
|
+
});
|
|
79
|
+
/** Encode the SHA-256 OCSP request used by the verifier. */
|
|
80
|
+
export const buildOcspRequest = (certificate, issuer) => {
|
|
81
|
+
const { issuerNameHash, issuerKeyHash, serialNumber } = ocspCertIdFor(certificate, issuer);
|
|
82
|
+
const certId = sequence(sequence(objectIdentifier(sha256Oid), nullValue()), octetString(issuerNameHash), octetString(issuerKeyHash), tlv(0x02, serialNumber));
|
|
83
|
+
return sequence(sequence(sequence(sequence(certId))));
|
|
84
|
+
};
|
|
85
|
+
const readOne = (reader, name) => {
|
|
86
|
+
const element = reader.readOptionalElement();
|
|
87
|
+
if (element === undefined) {
|
|
88
|
+
throw new DerParseError("unexpected-end", `Missing ${name}`, reader.end);
|
|
89
|
+
}
|
|
90
|
+
return element;
|
|
91
|
+
};
|
|
92
|
+
const isTag = (element, tagClass, tagNumber, constructed) => element.tagClass === tagClass &&
|
|
93
|
+
element.tagNumber === tagNumber &&
|
|
94
|
+
(constructed === undefined || element.constructed === constructed);
|
|
95
|
+
const requireTag = (element, tagClass, tagNumber, name, constructed) => {
|
|
96
|
+
if (!isTag(element, tagClass, tagNumber, constructed)) {
|
|
97
|
+
throw new DerParseError("invalid-tag", `${name} has an unexpected DER tag`, element.start);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
const withChildren = (element, callback) => {
|
|
101
|
+
requireTag(element, universal, 16, "SEQUENCE", true);
|
|
102
|
+
const reader = new DerReader(element.context.input, element.context.limits, element.valueStart, element.end, element.context.depth + 1, element.context.state);
|
|
103
|
+
callback(reader);
|
|
104
|
+
reader.assertEnd();
|
|
105
|
+
};
|
|
106
|
+
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: This bounded loop decodes one base-128 OID value without allocating an ASN.1 tree.
|
|
107
|
+
const readOid = (element, name) => {
|
|
108
|
+
requireTag(element, universal, 6, name, false);
|
|
109
|
+
if (element.value.length === 0)
|
|
110
|
+
throw new DerParseError("invalid-tag", `${name} is empty`, element.start);
|
|
111
|
+
const arcs = [];
|
|
112
|
+
let offset = 0;
|
|
113
|
+
while (offset < element.value.length) {
|
|
114
|
+
let value = 0n;
|
|
115
|
+
let first = true;
|
|
116
|
+
for (;;) {
|
|
117
|
+
if (offset >= element.value.length)
|
|
118
|
+
throw new DerParseError("unexpected-end", `${name} is truncated`, element.end);
|
|
119
|
+
const byte = element.value[offset++] ?? 0;
|
|
120
|
+
if (first && byte === 0x80)
|
|
121
|
+
throw new DerParseError("invalid-tag", `${name} is non-canonical`, element.start);
|
|
122
|
+
first = false;
|
|
123
|
+
value = value * 128n + BigInt(byte & 0x7f);
|
|
124
|
+
if (value > 0xffffffffffffffffn)
|
|
125
|
+
throw new DerParseError("limit-exceeded", `${name} is too large`, element.start);
|
|
126
|
+
if ((byte & 0x80) === 0)
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
arcs.push(value);
|
|
130
|
+
}
|
|
131
|
+
const first = arcs.shift();
|
|
132
|
+
if (first === undefined)
|
|
133
|
+
throw new DerParseError("invalid-tag", `${name} is empty`, element.start);
|
|
134
|
+
const firstArc = first < 40n ? 0n : first < 80n ? 1n : 2n;
|
|
135
|
+
return [firstArc, firstArc === 2n ? first - 80n : first % 40n, ...arcs].map(String).join(".");
|
|
136
|
+
};
|
|
137
|
+
const readAlgorithmIdentifier = (element, name) => {
|
|
138
|
+
let oid = "";
|
|
139
|
+
let params;
|
|
140
|
+
withChildren(element, (reader) => {
|
|
141
|
+
oid = readOid(readOne(reader, `${name} OID`), `${name} OID`);
|
|
142
|
+
params = reader.readOptionalElement();
|
|
143
|
+
});
|
|
144
|
+
if (params !== undefined && !isTag(params, universal, 5, false)) {
|
|
145
|
+
throw new DerParseError("invalid-tag", `${name} parameters are unsupported`, params.start);
|
|
146
|
+
}
|
|
147
|
+
return params === undefined ? { oid } : { oid, params };
|
|
148
|
+
};
|
|
149
|
+
const hashForOid = (oid) => oid === sha1Oid
|
|
150
|
+
? "sha1"
|
|
151
|
+
: oid === sha256Oid
|
|
152
|
+
? "sha256"
|
|
153
|
+
: oid === sha384Oid
|
|
154
|
+
? "sha384"
|
|
155
|
+
: oid === sha512Oid
|
|
156
|
+
? "sha512"
|
|
157
|
+
: undefined;
|
|
158
|
+
const signatureAlgorithm = (element) => {
|
|
159
|
+
const { oid } = readAlgorithmIdentifier(element, "signature algorithm");
|
|
160
|
+
const table = {
|
|
161
|
+
"1.2.840.10045.4.3.2": { oid, hash: "sha256", key: "ec" },
|
|
162
|
+
"1.2.840.10045.4.3.3": { oid, hash: "sha384", key: "ec" },
|
|
163
|
+
"1.2.840.10045.4.3.4": { oid, hash: "sha512", key: "ec" },
|
|
164
|
+
"1.2.840.113549.1.1.5": { oid, hash: "sha1", key: "rsa" },
|
|
165
|
+
"1.2.840.113549.1.1.11": { oid, hash: "sha256", key: "rsa" },
|
|
166
|
+
"1.2.840.113549.1.1.12": { oid, hash: "sha384", key: "rsa" },
|
|
167
|
+
"1.2.840.113549.1.1.13": { oid, hash: "sha512", key: "rsa" },
|
|
168
|
+
};
|
|
169
|
+
const value = table[oid];
|
|
170
|
+
if (value === undefined)
|
|
171
|
+
throw new DerParseError("invalid-tag", `Unsupported signature algorithm ${oid}`, element.start);
|
|
172
|
+
return value;
|
|
173
|
+
};
|
|
174
|
+
const readOctets = (element, name) => {
|
|
175
|
+
requireTag(element, universal, 4, name, false);
|
|
176
|
+
return new Uint8Array(element.value);
|
|
177
|
+
};
|
|
178
|
+
const readInteger = (element, name) => {
|
|
179
|
+
requireTag(element, universal, 2, name, false);
|
|
180
|
+
if (element.value.length === 0 ||
|
|
181
|
+
(element.value.length > 1 && element.value[0] === 0 && (element.value[1] ?? 0) < 0x80) ||
|
|
182
|
+
(element.value[0] ?? 0) >= 0x80) {
|
|
183
|
+
throw new DerParseError("invalid-tag", `${name} is not a canonical non-negative INTEGER`, element.start);
|
|
184
|
+
}
|
|
185
|
+
return new Uint8Array(element.value);
|
|
186
|
+
};
|
|
187
|
+
const parseCertId = (element) => {
|
|
188
|
+
let hashAlgorithm;
|
|
189
|
+
let issuerNameHash;
|
|
190
|
+
let issuerKeyHash;
|
|
191
|
+
let serialNumber;
|
|
192
|
+
withChildren(element, (reader) => {
|
|
193
|
+
const algorithm = readAlgorithmIdentifier(readOne(reader, "CertID hash algorithm"), "CertID hash algorithm");
|
|
194
|
+
hashAlgorithm = hashForOid(algorithm.oid);
|
|
195
|
+
if (hashAlgorithm === undefined)
|
|
196
|
+
throw new DerParseError("invalid-tag", "Unsupported CertID hash algorithm", element.start);
|
|
197
|
+
issuerNameHash = readOctets(readOne(reader, "CertID issuerNameHash"), "CertID issuerNameHash");
|
|
198
|
+
issuerKeyHash = readOctets(readOne(reader, "CertID issuerKeyHash"), "CertID issuerKeyHash");
|
|
199
|
+
serialNumber = readInteger(readOne(reader, "CertID serialNumber"), "CertID serialNumber");
|
|
200
|
+
});
|
|
201
|
+
if (hashAlgorithm === undefined ||
|
|
202
|
+
issuerNameHash === undefined ||
|
|
203
|
+
issuerKeyHash === undefined ||
|
|
204
|
+
serialNumber === undefined) {
|
|
205
|
+
throw new DerParseError("unexpected-end", "CertID is incomplete", element.start);
|
|
206
|
+
}
|
|
207
|
+
return Object.freeze({ hashAlgorithm, issuerNameHash, issuerKeyHash, serialNumber });
|
|
208
|
+
};
|
|
209
|
+
const parseGeneralizedTime = (element, name) => {
|
|
210
|
+
requireTag(element, universal, 24, name, false);
|
|
211
|
+
if (element.value.length !== 15 || element.value[14] !== 0x5a) {
|
|
212
|
+
throw new DerParseError("invalid-tag", `${name} must be YYYYMMDDHHMMSSZ`, element.start);
|
|
213
|
+
}
|
|
214
|
+
const text = new TextDecoder("ascii", { fatal: true }).decode(element.value);
|
|
215
|
+
if (!generalizedTimePattern.test(text))
|
|
216
|
+
throw new DerParseError("invalid-tag", `${name} has invalid digits`, element.start);
|
|
217
|
+
const date = new Date(Date.UTC(Number(text.slice(0, 4)), Number(text.slice(4, 6)) - 1, Number(text.slice(6, 8)), Number(text.slice(8, 10)), Number(text.slice(10, 12)), Number(text.slice(12, 14))));
|
|
218
|
+
if (date.getUTCFullYear() !== Number(text.slice(0, 4)) ||
|
|
219
|
+
date.getUTCMonth() !== Number(text.slice(4, 6)) - 1 ||
|
|
220
|
+
date.getUTCDate() !== Number(text.slice(6, 8)) ||
|
|
221
|
+
date.getUTCHours() !== Number(text.slice(8, 10)) ||
|
|
222
|
+
date.getUTCMinutes() !== Number(text.slice(10, 12)) ||
|
|
223
|
+
date.getUTCSeconds() !== Number(text.slice(12, 14))) {
|
|
224
|
+
throw new DerParseError("invalid-tag", `${name} has an invalid date`, element.start);
|
|
225
|
+
}
|
|
226
|
+
return date.getTime();
|
|
227
|
+
};
|
|
228
|
+
const parseExtensions = (element, name) => {
|
|
229
|
+
requireTag(element, contextSpecific, element.tagNumber, name, true);
|
|
230
|
+
const critical = [];
|
|
231
|
+
const outer = new DerReader(element.context.input, element.context.limits, element.valueStart, element.end, element.context.depth + 1, element.context.state);
|
|
232
|
+
const sequenceElement = readOne(outer, `${name} sequence`);
|
|
233
|
+
withChildren(sequenceElement, (reader) => {
|
|
234
|
+
while (reader.remaining > 0) {
|
|
235
|
+
const extension = reader.readElement();
|
|
236
|
+
withChildren(extension, (fields) => {
|
|
237
|
+
const oid = readOid(readOne(fields, "extension OID"), "extension OID");
|
|
238
|
+
const maybeCritical = fields.readOptionalElement();
|
|
239
|
+
if (maybeCritical !== undefined && isTag(maybeCritical, universal, 1, false)) {
|
|
240
|
+
if (maybeCritical.value[0] !== 0)
|
|
241
|
+
critical.push(oid);
|
|
242
|
+
readOctets(readOne(fields, "extension value"), "extension value");
|
|
243
|
+
}
|
|
244
|
+
else if (maybeCritical !== undefined) {
|
|
245
|
+
readOctets(maybeCritical, "extension value");
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
outer.assertEnd();
|
|
251
|
+
return Object.freeze(critical);
|
|
252
|
+
};
|
|
253
|
+
const parseSingleResponse = (element) => {
|
|
254
|
+
let certId;
|
|
255
|
+
let status;
|
|
256
|
+
let thisUpdateMs;
|
|
257
|
+
let nextUpdateMs;
|
|
258
|
+
let criticalExtensionOids = [];
|
|
259
|
+
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: The branches mirror the bounded SingleResponse ASN.1 choice and optional fields.
|
|
260
|
+
withChildren(element, (reader) => {
|
|
261
|
+
certId = parseCertId(readOne(reader, "SingleResponse certID"));
|
|
262
|
+
const statusElement = readOne(reader, "SingleResponse certStatus");
|
|
263
|
+
if (isTag(statusElement, contextSpecific, 0, false)) {
|
|
264
|
+
if (statusElement.value.length !== 0)
|
|
265
|
+
throw new DerParseError("invalid-tag", "OCSP good status is not NULL", statusElement.start);
|
|
266
|
+
status = "good";
|
|
267
|
+
}
|
|
268
|
+
else if (isTag(statusElement, contextSpecific, 1, true)) {
|
|
269
|
+
status = "revoked";
|
|
270
|
+
const revokedReader = new DerReader(statusElement.context.input, statusElement.context.limits, statusElement.valueStart, statusElement.end, statusElement.context.depth + 1, statusElement.context.state);
|
|
271
|
+
parseGeneralizedTime(readOne(revokedReader, "revocationTime"), "revocationTime");
|
|
272
|
+
if (revokedReader.remaining > 0)
|
|
273
|
+
revokedReader.readElement();
|
|
274
|
+
revokedReader.assertEnd();
|
|
275
|
+
}
|
|
276
|
+
else if (isTag(statusElement, contextSpecific, 2)) {
|
|
277
|
+
status = "unknown";
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
throw new DerParseError("invalid-tag", "Unsupported OCSP certStatus", statusElement.start);
|
|
281
|
+
}
|
|
282
|
+
thisUpdateMs = parseGeneralizedTime(readOne(reader, "SingleResponse thisUpdate"), "SingleResponse thisUpdate");
|
|
283
|
+
const optional = reader.readOptionalElement();
|
|
284
|
+
if (optional !== undefined && isTag(optional, contextSpecific, 0, true)) {
|
|
285
|
+
const nextReader = new DerReader(optional.context.input, optional.context.limits, optional.valueStart, optional.end, optional.context.depth + 1, optional.context.state);
|
|
286
|
+
nextUpdateMs = parseGeneralizedTime(readOne(nextReader, "nextUpdate"), "nextUpdate");
|
|
287
|
+
nextReader.assertEnd();
|
|
288
|
+
const extensions = reader.readOptionalElement();
|
|
289
|
+
if (extensions !== undefined)
|
|
290
|
+
criticalExtensionOids = parseExtensions(extensions, "singleExtensions");
|
|
291
|
+
}
|
|
292
|
+
else if (optional !== undefined) {
|
|
293
|
+
criticalExtensionOids = parseExtensions(optional, "singleExtensions");
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
if (certId === undefined || status === undefined || thisUpdateMs === undefined)
|
|
297
|
+
throw new DerParseError("unexpected-end", "SingleResponse is incomplete", element.start);
|
|
298
|
+
return Object.freeze({
|
|
299
|
+
certId,
|
|
300
|
+
status,
|
|
301
|
+
thisUpdateMs,
|
|
302
|
+
...(nextUpdateMs === undefined ? {} : { nextUpdateMs }),
|
|
303
|
+
criticalExtensionOids,
|
|
304
|
+
});
|
|
305
|
+
};
|
|
306
|
+
const parseBasicResponse = (input) => {
|
|
307
|
+
const reader = new DerReader(input);
|
|
308
|
+
const root = reader.readElement();
|
|
309
|
+
reader.assertEnd();
|
|
310
|
+
let tbsResponseData;
|
|
311
|
+
let algorithm;
|
|
312
|
+
let signature;
|
|
313
|
+
let responderId;
|
|
314
|
+
let producedAtMs;
|
|
315
|
+
let responses = [];
|
|
316
|
+
let certificates = [];
|
|
317
|
+
let criticalExtensionOids = [];
|
|
318
|
+
withChildren(root, (fields) => {
|
|
319
|
+
const tbs = readOne(fields, "tbsResponseData");
|
|
320
|
+
tbsResponseData = new Uint8Array(input.subarray(tbs.start, tbs.end));
|
|
321
|
+
withChildren(tbs, (data) => {
|
|
322
|
+
const first = data.readElement();
|
|
323
|
+
let responder;
|
|
324
|
+
if (isTag(first, contextSpecific, 0, true)) {
|
|
325
|
+
const versionReader = new DerReader(first.context.input, first.context.limits, first.valueStart, first.end, first.context.depth + 1, first.context.state);
|
|
326
|
+
readInteger(readOne(versionReader, "ResponseData version"), "ResponseData version");
|
|
327
|
+
versionReader.assertEnd();
|
|
328
|
+
responder = data.readElement();
|
|
329
|
+
}
|
|
330
|
+
else {
|
|
331
|
+
responder = first;
|
|
332
|
+
}
|
|
333
|
+
if (isTag(responder, contextSpecific, 1, true)) {
|
|
334
|
+
const nested = new DerReader(input, responder.context.limits, responder.valueStart, responder.end, responder.context.depth + 1, responder.context.state);
|
|
335
|
+
const candidate = nested.readOptionalElement();
|
|
336
|
+
if (candidate !== undefined &&
|
|
337
|
+
isTag(candidate, universal, 16, true) &&
|
|
338
|
+
nested.remaining === 0) {
|
|
339
|
+
responderId = {
|
|
340
|
+
kind: "name",
|
|
341
|
+
value: new Uint8Array(input.subarray(candidate.start, candidate.end)),
|
|
342
|
+
implicit: false,
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
else {
|
|
346
|
+
responderId = {
|
|
347
|
+
kind: "name",
|
|
348
|
+
value: new Uint8Array(input.subarray(responder.valueStart, responder.end)),
|
|
349
|
+
implicit: true,
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
else if (isTag(responder, contextSpecific, 2, true)) {
|
|
354
|
+
responderId = { kind: "key", value: readResponderKeyHash(responder) };
|
|
355
|
+
}
|
|
356
|
+
else {
|
|
357
|
+
throw new DerParseError("invalid-tag", "Invalid OCSP responderID", responder.start);
|
|
358
|
+
}
|
|
359
|
+
producedAtMs = parseGeneralizedTime(data.readElement(), "producedAt");
|
|
360
|
+
const responseList = data.readElement();
|
|
361
|
+
withChildren(responseList, (list) => {
|
|
362
|
+
const parsed = [];
|
|
363
|
+
while (list.remaining > 0)
|
|
364
|
+
parsed.push(parseSingleResponse(list.readElement()));
|
|
365
|
+
responses = Object.freeze(parsed);
|
|
366
|
+
});
|
|
367
|
+
const extensions = data.readOptionalElement();
|
|
368
|
+
if (extensions !== undefined)
|
|
369
|
+
criticalExtensionOids = parseExtensions(extensions, "responseExtensions");
|
|
370
|
+
});
|
|
371
|
+
algorithm = signatureAlgorithm(readOne(fields, "signatureAlgorithm"));
|
|
372
|
+
const signatureElement = readOne(fields, "signature");
|
|
373
|
+
requireTag(signatureElement, universal, 3, "signature", false);
|
|
374
|
+
if (signatureElement.value.length === 0 || signatureElement.value[0] !== 0)
|
|
375
|
+
throw new DerParseError("invalid-tag", "OCSP signature must have zero unused bits", signatureElement.start);
|
|
376
|
+
signature = new Uint8Array(signatureElement.value.subarray(1));
|
|
377
|
+
const certs = fields.readOptionalElement();
|
|
378
|
+
if (certs !== undefined) {
|
|
379
|
+
requireTag(certs, contextSpecific, 0, "certs", true);
|
|
380
|
+
const certReader = new DerReader(input, certs.context.limits, certs.valueStart, certs.end, certs.context.depth + 1, certs.context.state);
|
|
381
|
+
const certSequence = readOne(certReader, "certs sequence");
|
|
382
|
+
withChildren(certSequence, (list) => {
|
|
383
|
+
const parsed = [];
|
|
384
|
+
while (list.remaining > 0) {
|
|
385
|
+
const certificate = list.readElement();
|
|
386
|
+
parsed.push(new Uint8Array(input.subarray(certificate.start, certificate.end)));
|
|
387
|
+
}
|
|
388
|
+
certificates = Object.freeze(parsed);
|
|
389
|
+
});
|
|
390
|
+
certReader.assertEnd();
|
|
391
|
+
}
|
|
392
|
+
});
|
|
393
|
+
if (tbsResponseData === undefined ||
|
|
394
|
+
algorithm === undefined ||
|
|
395
|
+
signature === undefined ||
|
|
396
|
+
responderId === undefined ||
|
|
397
|
+
producedAtMs === undefined)
|
|
398
|
+
throw new DerParseError("unexpected-end", "BasicOCSPResponse is incomplete", 0);
|
|
399
|
+
return Object.freeze({
|
|
400
|
+
tbsResponseData,
|
|
401
|
+
signatureAlgorithm: algorithm,
|
|
402
|
+
signature,
|
|
403
|
+
responderId,
|
|
404
|
+
producedAtMs,
|
|
405
|
+
responses,
|
|
406
|
+
certificates,
|
|
407
|
+
criticalExtensionOids,
|
|
408
|
+
});
|
|
409
|
+
};
|
|
410
|
+
const readResponderKeyHash = (element) => {
|
|
411
|
+
const reader = new DerReader(element.context.input, element.context.limits, element.valueStart, element.end, element.context.depth + 1, element.context.state);
|
|
412
|
+
const hash = readOctets(reader.readElement(), "ResponderID KeyHash");
|
|
413
|
+
reader.assertEnd();
|
|
414
|
+
if (hash.length !== 20) {
|
|
415
|
+
throw new DerParseError("invalid-length", "ResponderID KeyHash must be 20 bytes", element.start);
|
|
416
|
+
}
|
|
417
|
+
return hash;
|
|
418
|
+
};
|
|
419
|
+
/** Parse an OCSPResponse without making a trust decision. */
|
|
420
|
+
export const parseOcspResponse = (input) => {
|
|
421
|
+
const reader = new DerReader(input);
|
|
422
|
+
const root = reader.readElement();
|
|
423
|
+
reader.assertEnd();
|
|
424
|
+
let responseStatus;
|
|
425
|
+
let responseType;
|
|
426
|
+
let basic;
|
|
427
|
+
withChildren(root, (fields) => {
|
|
428
|
+
const status = readOne(fields, "OCSP responseStatus");
|
|
429
|
+
requireTag(status, universal, 10, "OCSP responseStatus", false);
|
|
430
|
+
if (status.value.length !== 1)
|
|
431
|
+
throw new DerParseError("invalid-tag", "OCSP responseStatus must be one byte", status.start);
|
|
432
|
+
responseStatus = status.value[0];
|
|
433
|
+
const responseBytes = fields.readOptionalElement();
|
|
434
|
+
if (responseBytes === undefined)
|
|
435
|
+
return;
|
|
436
|
+
requireTag(responseBytes, contextSpecific, 0, "responseBytes", true);
|
|
437
|
+
const explicit = new DerReader(input, responseBytes.context.limits, responseBytes.valueStart, responseBytes.end, responseBytes.context.depth + 1, responseBytes.context.state);
|
|
438
|
+
const sequenceElement = readOne(explicit, "responseBytes sequence");
|
|
439
|
+
withChildren(sequenceElement, (responseFields) => {
|
|
440
|
+
responseType = readOid(readOne(responseFields, "responseType"), "responseType");
|
|
441
|
+
const octets = readOctets(readOne(responseFields, "response"), "response");
|
|
442
|
+
if (responseType === basicResponseOid)
|
|
443
|
+
basic = parseBasicResponse(octets);
|
|
444
|
+
});
|
|
445
|
+
explicit.assertEnd();
|
|
446
|
+
});
|
|
447
|
+
if (responseStatus === undefined)
|
|
448
|
+
throw new DerParseError("unexpected-end", "OCSP response is incomplete", 0);
|
|
449
|
+
return Object.freeze({
|
|
450
|
+
responseStatus,
|
|
451
|
+
...(responseType === undefined ? {} : { responseType }),
|
|
452
|
+
...(basic === undefined ? {} : { basic }),
|
|
453
|
+
});
|
|
454
|
+
};
|
|
455
|
+
export const ocspNameValue = (certificate) => {
|
|
456
|
+
const range = certificate.metadata.subject;
|
|
457
|
+
return new Uint8Array(certificate.der.subarray(range.offset, range.offset + range.length));
|
|
458
|
+
};
|
|
459
|
+
export const ocspKeyHash = (certificate) =>
|
|
460
|
+
// nosemgrep: no-weak-crypto-hash -- RFC 6960 responderID byKey is defined as SHA-1.
|
|
461
|
+
createHash("sha1")
|
|
462
|
+
.update(rangeBytes(certificate, certificate.metadata.subjectPublicKey.value))
|
|
463
|
+
.digest();
|
|
464
|
+
export const ocspBytesEqual = bytesEqual;
|
|
465
|
+
export const ocspDerRange = derRange;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export interface OcspFetchOptions {
|
|
2
|
+
readonly maxResponseBytes: number;
|
|
3
|
+
}
|
|
4
|
+
/** Default standards-only OCSP POST transport for Node and Workers. */
|
|
5
|
+
export declare const fetchOcspResponse: (url: string, body: Uint8Array, signal: AbortSignal, options: OcspFetchOptions) => Promise<Uint8Array>;
|
|
6
|
+
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../source/ocsp/transport.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;CACnC;AA8CD,uEAAuE;AACvE,eAAO,MAAM,iBAAiB,GAC5B,KAAK,MAAM,EACX,MAAM,UAAU,EAChB,QAAQ,WAAW,EACnB,SAAS,gBAAgB,KACxB,OAAO,CAAC,UAAU,CAuBpB,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
const contentType = "application/ocsp-response";
|
|
2
|
+
const cancelBody = (body) => {
|
|
3
|
+
// Cancellation is best-effort. Preserve the validation error even if cleanup fails.
|
|
4
|
+
void body?.cancel().catch(() => { });
|
|
5
|
+
};
|
|
6
|
+
const readBody = async (response, maxBytes) => {
|
|
7
|
+
const declaredLength = response.headers.get("content-length");
|
|
8
|
+
if (declaredLength !== null) {
|
|
9
|
+
const length = Number(declaredLength);
|
|
10
|
+
if (!Number.isSafeInteger(length) || length < 0 || length > maxBytes) {
|
|
11
|
+
cancelBody(response.body);
|
|
12
|
+
throw new Error("OCSP response exceeds the configured body limit");
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
if (response.body === null)
|
|
16
|
+
return new Uint8Array();
|
|
17
|
+
const reader = response.body.getReader();
|
|
18
|
+
const chunks = [];
|
|
19
|
+
let total = 0;
|
|
20
|
+
try {
|
|
21
|
+
for (;;) {
|
|
22
|
+
const item = await reader.read();
|
|
23
|
+
if (item.done)
|
|
24
|
+
break;
|
|
25
|
+
total += item.value.byteLength;
|
|
26
|
+
if (total > maxBytes) {
|
|
27
|
+
cancelBody(reader);
|
|
28
|
+
throw new Error("OCSP response exceeds the configured body limit");
|
|
29
|
+
}
|
|
30
|
+
chunks.push(item.value);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
finally {
|
|
34
|
+
reader.releaseLock();
|
|
35
|
+
}
|
|
36
|
+
const output = new Uint8Array(total);
|
|
37
|
+
let offset = 0;
|
|
38
|
+
for (const chunk of chunks) {
|
|
39
|
+
output.set(chunk, offset);
|
|
40
|
+
offset += chunk.byteLength;
|
|
41
|
+
}
|
|
42
|
+
return output;
|
|
43
|
+
};
|
|
44
|
+
/** Default standards-only OCSP POST transport for Node and Workers. */
|
|
45
|
+
export const fetchOcspResponse = async (url, body, signal, options) => {
|
|
46
|
+
const fetchFunction = globalThis.fetch;
|
|
47
|
+
if (typeof fetchFunction !== "function")
|
|
48
|
+
throw new Error("The host does not provide fetch");
|
|
49
|
+
const response = await fetchFunction(url, {
|
|
50
|
+
method: "POST",
|
|
51
|
+
body: body,
|
|
52
|
+
signal,
|
|
53
|
+
redirect: "error",
|
|
54
|
+
headers: {
|
|
55
|
+
accept: contentType,
|
|
56
|
+
"content-type": "application/ocsp-request",
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
if (!response.ok) {
|
|
60
|
+
cancelBody(response.body);
|
|
61
|
+
throw new Error(`OCSP responder returned HTTP ${response.status}`);
|
|
62
|
+
}
|
|
63
|
+
const responseContentType = response.headers.get("content-type");
|
|
64
|
+
if (responseContentType !== null && !responseContentType.toLowerCase().startsWith(contentType)) {
|
|
65
|
+
cancelBody(response.body);
|
|
66
|
+
throw new Error("OCSP responder returned an unexpected content type");
|
|
67
|
+
}
|
|
68
|
+
return readBody(response, options.maxResponseBytes);
|
|
69
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type ReceiptErrorCode = "invalid-base64" | "invalid-utf8" | "invalid-structure" | "limit-exceeded";
|
|
2
|
+
export declare class ReceiptFormatError extends Error {
|
|
3
|
+
readonly code: ReceiptErrorCode;
|
|
4
|
+
readonly offset?: number;
|
|
5
|
+
constructor(code: ReceiptErrorCode, message: string, offset?: number, cause?: unknown);
|
|
6
|
+
}
|
|
7
|
+
export type ReceiptExtractionResult = {
|
|
8
|
+
readonly kind: "found";
|
|
9
|
+
readonly transactionId: string;
|
|
10
|
+
} | {
|
|
11
|
+
readonly kind: "missing";
|
|
12
|
+
};
|
|
13
|
+
export type ReceiptExtractionOutcome = ReceiptExtractionResult | {
|
|
14
|
+
readonly kind: "error";
|
|
15
|
+
readonly error: ReceiptFormatError;
|
|
16
|
+
};
|
|
17
|
+
export type AppReceiptInput = string | Uint8Array;
|
|
18
|
+
export declare const parseAppReceiptTransactionId: (input: AppReceiptInput) => ReceiptExtractionOutcome;
|
|
19
|
+
export declare const extractTransactionIdFromAppReceipt: (input: AppReceiptInput) => string | null;
|
|
20
|
+
export declare const parseTransactionReceiptTransactionId: (transactionReceipt: string) => ReceiptExtractionOutcome;
|
|
21
|
+
export declare const extractTransactionIdFromTransactionReceipt: (transactionReceipt: string) => string | null;
|
|
22
|
+
/** Compatibility facade matching Apple's receipt utility method names. */
|
|
23
|
+
export declare class ReceiptUtility {
|
|
24
|
+
extractTransactionIdFromAppReceipt(input: AppReceiptInput): string | null;
|
|
25
|
+
extractTransactionIdFromTransactionReceipt(transactionReceipt: string): string | null;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=utility.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utility.d.ts","sourceRoot":"","sources":["../../source/receipt/utility.ts"],"names":[],"mappings":"AAsBA,MAAM,MAAM,gBAAgB,GACxB,gBAAgB,GAChB,cAAc,GACd,mBAAmB,GACnB,gBAAgB,CAAC;AAErB,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;gBAEb,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAMtF;AAED,MAAM,MAAM,uBAAuB,GAC/B;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;CAAE,GAC1D;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC;AAEjC,MAAM,MAAM,wBAAwB,GAChC,uBAAuB,GACvB;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,kBAAkB,CAAA;CAAE,CAAC;AAEnE,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,UAAU,CAAC;AAwSlD,eAAO,MAAM,4BAA4B,GAAI,OAAO,eAAe,KAAG,wBAOrE,CAAC;AAEF,eAAO,MAAM,kCAAkC,GAAI,OAAO,eAAe,KAAG,MAAM,GAAG,IAGpF,CAAC;AAaF,eAAO,MAAM,oCAAoC,GAC/C,oBAAoB,MAAM,KACzB,wBAOF,CAAC;AAEF,eAAO,MAAM,0CAA0C,GACrD,oBAAoB,MAAM,KACzB,MAAM,GAAG,IAGX,CAAC;AAEF,0EAA0E;AAC1E,qBAAa,cAAc;IACzB,kCAAkC,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,GAAG,IAAI;IAIzE,0CAA0C,CAAC,kBAAkB,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;CAGtF"}
|