@countinghouse/ch-local 0.0.0-stage → 1.0.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/LICENSE +202 -0
- package/README.md +361 -2
- package/bin/ch-local.js +472 -0
- package/clients/claude-code/.claude-plugin/plugin.json +6 -0
- package/clients/claude-code/.mcp.json +11 -0
- package/clients/claude-code/bin/launch.js +235 -0
- package/clients/claude-code/bin/win-acl.js +420 -0
- package/clients/claude-code/skills/ci-failure-triage/SKILL.md +21 -0
- package/clients/claude-code/skills/countinghouse-module/SKILL.md +177 -0
- package/clients/claude-code/skills/countinghouse-setup/SKILL.md +74 -0
- package/lib/allowlist.js +65 -0
- package/lib/aside.js +16 -0
- package/lib/atomic.js +45 -0
- package/lib/auto-apply.js +245 -0
- package/lib/auto-upgrade.js +98 -0
- package/lib/availability.js +307 -0
- package/lib/ceiling.js +280 -0
- package/lib/clean-text.js +20 -0
- package/lib/cli-change.js +38 -0
- package/lib/client-conditions-fixtures.js +143 -0
- package/lib/client-conditions.js +656 -0
- package/lib/clients.js +179 -0
- package/lib/command-line.js +202 -0
- package/lib/conditions-command.js +116 -0
- package/lib/control.js +134 -0
- package/lib/credential-store.js +414 -0
- package/lib/credentials-command.js +344 -0
- package/lib/daemon-requests.js +137 -0
- package/lib/daemon.js +888 -0
- package/lib/describe-module.js +137 -0
- package/lib/description-check.js +175 -0
- package/lib/failed-json.js +43 -0
- package/lib/gc.js +274 -0
- package/lib/github-token.js +57 -0
- package/lib/handoff-io.js +73 -0
- package/lib/held-back.js +116 -0
- package/lib/hidden-input.js +64 -0
- package/lib/history.js +49 -0
- package/lib/home.js +372 -0
- package/lib/in-place.js +1036 -0
- package/lib/install-plan.js +142 -0
- package/lib/install.js +846 -0
- package/lib/installed-description.js +153 -0
- package/lib/integrity.js +7 -0
- package/lib/lock.js +456 -0
- package/lib/lockfile-rules.js +98 -0
- package/lib/machine.js +20 -0
- package/lib/module-credentials.js +403 -0
- package/lib/module-record.js +298 -0
- package/lib/module-roles.js +44 -0
- package/lib/module-seams.js +26 -0
- package/lib/module-store.js +202 -0
- package/lib/module-values.js +334 -0
- package/lib/names.js +31 -0
- package/lib/next-steps.js +8 -0
- package/lib/node-check.js +56 -0
- package/lib/npm-fetch.js +123 -0
- package/lib/npm-release.js +99 -0
- package/lib/npm-upgrade.js +146 -0
- package/lib/npm.js +41 -0
- package/lib/outside-edits.js +162 -0
- package/lib/own-applied.js +175 -0
- package/lib/own-command.js +380 -0
- package/lib/own-file.js +120 -0
- package/lib/own-record.js +96 -0
- package/lib/own-tree.js +336 -0
- package/lib/pack-table.js +290 -0
- package/lib/packs-command.js +570 -0
- package/lib/packs.js +219 -0
- package/lib/pins.js +64 -0
- package/lib/pipe-probe.js +82 -0
- package/lib/plain-read.js +63 -0
- package/lib/private-file.js +90 -0
- package/lib/private-write.js +33 -0
- package/lib/provenance.js +234 -0
- package/lib/record.js +82 -0
- package/lib/registry.js +22 -0
- package/lib/release-pins.js +350 -0
- package/lib/release-pins.json +4225 -0
- package/lib/release-tags.js +12 -0
- package/lib/release.js +36 -0
- package/lib/restart-command.js +161 -0
- package/lib/rollback.js +227 -0
- package/lib/run-liveness.js +15 -0
- package/lib/runtime-log.js +287 -0
- package/lib/sandbox-support.js +17 -0
- package/lib/semver-order.js +40 -0
- package/lib/session-socket.js +69 -0
- package/lib/session-table.js +238 -0
- package/lib/session.js +281 -0
- package/lib/settings-command.js +82 -0
- package/lib/settings.js +564 -0
- package/lib/shim-binary.js +152 -0
- package/lib/shim-config.js +159 -0
- package/lib/shim-install.js +365 -0
- package/lib/sigstore/README.md +44 -0
- package/lib/sigstore/npm-keys.json +18 -0
- package/lib/sigstore/trusted-root.json +126 -0
- package/lib/snippets.js +76 -0
- package/lib/start.js +721 -0
- package/lib/store-files.js +48 -0
- package/lib/store-paths.js +33 -0
- package/lib/swap-preload.js +38 -0
- package/lib/tar.js +220 -0
- package/lib/uninstall.js +314 -0
- package/lib/unpack.js +41 -0
- package/lib/upgrade-stamp.js +63 -0
- package/lib/upgrade.js +281 -0
- package/lib/watch.js +40 -0
- package/lib/win-acl.js +420 -0
- package/node_modules/@sigstore/bundle/LICENSE +202 -0
- package/node_modules/@sigstore/bundle/README.md +19 -0
- package/node_modules/@sigstore/bundle/dist/build.d.ts +18 -0
- package/node_modules/@sigstore/bundle/dist/build.js +100 -0
- package/node_modules/@sigstore/bundle/dist/bundle.d.ts +74 -0
- package/node_modules/@sigstore/bundle/dist/bundle.js +24 -0
- package/node_modules/@sigstore/bundle/dist/error.d.ts +4 -0
- package/node_modules/@sigstore/bundle/dist/error.js +25 -0
- package/node_modules/@sigstore/bundle/dist/index.d.ts +8 -0
- package/node_modules/@sigstore/bundle/dist/index.js +43 -0
- package/node_modules/@sigstore/bundle/dist/serialized.d.ts +74 -0
- package/node_modules/@sigstore/bundle/dist/serialized.js +49 -0
- package/node_modules/@sigstore/bundle/dist/utility.d.ts +14 -0
- package/node_modules/@sigstore/bundle/dist/utility.js +2 -0
- package/node_modules/@sigstore/bundle/dist/validate.d.ts +7 -0
- package/node_modules/@sigstore/bundle/dist/validate.js +199 -0
- package/node_modules/@sigstore/bundle/package.json +35 -0
- package/node_modules/@sigstore/core/LICENSE +202 -0
- package/node_modules/@sigstore/core/README.md +10 -0
- package/node_modules/@sigstore/core/dist/asn1/error.d.ts +4 -0
- package/node_modules/@sigstore/core/dist/asn1/error.js +24 -0
- package/node_modules/@sigstore/core/dist/asn1/index.d.ts +1 -0
- package/node_modules/@sigstore/core/dist/asn1/index.js +20 -0
- package/node_modules/@sigstore/core/dist/asn1/length.d.ts +3 -0
- package/node_modules/@sigstore/core/dist/asn1/length.js +62 -0
- package/node_modules/@sigstore/core/dist/asn1/obj.d.ts +14 -0
- package/node_modules/@sigstore/core/dist/asn1/obj.js +155 -0
- package/node_modules/@sigstore/core/dist/asn1/parse.d.ts +6 -0
- package/node_modules/@sigstore/core/dist/asn1/parse.js +124 -0
- package/node_modules/@sigstore/core/dist/asn1/tag.d.ts +16 -0
- package/node_modules/@sigstore/core/dist/asn1/tag.js +89 -0
- package/node_modules/@sigstore/core/dist/crypto.d.ts +6 -0
- package/node_modules/@sigstore/core/dist/crypto.js +69 -0
- package/node_modules/@sigstore/core/dist/dsse.d.ts +1 -0
- package/node_modules/@sigstore/core/dist/dsse.js +29 -0
- package/node_modules/@sigstore/core/dist/encoding.d.ts +2 -0
- package/node_modules/@sigstore/core/dist/encoding.js +27 -0
- package/node_modules/@sigstore/core/dist/index.d.ts +9 -0
- package/node_modules/@sigstore/core/dist/index.js +66 -0
- package/node_modules/@sigstore/core/dist/json.d.ts +1 -0
- package/node_modules/@sigstore/core/dist/json.js +60 -0
- package/node_modules/@sigstore/core/dist/oid.d.ts +3 -0
- package/node_modules/@sigstore/core/dist/oid.js +20 -0
- package/node_modules/@sigstore/core/dist/pem.d.ts +2 -0
- package/node_modules/@sigstore/core/dist/pem.js +43 -0
- package/node_modules/@sigstore/core/dist/rfc3161/error.d.ts +2 -0
- package/node_modules/@sigstore/core/dist/rfc3161/error.js +21 -0
- package/node_modules/@sigstore/core/dist/rfc3161/index.d.ts +1 -0
- package/node_modules/@sigstore/core/dist/rfc3161/index.js +20 -0
- package/node_modules/@sigstore/core/dist/rfc3161/timestamp.d.ts +36 -0
- package/node_modules/@sigstore/core/dist/rfc3161/timestamp.js +212 -0
- package/node_modules/@sigstore/core/dist/rfc3161/tstinfo.d.ts +12 -0
- package/node_modules/@sigstore/core/dist/rfc3161/tstinfo.js +72 -0
- package/node_modules/@sigstore/core/dist/stream.d.ts +21 -0
- package/node_modules/@sigstore/core/dist/stream.js +117 -0
- package/node_modules/@sigstore/core/dist/x509/cert.d.ts +43 -0
- package/node_modules/@sigstore/core/dist/x509/cert.js +245 -0
- package/node_modules/@sigstore/core/dist/x509/ext.d.ts +41 -0
- package/node_modules/@sigstore/core/dist/x509/ext.js +146 -0
- package/node_modules/@sigstore/core/dist/x509/index.d.ts +2 -0
- package/node_modules/@sigstore/core/dist/x509/index.js +23 -0
- package/node_modules/@sigstore/core/dist/x509/sct.d.ts +25 -0
- package/node_modules/@sigstore/core/dist/x509/sct.js +158 -0
- package/node_modules/@sigstore/core/package.json +31 -0
- package/node_modules/@sigstore/protobuf-specs/LICENSE +202 -0
- package/node_modules/@sigstore/protobuf-specs/README.md +5 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/envelope.d.ts +44 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/envelope.js +59 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/events.d.ts +64 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/events.js +174 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/google/api/field_behavior.d.ts +74 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/google/api/field_behavior.js +141 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/google/protobuf/any.d.ts +74 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/google/protobuf/any.js +35 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/google/protobuf/descriptor.d.ts +1309 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/google/protobuf/descriptor.js +2191 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/google/protobuf/timestamp.d.ts +113 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/google/protobuf/timestamp.js +29 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/rekor/v2/dsse.d.ts +23 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/rekor/v2/dsse.js +55 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/rekor/v2/entry.d.ts +43 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/rekor/v2/entry.js +81 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/rekor/v2/hashedrekord.d.ts +22 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/rekor/v2/hashedrekord.js +56 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/rekor/v2/verifier.d.ts +35 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/rekor/v2/verifier.js +74 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_bundle.d.ts +146 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_bundle.js +103 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_common.d.ts +304 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_common.js +612 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_monitor.d.ts +33 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_monitor.js +55 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_rekor.d.ts +144 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_rekor.js +137 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_trustroot.d.ts +386 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_trustroot.js +284 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_verification.d.ts +191 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_verification.js +281 -0
- package/node_modules/@sigstore/protobuf-specs/dist/index.d.ts +6 -0
- package/node_modules/@sigstore/protobuf-specs/dist/index.js +37 -0
- package/node_modules/@sigstore/protobuf-specs/dist/rekor/v2/index.d.ts +4 -0
- package/node_modules/@sigstore/protobuf-specs/dist/rekor/v2/index.js +35 -0
- package/node_modules/@sigstore/protobuf-specs/package.json +35 -0
- package/node_modules/@sigstore/verify/README.md +9 -0
- package/node_modules/@sigstore/verify/dist/bundle/dsse.d.ts +12 -0
- package/node_modules/@sigstore/verify/dist/bundle/dsse.js +44 -0
- package/node_modules/@sigstore/verify/dist/bundle/index.d.ts +4 -0
- package/node_modules/@sigstore/verify/dist/bundle/index.js +59 -0
- package/node_modules/@sigstore/verify/dist/bundle/message.d.ts +13 -0
- package/node_modules/@sigstore/verify/dist/bundle/message.js +54 -0
- package/node_modules/@sigstore/verify/dist/error.d.ts +16 -0
- package/node_modules/@sigstore/verify/dist/error.js +34 -0
- package/node_modules/@sigstore/verify/dist/index.d.ts +6 -0
- package/node_modules/@sigstore/verify/dist/index.js +28 -0
- package/node_modules/@sigstore/verify/dist/key/certificate.d.ts +21 -0
- package/node_modules/@sigstore/verify/dist/key/certificate.js +216 -0
- package/node_modules/@sigstore/verify/dist/key/index.d.ts +10 -0
- package/node_modules/@sigstore/verify/dist/key/index.js +75 -0
- package/node_modules/@sigstore/verify/dist/key/sct.d.ts +4 -0
- package/node_modules/@sigstore/verify/dist/key/sct.js +78 -0
- package/node_modules/@sigstore/verify/dist/policy.d.ts +5 -0
- package/node_modules/@sigstore/verify/dist/policy.js +50 -0
- package/node_modules/@sigstore/verify/dist/shared.types.d.ts +50 -0
- package/node_modules/@sigstore/verify/dist/shared.types.js +2 -0
- package/node_modules/@sigstore/verify/dist/timestamp/index.d.ts +11 -0
- package/node_modules/@sigstore/verify/dist/timestamp/index.js +24 -0
- package/node_modules/@sigstore/verify/dist/timestamp/tsa.d.ts +3 -0
- package/node_modules/@sigstore/verify/dist/timestamp/tsa.js +63 -0
- package/node_modules/@sigstore/verify/dist/tlog/checkpoint.d.ts +11 -0
- package/node_modules/@sigstore/verify/dist/tlog/checkpoint.js +154 -0
- package/node_modules/@sigstore/verify/dist/tlog/dsse.d.ts +6 -0
- package/node_modules/@sigstore/verify/dist/tlog/dsse.js +106 -0
- package/node_modules/@sigstore/verify/dist/tlog/hashedrekord.d.ts +6 -0
- package/node_modules/@sigstore/verify/dist/tlog/hashedrekord.js +94 -0
- package/node_modules/@sigstore/verify/dist/tlog/index.d.ts +5 -0
- package/node_modules/@sigstore/verify/dist/tlog/index.js +92 -0
- package/node_modules/@sigstore/verify/dist/tlog/intoto.d.ts +3 -0
- package/node_modules/@sigstore/verify/dist/tlog/intoto.js +62 -0
- package/node_modules/@sigstore/verify/dist/tlog/merkle.d.ts +3 -0
- package/node_modules/@sigstore/verify/dist/tlog/merkle.js +104 -0
- package/node_modules/@sigstore/verify/dist/tlog/set.d.ts +3 -0
- package/node_modules/@sigstore/verify/dist/tlog/set.js +60 -0
- package/node_modules/@sigstore/verify/dist/trust/filter.d.ts +8 -0
- package/node_modules/@sigstore/verify/dist/trust/filter.js +23 -0
- package/node_modules/@sigstore/verify/dist/trust/index.d.ts +5 -0
- package/node_modules/@sigstore/verify/dist/trust/index.js +90 -0
- package/node_modules/@sigstore/verify/dist/trust/trust.types.d.ts +29 -0
- package/node_modules/@sigstore/verify/dist/trust/trust.types.js +2 -0
- package/node_modules/@sigstore/verify/dist/verifier.d.ts +31 -0
- package/node_modules/@sigstore/verify/dist/verifier.js +160 -0
- package/node_modules/@sigstore/verify/package.json +36 -0
- package/package.json +37 -4
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ASN1Obj } from '../asn1';
|
|
2
|
+
import * as crypto from '../crypto';
|
|
3
|
+
import { TSTInfo } from './tstinfo';
|
|
4
|
+
export declare class RFC3161Timestamp {
|
|
5
|
+
root: ASN1Obj;
|
|
6
|
+
constructor(asn1: ASN1Obj);
|
|
7
|
+
static parse(der: Buffer<ArrayBuffer>): RFC3161Timestamp;
|
|
8
|
+
get status(): bigint;
|
|
9
|
+
get contentType(): string;
|
|
10
|
+
get eContentType(): string;
|
|
11
|
+
get signingTime(): Date;
|
|
12
|
+
get signerIssuer(): Buffer;
|
|
13
|
+
get signerSerialNumber(): Buffer;
|
|
14
|
+
get signerDigestAlgorithm(): string;
|
|
15
|
+
get signatureAlgorithm(): string;
|
|
16
|
+
get signatureValue(): Buffer;
|
|
17
|
+
get tstInfo(): TSTInfo;
|
|
18
|
+
verify(data: Buffer, publicKey: crypto.KeyObject): void;
|
|
19
|
+
private verifyMessageDigest;
|
|
20
|
+
private verifySignature;
|
|
21
|
+
private get pkiStatusInfoObj();
|
|
22
|
+
private get timeStampTokenObj();
|
|
23
|
+
private get contentTypeObj();
|
|
24
|
+
private get signedDataObj();
|
|
25
|
+
private get encapContentInfoObj();
|
|
26
|
+
private get signerInfosObj();
|
|
27
|
+
private get signerInfoObj();
|
|
28
|
+
private get eContentTypeObj();
|
|
29
|
+
private get eContentObj();
|
|
30
|
+
private get signedAttrsObj();
|
|
31
|
+
private get messageDigestAttributeObj();
|
|
32
|
+
private get signerSidObj();
|
|
33
|
+
private get signerDigestAlgorithmObj();
|
|
34
|
+
private get signatureAlgorithmObj();
|
|
35
|
+
private get signatureValueObj();
|
|
36
|
+
}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.RFC3161Timestamp = void 0;
|
|
37
|
+
/*
|
|
38
|
+
Copyright 2023 The Sigstore Authors.
|
|
39
|
+
|
|
40
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
41
|
+
you may not use this file except in compliance with the License.
|
|
42
|
+
You may obtain a copy of the License at
|
|
43
|
+
|
|
44
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
45
|
+
|
|
46
|
+
Unless required by applicable law or agreed to in writing, software
|
|
47
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
48
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
49
|
+
See the License for the specific language governing permissions and
|
|
50
|
+
limitations under the License.
|
|
51
|
+
*/
|
|
52
|
+
const asn1_1 = require("../asn1");
|
|
53
|
+
const crypto = __importStar(require("../crypto"));
|
|
54
|
+
const oid_1 = require("../oid");
|
|
55
|
+
const error_1 = require("./error");
|
|
56
|
+
const tstinfo_1 = require("./tstinfo");
|
|
57
|
+
const OID_PKCS9_CONTENT_TYPE_SIGNED_DATA = '1.2.840.113549.1.7.2';
|
|
58
|
+
const OID_PKCS9_CONTENT_TYPE_TSTINFO = '1.2.840.113549.1.9.16.1.4';
|
|
59
|
+
const OID_PKCS9_MESSAGE_DIGEST_KEY = '1.2.840.113549.1.9.4';
|
|
60
|
+
class RFC3161Timestamp {
|
|
61
|
+
root;
|
|
62
|
+
constructor(asn1) {
|
|
63
|
+
this.root = asn1;
|
|
64
|
+
}
|
|
65
|
+
static parse(der) {
|
|
66
|
+
const asn1 = asn1_1.ASN1Obj.parseBuffer(der);
|
|
67
|
+
return new RFC3161Timestamp(asn1);
|
|
68
|
+
}
|
|
69
|
+
get status() {
|
|
70
|
+
return this.pkiStatusInfoObj.subs[0].toInteger();
|
|
71
|
+
}
|
|
72
|
+
get contentType() {
|
|
73
|
+
return this.contentTypeObj.toOID();
|
|
74
|
+
}
|
|
75
|
+
get eContentType() {
|
|
76
|
+
return this.eContentTypeObj.toOID();
|
|
77
|
+
}
|
|
78
|
+
get signingTime() {
|
|
79
|
+
return this.tstInfo.genTime;
|
|
80
|
+
}
|
|
81
|
+
get signerIssuer() {
|
|
82
|
+
return this.signerSidObj.subs[0].value;
|
|
83
|
+
}
|
|
84
|
+
get signerSerialNumber() {
|
|
85
|
+
return this.signerSidObj.subs[1].value;
|
|
86
|
+
}
|
|
87
|
+
get signerDigestAlgorithm() {
|
|
88
|
+
const oid = this.signerDigestAlgorithmObj.subs[0].toOID();
|
|
89
|
+
return oid_1.SHA2_HASH_ALGOS[oid];
|
|
90
|
+
}
|
|
91
|
+
get signatureAlgorithm() {
|
|
92
|
+
const oid = this.signatureAlgorithmObj.subs[0].toOID();
|
|
93
|
+
return oid_1.ECDSA_SIGNATURE_ALGOS[oid];
|
|
94
|
+
}
|
|
95
|
+
get signatureValue() {
|
|
96
|
+
return this.signatureValueObj.value;
|
|
97
|
+
}
|
|
98
|
+
get tstInfo() {
|
|
99
|
+
// Need to unpack tstInfo from an OCTET STRING
|
|
100
|
+
return new tstinfo_1.TSTInfo(this.eContentObj.subs[0].subs[0]);
|
|
101
|
+
}
|
|
102
|
+
verify(data, publicKey) {
|
|
103
|
+
if (!this.timeStampTokenObj) {
|
|
104
|
+
throw new error_1.RFC3161TimestampVerificationError('timeStampToken is missing');
|
|
105
|
+
}
|
|
106
|
+
// Check for expected ContentInfo content type
|
|
107
|
+
if (this.contentType !== OID_PKCS9_CONTENT_TYPE_SIGNED_DATA) {
|
|
108
|
+
throw new error_1.RFC3161TimestampVerificationError(`incorrect content type: ${this.contentType}`);
|
|
109
|
+
}
|
|
110
|
+
// Check for expected encapsulated content type
|
|
111
|
+
if (this.eContentType !== OID_PKCS9_CONTENT_TYPE_TSTINFO) {
|
|
112
|
+
throw new error_1.RFC3161TimestampVerificationError(`incorrect encapsulated content type: ${this.eContentType}`);
|
|
113
|
+
}
|
|
114
|
+
// Check that the tstInfo references the correct artifact
|
|
115
|
+
this.tstInfo.verify(data);
|
|
116
|
+
// Check that the signed message digest matches the tstInfo
|
|
117
|
+
this.verifyMessageDigest();
|
|
118
|
+
// Check that the signature is valid for the signed attributes
|
|
119
|
+
this.verifySignature(publicKey);
|
|
120
|
+
}
|
|
121
|
+
verifyMessageDigest() {
|
|
122
|
+
// Check that the tstInfo matches the signed data
|
|
123
|
+
const tstInfoDigest = crypto.digest(this.signerDigestAlgorithm, this.tstInfo.raw);
|
|
124
|
+
const expectedDigest = this.messageDigestAttributeObj.subs[1].subs[0].value;
|
|
125
|
+
if (!crypto.bufferEqual(tstInfoDigest, expectedDigest)) {
|
|
126
|
+
throw new error_1.RFC3161TimestampVerificationError('signed data does not match tstInfo');
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
verifySignature(key) {
|
|
130
|
+
// Encode the signed attributes for verification
|
|
131
|
+
const signedAttrs = this.signedAttrsObj.toDER();
|
|
132
|
+
signedAttrs[0] = 0x31; // Change context-specific tag to SET
|
|
133
|
+
// Check that the signature is valid for the signed attributes
|
|
134
|
+
const verified = crypto.verify(signedAttrs, key, this.signatureValue, this.signatureAlgorithm);
|
|
135
|
+
if (!verified) {
|
|
136
|
+
throw new error_1.RFC3161TimestampVerificationError('signature verification failed');
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
// https://www.rfc-editor.org/rfc/rfc3161#section-2.4.2
|
|
140
|
+
get pkiStatusInfoObj() {
|
|
141
|
+
// pkiStatusInfo is the first element of the timestamp response sequence
|
|
142
|
+
return this.root.subs[0];
|
|
143
|
+
}
|
|
144
|
+
// https://www.rfc-editor.org/rfc/rfc3161#section-2.4.2
|
|
145
|
+
get timeStampTokenObj() {
|
|
146
|
+
// timeStampToken is the first element of the timestamp response sequence
|
|
147
|
+
return this.root.subs[1];
|
|
148
|
+
}
|
|
149
|
+
// https://datatracker.ietf.org/doc/html/rfc5652#section-3
|
|
150
|
+
get contentTypeObj() {
|
|
151
|
+
return this.timeStampTokenObj.subs[0];
|
|
152
|
+
}
|
|
153
|
+
// https://www.rfc-editor.org/rfc/rfc5652#section-3
|
|
154
|
+
get signedDataObj() {
|
|
155
|
+
const obj = this.timeStampTokenObj.subs.find((sub) => sub.tag.isContextSpecific(0x00));
|
|
156
|
+
return obj.subs[0];
|
|
157
|
+
}
|
|
158
|
+
// https://datatracker.ietf.org/doc/html/rfc5652#section-5.1
|
|
159
|
+
get encapContentInfoObj() {
|
|
160
|
+
return this.signedDataObj.subs[2];
|
|
161
|
+
}
|
|
162
|
+
// https://datatracker.ietf.org/doc/html/rfc5652#section-5.1
|
|
163
|
+
get signerInfosObj() {
|
|
164
|
+
// SignerInfos is the last element of the signed data sequence
|
|
165
|
+
const sd = this.signedDataObj;
|
|
166
|
+
return sd.subs[sd.subs.length - 1];
|
|
167
|
+
}
|
|
168
|
+
// https://www.rfc-editor.org/rfc/rfc5652#section-5.1
|
|
169
|
+
get signerInfoObj() {
|
|
170
|
+
// Only supporting one signer
|
|
171
|
+
return this.signerInfosObj.subs[0];
|
|
172
|
+
}
|
|
173
|
+
// https://datatracker.ietf.org/doc/html/rfc5652#section-5.2
|
|
174
|
+
get eContentTypeObj() {
|
|
175
|
+
return this.encapContentInfoObj.subs[0];
|
|
176
|
+
}
|
|
177
|
+
// https://datatracker.ietf.org/doc/html/rfc5652#section-5.2
|
|
178
|
+
get eContentObj() {
|
|
179
|
+
return this.encapContentInfoObj.subs[1];
|
|
180
|
+
}
|
|
181
|
+
// https://datatracker.ietf.org/doc/html/rfc5652#section-5.3
|
|
182
|
+
get signedAttrsObj() {
|
|
183
|
+
const signedAttrs = this.signerInfoObj.subs.find((sub) => sub.tag.isContextSpecific(0x00));
|
|
184
|
+
return signedAttrs;
|
|
185
|
+
}
|
|
186
|
+
// https://datatracker.ietf.org/doc/html/rfc5652#section-5.3
|
|
187
|
+
get messageDigestAttributeObj() {
|
|
188
|
+
const messageDigest = this.signedAttrsObj.subs.find((sub) => sub.subs[0].tag.isOID() &&
|
|
189
|
+
sub.subs[0].toOID() === OID_PKCS9_MESSAGE_DIGEST_KEY);
|
|
190
|
+
return messageDigest;
|
|
191
|
+
}
|
|
192
|
+
// https://datatracker.ietf.org/doc/html/rfc5652#section-5.3
|
|
193
|
+
get signerSidObj() {
|
|
194
|
+
return this.signerInfoObj.subs[1];
|
|
195
|
+
}
|
|
196
|
+
// https://datatracker.ietf.org/doc/html/rfc5652#section-5.3
|
|
197
|
+
get signerDigestAlgorithmObj() {
|
|
198
|
+
// Signature is the 2nd element of the signerInfoObj object
|
|
199
|
+
return this.signerInfoObj.subs[2];
|
|
200
|
+
}
|
|
201
|
+
// https://datatracker.ietf.org/doc/html/rfc5652#section-5.3
|
|
202
|
+
get signatureAlgorithmObj() {
|
|
203
|
+
// Signature is the 4th element of the signerInfoObj object
|
|
204
|
+
return this.signerInfoObj.subs[4];
|
|
205
|
+
}
|
|
206
|
+
// https://datatracker.ietf.org/doc/html/rfc5652#section-5.3
|
|
207
|
+
get signatureValueObj() {
|
|
208
|
+
// Signature is the 6th element of the signerInfoObj object
|
|
209
|
+
return this.signerInfoObj.subs[5];
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
exports.RFC3161Timestamp = RFC3161Timestamp;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ASN1Obj } from '../asn1';
|
|
2
|
+
export declare class TSTInfo {
|
|
3
|
+
root: ASN1Obj;
|
|
4
|
+
constructor(asn1: ASN1Obj);
|
|
5
|
+
get version(): bigint;
|
|
6
|
+
get genTime(): Date;
|
|
7
|
+
get messageImprintHashAlgorithm(): string;
|
|
8
|
+
get messageImprintHashedMessage(): Buffer;
|
|
9
|
+
get raw(): Buffer;
|
|
10
|
+
verify(data: Buffer): void;
|
|
11
|
+
private get messageImprintObj();
|
|
12
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.TSTInfo = void 0;
|
|
37
|
+
const crypto = __importStar(require("../crypto"));
|
|
38
|
+
const oid_1 = require("../oid");
|
|
39
|
+
const error_1 = require("./error");
|
|
40
|
+
class TSTInfo {
|
|
41
|
+
root;
|
|
42
|
+
constructor(asn1) {
|
|
43
|
+
this.root = asn1;
|
|
44
|
+
}
|
|
45
|
+
get version() {
|
|
46
|
+
return this.root.subs[0].toInteger();
|
|
47
|
+
}
|
|
48
|
+
get genTime() {
|
|
49
|
+
return this.root.subs[4].toDate();
|
|
50
|
+
}
|
|
51
|
+
get messageImprintHashAlgorithm() {
|
|
52
|
+
const oid = this.messageImprintObj.subs[0].subs[0].toOID();
|
|
53
|
+
return oid_1.SHA2_HASH_ALGOS[oid];
|
|
54
|
+
}
|
|
55
|
+
get messageImprintHashedMessage() {
|
|
56
|
+
return this.messageImprintObj.subs[1].value;
|
|
57
|
+
}
|
|
58
|
+
get raw() {
|
|
59
|
+
return this.root.toDER();
|
|
60
|
+
}
|
|
61
|
+
verify(data) {
|
|
62
|
+
const digest = crypto.digest(this.messageImprintHashAlgorithm, data);
|
|
63
|
+
if (!crypto.bufferEqual(digest, this.messageImprintHashedMessage)) {
|
|
64
|
+
throw new error_1.RFC3161TimestampVerificationError('message imprint does not match artifact');
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
// https://www.rfc-editor.org/rfc/rfc3161#section-2.4.2
|
|
68
|
+
get messageImprintObj() {
|
|
69
|
+
return this.root.subs[2];
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.TSTInfo = TSTInfo;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare class ByteStream {
|
|
2
|
+
private static BLOCK_SIZE;
|
|
3
|
+
private buf;
|
|
4
|
+
private view;
|
|
5
|
+
private start;
|
|
6
|
+
constructor(buffer?: Buffer<ArrayBufferLike>);
|
|
7
|
+
get buffer(): Buffer;
|
|
8
|
+
get length(): number;
|
|
9
|
+
get position(): number;
|
|
10
|
+
seek(position: number): void;
|
|
11
|
+
slice(start: number, len: number): Buffer;
|
|
12
|
+
appendChar(char: number): void;
|
|
13
|
+
appendUint16(num: number): void;
|
|
14
|
+
appendUint24(num: number): void;
|
|
15
|
+
appendView(view: Uint8Array): void;
|
|
16
|
+
getBlock(size: number): Buffer;
|
|
17
|
+
getUint8(): number;
|
|
18
|
+
getUint16(): number;
|
|
19
|
+
private ensureCapacity;
|
|
20
|
+
private realloc;
|
|
21
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ByteStream = void 0;
|
|
4
|
+
/*
|
|
5
|
+
Copyright 2023 The Sigstore Authors.
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
class StreamError extends Error {
|
|
20
|
+
}
|
|
21
|
+
class ByteStream {
|
|
22
|
+
static BLOCK_SIZE = 1024;
|
|
23
|
+
buf;
|
|
24
|
+
view;
|
|
25
|
+
start = 0;
|
|
26
|
+
constructor(buffer) {
|
|
27
|
+
if (buffer) {
|
|
28
|
+
this.buf = buffer;
|
|
29
|
+
this.view = Buffer.from(buffer);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
this.buf = Buffer.alloc(0);
|
|
33
|
+
this.view = Buffer.from(this.buf);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
get buffer() {
|
|
37
|
+
return this.view.subarray(0, this.start);
|
|
38
|
+
}
|
|
39
|
+
get length() {
|
|
40
|
+
return this.view.byteLength;
|
|
41
|
+
}
|
|
42
|
+
get position() {
|
|
43
|
+
return this.start;
|
|
44
|
+
}
|
|
45
|
+
seek(position) {
|
|
46
|
+
this.start = position;
|
|
47
|
+
}
|
|
48
|
+
// Returns a Buffer containing the specified number of bytes starting at the
|
|
49
|
+
// given start position.
|
|
50
|
+
slice(start, len) {
|
|
51
|
+
const end = start + len;
|
|
52
|
+
if (end > this.length) {
|
|
53
|
+
throw new StreamError('request past end of buffer');
|
|
54
|
+
}
|
|
55
|
+
return this.view.subarray(start, end);
|
|
56
|
+
}
|
|
57
|
+
appendChar(char) {
|
|
58
|
+
this.ensureCapacity(1);
|
|
59
|
+
this.view[this.start] = char;
|
|
60
|
+
this.start += 1;
|
|
61
|
+
}
|
|
62
|
+
appendUint16(num) {
|
|
63
|
+
this.ensureCapacity(2);
|
|
64
|
+
const value = new Uint16Array([num]);
|
|
65
|
+
const view = new Uint8Array(value.buffer);
|
|
66
|
+
this.view[this.start] = view[1];
|
|
67
|
+
this.view[this.start + 1] = view[0];
|
|
68
|
+
this.start += 2;
|
|
69
|
+
}
|
|
70
|
+
appendUint24(num) {
|
|
71
|
+
this.ensureCapacity(3);
|
|
72
|
+
const value = new Uint32Array([num]);
|
|
73
|
+
const view = new Uint8Array(value.buffer);
|
|
74
|
+
this.view[this.start] = view[2];
|
|
75
|
+
this.view[this.start + 1] = view[1];
|
|
76
|
+
this.view[this.start + 2] = view[0];
|
|
77
|
+
this.start += 3;
|
|
78
|
+
}
|
|
79
|
+
appendView(view) {
|
|
80
|
+
this.ensureCapacity(view.length);
|
|
81
|
+
this.view.set(view, this.start);
|
|
82
|
+
this.start += view.length;
|
|
83
|
+
}
|
|
84
|
+
getBlock(size) {
|
|
85
|
+
if (size <= 0) {
|
|
86
|
+
return Buffer.alloc(0);
|
|
87
|
+
}
|
|
88
|
+
if (this.start + size > this.view.length) {
|
|
89
|
+
throw new Error('request past end of buffer');
|
|
90
|
+
}
|
|
91
|
+
const result = this.view.subarray(this.start, this.start + size);
|
|
92
|
+
this.start += size;
|
|
93
|
+
return result;
|
|
94
|
+
}
|
|
95
|
+
getUint8() {
|
|
96
|
+
return this.getBlock(1)[0];
|
|
97
|
+
}
|
|
98
|
+
getUint16() {
|
|
99
|
+
const block = this.getBlock(2);
|
|
100
|
+
return (block[0] << 8) | block[1];
|
|
101
|
+
}
|
|
102
|
+
ensureCapacity(size) {
|
|
103
|
+
if (this.start + size > this.view.byteLength) {
|
|
104
|
+
const blockSize = ByteStream.BLOCK_SIZE + (size > ByteStream.BLOCK_SIZE ? size : 0);
|
|
105
|
+
this.realloc(this.view.byteLength + blockSize);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
realloc(size) {
|
|
109
|
+
const newArray = Buffer.alloc(size);
|
|
110
|
+
const newView = Buffer.from(newArray);
|
|
111
|
+
// Copy the old buffer into the new one
|
|
112
|
+
newView.set(this.view);
|
|
113
|
+
this.buf = newArray;
|
|
114
|
+
this.view = newView;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
exports.ByteStream = ByteStream;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ASN1Obj } from '../asn1';
|
|
2
|
+
import { X509AuthorityKeyIDExtension, X509BasicConstraintsExtension, X509Extension, X509KeyUsageExtension, X509SCTExtension, X509SubjectAlternativeNameExtension, X509SubjectKeyIDExtension } from './ext';
|
|
3
|
+
export declare const EXTENSION_OID_SCT = "1.3.6.1.4.1.11129.2.4.2";
|
|
4
|
+
export declare class X509Certificate {
|
|
5
|
+
root: ASN1Obj;
|
|
6
|
+
constructor(asn1: ASN1Obj);
|
|
7
|
+
static parse(cert: Buffer<ArrayBuffer> | string): X509Certificate;
|
|
8
|
+
get tbsCertificate(): ASN1Obj;
|
|
9
|
+
get version(): string;
|
|
10
|
+
get serialNumber(): Buffer;
|
|
11
|
+
get notBefore(): Date;
|
|
12
|
+
get notAfter(): Date;
|
|
13
|
+
get issuer(): Buffer;
|
|
14
|
+
get subject(): Buffer;
|
|
15
|
+
get publicKey(): Buffer;
|
|
16
|
+
get signatureAlgorithm(): string;
|
|
17
|
+
get signatureValue(): Buffer;
|
|
18
|
+
get subjectAltName(): string | undefined;
|
|
19
|
+
get extensions(): ASN1Obj[];
|
|
20
|
+
get extKeyUsage(): X509KeyUsageExtension | undefined;
|
|
21
|
+
get extBasicConstraints(): X509BasicConstraintsExtension | undefined;
|
|
22
|
+
get extSubjectAltName(): X509SubjectAlternativeNameExtension | undefined;
|
|
23
|
+
get extAuthorityKeyID(): X509AuthorityKeyIDExtension | undefined;
|
|
24
|
+
get extSubjectKeyID(): X509SubjectKeyIDExtension | undefined;
|
|
25
|
+
get extSCT(): X509SCTExtension | undefined;
|
|
26
|
+
get isCA(): boolean;
|
|
27
|
+
extension(oid: string): X509Extension | undefined;
|
|
28
|
+
verify(issuerCertificate?: X509Certificate): boolean;
|
|
29
|
+
validForDate(date: Date): boolean;
|
|
30
|
+
equals(other: X509Certificate): boolean;
|
|
31
|
+
clone(): X509Certificate;
|
|
32
|
+
private findExtension;
|
|
33
|
+
private get tbsCertificateObj();
|
|
34
|
+
private get signatureAlgorithmObj();
|
|
35
|
+
private get signatureValueObj();
|
|
36
|
+
private get versionObj();
|
|
37
|
+
private get serialNumberObj();
|
|
38
|
+
private get issuerObj();
|
|
39
|
+
private get validityObj();
|
|
40
|
+
private get subjectObj();
|
|
41
|
+
private get subjectPublicKeyInfoObj();
|
|
42
|
+
private get extensionsObj();
|
|
43
|
+
}
|