import { ChipData } from '../types/license'; export type ChipSource = string | ArrayBuffer; /** * 芯片用户 */ export type ChipUser = { name: string; phone: string; }; /** * 原始许可证数据 */ export type RawLicenseData = { projName: string; projId: string; copyright: string; dueDate: string; versions: string[]; user: ChipUser; hosts: string[]; }; /** * 原始芯片数据 */ export type RawChipData = { license: { code: string; }; }; /** * 芯片配置 * @property {string} [chipPath] - 芯片路径 * @property {HTMLElement | string} [dropDom] - 拖拽元素 * @property {boolean} [isEnableDrop] - 是否启用拖拽 */ export type ChipConfig = { chipPath?: string; dropDom?: HTMLElement; isEnableDrop?: boolean; }; /** * 芯片接口 */ export interface IChip { /** * 初始化芯片 * @param config 芯片配置 */ init(config: ChipConfig): void; /** * 设置芯片路径 * @param path 芯片路径 */ setChipPath(path: string): void; /** * 设置拖拽元素 * @param dom 拖拽元素 */ setDropDom(dom: HTMLElement | string): void; /** * 设置是否启用拖拽 * @param isEnable 是否启用拖拽 * @param dom 拖拽元素 */ setIsEnableDrop(isEnable: boolean, dom?: HTMLElement | string): void; /** * 获取盐值 * @returns {string} 盐值 */ getSalt(): string; /** * 加载芯片 * @param data 芯片数据 * @returns {Promise} 芯片数据 */ loadChip(data?: ChipSource): Promise; }