diff --git a/types/jws/index.d.ts b/types/jws/index.d.ts index f384fadefc..fdbf1851c4 100644 --- a/types/jws/index.d.ts +++ b/types/jws/index.d.ts @@ -149,4 +149,5 @@ export type Algorithm = 'HS256' | 'HS384' | 'HS512' | 'RS256' | export interface Header { alg: Algorithm; + [name: string]: string; } diff --git a/types/jws/jws-tests.ts b/types/jws/jws-tests.ts index d5271b24ca..c6e62378f8 100644 --- a/types/jws/jws-tests.ts +++ b/types/jws/jws-tests.ts @@ -20,6 +20,13 @@ const signature = jws.sign({ secret: 'has a van', }); +// jws.sign with extra header values +const signatureWithHeaderParams = jws.sign({ + header: { alg: 'HS256', foo: 'bar' }, + payload: 'h. jon benjamin', + secret: 'has a van', +}); + // jws.decode const message = jws.decode('djfakdid');