diff --git a/package.json b/package.json index 1b74184..547959a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@rittaschool/shared", - "version": "0.0.26", + "version": "0.0.27", "main": "./lib/index.cjs.js", "module": "./lib/index.esm.js", "types": "./lib/index.d.ts", diff --git a/src/classes/Challenge.ts b/src/classes/Challenge.ts index bfd950a..03a0dd1 100644 --- a/src/classes/Challenge.ts +++ b/src/classes/Challenge.ts @@ -3,14 +3,16 @@ import { randomUUID } from "crypto"; export interface Challenge { id: string; type: IChallengeType; - data?: - | IPasswordChallengeData - | IOtpChallengeData - | IFido2ChallengeData - | null; + data?: ChallengeData | null; userId: string; } +export interface ChallengeData { + passwordData?: IPasswordChallengeData | null; + otpData?: IOtpChallengeData | null; + fido2Data?: IFido2ChallengeData | null; +} + export const generateChallenge = ( type: IChallengeType, userId: string @@ -25,12 +27,16 @@ export const generateChallenge = ( switch (type) { case IChallengeType.PASSWORD_NEEDED: challenge.data = { - password: "", + passwordData: { + password: "", + }, }; break; case IChallengeType.OTP_NEEDED: challenge.data = { - otp: "", + otpData: { + otp: "", + }, }; break; case IChallengeType.FIDO2_NEEDED: