Documents for @litert/jwt / Algorithms/Rsa / RsaJwaSigner
Class: RsaJwaSigner
Defined in: src/lib/Algorithms/Rsa.ts:193
The RSA JWT signer implementation, for both RSASSA-PKCS1-v1_5 (RS256, ...) and RSASSA-PSS (PS256, ...).
Example
Signing with RSASSA-PKCS1-v1_5:
import * as LibJWT from '@litert/jwt';
const signer = new LibJWT.RsaJwaSigner({
// NOTE: Don't use a RSA key with PSS padding parameters here.
'privateKey': '-----BEGIN PRIVATE KEY-----\n...',
'digestType': LibJWT.EDigestType.SHA256,
});
// ...Signing with RSASSA-PSS:
import * as LibJWT from '@litert/jwt';
const signer = new LibJWT.RsaJwaSigner({
'privateKey': '-----BEGIN PRIVATE KEY-----\n...',
'digestType': LibJWT.EDigestType.SHA256,
// NOTE: if your key is generated as RSA-PSS key, the usePssPadding
// option can be omitted or set to null.
'usePssPadding': true,
});
// ...Implements
Constructors
Constructor
new RsaJwaSigner(
opts):RsaJwaSigner
Defined in: src/lib/Algorithms/Rsa.ts:205
Parameters
opts
Returns
RsaJwaSigner
Properties
digestType
readonlydigestType:EDigestType
Defined in: src/lib/Algorithms/Rsa.ts:201
The digest type to use for signing.
Implementation of
family
readonlyfamily:ESigningAlgoFamily=cL.ESigningAlgoFamily.RSA
Defined in: src/lib/Algorithms/Rsa.ts:195
The signing algorithm family.
Implementation of
jwa
readonlyjwa:ESigningJwa
Defined in: src/lib/Algorithms/Rsa.ts:197
The signing algorithm to use, for the alg claim in the JWT header.
Implementation of
keyId?
readonlyoptionalkeyId:string|null
Defined in: src/lib/Algorithms/Rsa.ts:199
The key ID to use in the JWT header.
Implementation of
Methods
sign()
sign(
content):Buffer
Defined in: src/lib/Algorithms/Rsa.ts:218
Sign the provided data and return the signature.
Parameters
content
string | Buffer<ArrayBufferLike>
Returns
Buffer
The signature.