@humanmark/sdk-js
Version:
Browser-native JavaScript SDK for Humanmark human verification challenges
52 lines • 1.89 kB
TypeScript
/**
* Options for QR code generation
*/
export interface QRCodeOptions {
/** Width of the QR code in pixels (default: 256) */
width?: number;
/** Margin around the QR code in modules (default: 2) */
margin?: number;
/** Color configuration */
color?: {
/** Foreground color (default: #000000) */
dark?: string;
/** Background color (default: #FFFFFF) */
light?: string;
};
}
/**
* Generates QR codes for desktop verification flow
*
* Creates QR codes that encode deep links to the Humanmark app.
* Users scan the code with their mobile device to complete verification.
*/
export declare class QRCodeGenerator {
private static readonly DEFAULT_OPTIONS;
/**
* Generates a QR code as an SVG data URL
*
* @param token - Challenge token to encode in the QR code
* @param options - Optional QR code styling options
* @returns Promise resolving to SVG data URL of the QR code
* @throws {Error} If QR code generation fails
*
* @example
* const dataUrl = await QRCodeGenerator.generateQRCode('eyJhbGciOi...');
* // dataUrl can be used as src for an img element
*/
static generateQRCode(token: string, options?: QRCodeOptions): Promise<string>;
/**
* Generates a QR code as an HTML image element
*
* @param token - Challenge token to encode in the QR code
* @param options - Optional QR code styling options
* @returns Promise resolving to an img element ready to be inserted into DOM
* @throws {Error} If QR code generation fails
*
* @example
* const img = await QRCodeGenerator.generateQRCodeElement('eyJhbGciOi...');
* document.body.appendChild(img);
*/
static generateQRCodeElement(token: string, options?: QRCodeOptions): Promise<HTMLImageElement>;
}
//# sourceMappingURL=QRCodeGenerator.d.ts.map