avancement planning
This commit is contained in:
+1
@@ -19,6 +19,7 @@ limitations under the License.
|
||||
const error_1 = require("../../error");
|
||||
const fulcio_1 = require("../../external/fulcio");
|
||||
class CAClient {
|
||||
fulcio;
|
||||
constructor(options) {
|
||||
this.fulcio = new fulcio_1.Fulcio({
|
||||
baseURL: options.fulcioBaseURL,
|
||||
|
||||
+4
-6
@@ -1,7 +1,4 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.EphemeralSigner = void 0;
|
||||
/*
|
||||
@@ -19,20 +16,21 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
const crypto_1 = __importDefault(require("crypto"));
|
||||
const crypto_1 = require("crypto");
|
||||
const EC_KEYPAIR_TYPE = 'ec';
|
||||
const P256_CURVE = 'P-256';
|
||||
// Signer implementation which uses an ephemeral keypair to sign artifacts.
|
||||
// The private key lives only in memory and is tied to the lifetime of the
|
||||
// EphemeralSigner instance.
|
||||
class EphemeralSigner {
|
||||
keypair;
|
||||
constructor() {
|
||||
this.keypair = crypto_1.default.generateKeyPairSync(EC_KEYPAIR_TYPE, {
|
||||
this.keypair = (0, crypto_1.generateKeyPairSync)(EC_KEYPAIR_TYPE, {
|
||||
namedCurve: P256_CURVE,
|
||||
});
|
||||
}
|
||||
async sign(data) {
|
||||
const signature = crypto_1.default.sign(null, data, this.keypair.privateKey);
|
||||
const signature = (0, crypto_1.sign)('sha256', data, this.keypair.privateKey);
|
||||
const publicKey = this.keypair.publicKey
|
||||
.export({ format: 'pem', type: 'spki' })
|
||||
.toString('ascii');
|
||||
|
||||
+3
@@ -26,6 +26,9 @@ exports.DEFAULT_FULCIO_URL = 'https://fulcio.sigstore.dev';
|
||||
// Must be instantiated with an identity provider which can provide a JWT
|
||||
// which represents the identity to be bound to the signing certificate.
|
||||
class FulcioSigner {
|
||||
ca;
|
||||
identityProvider;
|
||||
keyHolder;
|
||||
constructor(options) {
|
||||
this.ca = new ca_1.CAClient({
|
||||
...options,
|
||||
|
||||
Reference in New Issue
Block a user