mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Changed the decode of context.pubKey so that it is stored in a buffer and transformed after in a Hex string.
This commit is contained in:
parent
74cc9522c2
commit
a16b7ad47a
@ -18,7 +18,8 @@ export class BalanceResolver {
|
||||
const balanceRepository = getCustomRepository(BalanceRepository)
|
||||
const userRepository = getCustomRepository(UserRepository)
|
||||
|
||||
const userEntity = await userRepository.findByPubkeyHex(context.pubKey)
|
||||
const pubKeyString = Buffer.from(context.pubKey).toString('hex')
|
||||
const userEntity = await userRepository.findByPubkeyHex(pubKeyString)
|
||||
const balanceEntity = await balanceRepository.findByUser(userEntity.id)
|
||||
const now = new Date()
|
||||
|
||||
|
||||
@ -22,7 +22,8 @@ export class GdtResolver {
|
||||
): Promise<GdtEntryList> {
|
||||
// load user
|
||||
const userRepository = getCustomRepository(UserRepository)
|
||||
const userEntity = await userRepository.findByPubkeyHex(context.pubKey)
|
||||
const pubKeyString = Buffer.from(context.pubKey).toString('hex')
|
||||
const userEntity = await userRepository.findByPubkeyHex(pubKeyString)
|
||||
|
||||
const resultGDT = await apiGet(
|
||||
`${CONFIG.GDT_API_URL}/GdtEntries/listPerEmailApi/${userEntity.email}/${currentPage}/${pageSize}/${order}`,
|
||||
|
||||
@ -496,7 +496,8 @@ export class TransactionResolver {
|
||||
): Promise<TransactionList> {
|
||||
// load user
|
||||
const userRepository = getCustomRepository(UserRepository)
|
||||
const userEntity = await userRepository.findByPubkeyHex(context.pubKey)
|
||||
const pubKeyString = Buffer.from(context.pubKey).toString('hex')
|
||||
const userEntity = await userRepository.findByPubkeyHex(pubKeyString)
|
||||
|
||||
const transactions = await listTransactions(currentPage, pageSize, order, userEntity)
|
||||
|
||||
@ -531,7 +532,8 @@ export class TransactionResolver {
|
||||
// TODO this is subject to replay attacks
|
||||
// validate sender user (logged in)
|
||||
const userRepository = getCustomRepository(UserRepository)
|
||||
const senderUser = await userRepository.findByPubkeyHex(context.pubKey)
|
||||
const pubKeyString = Buffer.from(context.pubKey).toString('hex')
|
||||
const senderUser = await userRepository.findByPubkeyHex(pubKeyString)
|
||||
if (senderUser.pubkey.length !== 32) {
|
||||
throw new Error('invalid sender public key')
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user