chore: add wasm console demo
This commit is contained in:
103
wasm_console_demo/wasm_app.d.ts
vendored
Normal file
103
wasm_console_demo/wasm_app.d.ts
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Initialize the scripting environment (must be called before run_rhai)
|
||||
*/
|
||||
export function init_rhai_env(): void;
|
||||
/**
|
||||
* Securely run a Rhai script in the extension context (must be called only after user approval)
|
||||
*/
|
||||
export function run_rhai(script: string): any;
|
||||
/**
|
||||
* Create and unlock a new keyspace with the given name and password
|
||||
*/
|
||||
export function create_keyspace(keyspace: string, password: string): Promise<void>;
|
||||
/**
|
||||
* Initialize session with keyspace and password
|
||||
*/
|
||||
export function init_session(keyspace: string, password: string): Promise<void>;
|
||||
/**
|
||||
* Lock the session (zeroize password and session)
|
||||
*/
|
||||
export function lock_session(): void;
|
||||
/**
|
||||
* Get metadata of the currently selected keypair
|
||||
*/
|
||||
export function current_keypair_metadata(): any;
|
||||
/**
|
||||
* Get public key of the currently selected keypair as Uint8Array
|
||||
*/
|
||||
export function current_keypair_public_key(): any;
|
||||
/**
|
||||
* Returns true if a keyspace is currently unlocked
|
||||
*/
|
||||
export function is_unlocked(): boolean;
|
||||
/**
|
||||
* Get all keypairs from the current session
|
||||
* Returns an array of keypair objects with id, type, and metadata
|
||||
* Select keypair for the session
|
||||
*/
|
||||
export function select_keypair(key_id: string): void;
|
||||
/**
|
||||
* List keypairs in the current session's keyspace
|
||||
*/
|
||||
export function list_keypairs(): Promise<any>;
|
||||
/**
|
||||
* Add a keypair to the current keyspace
|
||||
*/
|
||||
export function add_keypair(key_type?: string | null, metadata?: string | null): Promise<any>;
|
||||
/**
|
||||
* Sign message with current session
|
||||
*/
|
||||
export function sign(message: Uint8Array): Promise<any>;
|
||||
|
||||
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
||||
|
||||
export interface InitOutput {
|
||||
readonly memory: WebAssembly.Memory;
|
||||
readonly init_rhai_env: () => void;
|
||||
readonly run_rhai: (a: number, b: number) => [number, number, number];
|
||||
readonly create_keyspace: (a: number, b: number, c: number, d: number) => any;
|
||||
readonly init_session: (a: number, b: number, c: number, d: number) => any;
|
||||
readonly lock_session: () => void;
|
||||
readonly current_keypair_metadata: () => [number, number, number];
|
||||
readonly current_keypair_public_key: () => [number, number, number];
|
||||
readonly is_unlocked: () => number;
|
||||
readonly select_keypair: (a: number, b: number) => [number, number];
|
||||
readonly list_keypairs: () => any;
|
||||
readonly add_keypair: (a: number, b: number, c: number, d: number) => any;
|
||||
readonly sign: (a: number, b: number) => any;
|
||||
readonly __wbindgen_exn_store: (a: number) => void;
|
||||
readonly __externref_table_alloc: () => number;
|
||||
readonly __wbindgen_export_2: WebAssembly.Table;
|
||||
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
||||
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
||||
readonly __wbindgen_export_5: WebAssembly.Table;
|
||||
readonly __externref_table_dealloc: (a: number) => void;
|
||||
readonly closure89_externref_shim: (a: number, b: number, c: any) => void;
|
||||
readonly closure133_externref_shim: (a: number, b: number, c: any) => void;
|
||||
readonly closure188_externref_shim: (a: number, b: number, c: any) => void;
|
||||
readonly closure1847_externref_shim: (a: number, b: number, c: any, d: any) => void;
|
||||
readonly __wbindgen_start: () => void;
|
||||
}
|
||||
|
||||
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
||||
/**
|
||||
* Instantiates the given `module`, which can either be bytes or
|
||||
* a precompiled `WebAssembly.Module`.
|
||||
*
|
||||
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
||||
*
|
||||
* @returns {InitOutput}
|
||||
*/
|
||||
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
||||
|
||||
/**
|
||||
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
||||
* for everything else, calls `WebAssembly.instantiate` directly.
|
||||
*
|
||||
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
||||
*
|
||||
* @returns {Promise<InitOutput>}
|
||||
*/
|
||||
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|
||||
Reference in New Issue
Block a user