mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-04-27 11:56:05 +02:00
faa89850d0
* chore(deps): replace dependency eslint-config-standard-with-typescript with eslint-config-love 43.1.0 * actually apply the rules lol * rebuild --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: FabianLars <fabianlars@fabianlars.de>
65 lines
1.4 KiB
TypeScript
65 lines
1.4 KiB
TypeScript
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
import { invoke } from "@tauri-apps/api/core";
|
|
|
|
export class Authenticator {
|
|
async init(): Promise<void> {
|
|
await invoke("plugin:authenticator|init_auth");
|
|
}
|
|
|
|
async register(challenge: string, application: string): Promise<string> {
|
|
return await invoke("plugin:authenticator|register", {
|
|
timeout: 10000,
|
|
challenge,
|
|
application,
|
|
});
|
|
}
|
|
|
|
async verifyRegistration(
|
|
challenge: string,
|
|
application: string,
|
|
registerData: string,
|
|
clientData: string,
|
|
): Promise<string> {
|
|
return await invoke("plugin:authenticator|verify_registration", {
|
|
challenge,
|
|
application,
|
|
registerData,
|
|
clientData,
|
|
});
|
|
}
|
|
|
|
async sign(
|
|
challenge: string,
|
|
application: string,
|
|
keyHandle: string,
|
|
): Promise<string> {
|
|
return await invoke("plugin:authenticator|sign", {
|
|
timeout: 10000,
|
|
challenge,
|
|
application,
|
|
keyHandle,
|
|
});
|
|
}
|
|
|
|
async verifySignature(
|
|
challenge: string,
|
|
application: string,
|
|
signData: string,
|
|
clientData: string,
|
|
keyHandle: string,
|
|
pubkey: string,
|
|
): Promise<number> {
|
|
return await invoke("plugin:authenticator|verify_signature", {
|
|
challenge,
|
|
application,
|
|
signData,
|
|
clientData,
|
|
keyHandle,
|
|
pubkey,
|
|
});
|
|
}
|
|
}
|