diff options
author | Florian Dold <florian@dold.me> | 2022-10-14 22:47:11 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2022-10-14 22:47:11 +0200 |
commit | 0c8e56c32457ea9b9229a8a3607fcf8e7618bc17 (patch) | |
tree | d0b4bbe4e199d62426e722b803fdfa178cd6f3a0 /packages/taler-wallet-core/src/operations/common.ts | |
parent | eec6695be0409669fcad36c6cc7ea01f48d41c97 (diff) | |
download | wallet-core-0c8e56c32457ea9b9229a8a3607fcf8e7618bc17.tar.xz |
wallet-core: properly separate different types of IDs
Diffstat (limited to 'packages/taler-wallet-core/src/operations/common.ts')
-rw-r--r-- | packages/taler-wallet-core/src/operations/common.ts | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/packages/taler-wallet-core/src/operations/common.ts b/packages/taler-wallet-core/src/operations/common.ts index d69bc09f8..d17530c7f 100644 --- a/packages/taler-wallet-core/src/operations/common.ts +++ b/packages/taler-wallet-core/src/operations/common.ts @@ -25,6 +25,7 @@ import { RefreshReason, TalerErrorCode, TalerErrorDetail, + TombstoneIdStr, TransactionIdStr, TransactionType, } from "@gnu-taler/taler-util"; @@ -280,9 +281,19 @@ export enum TombstoneTag { /** * Create an event ID from the type and the primary key for the event. */ -export function makeEventId( - type: TransactionType | TombstoneTag, +export function makeTransactionId( + type: TransactionType, ...args: string[] -): string { - return type + ":" + args.map((x) => encodeURIComponent(x)).join(":"); +): TransactionIdStr { + return `txn:${type}:${args.map((x) => encodeURIComponent(x)).join(":")}`; +} + +/** + * Create an event ID from the type and the primary key for the event. + */ +export function makeTombstoneId( + type: TombstoneTag, + ...args: string[] +): TombstoneIdStr { + return `tmb:${type}:${args.map((x) => encodeURIComponent(x)).join(":")}`; } |