This commit is contained in:
2026-08-14 16:03:47 +01:00
parent fd53e3f4fb
commit dfdc3b2840
2463 changed files with 186456 additions and 111315 deletions
+10 -1
View File
@@ -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
View File
@@ -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,
]);
}