@documedis-components/prescription-sign
Version:
React component for signing electronic prescriptions with HIN authentication
49 lines (48 loc) • 1.69 kB
TypeScript
import { SAMLAuthCodeURLResponse, HINSignedPrescriptionResponse, HINSessionVerificationResponse, HINAccessTokenResponse, HINAuthHandleResponse } from '../../../../../../core/src/hin/index.ts';
export declare class HINClient {
private apiClient;
readonly backendUrl: string;
constructor({ accessToken, backendUrl, }: {
accessToken: string;
backendUrl: string;
});
/**
* Generate OAuth code URL
*/
generateOAuthCodeURL(openerOrigin?: string): Promise<string>;
/**
* Verify session validity
*/
verifyHinSession(sessionToken: string): Promise<HINSessionVerificationResponse>;
/**
* Update access token
*/
updateAccessToken(sessionToken: string, code?: string): Promise<HINAccessTokenResponse>;
/**
* Get SAML auth code URL
*/
getSAMLAuthCodeURL(sessionToken: string, openerOrigin?: string): Promise<SAMLAuthCodeURLResponse>;
/**
* Validate CHMED and its Author
* @returns true if valid (204 response)
* @throws DomainError if invalid (from API response)
*/
validateCHMED(sessionToken: string, chmed: string): Promise<boolean>;
/**
* Get SAML auth handle
*/
getSAMLAuthHandle(sessionToken: string, authCode: string): Promise<HINAuthHandleResponse>;
/**
* Sign prescription
*/
signPrescription(sessionToken: string, chmed: string, shouldGeneratePdf: boolean): Promise<HINSignedPrescriptionResponse & {
pdfData?: string;
}>;
}
/**
* Create a HIN client for use in components
*/
export declare function createHINClient({ accessToken, backendUrl, }: {
accessToken: string;
backendUrl: string;
}): HINClient;