/* eslint-disable @typescript-eslint/camelcase */ import { encodeCrock, stringToBytes } from "@gnu-taler/taler-util"; import { h, VNode } from "preact"; import { useState, useRef, useLayoutEffect } from "preact/hooks"; import { AuthMethodSetupProps } from "./AuthenticationEditorScreen"; import { AnastasisClientFrame } from "./index"; export function AuthMethodSmsSetup(props: AuthMethodSetupProps): VNode { const [mobileNumber, setMobileNumber] = useState(""); const addSmsAuth = (): void => { props.addAuthMethod({ authentication_method: { type: "sms", instructions: `SMS to ${mobileNumber}`, challenge: encodeCrock(stringToBytes(mobileNumber)), }, }); }; const inputRef = useRef(null); useLayoutEffect(() => { inputRef.current?.focus(); }, []); return (

For SMS authentication, you need to provide a mobile number. When recovering your secret, you will be asked to enter the code you receive via SMS.

); }