UNPKG

atlassian-connect-auth

Version:
51 lines 2.5 kB
import { AuthDataProvider } from './authDataProvider'; import { KeyProvider } from './publicKeyProvider'; import { ConnectJwt, CredentialsLoader, InstallationQueryStringHashType, InstallationType, QueryStringHashType } from './types'; interface CommonVerifyArgs<E, Q> { asymmetricKeyProvider: KeyProvider; authDataProvider: AuthDataProvider; authorizationMethod?: 'sharedSecret' | 'publicKey' | 'any'; baseUrl: string; credentialsLoader: CredentialsLoader<E>; queryStringHashType?: Q; } export type VerifyInstallationArgs<E> = CommonVerifyArgs<E, InstallationQueryStringHashType>; export interface NewInstallationResponse { type: InstallationType.newInstallation; clientKey: string; connectJwt?: ConnectJwt; } export interface UpdateInstallationResponse<E> { type: InstallationType.update; clientKey: string; connectJwt: ConnectJwt; storedEntity: E; } export type VerifyInstallationResponse<E> = NewInstallationResponse | UpdateInstallationResponse<E>; /** * Verifies a Connect request installation. * Use this function to make sure the request is valid before persisting any data. * This function handles both new installations and re-installations or installation updates. */ export declare function verifyInstallation<E>({ asymmetricKeyProvider, authDataProvider, authorizationMethod, baseUrl, credentialsLoader, queryStringHashType, }: VerifyInstallationArgs<E>): Promise<VerifyInstallationResponse<E>>; export type VerifyRequestArgs<E> = CommonVerifyArgs<E, QueryStringHashType>; export interface VerifyRequestResponse<E> { connectJwt: ConnectJwt; storedEntity: E; } /** * Verifies any post-installation incoming connect requests using currently stored Shared Secret. * Use this function to verify the request was actually initiated by Atlassian Connect service and that its content * is not tainted via the Query String Hash algorithm. * This function handles API, frame-loading, context, and some app-lifecycle requests. */ export declare function verifyRequest<E>({ asymmetricKeyProvider, authDataProvider, authorizationMethod, baseUrl, credentialsLoader, queryStringHashType, }: VerifyRequestArgs<E>): Promise<VerifyRequestResponse<E>>; export interface verifySignedRequestArgs { asymmetricKeyProvider: KeyProvider; authDataProvider: AuthDataProvider; baseUrl: string; queryStringHashType?: QueryStringHashType; unverifiedConnectJwt?: ConnectJwt; } export {}; //# sourceMappingURL=ConnectAuth.d.ts.map