gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-wallet-core] branch master updated (5f613b708 -> 414b1b84e)


From: gnunet
Subject: [taler-wallet-core] branch master updated (5f613b708 -> 414b1b84e)
Date: Thu, 20 Oct 2022 19:54:59 +0200

This is an automated email from the git hooks/post-receive script.

sebasjm pushed a change to branch master
in repository wallet-core.

    from 5f613b708 bump manifest version
     new 8390c6003 parse and construct taler recovery URI
     new 414b1b84e implement the simplest recovery function

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 packages/taler-util/src/taleruri.ts                | 46 +++++++++++
 .../src/NavigationBar.tsx                          |  1 +
 .../Recovery}/index.ts                             | 20 +++--
 .../src/cta/Recovery/state.ts                      | 67 ++++++++++++++++
 .../AddAccount => cta/Recovery}/stories.tsx        |  5 +-
 .../SelectOutlined.tsx => cta/Recovery/test.ts}    |  9 ++-
 .../Recovery}/views.tsx                            | 36 +++++++--
 .../src/platform/chrome.ts                         |  5 ++
 .../src/wallet/Application.tsx                     |  7 ++
 .../src/wallet/Backup.stories.tsx                  |  9 ++-
 .../src/wallet/BackupPage.tsx                      | 89 +++++++++++++++++++++-
 .../src/wallet/ProviderAddPage.tsx                 | 10 ++-
 packages/taler-wallet-webextension/src/wxApi.ts    |  2 +-
 .../taler-wallet-webextension/src/wxBackend.ts     |  5 ++
 14 files changed, 286 insertions(+), 25 deletions(-)
 copy packages/taler-wallet-webextension/src/{wallet/EmptyComponentExample => 
cta/Recovery}/index.ts (80%)
 create mode 100644 packages/taler-wallet-webextension/src/cta/Recovery/state.ts
 copy packages/taler-wallet-webextension/src/{wallet/AddAccount => 
cta/Recovery}/stories.tsx (92%)
 copy packages/taler-wallet-webextension/src/{mui/input/SelectOutlined.tsx => 
cta/Recovery/test.ts} (85%)
 copy packages/taler-wallet-webextension/src/{wallet/EmptyComponentExample => 
cta/Recovery}/views.tsx (54%)

diff --git a/packages/taler-util/src/taleruri.ts 
b/packages/taler-util/src/taleruri.ts
index baca3efac..45f9a90f2 100644
--- a/packages/taler-util/src/taleruri.ts
+++ b/packages/taler-util/src/taleruri.ts
@@ -14,7 +14,9 @@
  GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
  */
 
+import { BackupRecovery } from "./backup-types.js";
 import { canonicalizeBaseUrl } from "./helpers.js";
