avancement planning
This commit is contained in:
+33
-2
@@ -1,8 +1,8 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.TLogClient = void 0;
|
||||
exports.TLogV2Client = exports.TLogClient = void 0;
|
||||
/*
|
||||
Copyright 2023 The Sigstore Authors.
|
||||
Copyright 2025 The Sigstore Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -19,7 +19,10 @@ limitations under the License.
|
||||
const error_1 = require("../../error");
|
||||
const error_2 = require("../../external/error");
|
||||
const rekor_1 = require("../../external/rekor");
|
||||
const rekor_v2_1 = require("../../external/rekor-v2");
|
||||
class TLogClient {
|
||||
rekor;
|
||||
fetchOnConflict;
|
||||
constructor(options) {
|
||||
this.fetchOnConflict = options.fetchOnConflict ?? false;
|
||||
this.rekor = new rekor_1.Rekor({
|
||||
@@ -59,3 +62,31 @@ function entryExistsError(value) {
|
||||
value.statusCode === 409 &&
|
||||
value.location !== undefined);
|
||||
}
|
||||
class TLogV2Client {
|
||||
rekor;
|
||||
constructor(options) {
|
||||
this.rekor = new rekor_v2_1.RekorV2({
|
||||
baseURL: options.rekorBaseURL,
|
||||
retry: options.retry,
|
||||
timeout: options.timeout,
|
||||
});
|
||||
}
|
||||
async createEntry(createEntryRequest) {
|
||||
let entry;
|
||||
try {
|
||||
entry = await this.rekor.createEntry(createEntryRequest);
|
||||
}
|
||||
catch (err) {
|
||||
(0, error_1.internalError)(err, 'TLOG_CREATE_ENTRY_ERROR', 'error creating tlog entry');
|
||||
}
|
||||
if (entry.logId === undefined || entry.kindVersion === undefined) {
|
||||
(0, error_1.internalError)(new Error('invalid tlog entry'), 'TLOG_CREATE_ENTRY_ERROR', 'error creating tlog entry');
|
||||
}
|
||||
return {
|
||||
...entry,
|
||||
logId: entry.logId,
|
||||
kindVersion: entry.kindVersion,
|
||||
};
|
||||
}
|
||||
}
|
||||
exports.TLogV2Client = TLogV2Client;
|
||||
|
||||
Reference in New Issue
Block a user