@xevolab/jades
Version:
JAdES Digital Signatures compatible with the ETSI TS 119 182-1 Standard
69 lines (68 loc) • 1.85 kB
TypeScript
import type { SignAlg } from "../types";
export type IProtectedHeaders = {
kid?: null | string;
x5u?: null | string;
x5c?: null | string[];
x5tS256?: null | string;
x5tO?: null | {
digAlg: string;
digVal: string;
};
sigX5ts?: null | {
digAlg: string;
digVal: string;
}[];
srCms?: null | {
commId: object;
}[];
srAts?: null | object[];
sigPl?: null | object;
sigPId?: null | object;
sigT?: null | string;
adoTst?: null | object[];
};
export interface ExtProtectedHeaders extends IProtectedHeaders {
alg?: SignAlg;
cty?: null | string;
b64?: boolean;
"x5t#o"?: null | {
digAlg: string;
digVal: string;
};
"x5t#S256"?: null | string;
crit?: string[];
sigD?: null | object;
}
/**
* This class is used to manage the protected headers of a token, validating them and returning a
* set of methods to interact with them.
*/
export default class ProtectedHeaders {
private header?;
constructor(p?: IProtectedHeaders);
/**
* The addHeaders method is used to add headers to the protected headers.
*
* @param {object} p The headers to add.
*
* @return {void}
*/
addHeaders(p: ExtProtectedHeaders): void;
/**
* The detach method is used to set the headers for a detached signature.
* This method is used to set the `sigD` header parameter.
*/
setDetached(sigD: ExtProtectedHeaders["sigD"]): void;
/**
* Get the object of the protected headers.
*
* @return {Object} The protected headers.
*/
getHeaders(): Object;
/**
* Get the base64url string encoded version of the protected headers.
*
* @return {string} The protected headers in base64url string form.
*/
toString(): string;
}