mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
add more logs
This commit is contained in:
parent
f04d156e5c
commit
c8c91ebf4e
@ -1,6 +1,7 @@
|
||||
import { SignJWT, jwtVerify } from 'jose'
|
||||
|
||||
import { LogError } from '@/server/LogError'
|
||||
import { backendLogger as logger } from '@/server/logger'
|
||||
|
||||
import { JwtPayloadType } from './payloadtypes/JwtPayloadType'
|
||||
|
||||
@ -13,6 +14,7 @@ export const decode = async (token: string, signkey: Buffer): Promise<JwtPayload
|
||||
issuer: 'urn:gradido:issuer',
|
||||
audience: 'urn:gradido:audience',
|
||||
})
|
||||
logger.debug('JWT.decode after jwtVerify... payload=', payload)
|
||||
return payload as unknown as JwtPayloadType
|
||||
} catch (err) {
|
||||
return null
|
||||
|
||||
@ -162,6 +162,10 @@ export class TransactionLinkResolver {
|
||||
}
|
||||
// normal redeem code
|
||||
if (txLinkFound) {
|
||||
logger.debug(
|
||||
'TransactionLinkResolver.queryTransactionLink... normal redeem code found=',
|
||||
txLinkFound,
|
||||
)
|
||||
const user = await DbUser.findOneOrFail({ where: { id: dbTransactionLink.userId } })
|
||||
let redeemedBy
|
||||
if (dbTransactionLink.redeemedBy) {
|
||||
@ -173,9 +177,13 @@ export class TransactionLinkResolver {
|
||||
return new TransactionLink(dbTransactionLink, new User(user), redeemedBy, communities)
|
||||
} else {
|
||||
// disbursement jwt-token
|
||||
logger.debug(
|
||||
'TransactionLinkResolver.queryTransactionLink... disbursement jwt-token found=',
|
||||
)
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-assignment
|
||||
const homeCom = await getHomeCommunity()
|
||||
const jwtPayload = await decode(code, homeCom.publicKey)
|
||||
logger.debug('TransactionLinkResolver.queryTransactionLink... jwtPayload=', jwtPayload)
|
||||
if (jwtPayload !== null && jwtPayload instanceof DisbursementJwtPayloadType) {
|
||||
const disburseJwtPayload: DisbursementJwtPayloadType = jwtPayload
|
||||
transactionLink.communityName = homeCom.name !== null ? homeCom.name : 'unknown'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user