mirror of
https://github.com/haveno-dex/haveno-ui.git
synced 2025-08-07 14:12:33 -04:00
feat: account backup
--- Co-authored-by: @schowdhuri Reviewed-by: @schowdhuri
This commit is contained in:
parent
ad493f5147
commit
500be9a7fd
17 changed files with 443 additions and 11 deletions
1
packages/preload/contracts.d.ts
vendored
1
packages/preload/contracts.d.ts
vendored
|
@ -20,6 +20,7 @@ interface Exposed {
|
|||
readonly nodeCrypto: Readonly<typeof import("./src/nodeCrypto").nodeCrypto>;
|
||||
readonly versions: Readonly<typeof import("./src/versions").versions>;
|
||||
readonly electronStore: Readonly<typeof import("./src/store").store>;
|
||||
readonly haveno: Readonly<typeof import("./src/haveno").store>;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
|
|
31
packages/preload/src/haveno.ts
Normal file
31
packages/preload/src/haveno.ts
Normal file
|
@ -0,0 +1,31 @@
|
|||
// =============================================================================
|
||||
// Copyright 2022 Haveno
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
// =============================================================================
|
||||
|
||||
import { ipcRenderer } from "electron";
|
||||
import { exposeInMainWorld } from "./exposeInMainWorld";
|
||||
import type { DownloadBackupInput } from "./types";
|
||||
import { IpcChannels } from "./types";
|
||||
|
||||
// Export for types in contracts.d.ts
|
||||
export const haveno = {
|
||||
downloadBackup: async (data: DownloadBackupInput): Promise<void> =>
|
||||
ipcRenderer.invoke(IpcChannels.DownloadBackup, data),
|
||||
|
||||
getBackupData: async (): Promise<Uint8Array> =>
|
||||
ipcRenderer.invoke(IpcChannels.RestoreBackup),
|
||||
};
|
||||
|
||||
exposeInMainWorld("haveno", haveno);
|
|
@ -21,3 +21,4 @@
|
|||
import "./nodeCrypto";
|
||||
import "./versions";
|
||||
import "./store";
|
||||
import "./haveno";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue