import { canonicalJson, encodeCrock, stringToBytes, } from "@gnu-taler/taler-util"; import { h, VNode } from "preact"; import { useState } from "preact/hooks"; import { AuthMethodSetupProps } from "."; import { TextInput } from "../../../components/fields/TextInput"; import { AnastasisClientFrame } from "../index"; export function AuthMethodIbanSetup({ addAuthMethod, cancel, configured, }: AuthMethodSetupProps): VNode { const [name, setName] = useState(""); const [account, setAccount] = useState(""); const addIbanAuth = (): void => addAuthMethod({ authentication_method: { type: "iban", instructions: `Wire transfer from ${account} with holder ${name}`, challenge: encodeCrock( stringToBytes( canonicalJson({ name, account, }), ), ), }, }); const errors = !name ? "Add an account name" : !account ? "Add an account IBAN number" : undefined; return (

For bank transfer authentication, you need to provide a bank account (account holder name and IBAN). When recovering your secret, you will be asked to pay the recovery fee via bank transfer from the account you provided here.

{configured.length > 0 && (
Your bank accounts:
{configured.map((c, i) => { return (

{c.instructions}

); })}
)}
); }