taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit eaf59d5422321a470154f8cb2303f43dba4f3636
parent caf9765bcdaa8b1aae122c7467549f80055a1270
Author: Sebastian <sebasjm@taler-systems.com>
Date:   Wed, 22 Jul 2026 15:41:57 -0300

use duration spec

Diffstat:
Mpackages/anastasis-webui/src/pages/home/BackupFinishedScreen.stories.tsx | 14++++++++------
Mpackages/anastasis-webui/src/pages/home/SecretEditorScreen.tsx | 18++++++++++++++----
2 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/packages/anastasis-webui/src/pages/home/BackupFinishedScreen.stories.tsx b/packages/anastasis-webui/src/pages/home/BackupFinishedScreen.stories.tsx @@ -23,6 +23,7 @@ import { ReducerState } from "@gnu-taler/anastasis-core"; import { reducerStatesExample } from "../../utils/index.js"; import { BackupFinishedScreen as TestedComponent } from "./BackupFinishedScreen.js"; import * as tests from "@gnu-taler/web-util/testing"; +import { AbsoluteTime, Duration, TalerProtocolTimestamp } from "@gnu-taler/taler-util"; export default { title: "Backup finish", @@ -52,15 +53,16 @@ export const WithDetails = tests.createExample(TestedComponent, {}, { secret_name: "super_secret", success_details: { "https://anastasis.demo.taler.net/": { - policy_expiration: { - t_s: "never", - }, + policy_expiration: TalerProtocolTimestamp.never(), policy_version: 0, }, "https://kudos.demo.anastasis.lu/": { - policy_expiration: { - t_s: new Date().getTime() + 60 * 60 * 24, - }, + policy_expiration: AbsoluteTime.toProtocolTimestamp( + AbsoluteTime.addDuration( + AbsoluteTime.now(), + Duration.fromSpec({ days: 1 }), + ), + ), policy_version: 1, }, }, diff --git a/packages/anastasis-webui/src/pages/home/SecretEditorScreen.tsx b/packages/anastasis-webui/src/pages/home/SecretEditorScreen.tsx @@ -13,7 +13,13 @@ You should have received a copy of the GNU Affero General Public License along with GNU Anastasis; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ -import { encodeCrock, stringToBytes } from "@gnu-taler/taler-util"; +import { + AbsoluteTime, + Duration, + encodeCrock, + stringToBytes, + TalerProtocolTimestamp, +} from "@gnu-taler/taler-util"; import { h, VNode } from "preact"; import { useState } from "preact/hooks"; import { @@ -64,11 +70,15 @@ export function SecretEditorScreen(): VNode { await tx.transition("enter_secret_name", { name: secretName, }); + await tx.transition("enter_secret", { secret, - expiration: { - t_s: new Date().getTime() + 60 * 60 * 24 * 365 * 5, - }, + expiration: AbsoluteTime.toProtocolTimestamp( + AbsoluteTime.addDuration( + AbsoluteTime.now(), + Duration.fromSpec({ years: 5 }), + ), + ), }); await tx.transition("next", {}); });