From 23e70c5f1c42e9a9f4b2413adf2409a8c09ba60d Mon Sep 17 00:00:00 2001
From: clauspeterhuebner
Date: Wed, 6 Aug 2025 16:42:19 +0200
Subject: [PATCH] only for save current work
---
backend/src/graphql/resolver/TransactionLinkResolver.ts | 9 ++++++---
shared/src/jwt/payloadtypes/DisburseJwtPayloadType.ts | 5 ++---
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/backend/src/graphql/resolver/TransactionLinkResolver.ts b/backend/src/graphql/resolver/TransactionLinkResolver.ts
index 32464cc82..65c2d5df6 100644
--- a/backend/src/graphql/resolver/TransactionLinkResolver.ts
+++ b/backend/src/graphql/resolver/TransactionLinkResolver.ts
@@ -39,7 +39,7 @@ import { TRANSACTIONS_LOCK } from '@/util/TRANSACTIONS_LOCK'
import { TRANSACTION_LINK_LOCK } from '@/util/TRANSACTION_LINK_LOCK'
import { fullName } from '@/util/utilities'
import { calculateBalance } from '@/util/validate'
-import { calculateDecay, decode, DisburseJwtPayloadType, encode, RedeemJwtPayloadType, verify } from 'shared'
+import { calculateDecay, decode, DisburseJwtPayloadType, encode, encryptAndSign, RedeemJwtPayloadType, verify } from 'shared'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { getLogger, Logger } from 'log4js'
@@ -655,6 +655,7 @@ export class TransactionLinkResolver {
}
async createDisburseJwt(
+ handshakeId: string,
senderCommunityUuid: string,
senderGradidoId: string,
recipientCommunityUuid: string,
@@ -670,6 +671,7 @@ export class TransactionLinkResolver {
const logger = createLogger()
logger.addContext('code', code.substring(0, 6))
logger.debug('TransactionLinkResolver.createDisburseJwt... args=', {
+ handshakeId,
senderCommunityUuid,
senderGradidoId,
recipientCommunityUuid,
@@ -683,7 +685,8 @@ export class TransactionLinkResolver {
recipientAlias,
})
- const disburseJwtPayloadType = new DisburseJwtPayloadType(
+ const disburseJwtPayload = new DisburseJwtPayloadType(
+ handshakeId,
senderCommunityUuid,
senderGradidoId,
recipientCommunityUuid,
@@ -696,8 +699,8 @@ export class TransactionLinkResolver {
validUntil,
recipientAlias,
)
+ const disburseJwt = await encryptAndSign(disburseJwtPayload, homeComB.privateJwtKey!, authCom.publicJwtKey!)
// TODO:encode/sign the jwt normally with the private key of the recipient community, but interims with uuid
- const disburseJwt = await encode(disburseJwtPayloadType, recipientCommunityUuid)
logger.debug('TransactionLinkResolver.createDisburseJwt... disburseJwt=', disburseJwt)
// TODO: encrypt the payload with the public key of the target/sender community
return disburseJwt
diff --git a/shared/src/jwt/payloadtypes/DisburseJwtPayloadType.ts b/shared/src/jwt/payloadtypes/DisburseJwtPayloadType.ts
index 2940161df..426e3f58a 100644
--- a/shared/src/jwt/payloadtypes/DisburseJwtPayloadType.ts
+++ b/shared/src/jwt/payloadtypes/DisburseJwtPayloadType.ts
@@ -17,6 +17,7 @@ export class DisburseJwtPayloadType extends JwtPayloadType {
recipientalias: string
constructor(
+ handshakeID: string,
senderCommunityUuid: string,
senderGradidoId: string,
recipientCommunityUuid: string,
@@ -29,9 +30,7 @@ export class DisburseJwtPayloadType extends JwtPayloadType {
validUntil: string,
recipientAlias: string,
) {
- // eslint-disable-next-line @typescript-eslint/no-unsafe-call
- super('handshakeID')
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
+ super(handshakeID)
this.tokentype = DisburseJwtPayloadType.DISBURSE_ACTIVATION_TYPE
this.sendercommunityuuid = senderCommunityUuid
this.sendergradidoid = senderGradidoId