refactor: check general jws sign recipients length

This commit is contained in:
Filip Skokan 2020-12-17 18:55:38 +01:00
parent 626d91f201
commit 2d58cbcf12

View file

@ -141,6 +141,10 @@ export default class GeneralSign {
* Signs and resolves the value of the General JWS object.
*/
async sign(): Promise<GeneralJWS> {
if (!this._signatures.length) {
throw new JWSInvalid('at least one signature must be added')
}
const jws: GeneralJWS = {
signatures: [],
}