update open api

This commit is contained in:
Gianmarco Pettinato 2021-09-26 20:30:50 +02:00
parent f551ff3084
commit 7e9057669b
2 changed files with 15 additions and 103 deletions

View File

@ -51,86 +51,6 @@
"dob": "1973-06-22" "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": { "Valid-response": {
"description": "", "description": "",
"type": "object", "type": "object",
"x-examples": { "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"
}
}
},
"properties": { "properties": {
"signature": { "signature": {
"type": "object", "type": "object",
@ -189,7 +90,17 @@
}, },
"message": { "message": {
"type": "string", "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": { "dob": {
"type": "string", "type": "string",
"minLength": 1 "minLength": 1,
"format": "date"
} }
} }
} }

View File

@ -38,7 +38,7 @@ export default class Verifier {
} }
async checkCertificate(certificate:string): Promise<certificateResponse>{ async checkCertificate(certificate:string): Promise<certificateResponse>{
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 { try {
const dcc = await DCC.fromRaw(certificate); const dcc = await DCC.fromRaw(certificate);
const signatureValidity = (await this.checkKey(dcc)).valid; const signatureValidity = (await this.checkKey(dcc)).valid;