Skip to content

Commit abdca39

Browse files
committed
1 parent 16f68fb commit abdca39

File tree

9 files changed

+70
-22
lines changed

9 files changed

+70
-22
lines changed

node_modules/sigstore/dist/ca/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ class CAClient {
1515
return certificate.signedCertificateEmbeddedSct.chain.certificates;
1616
}
1717
catch (err) {
18-
throw new error_1.InternalError('error creating signing certificate', err);
18+
throw new error_1.InternalError({
19+
code: 'CA_CREATE_SIGNING_CERTIFICATE_ERROR',
20+
message: 'error creating signing certificate',
21+
cause: err,
22+
});
1923
}
2024
}
2125
}

node_modules/sigstore/dist/cli/index.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,19 @@ function printUsage() {
6262
sigstore help print help information
6363
`);
6464
}
65+
function printRekorEntry(bundle, options) {
66+
let url;
67+
if (options.rekorURL === index_1.sigstore.DEFAULT_REKOR_URL) {
68+
url = `https://search.sigstore.dev`;
69+
}
70+
else {
71+
url = `${options.rekorURL}/api/v1/log/entries`;
72+
}
73+
const logIndex = bundle.verificationMaterial?.tlogEntries[0].logIndex;
74+
console.error(`Created entry at index ${logIndex}, available at`);
75+
console.error(`${url}?logIndex=${logIndex}`);
76+
}
77+
// TODO: Allow customing these options
6578
const signOptions = {
6679
oidcClientID: 'sigstore',
6780
oidcIssuer: 'https://oauth2.sigstore.dev/auth',
@@ -71,15 +84,13 @@ const signOptions = {
7184
async function sign(artifactPath) {
7285
const buffer = fs_1.default.readFileSync(artifactPath);
7386
const bundle = await index_1.sigstore.sign(buffer, signOptions);
74-
const url = `${signOptions.rekorURL}/api/v1/log/entries`;
75-
const logIndex = bundle.verificationMaterial?.tlogEntries[0].logIndex;
76-
console.error(`Created entry at index ${logIndex}, available at`);
77-
console.error(`${url}?logIndex=${logIndex}`);
87+
printRekorEntry(bundle, signOptions);
7888
console.log(JSON.stringify(bundle));
7989
}
8090
async function attest(artifactPath, payloadType = INTOTO_PAYLOAD_TYPE) {
8191
const buffer = fs_1.default.readFileSync(artifactPath);
8292
const bundle = await index_1.sigstore.attest(buffer, payloadType, signOptions);
93+
printRekorEntry(bundle, signOptions);
8394
console.log(JSON.stringify(bundle));
8495
}
8596
async function verify(bundlePath, artifactPath) {

node_modules/sigstore/dist/error.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use strict";
22
Object.defineProperty(exports, "__esModule", { value: true });
3-
exports.PolicyError = exports.InternalError = exports.ValidationError = exports.VerificationError = void 0;
3+
exports.InternalError = exports.PolicyError = exports.ValidationError = exports.VerificationError = void 0;
44
/*
55
Copyright 2023 The Sigstore Authors.
66
@@ -30,9 +30,13 @@ exports.VerificationError = VerificationError;
3030
class ValidationError extends BaseError {
3131
}
3232
exports.ValidationError = ValidationError;
33-
class InternalError extends BaseError {
34-
}
35-
exports.InternalError = InternalError;
3633
class PolicyError extends BaseError {
3734
}
3835
exports.PolicyError = PolicyError;
36+
class InternalError extends BaseError {
37+
constructor({ code, message, cause, }) {
38+
super(message, cause);
39+
this.code = code;
40+
}
41+
}
42+
exports.InternalError = InternalError;

node_modules/sigstore/dist/sigstore.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
2323
return result;
2424
};
2525
Object.defineProperty(exports, "__esModule", { value: true });
26-
exports.DEFAULT_REKOR_URL = exports.DEFAULT_FULCIO_URL = exports.tuf = exports.utils = exports.verify = exports.attest = exports.sign = void 0;
26+
exports.DEFAULT_REKOR_URL = exports.DEFAULT_FULCIO_URL = exports.tuf = exports.utils = exports.VerificationError = exports.ValidationError = exports.PolicyError = exports.InternalError = exports.verify = exports.attest = exports.sign = void 0;
2727
/*
2828
Copyright 2023 The Sigstore Authors.
2929
@@ -92,6 +92,11 @@ const tufUtils = {
9292
},
9393
};
9494
exports.tuf = tufUtils;
95+
var error_1 = require("./error");
96+
Object.defineProperty(exports, "InternalError", { enumerable: true, get: function () { return error_1.InternalError; } });
97+
Object.defineProperty(exports, "PolicyError", { enumerable: true, get: function () { return error_1.PolicyError; } });
98+
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return error_1.ValidationError; } });
99+
Object.defineProperty(exports, "VerificationError", { enumerable: true, get: function () { return error_1.VerificationError; } });
95100
exports.utils = __importStar(require("./sigstore-utils"));
96101
exports.DEFAULT_FULCIO_URL = config.DEFAULT_FULCIO_URL;
97102
exports.DEFAULT_REKOR_URL = config.DEFAULT_REKOR_URL;

node_modules/sigstore/dist/tlog/index.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,19 @@ class TLogClient {
4848
entry = await this.rekor.getEntry(uuid);
4949
}
5050
catch (err) {
51-
throw new error_1.InternalError('error fetching tlog entry', err);
51+
throw new error_1.InternalError({
52+
code: 'TLOG_FETCH_ENTRY_ERROR',
53+
message: 'error fetching tlog entry',
54+
cause: err,
55+
});
5256
}
5357
}
5458
else {
55-
throw new error_1.InternalError('error creating tlog entry', err);
59+
throw new error_1.InternalError({
60+
code: 'TLOG_CREATE_ENTRY_ERROR',
61+
message: 'error creating tlog entry',
62+
cause: err,
63+
});
5664
}
5765
}
5866
return entry;

node_modules/sigstore/dist/tuf/target.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ async function readTarget(tuf, targetPath) {
2727
return new Promise((resolve, reject) => {
2828
fs_1.default.readFile(path, 'utf-8', (err, data) => {
2929
if (err) {
30-
reject(new error_1.InternalError(`error reading target: ${err}`));
30+
reject(new error_1.InternalError({
31+
code: 'TUF_READ_TARGET_ERROR',
32+
message: `error reading target ${path}`,
33+
cause: err,
34+
}));
3135
}
3236
else {
3337
resolve(data);
@@ -45,10 +49,17 @@ async function getTargetPath(tuf, target) {
4549
targetInfo = await tuf.refresh().then(() => tuf.getTargetInfo(target));
4650
}
4751
catch (err) {
48-
throw new error_1.InternalError(`error refreshing TUF metadata: ${err}`);
52+
throw new error_1.InternalError({
53+
code: 'TUF_REFRESH_METADATA_ERROR',
54+
message: 'error refreshing TUF metadata',
55+
cause: err,
56+
});
4957
}
5058
if (!targetInfo) {
51-
throw new error_1.InternalError(`target ${target} not found`);
59+
throw new error_1.InternalError({
60+
code: 'TUF_FIND_TARGET_ERROR',
61+
message: `target ${target} not found`,
62+
});
5263
}
5364
let path = await tuf.findCachedTarget(targetInfo);
5465
// An empty path here means the target has not been cached locally, or is
@@ -58,7 +69,11 @@ async function getTargetPath(tuf, target) {
5869
path = await tuf.downloadTarget(targetInfo);
5970
}
6071
catch (err) {
61-
throw new error_1.InternalError(`error downloading target: ${err}`);
72+
throw new error_1.InternalError({
73+
code: 'TUF_DOWNLOAD_TARGET_ERROR',
74+
message: `error downloading target ${path}`,
75+
cause: err,
76+
});
6277
}
6378
}
6479
return path;

node_modules/sigstore/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sigstore",
3-
"version": "1.3.0",
3+
"version": "1.4.0",
44
"description": "code-signing for npm packages",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
@@ -37,6 +37,7 @@
3737
"homepage": "https://github.com/sigstore/sigstore-js#readme",
3838
"devDependencies": {
3939
"@changesets/cli": "^2.26.0",
40+
"@total-typescript/shoehorn": "^0.1.0",
4041
"@tsconfig/node14": "^1.0.3",
4142
"@tufjs/repo-mock": "^1.1.0",
4243
"@types/jest": "^29.4.0",

package-lock.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11536,9 +11536,9 @@
1153611536
"inBundle": true
1153711537
},
1153811538
"node_modules/sigstore": {
11539-
"version": "1.3.0",
11540-
"resolved": "https://registry.npmjs.org/sigstore/-/sigstore-1.3.0.tgz",
11541-
"integrity": "sha512-dhdv+jOAi1RgLHw13lxumk3rlgZtumUz9QrCNPTx9MazUnUV3BfAb74oYAMPQQ7uaeogB5vTosbz3POzKbEHUQ==",
11539+
"version": "1.4.0",
11540+
"resolved": "https://registry.npmjs.org/sigstore/-/sigstore-1.4.0.tgz",
11541+
"integrity": "sha512-N7TRpSbFjY/TrFDg6yGAQSYBrQ5s6qmPiq4pD6fkv1LoyfMsLG0NwZWG2s5q+uttLHgyVyTa0Rogx2P78rN8kQ==",
1154211542
"inBundle": true,
1154311543
"dependencies": {
1154411544
"@sigstore/protobuf-specs": "^0.1.0",
@@ -15669,7 +15669,7 @@
1566915669
"npm-registry-fetch": "^14.0.3",
1567015670
"proc-log": "^3.0.0",
1567115671
"semver": "^7.3.7",
15672-
"sigstore": "^1.3.0",
15672+
"sigstore": "^1.4.0",
1567315673
"ssri": "^10.0.1"
1567415674
},
1567515675
"devDependencies": {

workspaces/libnpmpublish/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"npm-registry-fetch": "^14.0.3",
4545
"proc-log": "^3.0.0",
4646
"semver": "^7.3.7",
47-
"sigstore": "^1.0.0",
47+
"sigstore": "^1.4.0",
4848
"ssri": "^10.0.1"
4949
},
5050
"engines": {

0 commit comments

Comments
 (0)