atlassian-connect-auth
Version:
Helper for handling webhooks from Atlassian products
29 lines • 1.22 kB
TypeScript
import { ConnectJwt } from './types';
/**
* Checks whether the algorithm is asymmetric. Currently, only RS256 is supported.
*/
export declare function isAsymmetricAlgorithm(alg?: string): boolean;
/**
* Decodes a Connect JWT without verifying its authenticity.
*/
export declare function decodeUnverifiedConnectJwt(rawConnectJwt: string): ConnectJwt;
export interface VerifyConnectJwtArgs {
rawConnectJwt: string;
sharedSecret: string;
unverifiedConnectJwt?: ConnectJwt;
}
/**
* Decodes a Connect JWT verifying it against the Shared Secret (provided during installation) and checks expiration.
*/
export declare function verifyConnectJwt({ rawConnectJwt, sharedSecret, unverifiedConnectJwt, }: VerifyConnectJwtArgs): ConnectJwt;
export interface VerifyAsymmetricConnectJwtArgs {
rawConnectJwt: string;
publicKey: string;
unverifiedConnectJwt?: ConnectJwt;
}
/**
* Decodes an asymmetric Connect JWT verifying it against the public secret (obtained from the CDN by the kid) and
* checks expiration.
*/
export declare function verifyAsymmetricConnectJwt({ rawConnectJwt, publicKey, unverifiedConnectJwt, }: VerifyAsymmetricConnectJwtArgs): ConnectJwt;
//# sourceMappingURL=Jwt.d.ts.map