binary -> bytes

This commit is contained in:
FabianLars
2025-10-14 18:36:15 +02:00
parent 28ea4dbadc
commit 403f54b78c
3 changed files with 28 additions and 10 deletions
+15 -2
View File
@@ -5,22 +5,35 @@
import { invoke } from '@tauri-apps/api/core'
// TODO: functions to delete entries?
// TODO: docs
/*
* Corresponds to [`set_password`](https://docs.rs/keyring-core/latest/keyring_core/struct.Entry.html#method.set_password) in keyring-rs.
*/
export async function setString(key: string, value: string) {
return await invoke('plugin:secure-storage|set_string', { key, value })
}
/*
* Corresponds to [`get_password`](https://docs.rs/keyring-core/latest/keyring_core/struct.Entry.html#method.get_password) in keyring-rs.
*/
export async function getString(key: string): Promise<string> {
return await invoke('plugin:secure-storage|get_string', { key })
}
export async function setBinary(
/*
* Corresponds to [`set_secret`](https://docs.rs/keyring-core/latest/keyring_core/struct.Entry.html#method.set_secret) in keyring-rs.
*/
export async function setBytes(
key: string,
value: number[] | Uint8Array | ArrayBuffer
) {
return await invoke('plugin:secure-storage|set_binary', { key, value })
}
export async function getBinary(key: string): Promise<number[]> {
/*
* Corresponds to [`get_secret`](https://docs.rs/keyring-core/latest/keyring_core/struct.Entry.html#method.set_password) in keyring-rs.
*/
export async function getBytes(key: string): Promise<number[]> {
return await invoke('plugin:secure-storage|set_string', { key })
}