Documents for @litert/jwt / Algorithms/Hmac / HmacJwaSigner
Class: HmacJwaSigner
Defined in: src/lib/Algorithms/Hmac.ts:87
The HMAC JWT signer implementation.
Example
import * as LibJWT from '@litert/jwt';
const signer = new LibJWT.HmacJwaSigner({
'key': 'the-secret-key',
'digestType': LibJWT.EDigestType.SHA256,
});
const token = await LibJWT.stringify({
'payload': { foo: 'bar' },
'signer': signer,
});
console.log(token);Implements
Constructors
Constructor
new HmacJwaSigner(
opts):HmacJwaSigner
Defined in: src/lib/Algorithms/Hmac.ts:99
Parameters
opts
Returns
HmacJwaSigner
Properties
digestType
readonlydigestType:EDigestType
Defined in: src/lib/Algorithms/Hmac.ts:93
The digest type to use for signing.
Implementation of
family
readonlyfamily:ESigningAlgoFamily=cL.ESigningAlgoFamily.HMAC
Defined in: src/lib/Algorithms/Hmac.ts:89
The signing algorithm family.
Implementation of
jwa
readonlyjwa:ESigningJwa
Defined in: src/lib/Algorithms/Hmac.ts:91
The signing algorithm to use, for the alg claim in the JWT header.
Implementation of
keyId?
readonlyoptionalkeyId:string|null
Defined in: src/lib/Algorithms/Hmac.ts:95
The key ID to use in the JWT header.
Implementation of
Methods
sign()
sign(
content):Buffer
Defined in: src/lib/Algorithms/Hmac.ts:109
Sign the provided data and return the signature.
Parameters
content
string | Buffer<ArrayBufferLike>
Returns
Buffer
The signature.