From 6d460b6de57ec138ebbcffb7de4efff99b9b2c03 Mon Sep 17 00:00:00 2001 From: Arendor Date: Sun, 5 May 2024 14:26:20 +0200 Subject: [PATCH 1/3] Add support for A2F + update packages --- package.json | 2 +- v3/routes.ts | 27 ++++++++++++++++++++++----- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index af05544..b458aff 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ecoledirecte-api-types", - "version": "0.14.0", + "version": "0.14.1", "description": "", "main": "default/index.js", "repository": { diff --git a/v3/routes.ts b/v3/routes.ts index 44a977b..069d787 100644 --- a/v3/routes.ts +++ b/v3/routes.ts @@ -22,25 +22,42 @@ export const Routes = { return "/v3/login.awp"; }, + /** + * Route for: + * - POST /v3/connexion/doubleauth.awp?verbe=get&v=4.56.0 + */ + getA2FQCM(): string { + return "/v3/connexion/doubleauth.awp?verbe=get&v=4.56.0" + }, + + /** + * Route for: + * - POST v3/connexion/doubleauth.awp?verbe=post&v=4.56.0 + */ + postA2FRes(): string { + return "v3/connexion/doubleauth.awp?verbe=post&v=4.56.0" + }, + + //! TEACHER /** * Use with `root2`! * * Route for: - * - POST *p/v3/niveauxListe.awp?verbe=get&v=4.14.7 + * - POST *p/v3/niveauxListe.awp?verbe=get&v=4.56.0 */ teacherSchools(): string { - return "/v3/niveauxListe.awp?verbe=get&v=4.14.7"; + return "/v3/niveauxListe.awp?verbe=get&v=4.56.0"; }, /** * Use with `root2`! * * Route for: - * - POST *p/v3/classes/{classId}/eleves.awp?verbe=get&v=4.14.7 + * - POST *p/v3/classes/{classId}/eleves.awp?verbe=get&v=4.56.0 */ teacherStudents(classId: number): string { - return `/v3/classes/${classId}/eleves.awp?verbe=get&v=4.14.7`; + return `/v3/classes/${classId}/eleves.awp?verbe=get&v=4.56.0`; }, //! STUDENT @@ -209,7 +226,7 @@ export const Routes = { * - POST /v3/comptes/detail.awp */ studentWallets(): string { - return "/v3/comptes/detail.awp?verbe=get&v=4.14.3"; + return "/v3/comptes/detail.awp?verbe=get&v=4.56.0"; }, /** From 46df8008cd060de84255eeb87658aa8a40966200 Mon Sep 17 00:00:00 2001 From: Arendor Date: Sun, 5 May 2024 15:04:54 +0200 Subject: [PATCH 2/3] Add A2F types responses --- v3/responses/login/index.ts | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/v3/responses/login/index.ts b/v3/responses/login/index.ts index 9eca419..c16da3b 100644 --- a/v3/responses/login/index.ts +++ b/v3/responses/login/index.ts @@ -3,7 +3,35 @@ import { account } from "./accounts"; export * from "./accounts"; -export type loginRes = loginResSuccess | failureRes; +export type base64 = string +export type loginRes = loginResSuccess | failureRes | A2FRes + +export type A2FRes = { + code: 250, + token: string, + message: 'Identifiant et/ou mot de passe invalide !', + data: { changementMDP: false, accounts: [] } +} + +export type A2FQCM = { + code: 200, + data: { + question: base64, + propositions: base64[] + }, + message: null, // ??? + host: "HTTP" +} + +export type A2FQCMRes = { + code: 200, + data: { + cn: base64, + cv: base64, + }, + message: null, // ??? + host: "HTTP" +} export type loginResSuccess = { code: 200; From b3a076f234af79374af9b94cdb7381762c4e0699 Mon Sep 17 00:00:00 2001 From: Arendor Date: Sun, 5 May 2024 16:05:18 +0200 Subject: [PATCH 3/3] fix of A2F routes --- v3/responses/login/index.ts | 2 +- v3/routes.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/v3/responses/login/index.ts b/v3/responses/login/index.ts index c16da3b..1712e2c 100644 --- a/v3/responses/login/index.ts +++ b/v3/responses/login/index.ts @@ -17,7 +17,7 @@ export type A2FQCM = { code: 200, data: { question: base64, - propositions: base64[] + propositions: Array }, message: null, // ??? host: "HTTP" diff --git a/v3/routes.ts b/v3/routes.ts index 069d787..2521452 100644 --- a/v3/routes.ts +++ b/v3/routes.ts @@ -35,7 +35,7 @@ export const Routes = { * - POST v3/connexion/doubleauth.awp?verbe=post&v=4.56.0 */ postA2FRes(): string { - return "v3/connexion/doubleauth.awp?verbe=post&v=4.56.0" + return "/v3/connexion/doubleauth.awp?verbe=post&v=4.56.0" },