From 7e9057669b9b996d518092f9b723b81eaf7e8d51 Mon Sep 17 00:00:00 2001 From: Gianmarco Pettinato Date: Sun, 26 Sep 2021 20:30:50 +0200 Subject: [PATCH] update open api --- apigreen.json | 116 ++++----------------------- src/Services/dgcVerifier/Verifier.ts | 2 +- 2 files changed, 15 insertions(+), 103 deletions(-) diff --git a/apigreen.json b/apigreen.json index ac169e0..c6d0f17 100644 --- a/apigreen.json +++ b/apigreen.json @@ -51,86 +51,6 @@ "dob": "1973-06-22" } } - }, - "expired certificate": { - "value": { - "signature": { - "valid": true - }, - "valid": { - "valid": false, - "message": "Certificate is not valid" - }, - "info": { - "identity": { - "fnt": "ROSSI", - "fn": "ROSSI", - "gnt": "MARIO", - "gn": "MARIO" - }, - "dob": "1973-06-22" - } - } - }, - "Certificate not yet valid": { - "value": { - "signature": { - "valid": true - }, - "valid": { - "valid": false, - "message": "Certificate is not valid yet" - }, - "info": { - "identity": { - "fnt": "ROSSI", - "fn": "ROSSI", - "gnt": "MARIO", - "gn": "MARIO" - }, - "dob": "1973-06-22" - } - } - }, - "Invalid signature": { - "value": { - "signature": { - "valid": false - }, - "valid": { - "valid": false, - "message": "Certificate is not valid yet" - }, - "info": { - "identity": { - "fnt": "ROSSI", - "fn": "ROSSI", - "gnt": "MARIO", - "gn": "MARIO" - }, - "dob": "1973-06-22" - } - } - }, - "Invalid certificate": { - "value": { - "signature": { - "valid": false - }, - "valid": { - "valid": false, - "message": "" - }, - "info": { - "identity": { - "fnt": "", - "fn": "", - "gnt": "", - "gn": "" - }, - "dob": "" - } - } } } } @@ -145,26 +65,7 @@ "Valid-response": { "description": "", "type": "object", - "x-examples": { - "example-1": { - "signature": { - "valid": true - }, - "valid": { - "valid": true, - "message": "Certificate is valid" - }, - "info": { - "identity": { - "fnt": "ROSSI", - "fn": "ROSSI", - "gnt": "MARIO", - "gn": "MARIO" - }, - "dob": "1973-06-22" - } - } - }, + "x-examples": {}, "properties": { "signature": { "type": "object", @@ -189,7 +90,17 @@ }, "message": { "type": "string", - "minLength": 1 + "enum": [ + "Certificate is valid", + "The test detected the virus", + "Invaild set of rules check with operator", + "Certificate is not valid", + "The test detected the virus", + "unknown test type", + "Certificate is not valid yet", + "nd" + ], + "example": null } } }, @@ -229,7 +140,8 @@ }, "dob": { "type": "string", - "minLength": 1 + "minLength": 1, + "format": "date" } } } diff --git a/src/Services/dgcVerifier/Verifier.ts b/src/Services/dgcVerifier/Verifier.ts index 60a2ddf..48aa2fc 100644 --- a/src/Services/dgcVerifier/Verifier.ts +++ b/src/Services/dgcVerifier/Verifier.ts @@ -38,7 +38,7 @@ export default class Verifier { } async checkCertificate(certificate:string): Promise{ - let result:certificateResponse = {signature:{valid: false}, valid:{valid:false, message:''}, info:{identity:{fnt:'',fn:'',gnt:'',gn:''},dob:''}}; + let result:certificateResponse = {signature:{valid: false}, valid:{valid:false, message:'nd'}, info:{identity:{fnt:'nd',fn:'nd',gnt:'nd',gn:''nd},dob:'nd'}}; try { const dcc = await DCC.fromRaw(certificate); const signatureValidity = (await this.checkKey(dcc)).valid;