| 1 |
"use strict"; |
| 2 |
var __importDefault = (this && this.__importDefault) || function (mod) { |
| 3 |
return (mod && mod.__esModule) ? mod : { "default": mod }; |
| 4 |
}; |
| 5 |
Object.defineProperty(exports, "__esModule", { value: true }); |
| 6 |
exports.getUserAgent = void 0; |
| 7 |
/* |
| 8 |
Copyright 2023 The Sigstore Authors. |
| 9 |
|
| 10 |
Licensed under the Apache License, Version 2.0 (the "License"); |
| 11 |
you may not use this file except in compliance with the License. |
| 12 |
You may obtain a copy of the License at |
| 13 |
|
| 14 |
http://www.apache.org/licenses/LICENSE-2.0 |
| 15 |
|
| 16 |
Unless required by applicable law or agreed to in writing, software |
| 17 |
distributed under the License is distributed on an "AS IS" BASIS, |
| 18 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 19 |
See the License for the specific language governing permissions and |
| 20 |
limitations under the License. |
| 21 |
*/ |
| 22 |
const os_1 = __importDefault(require("os")); |
| 23 |
// Format User-Agent: <product> / <product-version> (<platform>) |
| 24 |
// source: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent |
| 25 |
const getUserAgent = () => { |
| 26 |
const packageVersion = require('../../package.json').version; |
| 27 |
const nodeVersion = process.version; |
| 28 |
const platformName = os_1.default.platform(); |
| 29 |
const archName = os_1.default.arch(); |
| 30 |
return `sigstore-js/${packageVersion} (Node ${nodeVersion}) (${platformName}/${archName})`; |
| 31 |
}; |
| 32 |
exports.getUserAgent = getUserAgent; |