diff --git a/index.d.ts b/index.d.ts index 52ccff7..47e3a6e 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,9 +1,13 @@ +import { KeyLike } from 'crypto'; + export type TAlgorithm = 'HS256' | 'HS384' | 'HS512' | 'RS256'; export interface IOptions { header: any; } -export function decode(token: string, key: string, noVerify?: boolean, algorithm?: TAlgorithm): any; +export function decode(token: string, key: string | Buffer, noVerify?: boolean, algorithm?: TAlgorithm): any; +export function decode(token: string, key: KeyLike, noVerify: true): any; +export function decode(token: string, key: KeyLike, noVerify: boolean, algorithm: TAlgorithm): any; -export function encode(payload: any, key: string, algorithm?: TAlgorithm, options?: IOptions): string; +export function encode(payload: any, key: KeyLike, algorithm?: TAlgorithm, options?: IOptions): string;