formacao
This commit is contained in:
+10
-1
@@ -25,7 +25,16 @@ limitations under the License.
|
||||
const crypto_1 = __importDefault(require("crypto"));
|
||||
function createPublicKey(key, type = 'spki') {
|
||||
if (typeof key === 'string') {
|
||||
return crypto_1.default.createPublicKey(key);
|
||||
if (key.startsWith('-----')) {
|
||||
return crypto_1.default.createPublicKey(key);
|
||||
}
|
||||
else {
|
||||
return crypto_1.default.createPublicKey({
|
||||
key: Buffer.from(key, 'base64'),
|
||||
format: 'der',
|
||||
type: type,
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
return crypto_1.default.createPublicKey({ key, format: 'der', type: type });
|
||||
|
||||
+7
-8
@@ -19,12 +19,11 @@ limitations under the License.
|
||||
const PAE_PREFIX = 'DSSEv1';
|
||||
// DSSE Pre-Authentication Encoding
|
||||
function preAuthEncoding(payloadType, payload) {
|
||||
const prefix = [
|
||||
PAE_PREFIX,
|
||||
payloadType.length,
|
||||
payloadType,
|
||||
payload.length,
|
||||
'',
|
||||
].join(' ');
|
||||
return Buffer.concat([Buffer.from(prefix, 'ascii'), payload]);
|
||||
const typeBytes = Buffer.from(payloadType, 'utf-8');
|
||||
return Buffer.concat([
|
||||
Buffer.from(`${PAE_PREFIX} ${typeBytes.length} `, 'ascii'),
|
||||
typeBytes,
|
||||
Buffer.from(` ${payload.length} `, 'ascii'),
|
||||
payload,
|
||||
]);
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@sigstore/core",
|
||||
"version": "3.1.0",
|
||||
"version": "3.2.1",
|
||||
"description": "Base library for Sigstore",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
|
||||
Reference in New Issue
Block a user