2021-10-19 15:56:52 +02:00
|
|
|
import {
|
|
|
|
bytesToString,
|
|
|
|
decodeCrock
|
|
|
|
} from "@gnu-taler/taler-util";
|
|
|
|
import { h, VNode } from "preact";
|
2021-10-22 06:31:46 +02:00
|
|
|
import { useAnastasisContext } from "../../context/anastasis";
|
|
|
|
import { AnastasisClientFrame } from "./index";
|
2021-10-19 15:56:52 +02:00
|
|
|
|
2021-10-22 06:31:46 +02:00
|
|
|
export function RecoveryFinishedScreen(): VNode {
|
|
|
|
const reducer = useAnastasisContext()
|
|
|
|
|
|
|
|
if (!reducer) {
|
|
|
|
return <div>no reducer in context</div>
|
|
|
|
}
|
|
|
|
if (!reducer.currentReducerState || reducer.currentReducerState.recovery_state === undefined) {
|
|
|
|
return <div>invalid state</div>
|
|
|
|
}
|
|
|
|
const encodedSecret = reducer.currentReducerState.core_secret?.value
|
|
|
|
if (!encodedSecret) {
|
2021-11-01 20:10:49 +01:00
|
|
|
return <AnastasisClientFrame title="Recovery Problem" hideNav>
|
2021-10-22 06:31:46 +02:00
|
|
|
<p>
|
|
|
|
Secret not found
|
|
|
|
</p>
|
|
|
|
</AnastasisClientFrame>
|
|
|
|
}
|
|
|
|
const secret = bytesToString(decodeCrock(encodedSecret))
|
2021-10-19 15:56:52 +02:00
|
|
|
return (
|
2021-11-01 20:10:49 +01:00
|
|
|
<AnastasisClientFrame title="Recovery Finished" hideNav>
|
2021-10-19 15:56:52 +02:00
|
|
|
<p>
|
2021-10-22 06:31:46 +02:00
|
|
|
Secret: {secret}
|
2021-10-19 15:56:52 +02:00
|
|
|
</p>
|
|
|
|
</AnastasisClientFrame>
|
|
|
|
);
|
|
|
|
}
|