Skip to content

allowInsecureKeySizes flag not present among TS types. #969

Open
@toabm

Description

@toabm

Description

I updated from version 8 to 9, and since my RSA keys were not long enough I got the error: "secretOrPrivateKey has a minimum key size of 2048 bits for RS256"

I do not want to change all RSA keys in every environment so I decided to use the flag allowInsecureKeySizes to bypass that new check.

My project is buillt with typescript and if I use that flag with in the options of jwt.sign() method I will see this error:

"TS2769: No overload matches this cal"

Reproduction

jwt.sign({}, privateKey, {
issuer: 'streetcrowd',
subject: provider,
algorithm: 'RS256',
allowInsecureKeySizes: true
});

This is the definition of SignOptions, as you can see, the required flag is missing:

export interface SignOptions {
algorithm?: Algorithm | undefined;
keyid?: string | undefined;
expiresIn?: string | number | undefined;
notBefore?: string | number | undefined;
audience?: string | string[] | undefined;
subject?: string | undefined;
issuer?: string | undefined;
jwtid?: string | undefined;
mutatePayload?: boolean | undefined;
noTimestamp?: boolean | undefined;
header?: JwtHeader | undefined;
encoding?: string | undefined;
}

image

Environment

  • jsonwebtoken 9.0.2
  • Node 18

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions