aboutsummaryrefslogtreecommitdiff
path: root/extension/src/entries/background/identity-api.ts
diff options
context:
space:
mode:
Diffstat (limited to 'extension/src/entries/background/identity-api.ts')
-rw-r--r--extension/src/entries/background/identity-api.ts59
1 files changed, 0 insertions, 59 deletions
diff --git a/extension/src/entries/background/identity-api.ts b/extension/src/entries/background/identity-api.ts
deleted file mode 100644
index c835f7c..0000000
--- a/extension/src/entries/background/identity-api.ts
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright (C) 2023 Vaughn Nugent
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Affero General Public License as
-// published by the Free Software Foundation, either version 3 of the
-// License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Affero General Public License for more details.
-//
-// You should have received a copy of the GNU Affero General Public License
-// along with this program. If not, see <https://www.gnu.org/licenses/>.
-
-import { NostrIdentiy } from "../../bg-api/types";
-import { useAuthApi } from "./auth-api";
-import { useSettings } from "./settings";
-
-export const useIdentityApi = (() => {
-
- const { handleProtectedApicall } = useAuthApi();
- const { currentConfig } = useSettings();
-
- const onCreateIdentity = handleProtectedApicall<NostrIdentiy>(async (data, { axios }) => {
- //Create a new identity
- const response = await axios.put(`${currentConfig.value.nostrEndpoint}?type=identity`, data)
-
- if (response.data.success) {
- return response.data.result;
- }
-
- //If we get here, the login failed
- throw { response }
- })
-
- const onUpdateIdentity = handleProtectedApicall(async (data, { axios }) => {
- delete data.Created;
- delete data.LastModified;
-
- //Create a new identity
- const response = await axios.patch(`${currentConfig.value.nostrEndpoint}?type=identity`, data)
-
- if (response.data.success) {
- return response.data.result;
- }
-
- //If we get here, the login failed
- throw { response }
- })
-
- return () =>{
- return{
- onCreateIdentity,
- onUpdateIdentity
- }
- }
-
-})() \ No newline at end of file