mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
change publicKey logging
This commit is contained in:
parent
29c104002d
commit
45c473aeec
@ -6,7 +6,7 @@ import { CONFIG } from '@/config'
|
||||
// eslint-disable-next-line camelcase
|
||||
import { AuthenticationClient as V1_0_AuthenticationClient } from '@/federation/client/1_0/AuthenticationClient'
|
||||
import { backendLogger as logger } from '@/server/logger'
|
||||
|
||||
import { stringToHex } from '@/util/utilities'
|
||||
|
||||
import { OpenConnectionArgs } from './client/1_0/model/OpenConnectionArgs'
|
||||
import { AuthenticationClientFactory } from './client/AuthenticationClientFactory'
|
||||
@ -23,7 +23,7 @@ export async function startCommunityAuthentication(
|
||||
logger.debug(
|
||||
'Authentication: started for foreignFedCom:',
|
||||
foreignFedCom.endPoint,
|
||||
foreignFedCom.publicKey.toString('hex'),
|
||||
stringToHex(foreignFedCom.publicKey.toString()),
|
||||
)
|
||||
// check if communityUuid is a valid v4Uuid and not still a temporary onetimecode
|
||||
if (
|
||||
|
||||
@ -2,6 +2,7 @@ import { FederatedCommunity as DbFederatedCommunity } from '@entity/FederatedCom
|
||||
import { GraphQLClient } from 'graphql-request'
|
||||
|
||||
import { backendLogger as logger } from '@/server/logger'
|
||||
import { stringToHex } from '@/util/utilities'
|
||||
|
||||
import { OpenConnectionArgs } from './model/OpenConnectionArgs'
|
||||
import { openConnection } from './query/openConnection'
|
||||
@ -29,7 +30,7 @@ export class AuthenticationClient {
|
||||
logger.debug(
|
||||
`Authentication: openConnection at ${this.endpoint} for args:`,
|
||||
args.url,
|
||||
Buffer.from(args.publicKey, 'hex').toString(),
|
||||
stringToHex(args.publicKey),
|
||||
)
|
||||
try {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
|
||||
@ -15,3 +15,10 @@ export const decimalSeparatorByLanguage = (a: Decimal, language: string): string
|
||||
|
||||
export const fullName = (firstName: string, lastName: string): string =>
|
||||
[firstName, lastName].filter(Boolean).join(' ')
|
||||
|
||||
export function stringToHex(str: string): string {
|
||||
return str
|
||||
.split('')
|
||||
.map((char) => char.charCodeAt(0).toString(16).padStart(2, '0'))
|
||||
.join('')
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ import { startAuthentication, startOpenConnectionCallback } from '../util/authen
|
||||
import { OpenConnectionCallbackArgs } from '../model/OpenConnectionCallbackArgs'
|
||||
import { CONFIG } from '@/config'
|
||||
import { AuthenticationArgs } from '../model/AuthenticationArgs'
|
||||
import { stringToHex } from '@/util/utilities'
|
||||
|
||||
@Resolver()
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
@ -21,7 +22,7 @@ export class AuthenticationResolver {
|
||||
logger.debug(
|
||||
`Authentication: openConnection() via apiVersion=1_0 ...`,
|
||||
args.url,
|
||||
Buffer.from(args.publicKey, 'hex').toString(),
|
||||
stringToHex(args.publicKey),
|
||||
)
|
||||
|
||||
// first find with args.publicKey the community, which starts openConnection request
|
||||
@ -29,10 +30,7 @@ export class AuthenticationResolver {
|
||||
publicKey: Buffer.from(args.publicKey),
|
||||
})
|
||||
if (!requestedCom) {
|
||||
throw new LogError(
|
||||
`unknown requesting community with publicKey`,
|
||||
Buffer.from(args.publicKey, 'hex').toString(),
|
||||
)
|
||||
throw new LogError(`unknown requesting community with publicKey`, stringToHex(args.publicKey))
|
||||
}
|
||||
logger.debug(`Authentication: found requestedCom:`, requestedCom)
|
||||
// no await to respond immediatly and invoke callback-request asynchron
|
||||
|
||||
@ -9,6 +9,7 @@ import { AuthenticationClientFactory } from '@/client/AuthenticationClientFactor
|
||||
// eslint-disable-next-line camelcase
|
||||
import { AuthenticationClient as V1_0_AuthenticationClient } from '@/client/1_0/AuthenticationClient'
|
||||
import { AuthenticationArgs } from '../model/AuthenticationArgs'
|
||||
import { stringToHex } from '@/util/utilities'
|
||||
|
||||
export async function startOpenConnectionCallback(
|
||||
args: OpenConnectionArgs,
|
||||
@ -18,7 +19,7 @@ export async function startOpenConnectionCallback(
|
||||
logger.debug(
|
||||
`Authentication: startOpenConnectionCallback() with:`,
|
||||
args.url,
|
||||
Buffer.from(args.publicKey, 'hex').toString(),
|
||||
stringToHex(args.publicKey),
|
||||
requestedCom,
|
||||
)
|
||||
try {
|
||||
|
||||
6
federation/src/util/utilities.ts
Normal file
6
federation/src/util/utilities.ts
Normal file
@ -0,0 +1,6 @@
|
||||
export function stringToHex(str: string): string {
|
||||
return str
|
||||
.split('')
|
||||
.map((char) => char.charCodeAt(0).toString(16).padStart(2, '0'))
|
||||
.join('')
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user