From 30f51e0a9fd6d818f20f440ccbce5cbfe9e7b530 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodolphe=20Br=C3=A9ard?= Date: Tue, 25 Jul 2023 18:50:04 +0200 Subject: [PATCH] Implement the getName method for the KeyedAddress object --- pwa/app.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pwa/app.js b/pwa/app.js index 9cea1cd..5e41475 100644 --- a/pwa/app.js +++ b/pwa/app.js @@ -22,6 +22,10 @@ class KeyedAddress { this.key = base64_decode(key_b64); } + getName() { + return `${this.local_part}@${this.domain}`; + } + genSubAddr(sub_addr_name) { var hasher = sha256.hmac.create(this.key); hasher.update(this.local_part); @@ -38,6 +42,7 @@ class KeyedAddress { ['a', 'b'].forEach((e) => { const test_addr = new KeyedAddress(e, '+', 'example.org', '11voiefK5PgCX5F1TTcuoQ=='); console.log(test_addr); + console.log('Account name: ' + test_addr.getName()); console.log('Sub-addr: ' + test_addr.genSubAddr('test')); });