+import { initNodePrng } from "./prng-node.js";
 import { URLSearchParams, URL } from "./url.js";
 
 export interface PayUriResult {
@@ -95,6 +97,7 @@ export enum TalerUriType {
   TalerNotifyReserve = "taler-notify-reserve",
   TalerPayPush = "taler-pay-push",
   TalerPayPull = "taler-pay-pull",
+  TalerRecovery = "taler-recovery",
   TalerDevExperiment = "taler-dev-experiment",
   Unknown = "unknown",
 }
@@ -107,6 +110,12 @@ const talerActionPayPush = "pay-push";
  */
 export function classifyTalerUri(s: string): TalerUriType {
   const sl = s.toLowerCase();
+  if (sl.startsWith("taler://recovery/")) {
+    return TalerUriType.TalerRecovery;
+  }
+  if (sl.startsWith("taler+http://recovery/";)) {
+    return TalerUriType.TalerRecovery;
+  }
   if (sl.startsWith("taler://pay/")) {
     return TalerUriType.TalerPay;
   }
@@ -362,3 +371,40 @@ export function constructPayPullUri(args: {
   }
   return `${proto}://pay-pull/${url.host}${url.pathname}${args.contractPriv}`;
 }
+
+export function constructRecoveryUri(args: BackupRecovery): string {
+  const key = args.walletRootPriv
+  const urls = args.providers.map(p => 
`p=${canonicalizeBaseUrl(p.url)}`).join("&")
+
+  return `taler://recovery/${key}?${urls}`
+}
+export function parseRecoveryUri(uri: string): BackupRecovery | undefined {
+  const pi = parseProtoInfo(uri, "recovery");
+  if (!pi) {
+    return undefined;
+  }
+  const idx = pi.rest.indexOf("?");
+  if (idx === -1) {
+    return undefined
+  }
+  const path = pi.rest.slice(0, idx)
+  const params = pi.rest.slice(idx + 1)
+  if (!path || !params) {
+    return undefined;
+  }
+  const parts = path.split("/");
+  const walletRootPriv = parts[0];
+  if (!walletRootPriv) return undefined
+  const providers = new Array<{ url: string }>();
+  const args = params.split("&")
+  for (const param in args) {
+    const eq = args[param].indexOf("=")
+    if (eq === -1) return undefined;
+    const name = args[param].slice(0, eq)
+    const value = args[param].slice(eq + 1)
+    if (name !== "p" || !value) return undefined;
+    providers.push({ url: value })
+  }
+  return { walletRootPriv, providers }
+}
+
diff --git a/packages/taler-wallet-webextension/src/NavigationBar.tsx 
b/packages/taler-wallet-webextension/src/NavigationBar.tsx
index f6c56af13..4f105aa10 100644
--- a/packages/taler-wallet-webextension/src/NavigationBar.tsx
+++ b/packages/taler-wallet-webextension/src/NavigationBar.tsx
@@ -110,6 +110,7 @@ export const Pages = {
 
   cta: pageDefinition<{ action: string }>("/cta/:action"),
   ctaPay: "/cta/pay",
+  ctaRecovery: "/cta/recovery",
   ctaRefund: "/cta/refund",
   ctaTips: "/cta/tip",
   ctaWithdraw: "/cta/withdraw",
diff --git 
a/packages/taler-wallet-webextension/src/wallet/EmptyComponentExample/index.ts 
b/packages/taler-wallet-webextension/src/cta/Recovery/index.ts
similarity index 80%
copy from 
packages/taler-wallet-webextension/src/wallet/EmptyComponentExample/index.ts
copy to packages/taler-wallet-webextension/src/cta/Recovery/index.ts
index 605c71e80..013e9c041 100644
--- 
a/packages/taler-wallet-webextension/src/wallet/EmptyComponentExample/index.ts
+++ b/packages/taler-wallet-webextension/src/cta/Recovery/index.ts
@@ -14,15 +14,19 @@
  GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
  */
 
+import { AmountJson } from "@gnu-taler/taler-util";
 import { Loading } from "../../components/Loading.js";
 import { HookError } from "../../hooks/useAsyncAsHook.js";
+import { ButtonHandler } from "../../mui/handlers.js";
 import { compose, StateViewMap } from "../../utils/index.js";
-import { LoadingUriView, ReadyView } from "./views.js";
 import * as wxApi from "../../wxApi.js";
 import { useComponentState } from "./state.js";
+import { LoadingUriView, ReadyView } from "./views.js";
 
 export interface Props {
-  p: string;
+  talerRecoveryUri?: string;
+  onCancel: () => Promise<void>;
+  onSuccess: () => Promise<void>;
 }
 
 export type State = State.Loading | State.LoadingUriError | State.Ready;
@@ -34,27 +38,29 @@ export namespace State {
   }
 
   export interface LoadingUriError {
-    status: "loading-error";
+    status: "loading-uri";
     error: HookError;
   }
 
   export interface BaseInfo {
     error: undefined;
+    cancel: ButtonHandler;
   }
+
   export interface Ready extends BaseInfo {
     status: "ready";
-    error: undefined;
+    accept: ButtonHandler;
   }
 }
 
 const viewMapping: StateViewMap<State> = {
   loading: Loading,
-  "loading-error": LoadingUriView,
+  "loading-uri": LoadingUriView,
   ready: ReadyView,
 };
 
-export const ComponentName = compose(
-  "ComponentName",
+export const RecoveryPage = compose(
+  "Recovery",
   (p: Props) => useComponentState(p, wxApi),
   viewMapping,
 );
diff --git a/packages/taler-wallet-webextension/src/cta/Recovery/state.ts 
b/packages/taler-wallet-webextension/src/cta/Recovery/state.ts
new file mode 100644
index 000000000..965a64e69
--- /dev/null
+++ b/packages/taler-wallet-webextension/src/cta/Recovery/state.ts
@@ -0,0 +1,67 @@
+/*
+ This file is part of GNU Taler
+ (C) 2022 Taler Systems S.A.
+
+ GNU Taler is free software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ GNU Taler 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
+ */
+
+import { parseRecoveryUri } from "@gnu-taler/taler-util";
+import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
+import * as wxApi from "../../wxApi.js";
+import { wxClient } from "../../wxApi.js";
+import { Props, State } from "./index.js";
+
+export function useComponentState(
+  { talerRecoveryUri, onCancel, onSuccess }: Props,
+  api: typeof wxApi,
+): State {
+  if (!talerRecoveryUri) {
+    return {
+      status: "loading-uri",
+      error: {
+        operational: false,
+        hasError: true,
+        message: "Missing URI",
+      },
+    };
+  }
+  const info = parseRecoveryUri(talerRecoveryUri);
+
+  if (!info) {
+    return {
+      status: "loading-uri",
+      error: {
+        operational: false,
+        hasError: true,
+        message: "Could not be read",
+      },
+    };
+  }
+  const recovery = info;
+
+  async function recoverBackup(): Promise<void> {
+    await wxClient.call(WalletApiOperation.ImportBackupRecovery, { recovery });
+    onSuccess();
+  }
+
+  return {
+    status: "ready",
+
+    accept: {
+      onClick: recoverBackup,
+    },
+    cancel: {
+      onClick: onCancel,
+    },
+    error: undefined,
+  };
+}
diff --git 
a/packages/taler-wallet-webextension/src/wallet/AddAccount/stories.tsx 
b/packages/taler-wallet-webextension/src/cta/Recovery/stories.tsx
similarity index 92%
copy from packages/taler-wallet-webextension/src/wallet/AddAccount/stories.tsx
copy to packages/taler-wallet-webextension/src/cta/Recovery/stories.tsx
index 696e424c4..e1da860fb 100644
--- a/packages/taler-wallet-webextension/src/wallet/AddAccount/stories.tsx
+++ b/packages/taler-wallet-webextension/src/cta/Recovery/stories.tsx
@@ -19,11 +19,10 @@
  * @author Sebastian Javier Marchano (sebasjm)
  */
 
+import { Amounts } from "@gnu-taler/taler-util";
 import { createExample } from "../../test-utils.js";
 import { ReadyView } from "./views.js";
 
 export default {
-  title: "example",
+  title: "cta/recovery",
 };
-
-export const Ready = createExample(ReadyView, {});
diff --git 
a/packages/taler-wallet-webextension/src/mui/input/SelectOutlined.tsx 
b/packages/taler-wallet-webextension/src/cta/Recovery/test.ts
similarity index 85%
copy from packages/taler-wallet-webextension/src/mui/input/SelectOutlined.tsx
copy to packages/taler-wallet-webextension/src/cta/Recovery/test.ts
index 72579aed2..68c75b380 100644
--- a/packages/taler-wallet-webextension/src/mui/input/SelectOutlined.tsx
+++ b/packages/taler-wallet-webextension/src/cta/Recovery/test.ts
@@ -13,8 +13,9 @@
  You should have received a copy of the GNU General Public License along with
  GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
  */
-import { h, VNode } from "preact";
 
-export function SelectOutlined(): VNode {
-  return <div />;
-}
+describe("Backup import CTA states", () => {
+  it.skip("should test something", async () => {
+    return;
+  });
+});
diff --git 
a/packages/taler-wallet-webextension/src/wallet/EmptyComponentExample/views.tsx 
b/packages/taler-wallet-webextension/src/cta/Recovery/views.tsx
similarity index 54%
copy from 
packages/taler-wallet-webextension/src/wallet/EmptyComponentExample/views.tsx
copy to packages/taler-wallet-webextension/src/cta/Recovery/views.tsx
index 5784a7db5..371516932 100644
--- 
a/packages/taler-wallet-webextension/src/wallet/EmptyComponentExample/views.tsx
+++ b/packages/taler-wallet-webextension/src/cta/Recovery/views.tsx
@@ -14,9 +14,12 @@
  GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
  */
 
-import { h, VNode } from "preact";
+import { Fragment, h, VNode } from "preact";
 import { LoadingError } from "../../components/LoadingError.js";
+import { LogoHeader } from "../../components/LogoHeader.js";
+import { SubTitle, WalletAction } from "../../components/styled/index.js";
 import { useTranslationContext } from "../../context/translation.js";
+import { Button } from "../../mui/Button.js";
 import { State } from "./index.js";
 
 export function LoadingUriView({ error }: State.LoadingUriError): VNode {
@@ -24,14 +27,37 @@ export function LoadingUriView({ error }: 
State.LoadingUriError): VNode {
 
   return (
     <LoadingError
-      title={<i18n.Translate>Could not load</i18n.Translate>}
+      title={
+        <i18n.Translate>
+          Could not load backup recovery information
+        </i18n.Translate>
+      }
       error={error}
     />
   );
 }
 
-export function ReadyView({ error }: State.Ready): VNode {
+export function ReadyView({ accept, cancel }: State.Ready): VNode {
   const { i18n } = useTranslationContext();
-
-  return <div />;
+  return (
+    <WalletAction>
+      <LogoHeader />
+
+      <SubTitle>
+        <i18n.Translate>Digital wallet recovery</i18n.Translate>
+      </SubTitle>
+
+      <section>
+        <p>
+          <i18n.Translate>Import backup, show info</i18n.Translate>
+        </p>
+        <Button variant="contained" onClick={accept.onClick}>
+          Import
+        </Button>
+        <Button variant="contained" onClick={cancel.onClick}>
+          Cancel
+        </Button>
+      </section>
+    </WalletAction>
+  );
 }
diff --git a/packages/taler-wallet-webextension/src/platform/chrome.ts 
b/packages/taler-wallet-webextension/src/platform/chrome.ts
index dfd5ef818..d7af57564 100644
--- a/packages/taler-wallet-webextension/src/platform/chrome.ts
+++ b/packages/taler-wallet-webextension/src/platform/chrome.ts
@@ -236,6 +236,11 @@ function openWalletURIFromPopup(talerUri: string): void {
         `static/wallet.html#/cta/withdraw?talerWithdrawUri=${talerUri}`,
       );
       break;
+    case TalerUriType.TalerRecovery:
+      url = chrome.runtime.getURL(
+        `static/wallet.html#/cta/recovery?talerRecoveryUri=${talerUri}`,
+      );
+      break;
     case TalerUriType.TalerPay:
       url = chrome.runtime.getURL(
         `static/wallet.html#/cta/pay?talerPayUri=${talerUri}`,
diff --git a/packages/taler-wallet-webextension/src/wallet/Application.tsx 
b/packages/taler-wallet-webextension/src/wallet/Application.tsx
index f8b2f3ec8..5934dec00 100644
--- a/packages/taler-wallet-webextension/src/wallet/Application.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/Application.tsx
@@ -64,6 +64,7 @@ import { TransferCreatePage } from 
"../cta/TransferCreate/index.js";
 import { InvoiceCreatePage } from "../cta/InvoiceCreate/index.js";
 import { TransferPickupPage } from "../cta/TransferPickup/index.js";
 import { InvoicePayPage } from "../cta/InvoicePay/index.js";
+import { RecoveryPage } from "../cta/Recovery/index.js";
 
 export function Application(): VNode {
   const [globalNotification, setGlobalNotification] = useState<
@@ -328,6 +329,12 @@ export function Application(): VNode {
                   redirectTo(Pages.balanceTransaction({ tid }))
                 }
               />
+              <Route
+                path={Pages.ctaRecovery}
+                component={RecoveryPage}
+                onCancel={() => redirectTo(Pages.balance)}
+                onSuccess={() => redirectTo(Pages.backup)}
+              />
 
               {/**
                * NOT FOUND
diff --git a/packages/taler-wallet-webextension/src/wallet/Backup.stories.tsx 
b/packages/taler-wallet-webextension/src/wallet/Backup.stories.tsx
index 1b54dbfa5..b12f5e5f6 100644
--- a/packages/taler-wallet-webextension/src/wallet/Backup.stories.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/Backup.stories.tsx
@@ -21,7 +21,10 @@
 
 import { ProviderPaymentType } from "@gnu-taler/taler-wallet-core";
 import { addDays } from "date-fns";
-import { BackupView as TestedComponent } from "./BackupPage.js";
+import {
+  BackupView as TestedComponent,
+  ShowRecoveryInfo,
+} from "./BackupPage.js";
 import { createExample } from "../test-utils.js";
 import { TalerProtocolTimestamp } from "@gnu-taler/taler-util";
 
@@ -194,3 +197,7 @@ export const OneProvider = createExample(TestedComponent, {
 export const Empty = createExample(TestedComponent, {
   providers: [],
 });
+
+export const Recovery = createExample(ShowRecoveryInfo, {
+  info: "taler://recovery/ASLDKJASLKDJASD",
+});
diff --git a/packages/taler-wallet-webextension/src/wallet/BackupPage.tsx 
b/packages/taler-wallet-webextension/src/wallet/BackupPage.tsx
index 3f948d37b..bba8b5964 100644
--- a/packages/taler-wallet-webextension/src/wallet/BackupPage.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/BackupPage.tsx
@@ -14,12 +14,17 @@
  GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
  */
 
-import { AbsoluteTime } from "@gnu-taler/taler-util";
+import {
+  AbsoluteTime,
+  BackupRecovery,
+  constructRecoveryUri,
+} from "@gnu-taler/taler-util";
 import {
   ProviderInfo,
   ProviderPaymentPaid,
   ProviderPaymentStatus,
   ProviderPaymentType,
+  WalletApiOperation,
 } from "@gnu-taler/taler-wallet-core";
 import {
   differenceInMonths,
@@ -37,20 +42,78 @@ import {
   RowBorderGray,
   SmallLightText,
   SmallText,
+  WarningBox,
 } from "../components/styled/index.js";
 import { useTranslationContext } from "../context/translation.js";
 import { useAsyncAsHook } from "../hooks/useAsyncAsHook.js";
 import { Button } from "../mui/Button.js";
 import { Pages } from "../NavigationBar.js";
 import * as wxApi from "../wxApi.js";
+import { wxClient } from "../wxApi.js";
+import { useEffect, useState } from "preact/hooks";
+import { QR } from "../components/QR.js";
 
 interface Props {
   onAddProvider: () => Promise<void>;
 }
 
+export function ShowRecoveryInfo({
+  info,
+  onClose,
+}: {
+  info: string;
+  onClose: () => Promise<void>;
+}): VNode {
+  const [display, setDisplay] = useState(false);
+  const [copied, setCopied] = useState(false);
+  async function copyText(): Promise<void> {
+    navigator.clipboard.writeText(info);
+    setCopied(true);
+  }
+  useEffect(() => {
+    if (copied) {
+      setTimeout(() => {
+        setCopied(false);
+      }, 1000);
+    }
+  }, [copied]);
+  return (
+    <Fragment>
+      <h2>Wallet Recovery</h2>
+      <WarningBox>Do not share this QR or URI with anyone</WarningBox>
+      <section>
+        <p>
+          The qr code can be scanned by another wallet to keep synchronized 
with
+          this wallet.
+        </p>
+        <Button variant="contained" onClick={async () => setDisplay((d) => 
!d)}>
+          {display ? "Hide" : "Show"} QR code
+        </Button>
+        {display && <QR text={JSON.stringify(info)} />}
+      </section>
+
+      <section>
+        <p>You can also use the string version</p>
+        <Button variant="contained" disabled={copied} onClick={copyText}>
+          Copy recovery URI
+        </Button>
+      </section>
+      <footer>
+        <div></div>
+        <div>
+          <Button variant="contained" onClick={onClose}>
+            Close
+          </Button>
+        </div>
+      </footer>
+    </Fragment>
+  );
+}
+
 export function BackupPage({ onAddProvider }: Props): VNode {
   const { i18n } = useTranslationContext();
   const status = useAsyncAsHook(wxApi.getBackupInfo);
+  const [recoveryInfo, setRecoveryInfo] = useState<string>("");
   if (!status) {
     return <Loading />;
   }
@@ -63,6 +126,12 @@ export function BackupPage({ onAddProvider }: Props): VNode 
{
     );
   }
 
+  async function getRecoveryInfo(): Promise<void> {
+    const r = await wxClient.call(WalletApiOperation.ExportBackupRecovery, {});
+    const str = constructRecoveryUri(r);
+    setRecoveryInfo(str);
+  }
+
   const providers = status.response.providers.sort((a, b) => {
     if (
       a.paymentStatus.type === ProviderPaymentType.Paid &&
@@ -75,11 +144,21 @@ export function BackupPage({ onAddProvider }: Props): 
VNode {
     );
   });
 
+  if (recoveryInfo) {
+    return (
+      <ShowRecoveryInfo
+        info={recoveryInfo}
+        onClose={async () => setRecoveryInfo("")}
+      />
+    );
+  }
+
   return (
     <BackupView
       providers={providers}
       onAddProvider={onAddProvider}
       onSyncAll={wxApi.syncAllProviders}
+      onShowInfo={getRecoveryInfo}
     />
   );
 }
@@ -88,12 +167,14 @@ export interface ViewProps {
   providers: ProviderInfo[];
   onAddProvider: () => Promise<void>;
   onSyncAll: () => Promise<void>;
+  onShowInfo: () => Promise<void>;
 }
 
 export function BackupView({
   providers,
   onAddProvider,
   onSyncAll,
+  onShowInfo,
 }: ViewProps): VNode {
   const { i18n } = useTranslationContext();
   return (
@@ -128,7 +209,11 @@ export function BackupView({
       </section>
       {!!providers.length && (
         <footer>
-          <div />
+          <div>
+            <Button variant="contained" onClick={onShowInfo}>
+              Show recovery
+            </Button>
+          </div>
           <div>
             <Button variant="contained" onClick={onSyncAll}>
               {providers.length > 1 ? (
diff --git a/packages/taler-wallet-webextension/src/wallet/ProviderAddPage.tsx 
b/packages/taler-wallet-webextension/src/wallet/ProviderAddPage.tsx
index 37d54eedc..e0bdeec5f 100644
--- a/packages/taler-wallet-webextension/src/wallet/ProviderAddPage.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/ProviderAddPage.tsx
@@ -19,6 +19,7 @@ import {
   BackupBackupProviderTerms,
   canonicalizeBaseUrl,
 } from "@gnu-taler/taler-util";
+import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
 import { Fragment, h, VNode } from "preact";
 import { useEffect, useState } from "preact/hooks";
 import { Checkbox } from "../components/Checkbox.js";
@@ -34,6 +35,7 @@ import { useTranslationContext } from 
"../context/translation.js";
 import { Button } from "../mui/Button.js";
 import { queryToSlashConfig } from "../utils/index.js";
 import * as wxApi from "../wxApi.js";
+import { wxClient } from "../wxApi.js";
 
 interface Props {
   currency: string;
@@ -69,8 +71,12 @@ export function ProviderAddPage({ onBack }: Props): VNode {
         setVerifying(undefined);
       }}
       onConfirm={() => {
-        return wxApi
-          .addBackupProvider(verifying.url, verifying.name)
+        return wxClient
+          .call(WalletApiOperation.AddBackupProvider, {
+            backupProviderBaseUrl: verifying.url,
+            name: verifying.name,
+            activate: true,
+          })
           .then(onBack);
       }}
     />
diff --git a/packages/taler-wallet-webextension/src/wxApi.ts 
b/packages/taler-wallet-webextension/src/wxApi.ts
index 8ec16a698..cb333f1dc 100644
--- a/packages/taler-wallet-webextension/src/wxApi.ts
+++ b/packages/taler-wallet-webextension/src/wxApi.ts
@@ -167,7 +167,7 @@ export class WxWalletCoreApiClient implements 
WalletCoreApiClient {
   }
 }
 
-const wxClient = new WxWalletCoreApiClient();
+export const wxClient = new WxWalletCoreApiClient();
 
 /**
  * Pay for a proposal.
diff --git a/packages/taler-wallet-webextension/src/wxBackend.ts 
b/packages/taler-wallet-webextension/src/wxBackend.ts
index 13cffe747..6f930b788 100644
--- a/packages/taler-wallet-webextension/src/wxBackend.ts
+++ b/packages/taler-wallet-webextension/src/wxBackend.ts
@@ -290,6 +290,11 @@ function parseTalerUriAndRedirect(tabId: number, talerUri: 
string): void {
         tabId,
         `/cta/transfer/pickup?talerPayPushUri=${talerUri}`,
       );
+    case TalerUriType.TalerRecovery:
+      return platform.redirectTabToWalletPage(
+        tabId,
+        `/cta/transfer/recovery?talerBackupUri=${talerUri}`,
+      );
     case TalerUriType.TalerNotifyReserve:
       // FIXME:  Is this still useful?
       // handleNotifyReserve(w);

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]