@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
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Releases
|
|
2
|
+
|
|
3
|
+
## v0.0.1 — Initial public release
|
|
4
|
+
|
|
5
|
+
Initial public release of `@preeternal/jws-verifier`.
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Compact ES256 JWS verification with X.509 certificate-chain validation.
|
|
10
|
+
- Offline and online verification modes with optional OCSP revocation checks.
|
|
11
|
+
- Synchronous transaction ID extraction from App Receipts and transaction
|
|
12
|
+
receipts.
|
|
13
|
+
- ESM package for Node.js 22+ and Cloudflare Workers.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Preeternal
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,86 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@preeternal/jws-verifier`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@preeternal/jws-verifier)
|
|
4
|
+
[](https://www.npmjs.com/package/@preeternal/jws-verifier)
|
|
5
|
+
[](https://www.patreon.com/preeternal)
|
|
6
|
+
|
|
7
|
+
TypeScript library for verifying compact ES256 JWS with X.509 certificate chains
|
|
8
|
+
and optional OCSP revocation checks.
|
|
9
|
+
|
|
10
|
+
## Why this library?
|
|
11
|
+
|
|
12
|
+
Use it when your application needs to verify signed messages independently of
|
|
13
|
+
a provider SDK. You supply trusted roots, claim rules, and an OCSP policy. For
|
|
14
|
+
example, a service that receives App Store notifications can use the verifier
|
|
15
|
+
independently of its App Store Server API client.
|
|
16
|
+
|
|
17
|
+
The package is ESM-only and targets Node.js 22+ and Cloudflare Workers with
|
|
18
|
+
Node.js compatibility enabled. It uses `node:crypto` for signatures and
|
|
19
|
+
hashing, with TypeScript parsers for certificates, OCSP, and legacy receipts.
|
|
20
|
+
|
|
21
|
+
## Install
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
yarn add @preeternal/jws-verifier
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import { createVerifier } from "@preeternal/jws-verifier";
|
|
31
|
+
|
|
32
|
+
const verifier = createVerifier({
|
|
33
|
+
trustedRoots: [rootDer], // Uint8Array loaded from your trusted configuration
|
|
34
|
+
policy: {
|
|
35
|
+
mode: "offline",
|
|
36
|
+
application: "com.example.app",
|
|
37
|
+
environment: "sandbox",
|
|
38
|
+
claimPaths: { application: ["data", "id"], environment: ["data", "environment"] },
|
|
39
|
+
signedTimePath: ["issuedAt"],
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const { payload } = await verifier.verify(compactJws);
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Obtain DER trust anchors from your provider or your own trust configuration,
|
|
47
|
+
independently of the incoming JWS. Set the claim paths and any
|
|
48
|
+
`requiredExtensions` to match the signing profile your application accepts.
|
|
49
|
+
The example paths are illustrative.
|
|
50
|
+
|
|
51
|
+
- **Offline** checks certificate validity at a signed Unix millisecond
|
|
52
|
+
timestamp from `signedTimePath` or at an explicit time passed as
|
|
53
|
+
`verify(compactJws, { effectiveTime })`. It performs no OCSP queries.
|
|
54
|
+
- **Online** checks certificate validity against the host clock and checks
|
|
55
|
+
revocation through OCSP. Set `mode: "online"` and
|
|
56
|
+
`ocsp: { allowedEndpoints: [...] }` inside `policy`. The built-in transport
|
|
57
|
+
uses the host's `fetch`, rejects redirects, and enforces time and body-size
|
|
58
|
+
limits. To customize it, pass a top-level `ocspTransport` callback that
|
|
59
|
+
takes `{ url, body, signal }` and returns response bytes. Reuse the verifier
|
|
60
|
+
for a stable configuration to take advantage of its validation cache.
|
|
61
|
+
|
|
62
|
+
For legacy App Receipts, `extractTransactionIdFromAppReceipt` reads the ID
|
|
63
|
+
synchronously. The extracted value alone does not establish receipt
|
|
64
|
+
authenticity or purchase entitlement.
|
|
65
|
+
|
|
66
|
+
## Performance
|
|
67
|
+
|
|
68
|
+
CPU time per verification (median / p95) on Linux GitHub Actions at `8fe678a`.
|
|
69
|
+
The benchmark uses synthetic ES256 JWS and OCSP responses replayed from memory.
|
|
70
|
+
|
|
71
|
+
| Scenario | Node 22 · Xeon | Node 24 · EPYC |
|
|
72
|
+
| ------------------------------ | -------------: | -------------: |
|
|
73
|
+
| First verification after setup | 7.11 / 7.48 ms | 5.46 / 7.89 ms |
|
|
74
|
+
| Warm cache miss | 1.24 / 3.94 ms | 0.68 / 1.31 ms |
|
|
75
|
+
| Warm cache hit | 0.14 / 0.49 ms | 0.08 / 0.48 ms |
|
|
76
|
+
|
|
77
|
+
Run locally with `yarn benchmark:ci`. [Node 22 CI report](https://github.com/Preeternal/jws-verifier/actions/runs/44414540308/attempts/1#summary-135191235409) · [Node 24 CI report](https://github.com/Preeternal/jws-verifier/actions/runs/44414540308/attempts/1#summary-135191235313)
|
|
78
|
+
|
|
79
|
+
## Contributing
|
|
80
|
+
|
|
81
|
+
Development setup, checks, benchmarks, Worker startup, and pull-request
|
|
82
|
+
guidance are documented in [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
83
|
+
|
|
84
|
+
## License
|
|
85
|
+
|
|
86
|
+
[MIT](LICENSE) © Preeternal.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export type BerTagClass = 0 | 1 | 2 | 3;
|
|
2
|
+
export type BerErrorCode = "invalid-tag" | "invalid-length" | "indefinite-primitive" | "unexpected-end" | "container-overrun" | "trailing-data" | "limit-exceeded";
|
|
3
|
+
export interface BerLimits {
|
|
4
|
+
readonly maxDepth?: number;
|
|
5
|
+
readonly maxElements?: number;
|
|
6
|
+
readonly maxInputBytes?: number;
|
|
7
|
+
readonly maxWorkBytes?: number;
|
|
8
|
+
}
|
|
9
|
+
interface BerState {
|
|
10
|
+
elements: number;
|
|
11
|
+
workBytes: number;
|
|
12
|
+
}
|
|
13
|
+
export declare const DEFAULT_BER_LIMITS: Readonly<{
|
|
14
|
+
maxDepth: 32;
|
|
15
|
+
maxElements: 8192;
|
|
16
|
+
maxInputBytes: number;
|
|
17
|
+
maxWorkBytes: number;
|
|
18
|
+
}>;
|
|
19
|
+
export declare class BerParseError extends Error {
|
|
20
|
+
readonly code: BerErrorCode;
|
|
21
|
+
readonly offset: number;
|
|
22
|
+
constructor(code: BerErrorCode, message: string, offset: number);
|
|
23
|
+
}
|
|
24
|
+
export interface BerElement {
|
|
25
|
+
readonly tagClass: BerTagClass;
|
|
26
|
+
readonly tagNumber: number;
|
|
27
|
+
readonly constructed: boolean;
|
|
28
|
+
readonly indefiniteLength: boolean;
|
|
29
|
+
readonly start: number;
|
|
30
|
+
readonly headerLength: number;
|
|
31
|
+
readonly valueStart: number;
|
|
32
|
+
/** End of the content, excluding the EOC marker for indefinite elements. */
|
|
33
|
+
readonly contentEnd: number;
|
|
34
|
+
/** End of the complete TLV, including the EOC marker when present. */
|
|
35
|
+
readonly end: number;
|
|
36
|
+
readonly value: Uint8Array;
|
|
37
|
+
readonly limits: Required<BerLimits>;
|
|
38
|
+
}
|
|
39
|
+
export declare class BerCursor {
|
|
40
|
+
readonly input: Uint8Array;
|
|
41
|
+
readonly start: number;
|
|
42
|
+
readonly end: number;
|
|
43
|
+
readonly depth: number;
|
|
44
|
+
readonly limits: Required<BerLimits>;
|
|
45
|
+
private position;
|
|
46
|
+
private readonly state;
|
|
47
|
+
constructor(input: Uint8Array, options?: BerLimits, start?: number, end?: number, depth?: number, state?: BerState);
|
|
48
|
+
get remaining(): number;
|
|
49
|
+
readElement(): BerElement;
|
|
50
|
+
readOptionalElement(): BerElement | undefined;
|
|
51
|
+
assertEnd(): void;
|
|
52
|
+
private parseIndefiniteContent;
|
|
53
|
+
private parseDefiniteContent;
|
|
54
|
+
private parseElement;
|
|
55
|
+
}
|
|
56
|
+
export {};
|
|
57
|
+
//# sourceMappingURL=ber-reader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ber-reader.d.ts","sourceRoot":"","sources":["../../source/asn1/ber-reader.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAExC,MAAM,MAAM,YAAY,GACpB,aAAa,GACb,gBAAgB,GAChB,sBAAsB,GACtB,gBAAgB,GAChB,mBAAmB,GACnB,eAAe,GACf,gBAAgB,CAAC;AAErB,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,UAAU,QAAQ;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,kBAAkB;;;;;EAK7B,CAAC;AAEH,qBAAa,aAAc,SAAQ,KAAK;IACtC,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAMhE;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACnC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,4EAA4E;IAC5E,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,sEAAsE;IACtE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;CACtC;AAsGD,qBAAa,SAAS;IACpB,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;IAErC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAW;gBAG/B,KAAK,EAAE,UAAU,EACjB,OAAO,GAAE,SAAc,EACvB,KAAK,SAAI,EACT,GAAG,SAAmB,EACtB,KAAK,SAAI,EACT,KAAK,GAAE,QAAwC;IA4BjD,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,WAAW,IAAI,UAAU;IAMzB,mBAAmB,IAAI,UAAU,GAAG,SAAS;IAI7C,SAAS,IAAI,IAAI;IAUjB,OAAO,CAAC,sBAAsB;IAqB9B,OAAO,CAAC,oBAAoB;IA2B5B,OAAO,CAAC,YAAY;CAkDrB"}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
export const DEFAULT_BER_LIMITS = Object.freeze({
|
|
2
|
+
maxDepth: 32,
|
|
3
|
+
maxElements: 8192,
|
|
4
|
+
maxInputBytes: 4 * 1024 * 1024,
|
|
5
|
+
maxWorkBytes: 16 * 1024 * 1024,
|
|
6
|
+
});
|
|
7
|
+
export class BerParseError extends Error {
|
|
8
|
+
code;
|
|
9
|
+
offset;
|
|
10
|
+
constructor(code, message, offset) {
|
|
11
|
+
super(`${message} at offset ${offset}`);
|
|
12
|
+
this.name = "BerParseError";
|
|
13
|
+
this.code = code;
|
|
14
|
+
this.offset = offset;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
const readHighTagNumber = (input, position, end, start) => {
|
|
18
|
+
let tagNumber = 0;
|
|
19
|
+
let count = 0;
|
|
20
|
+
let firstByte = true;
|
|
21
|
+
let byte = 0;
|
|
22
|
+
do {
|
|
23
|
+
if (position.value >= end) {
|
|
24
|
+
throw new BerParseError("unexpected-end", "Truncated BER high-tag-number form", position.value);
|
|
25
|
+
}
|
|
26
|
+
byte = input[position.value] ?? 0;
|
|
27
|
+
position.value += 1;
|
|
28
|
+
count += 1;
|
|
29
|
+
if (firstByte && byte === 0x80) {
|
|
30
|
+
throw new BerParseError("invalid-tag", "Non-canonical BER high-tag-number form", position.value - 1);
|
|
31
|
+
}
|
|
32
|
+
firstByte = false;
|
|
33
|
+
tagNumber = tagNumber * 128 + (byte & 0x7f);
|
|
34
|
+
if (tagNumber > 0x1fffff || count > 4) {
|
|
35
|
+
throw new BerParseError("limit-exceeded", "BER tag number is too large", start);
|
|
36
|
+
}
|
|
37
|
+
} while ((byte & 0x80) !== 0);
|
|
38
|
+
if (tagNumber < 31) {
|
|
39
|
+
throw new BerParseError("invalid-tag", "Non-canonical BER high-tag-number form", start);
|
|
40
|
+
}
|
|
41
|
+
return tagNumber;
|
|
42
|
+
};
|
|
43
|
+
const readTag = (input, position, end) => {
|
|
44
|
+
if (position.value >= end) {
|
|
45
|
+
throw new BerParseError("unexpected-end", "Missing BER tag", position.value);
|
|
46
|
+
}
|
|
47
|
+
const start = position.value;
|
|
48
|
+
const first = input[position.value] ?? 0;
|
|
49
|
+
position.value += 1;
|
|
50
|
+
if (first === 0) {
|
|
51
|
+
throw new BerParseError("invalid-tag", "Unexpected BER end-of-contents marker", start);
|
|
52
|
+
}
|
|
53
|
+
const tagNumber = (first & 0x1f) === 0x1f ? readHighTagNumber(input, position, end, start) : first & 0x1f;
|
|
54
|
+
return {
|
|
55
|
+
tagClass: ((first >>> 6) & 0x03),
|
|
56
|
+
tagNumber,
|
|
57
|
+
constructed: (first & 0x20) !== 0,
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
const readLength = (input, position, end) => {
|
|
61
|
+
if (position.value >= end) {
|
|
62
|
+
throw new BerParseError("unexpected-end", "Missing BER length", position.value);
|
|
63
|
+
}
|
|
64
|
+
const offset = position.value;
|
|
65
|
+
const first = input[position.value] ?? 0;
|
|
66
|
+
position.value += 1;
|
|
67
|
+
if (first === 0x80)
|
|
68
|
+
return { indefinite: true };
|
|
69
|
+
if ((first & 0x80) === 0)
|
|
70
|
+
return { indefinite: false, length: first };
|
|
71
|
+
const byteCount = first & 0x7f;
|
|
72
|
+
if (byteCount === 0 || byteCount > 4) {
|
|
73
|
+
throw new BerParseError("invalid-length", "BER length uses too many bytes", offset);
|
|
74
|
+
}
|
|
75
|
+
if (position.value >= end) {
|
|
76
|
+
throw new BerParseError("unexpected-end", "Truncated BER length", position.value);
|
|
77
|
+
}
|
|
78
|
+
const firstLengthByte = input[position.value] ?? 0;
|
|
79
|
+
if (firstLengthByte === 0) {
|
|
80
|
+
throw new BerParseError("invalid-length", "Non-canonical BER length", position.value);
|
|
81
|
+
}
|
|
82
|
+
let length = firstLengthByte;
|
|
83
|
+
position.value += 1;
|
|
84
|
+
for (let index = 1; index < byteCount; index += 1) {
|
|
85
|
+
if (position.value >= end) {
|
|
86
|
+
throw new BerParseError("unexpected-end", "Truncated BER length", position.value);
|
|
87
|
+
}
|
|
88
|
+
length = length * 256 + (input[position.value] ?? 0);
|
|
89
|
+
position.value += 1;
|
|
90
|
+
}
|
|
91
|
+
return { indefinite: false, length };
|
|
92
|
+
};
|
|
93
|
+
export class BerCursor {
|
|
94
|
+
input;
|
|
95
|
+
start;
|
|
96
|
+
end;
|
|
97
|
+
depth;
|
|
98
|
+
limits;
|
|
99
|
+
position;
|
|
100
|
+
state;
|
|
101
|
+
constructor(input, options = {}, start = 0, end = input.byteLength, depth = 0, state = { elements: 0, workBytes: 0 }) {
|
|
102
|
+
if (!(input instanceof Uint8Array)) {
|
|
103
|
+
throw new TypeError("BER input must be a Uint8Array");
|
|
104
|
+
}
|
|
105
|
+
const limits = { ...DEFAULT_BER_LIMITS, ...options };
|
|
106
|
+
if (input.byteLength > limits.maxInputBytes) {
|
|
107
|
+
throw new BerParseError("limit-exceeded", "BER input exceeds the configured limit", 0);
|
|
108
|
+
}
|
|
109
|
+
if (start < 0 || end < start || end > input.byteLength) {
|
|
110
|
+
throw new RangeError("BER cursor bounds are invalid");
|
|
111
|
+
}
|
|
112
|
+
if (depth > limits.maxDepth) {
|
|
113
|
+
throw new BerParseError("limit-exceeded", "BER nesting depth exceeds the configured limit", start);
|
|
114
|
+
}
|
|
115
|
+
this.input = input;
|
|
116
|
+
this.start = start;
|
|
117
|
+
this.end = end;
|
|
118
|
+
this.depth = depth;
|
|
119
|
+
this.limits = limits;
|
|
120
|
+
this.position = start;
|
|
121
|
+
this.state = state;
|
|
122
|
+
}
|
|
123
|
+
get remaining() {
|
|
124
|
+
return this.end - this.position;
|
|
125
|
+
}
|
|
126
|
+
readElement() {
|
|
127
|
+
const element = this.parseElement(this.position, this.end, this.depth);
|
|
128
|
+
this.position = element.end;
|
|
129
|
+
return element;
|
|
130
|
+
}
|
|
131
|
+
readOptionalElement() {
|
|
132
|
+
return this.position < this.end ? this.readElement() : undefined;
|
|
133
|
+
}
|
|
134
|
+
assertEnd() {
|
|
135
|
+
if (this.position !== this.end) {
|
|
136
|
+
throw new BerParseError("trailing-data", "Unexpected bytes after BER elements", this.position);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
parseIndefiniteContent(valueStart, boundary, depth) {
|
|
140
|
+
let childPosition = valueStart;
|
|
141
|
+
for (;;) {
|
|
142
|
+
if (childPosition + 2 > boundary) {
|
|
143
|
+
throw new BerParseError("unexpected-end", "Missing BER end-of-contents marker", childPosition);
|
|
144
|
+
}
|
|
145
|
+
if (this.input[childPosition] === 0 && this.input[childPosition + 1] === 0) {
|
|
146
|
+
return { contentEnd: childPosition, end: childPosition + 2 };
|
|
147
|
+
}
|
|
148
|
+
childPosition = this.parseElement(childPosition, boundary, depth + 1).end;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
parseDefiniteContent(valueStart, length, boundary, constructed, depth) {
|
|
152
|
+
const contentEnd = valueStart + length;
|
|
153
|
+
if (contentEnd > boundary) {
|
|
154
|
+
throw new BerParseError("container-overrun", "BER element exceeds its parent container", valueStart);
|
|
155
|
+
}
|
|
156
|
+
if (constructed) {
|
|
157
|
+
let childPosition = valueStart;
|
|
158
|
+
while (childPosition < contentEnd) {
|
|
159
|
+
childPosition = this.parseElement(childPosition, contentEnd, depth + 1).end;
|
|
160
|
+
}
|
|
161
|
+
if (childPosition !== contentEnd) {
|
|
162
|
+
throw new BerParseError("trailing-data", "BER container has trailing bytes", childPosition);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return { contentEnd, end: contentEnd };
|
|
166
|
+
}
|
|
167
|
+
parseElement(start, boundary, depth) {
|
|
168
|
+
if (depth > this.limits.maxDepth) {
|
|
169
|
+
throw new BerParseError("limit-exceeded", "BER nesting depth exceeds the configured limit", start);
|
|
170
|
+
}
|
|
171
|
+
this.state.elements += 1;
|
|
172
|
+
if (this.state.elements > this.limits.maxElements) {
|
|
173
|
+
throw new BerParseError("limit-exceeded", "BER element count exceeds the configured limit", start);
|
|
174
|
+
}
|
|
175
|
+
const position = { value: start };
|
|
176
|
+
const tag = readTag(this.input, position, boundary);
|
|
177
|
+
const length = readLength(this.input, position, boundary);
|
|
178
|
+
const valueStart = position.value;
|
|
179
|
+
if (length.indefinite && !tag.constructed) {
|
|
180
|
+
throw new BerParseError("indefinite-primitive", "Indefinite BER length is only valid for constructed elements", start);
|
|
181
|
+
}
|
|
182
|
+
const content = length.indefinite
|
|
183
|
+
? this.parseIndefiniteContent(valueStart, boundary, depth)
|
|
184
|
+
: this.parseDefiniteContent(valueStart, length.length ?? 0, boundary, tag.constructed, depth);
|
|
185
|
+
const { contentEnd, end } = content;
|
|
186
|
+
this.state.workBytes += end - start;
|
|
187
|
+
if (this.state.workBytes > this.limits.maxWorkBytes) {
|
|
188
|
+
throw new BerParseError("limit-exceeded", "BER work exceeds the configured limit", start);
|
|
189
|
+
}
|
|
190
|
+
return Object.freeze({
|
|
191
|
+
...tag,
|
|
192
|
+
indefiniteLength: length.indefinite,
|
|
193
|
+
start,
|
|
194
|
+
headerLength: valueStart - start,
|
|
195
|
+
valueStart,
|
|
196
|
+
contentEnd,
|
|
197
|
+
end,
|
|
198
|
+
value: this.input.subarray(valueStart, contentEnd),
|
|
199
|
+
limits: this.limits,
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export type DerTagClass = 0 | 1 | 2 | 3;
|
|
2
|
+
export type DerErrorCode = "input-too-large" | "invalid-tag" | "invalid-length" | "indefinite-length" | "unexpected-end" | "container-overrun" | "trailing-data" | "limit-exceeded";
|
|
3
|
+
export interface ByteRange {
|
|
4
|
+
readonly offset: number;
|
|
5
|
+
readonly length: number;
|
|
6
|
+
}
|
|
7
|
+
export interface DerLimits {
|
|
8
|
+
readonly maxDepth?: number;
|
|
9
|
+
readonly maxElements?: number;
|
|
10
|
+
readonly maxInputBytes?: number;
|
|
11
|
+
readonly maxWorkBytes?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface DerElement {
|
|
14
|
+
readonly tagClass: DerTagClass;
|
|
15
|
+
readonly tagNumber: number;
|
|
16
|
+
readonly constructed: boolean;
|
|
17
|
+
readonly start: number;
|
|
18
|
+
readonly headerLength: number;
|
|
19
|
+
readonly valueStart: number;
|
|
20
|
+
readonly end: number;
|
|
21
|
+
readonly value: Uint8Array;
|
|
22
|
+
readonly context: DerReaderContext;
|
|
23
|
+
}
|
|
24
|
+
interface ReaderState {
|
|
25
|
+
elements: number;
|
|
26
|
+
workBytes: number;
|
|
27
|
+
}
|
|
28
|
+
export interface DerReaderContext {
|
|
29
|
+
readonly input: Uint8Array;
|
|
30
|
+
readonly limits: Required<DerLimits>;
|
|
31
|
+
readonly depth: number;
|
|
32
|
+
readonly state: ReaderState;
|
|
33
|
+
}
|
|
34
|
+
export declare const DEFAULT_DER_LIMITS: Readonly<{
|
|
35
|
+
maxDepth: 24;
|
|
36
|
+
maxElements: 4096;
|
|
37
|
+
maxInputBytes: number;
|
|
38
|
+
maxWorkBytes: number;
|
|
39
|
+
}>;
|
|
40
|
+
export declare class DerParseError extends Error {
|
|
41
|
+
readonly code: DerErrorCode;
|
|
42
|
+
readonly offset: number;
|
|
43
|
+
constructor(code: DerErrorCode, message: string, offset: number);
|
|
44
|
+
}
|
|
45
|
+
export declare class DerReader {
|
|
46
|
+
readonly input: Uint8Array;
|
|
47
|
+
readonly start: number;
|
|
48
|
+
readonly end: number;
|
|
49
|
+
readonly depth: number;
|
|
50
|
+
readonly limits: Required<DerLimits>;
|
|
51
|
+
private position;
|
|
52
|
+
private readonly state;
|
|
53
|
+
constructor(input: Uint8Array, options?: DerLimits, start?: number, end?: number, depth?: number, state?: ReaderState);
|
|
54
|
+
get remaining(): number;
|
|
55
|
+
readElement(): DerElement;
|
|
56
|
+
readOptionalElement(): DerElement | undefined;
|
|
57
|
+
readChildren(element: DerElement, callback: (reader: DerReader) => void): void;
|
|
58
|
+
assertEnd(): void;
|
|
59
|
+
range(element: DerElement): ByteRange;
|
|
60
|
+
valueRange(element: DerElement): ByteRange;
|
|
61
|
+
private incrementWork;
|
|
62
|
+
private readTag;
|
|
63
|
+
private readLength;
|
|
64
|
+
private readByte;
|
|
65
|
+
}
|
|
66
|
+
export declare const derRange: (offset: number, length: number) => ByteRange;
|
|
67
|
+
export {};
|
|
68
|
+
//# sourceMappingURL=der-reader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"der-reader.d.ts","sourceRoot":"","sources":["../../source/asn1/der-reader.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
export const DEFAULT_DER_LIMITS = Object.freeze({
|
|
2
|
+
maxDepth: 24,
|
|
3
|
+
maxElements: 4096,
|
|
4
|
+
maxInputBytes: 1024 * 1024,
|
|
5
|
+
maxWorkBytes: 4 * 1024 * 1024,
|
|
6
|
+
});
|
|
7
|
+
const makeRange = (offset, length) => Object.freeze({ offset, length });
|
|
8
|
+
export class DerParseError extends Error {
|
|
9
|
+
code;
|
|
10
|
+
offset;
|
|
11
|
+
constructor(code, message, offset) {
|
|
12
|
+
super(`${message} at offset ${offset}`);
|
|
13
|
+
this.name = "DerParseError";
|
|
14
|
+
this.code = code;
|
|
15
|
+
this.offset = offset;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export class DerReader {
|
|
19
|
+
input;
|
|
20
|
+
start;
|
|
21
|
+
end;
|
|
22
|
+
depth;
|
|
23
|
+
limits;
|
|
24
|
+
position;
|
|
25
|
+
state;
|
|
26
|
+
constructor(input, options = {}, start = 0, end = input.byteLength, depth = 0, state = { elements: 0, workBytes: 0 }) {
|
|
27
|
+
if (!(input instanceof Uint8Array)) {
|
|
28
|
+
throw new TypeError("DER input must be a Uint8Array");
|
|
29
|
+
}
|
|
30
|
+
const limits = {
|
|
31
|
+
...DEFAULT_DER_LIMITS,
|
|
32
|
+
...options,
|
|
33
|
+
};
|
|
34
|
+
if (input.byteLength > limits.maxInputBytes) {
|
|
35
|
+
throw new DerParseError("input-too-large", "DER input exceeds the configured limit", 0);
|
|
36
|
+
}
|
|
37
|
+
if (start < 0 || end < start || end > input.byteLength) {
|
|
38
|
+
throw new RangeError("DER reader bounds are invalid");
|
|
39
|
+
}
|
|
40
|
+
if (depth > limits.maxDepth) {
|
|
41
|
+
throw new DerParseError("limit-exceeded", "DER nesting depth exceeds the configured limit", start);
|
|
42
|
+
}
|
|
43
|
+
this.input = input;
|
|
44
|
+
this.start = start;
|
|
45
|
+
this.end = end;
|
|
46
|
+
this.depth = depth;
|
|
47
|
+
this.limits = limits;
|
|
48
|
+
this.position = start;
|
|
49
|
+
this.state = state;
|
|
50
|
+
}
|
|
51
|
+
get remaining() {
|
|
52
|
+
return this.end - this.position;
|
|
53
|
+
}
|
|
54
|
+
readElement() {
|
|
55
|
+
const start = this.position;
|
|
56
|
+
if (start >= this.end) {
|
|
57
|
+
throw new DerParseError("unexpected-end", "Expected another DER element", start);
|
|
58
|
+
}
|
|
59
|
+
this.incrementWork(start);
|
|
60
|
+
const tag = this.readTag(start);
|
|
61
|
+
const length = this.readLength(this.position);
|
|
62
|
+
const valueStart = this.position;
|
|
63
|
+
const end = valueStart + length;
|
|
64
|
+
if (end > this.end) {
|
|
65
|
+
throw new DerParseError("container-overrun", "DER element exceeds its parent container", valueStart);
|
|
66
|
+
}
|
|
67
|
+
this.state.workBytes += end - start;
|
|
68
|
+
if (this.state.workBytes > this.limits.maxWorkBytes) {
|
|
69
|
+
throw new DerParseError("limit-exceeded", "DER work exceeds the configured limit", start);
|
|
70
|
+
}
|
|
71
|
+
this.position = end;
|
|
72
|
+
return Object.freeze({
|
|
73
|
+
...tag,
|
|
74
|
+
start,
|
|
75
|
+
headerLength: valueStart - start,
|
|
76
|
+
valueStart,
|
|
77
|
+
end,
|
|
78
|
+
value: this.input.subarray(valueStart, end),
|
|
79
|
+
context: Object.freeze({
|
|
80
|
+
input: this.input,
|
|
81
|
+
limits: this.limits,
|
|
82
|
+
depth: this.depth,
|
|
83
|
+
state: this.state,
|
|
84
|
+
}),
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
readOptionalElement() {
|
|
88
|
+
return this.position < this.end ? this.readElement() : undefined;
|
|
89
|
+
}
|
|
90
|
+
readChildren(element, callback) {
|
|
91
|
+
if (!element.constructed) {
|
|
92
|
+
throw new DerParseError("invalid-tag", "Constructed DER element expected", element.start);
|
|
93
|
+
}
|
|
94
|
+
const child = new DerReader(this.input, this.limits, element.valueStart, element.end, this.depth + 1, this.state);
|
|
95
|
+
callback(child);
|
|
96
|
+
child.assertEnd();
|
|
97
|
+
}
|
|
98
|
+
assertEnd() {
|
|
99
|
+
if (this.position !== this.end) {
|
|
100
|
+
throw new DerParseError("trailing-data", "Unexpected bytes after DER elements", this.position);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
range(element) {
|
|
104
|
+
return makeRange(element.start, element.end - element.start);
|
|
105
|
+
}
|
|
106
|
+
valueRange(element) {
|
|
107
|
+
return makeRange(element.valueStart, element.end - element.valueStart);
|
|
108
|
+
}
|
|
109
|
+
incrementWork(start) {
|
|
110
|
+
this.state.elements += 1;
|
|
111
|
+
this.state.workBytes += 1;
|
|
112
|
+
if (this.state.elements > this.limits.maxElements) {
|
|
113
|
+
throw new DerParseError("limit-exceeded", "DER element count exceeds the configured limit", start);
|
|
114
|
+
}
|
|
115
|
+
if (this.state.workBytes > this.limits.maxWorkBytes) {
|
|
116
|
+
throw new DerParseError("limit-exceeded", "DER work exceeds the configured limit", start);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
readTag(start) {
|
|
120
|
+
const first = this.readByte("invalid-tag", "Missing DER tag");
|
|
121
|
+
const tagClass = ((first >>> 6) & 0x03);
|
|
122
|
+
const constructed = (first & 0x20) !== 0;
|
|
123
|
+
let tagNumber = first & 0x1f;
|
|
124
|
+
if (tagNumber === 0x1f) {
|
|
125
|
+
tagNumber = 0;
|
|
126
|
+
let count = 0;
|
|
127
|
+
let firstHighByte = true;
|
|
128
|
+
let byte;
|
|
129
|
+
do {
|
|
130
|
+
byte = this.readByte("invalid-tag", "Truncated high-tag-number form");
|
|
131
|
+
count += 1;
|
|
132
|
+
if (firstHighByte && byte === 0x80) {
|
|
133
|
+
throw new DerParseError("invalid-tag", "Non-canonical high-tag-number form", this.position - 1);
|
|
134
|
+
}
|
|
135
|
+
firstHighByte = false;
|
|
136
|
+
tagNumber = tagNumber * 128 + (byte & 0x7f);
|
|
137
|
+
if (tagNumber > 0x1fffff || count > 4) {
|
|
138
|
+
throw new DerParseError("limit-exceeded", "DER tag number is too large", start);
|
|
139
|
+
}
|
|
140
|
+
} while ((byte & 0x80) !== 0);
|
|
141
|
+
if (tagNumber < 31) {
|
|
142
|
+
throw new DerParseError("invalid-tag", "Non-canonical high-tag-number form", start);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return { tagClass, tagNumber, constructed };
|
|
146
|
+
}
|
|
147
|
+
readLength(offset) {
|
|
148
|
+
const first = this.readByte("invalid-length", "Missing DER length");
|
|
149
|
+
if (first === 0x80) {
|
|
150
|
+
throw new DerParseError("indefinite-length", "Indefinite DER length is not allowed", offset);
|
|
151
|
+
}
|
|
152
|
+
if ((first & 0x80) === 0) {
|
|
153
|
+
return first;
|
|
154
|
+
}
|
|
155
|
+
const byteCount = first & 0x7f;
|
|
156
|
+
if (byteCount === 0 || byteCount > 4) {
|
|
157
|
+
throw new DerParseError("invalid-length", "DER length uses too many bytes", offset);
|
|
158
|
+
}
|
|
159
|
+
const firstLengthByte = this.readByte("invalid-length", "Truncated DER length");
|
|
160
|
+
if (firstLengthByte === 0) {
|
|
161
|
+
throw new DerParseError("invalid-length", "Non-canonical DER length", this.position - 1);
|
|
162
|
+
}
|
|
163
|
+
let length = firstLengthByte;
|
|
164
|
+
for (let index = 1; index < byteCount; index += 1) {
|
|
165
|
+
length = length * 256 + this.readByte("invalid-length", "Truncated DER length");
|
|
166
|
+
}
|
|
167
|
+
if (length < 128) {
|
|
168
|
+
throw new DerParseError("invalid-length", "Non-canonical DER length", offset);
|
|
169
|
+
}
|
|
170
|
+
return length;
|
|
171
|
+
}
|
|
172
|
+
readByte(code, message) {
|
|
173
|
+
if (this.position >= this.end) {
|
|
174
|
+
throw new DerParseError(code === "invalid-tag" ? "unexpected-end" : code, message, this.position);
|
|
175
|
+
}
|
|
176
|
+
const value = this.input[this.position];
|
|
177
|
+
this.position += 1;
|
|
178
|
+
return value ?? 0;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
export const derRange = (offset, length) => makeRange(offset, length);
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { createVerifier, JwsVerifier, type OcspPolicy, type OcspTransport, type OcspTransportRequest, type TrustedRoot, VerificationError, type VerificationErrorCode, type VerificationMode, type VerifiedJws, type VerifierLimits, type VerifierOptions, type VerifierPolicy, type VerifyOptions, } from "./jws/verifier.js";
|
|
2
|
+
export { buildOcspRequest, type OcspCertId, type OcspCertificateStatus, type OcspHashAlgorithm, type OcspResponderId, type OcspSignatureAlgorithm, ocspCertIdFor, type ParsedBasicOcspResponse, type ParsedOcspResponse, type ParsedOcspSingleResponse, parseOcspResponse, } from "./ocsp/codec.js";
|
|
3
|
+
export { fetchOcspResponse } from "./ocsp/transport.js";
|
|
4
|
+
export { type AppReceiptInput, extractTransactionIdFromAppReceipt, extractTransactionIdFromTransactionReceipt, parseAppReceiptTransactionId, parseTransactionReceiptTransactionId, type ReceiptErrorCode, type ReceiptExtractionOutcome, type ReceiptExtractionResult, ReceiptFormatError, ReceiptUtility, } from "./receipt/utility.js";
|
|
5
|
+
export type { BrandedId } from "./types/index.js";
|
|
6
|
+
export { formatValue } from "./utils/formatting.js";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,WAAW,EACX,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,WAAW,EAChB,iBAAiB,EACjB,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,aAAa,GACnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,gBAAgB,EAChB,KAAK,UAAU,EACf,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,aAAa,EACb,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAC7B,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EACL,KAAK,eAAe,EACpB,kCAAkC,EAClC,0CAA0C,EAC1C,4BAA4B,EAC5B,oCAAoC,EACpC,KAAK,gBAAgB,EACrB,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,kBAAkB,EAClB,cAAc,GACf,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { createVerifier, JwsVerifier, VerificationError, } from "./jws/verifier.js";
|
|
2
|
+
export { buildOcspRequest, ocspCertIdFor, parseOcspResponse, } from "./ocsp/codec.js";
|
|
3
|
+
export { fetchOcspResponse } from "./ocsp/transport.js";
|
|
4
|
+
export { extractTransactionIdFromAppReceipt, extractTransactionIdFromTransactionReceipt, parseAppReceiptTransactionId, parseTransactionReceiptTransactionId, ReceiptFormatError, ReceiptUtility, } from "./receipt/utility.js";
|
|
5
|
+
export { formatValue } from "./utils/formatting.js";
|