mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
fix federation authentication
This commit is contained in:
parent
097fcd7103
commit
7b0e7f05b6
@ -109,7 +109,7 @@ export class AuthenticationResolver {
|
||||
}
|
||||
}
|
||||
|
||||
@Mutation(() => String)
|
||||
@Mutation(() => String, { nullable: true })
|
||||
async authenticate(
|
||||
@Arg('data')
|
||||
args: EncryptedTransferArgs,
|
||||
@ -125,7 +125,7 @@ export class AuthenticationResolver {
|
||||
// no infos to the caller
|
||||
return null
|
||||
}
|
||||
if (!uint32Schema.safeParse(authArgs.oneTimeCode).success) {
|
||||
if (!uint32Schema.safeParse(Number(authArgs.oneTimeCode)).success) {
|
||||
const errmsg = `invalid oneTimeCode: ${authArgs.oneTimeCode} for community with publicKey ${authArgs.publicKey}, expect uint32`
|
||||
methodLogger.error(errmsg)
|
||||
// no infos to the caller
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from 'bun:test'
|
||||
import { uuidv4Schema } from './base.schema'
|
||||
import { uuidv4Schema, uint32Schema } from './base.schema'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
|
||||
describe('uuidv4 schema', () => {
|
||||
@ -10,3 +10,15 @@ describe('uuidv4 schema', () => {
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
describe('uint32 schema', () => {
|
||||
it('should validate uint32 (40x)', () => {
|
||||
for (let i = 0; i < 40; i++) {
|
||||
const uint32 = Math.floor(Math.random() * 4294967295)
|
||||
expect(uint32Schema.safeParse(uint32).success).toBeTruthy()
|
||||
}
|
||||
})
|
||||
it('should validate 2092352810', () => {
|
||||
expect(uint32Schema.safeParse(2092352810).success).toBeTruthy()
|
||||
})
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user