Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
21 lines
862 B
Plaintext
21 lines
862 B
Plaintext
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.EmbeddedJWK = EmbeddedJWK;
|
|
const import_js_1 = require("../key/import.js");
|
|
const is_object_js_1 = require("../lib/is_object.js");
|
|
const errors_js_1 = require("../util/errors.js");
|
|
async function EmbeddedJWK(protectedHeader, token) {
|
|
const joseHeader = {
|
|
...protectedHeader,
|
|
...token?.header,
|
|
};
|
|
if (!(0, is_object_js_1.default)(joseHeader.jwk)) {
|
|
throw new errors_js_1.JWSInvalid('"jwk" (JSON Web Key) Header Parameter must be a JSON object');
|
|
}
|
|
const key = await (0, import_js_1.importJWK)({ ...joseHeader.jwk, ext: true }, joseHeader.alg);
|
|
if (key instanceof Uint8Array || key.type !== 'public') {
|
|
throw new errors_js_1.JWSInvalid('"jwk" (JSON Web Key) Header Parameter must be a public key');
|
|
}
|
|
return key;
|
|
}
|