1"use strict"; 2Object.defineProperty(exports, "__esModule", { value: true }); 3/* 4Copyright 2022 The Sigstore Authors. 5 6Licensed under the Apache License, Version 2.0 (the "License"); 7you may not use this file except in compliance with the License. 8You may obtain a copy of the License at 9 10 http://www.apache.org/licenses/LICENSE-2.0 11 12Unless required by applicable law or agreed to in writing, software 13distributed under the License is distributed on an "AS IS" BASIS, 14WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15See the License for the specific language governing permissions and 16limitations under the License. 17*/ 18const ci_1 = require("./ci"); 19const issuer_1 = require("./issuer"); 20const oauth_1 = require("./oauth"); 21/** 22 * oauthProvider returns a new Provider instance which attempts to retrieve 23 * an identity token from the configured OAuth2 issuer. 24 * 25 * @param issuer Base URL of the issuer 26 * @param clientID Client ID for the issuer 27 * @param clientSecret Client secret for the issuer (optional) 28 * @returns {Provider} 29 */ 30function oauthProvider(options) { 31 return new oauth_1.OAuthProvider({ 32 issuer: new issuer_1.Issuer(options.issuer), 33 clientID: options.clientID, 34 clientSecret: options.clientSecret, 35 redirectURL: options.redirectURL, 36 }); 37} 38/** 39 * ciContextProvider returns a new Provider instance which attempts to retrieve 40 * an identity token from the CI context. 41 * 42 * @param audience audience claim for the generated token 43 * @returns {Provider} 44 */ 45function ciContextProvider(audience = 'sigstore') { 46 return new ci_1.CIContextProvider(audience); 47} 48exports.default = { 49 ciContextProvider, 50 oauthProvider, 51}; 52