taler-typescript-core

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

commit 4666bbfcbd2ec98e67d8aa8f2ce69b1237c74251
parent 3c27d407c3f01efb0899e7479c5273c456093a3a
Author: Martin Schanzenbach <schanzen@gnunet.org>
Date:   Tue, 14 Jul 2026 15:41:19 +0200

mailbox: add hAddress to MailboxConfiguration

Diffstat:
Aflake.lock | 60++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aflake.nix | 33+++++++++++++++++++++++++++++++++
Mpackages/taler-util/src/types-taler-wallet.ts | 2++
Mpackages/taler-wallet-core/src/mailbox.ts | 9++++-----
4 files changed, 99 insertions(+), 5 deletions(-)

diff --git a/flake.lock b/flake.lock @@ -0,0 +1,60 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1784030366, + "narHash": "sha256-bNNRHC90SAJC/qVtcU1K387+FsOO6AYWa/YFYjNXxKU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "884303deaa9f3f35ed68fd836d5e461199909c93", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "release-26.05", + "type": "indirect" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix @@ -0,0 +1,33 @@ +{ + description = "Devenv for Taler Typescript stuff"; + + inputs = { + nixpkgs.url = "nixpkgs/release-26.05"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { + inherit system; + }; + + in + { + devShells.default = pkgs.mkShell { + buildInputs = [ + pkgs.jq + pkgs.zip + pkgs.pnpm + pkgs.nodejs + pkgs.python3 + pkgs.typescript-language-server + ]; + + shellHook = '' + ''; + }; + } + ); +} diff --git a/packages/taler-util/src/types-taler-wallet.ts b/packages/taler-util/src/types-taler-wallet.ts @@ -1422,12 +1422,14 @@ export interface MailboxConfiguration { privateKey: EddsaPrivateKeyString; privateEncryptionKey: string; expiration: Timestamp; + hAddress: string; payUri?: TalerUri; } export const codecForMailboxConfiguration = (): Codec<MailboxConfiguration> => buildCodecForObject<MailboxConfiguration>() .property("mailboxBaseUrl", codecForString()) + .property("hAddress", codecForString()) .property("privateEncryptionKey", codecForString()) .property("privateKey", codecForEddsaPrivateKey()) .property("expiration", codecForTimestamp) diff --git a/packages/taler-wallet-core/src/mailbox.ts b/packages/taler-wallet-core/src/mailbox.ts @@ -193,7 +193,8 @@ export async function createNewMailbox( const keys = createEddsaKeyPair(); const hpkeKey = encodeCrock(hpkeCreateSecretKey()); const privKey = encodeCrock(keys.eddsaPriv); - const nowInAYear = AbsoluteTime.addDuration( + const hAddress = encodeCrock(sha512(keys.eddsaPub)); + const nowInAYear = AbsoluteTime.addDuration( AbsoluteTime.now(), Duration.fromSpec({ years: 1, @@ -203,6 +204,7 @@ export async function createNewMailbox( mailboxBaseUrl: mailboxBaseUrl, privateKey: privKey, privateEncryptionKey: hpkeKey, + hAddress: hAddress, expiration: AbsoluteTime.toProtocolTimestamp(nowInAYear), }; @@ -258,9 +260,6 @@ export async function refreshMailbox( mailboxConf.mailboxBaseUrl, wex.http, ); - const privKey = decodeCrock(mailboxConf.privateKey); - const pubKey = eddsaGetPublic(privKey); - const hAddress = encodeCrock(sha512(pubKey)); // Refresh message size var message_size; const resConf = await mailboxClient.getConfig(); @@ -271,7 +270,7 @@ export async function refreshMailbox( default: throw Error("unable to get mailbox service config"); } - const res = await mailboxClient.getMessages({ hMailbox: hAddress }); + const res = await mailboxClient.getMessages({ hMailbox: mailboxConf.hAddress }); switch (res.case) { case "ok": const hpkeSk: Uint8Array = decodeCrock(mailboxConf.privateEncryptionKey);