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
23 lines
769 B
Plaintext
23 lines
769 B
Plaintext
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.CompactSign = void 0;
|
|
const sign_js_1 = require("../flattened/sign.js");
|
|
class CompactSign {
|
|
_flattened;
|
|
constructor(payload) {
|
|
this._flattened = new sign_js_1.FlattenedSign(payload);
|
|
}
|
|
setProtectedHeader(protectedHeader) {
|
|
this._flattened.setProtectedHeader(protectedHeader);
|
|
return this;
|
|
}
|
|
async sign(key, options) {
|
|
const jws = await this._flattened.sign(key, options);
|
|
if (jws.payload === undefined) {
|
|
throw new TypeError('use the flattened module for creating JWS with b64: false');
|
|
}
|
|
return `${jws.protected}.${jws.payload}.${jws.signature}`;
|
|
}
|
|
}
|
|
exports.CompactSign = CompactSign;
|