Skip to content

Commit

Permalink
refactor: handle errors akin to core ml services and update verificat…
Browse files Browse the repository at this point in the history
…ion response (#99)

* chore: bump snippets and handle lint errors

* refactor: change up error handling and handle rejected case

* chore: update int tests

* chore: resolve audit
  • Loading branch information
kleyow authored Feb 23, 2022
1 parent bb5e87d commit c97e75e
Show file tree
Hide file tree
Showing 24 changed files with 673 additions and 432 deletions.
6 changes: 4 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ module.exports = {
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-var-requires': 'error',
'@typescript-eslint/no-empty-interface': 'warn',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'no-console': 'off',
quotes: ['error', 'single'],
'linebreak-style': ['error', 'unix'],
Expand All @@ -38,7 +40,7 @@ module.exports = {
'cucumber/no-arrow-functions': 2,
'import/default': 'warn', // Support legacy modules without default export
'import/extensions': 'off',
'max-len': ["warn", { "code": 120 }],
'max-len': ["off", { "code": 120 }],
},
settings: {
"import/resolver": {
Expand All @@ -62,7 +64,7 @@ module.exports = {
rules: {
'@typescript-eslint/no-var-requires': 'off',
}
},
},
{ // properly handle generated DTO and autofix it
files: [
'src/interface/**/*.ts'
Expand Down
116 changes: 116 additions & 0 deletions audit-resolve.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,122 @@
"decision": "ignore",
"madeAt": 1636084373888,
"expiresAt": 1638676347746
},
"1006904|hapi-swagger>swagger-ui-dist": {
"decision": "fix",
"madeAt": 1645585036388
},
"1004946|@mojaloop/event-sdk>@grpc/proto-loader>yargs>string-width>strip-ansi>ansi-regex": {
"decision": "ignore",
"madeAt": 1645585509117,
"expiresAt": 1648177505123
},
"1004946|@mojaloop/event-sdk>@grpc/proto-loader>yargs>cliui>string-width>strip-ansi>ansi-regex": {
"decision": "ignore",
"madeAt": 1645585509117,
"expiresAt": 1648177505123
},
"1006852|fido2-lib>node-jose>node-forge": {
"decision": "fix",
"madeAt": 1645585193032
},
"1006854|fido2-lib>node-jose>node-forge": {
"decision": "fix",
"madeAt": 1645585193032
},
"1006898|fido2-lib>node-jose>node-forge": {
"decision": "fix",
"madeAt": 1645585193032
},
"1006865|@mojaloop/central-services-shared>axios>follow-redirects": {
"decision": "ignore",
"madeAt": 1645585510312,
"expiresAt": 1648177505123
},
"1006865|axios>follow-redirects": {
"decision": "fix",
"madeAt": 1645585411869
},
"1007026|@mojaloop/central-services-shared>axios>follow-redirects": {
"decision": "ignore",
"madeAt": 1645585510312,
"expiresAt": 1648177505123
},
"1007026|axios>follow-redirects": {
"decision": "fix",
"madeAt": 1645585411869
},
"1006899|openapi-typescript>node-fetch": {
"decision": "fix",
"madeAt": 1645585431603
},
"1006899|@mojaloop/central-services-shared>widdershins>node-fetch": {
"decision": "fix",
"madeAt": 1645585431603
},
"1006899|@mojaloop/event-sdk>grpc>@mapbox/node-pre-gyp>node-fetch": {
"decision": "fix",
"madeAt": 1645585431603
},
"1004854|@mojaloop/central-services-shared>widdershins>openapi-sampler>json-pointer": {
"decision": "ignore",
"madeAt": 1645585478508,
"expiresAt": 1648177016953
},
"1004869|@mojaloop/central-services-shared>widdershins>swagger2openapi>better-ajv-errors>jsonpointer": {
"decision": "ignore",
"madeAt": 1645585479620,
"expiresAt": 1648177016953
},
"1004869|@mojaloop/central-services-shared>widdershins>swagger2openapi>oas-validator>better-ajv-errors>jsonpointer": {
"decision": "ignore",
"madeAt": 1645585479620,
"expiresAt": 1648177016953
},
"1004876|hapi-swagger>swagger-parser>z-schema>validator": {
"decision": "ignore",
"madeAt": 1645585480639,
"expiresAt": 1648177016953
},
"1004946|@mojaloop/central-services-shared>widdershins>yargs>string-width>strip-ansi>ansi-regex": {
"decision": "ignore",
"madeAt": 1645585481655,
"expiresAt": 1648177016953
},
"1004946|@mojaloop/central-services-shared>widdershins>yargs>cliui>string-width>strip-ansi>ansi-regex": {
"decision": "ignore",
"madeAt": 1645585481655,
"expiresAt": 1648177016953
},
"1005383|@mojaloop/central-services-shared>shins>sanitize-html": {
"decision": "ignore",
"madeAt": 1645585482701,
"expiresAt": 1648177016953
},
"1005384|@mojaloop/central-services-shared>shins>sanitize-html": {
"decision": "ignore",
"madeAt": 1645585482701,
"expiresAt": 1648177016953
},
"1005534|@mojaloop/central-services-shared>widdershins>yargs>yargs-parser": {
"decision": "ignore",
"madeAt": 1645585483849,
"expiresAt": 1648177016953
},
"1006846|@mojaloop/central-services-shared>shins>sanitize-html>postcss": {
"decision": "ignore",
"madeAt": 1645585485233,
"expiresAt": 1648177016953
},
"1006886|@mojaloop/central-services-shared>shins>markdown-it": {
"decision": "ignore",
"madeAt": 1645585486383,
"expiresAt": 1648177016953
},
"1007017|@mojaloop/central-services-shared>widdershins>swagger2openapi>oas-validator>ajv": {
"decision": "ignore",
"madeAt": 1645585487352,
"expiresAt": 1648177016953
}
},
"rules": {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ info:
servers:
- url: /
paths:
'/consents/{ID}':
/consents/{ID}:
parameters:
- $ref: '#/components/parameters/ID'
- $ref: '#/components/parameters/Content-Type'
Expand Down Expand Up @@ -182,7 +182,7 @@ paths:
$ref: '#/components/responses/501'
'503':
$ref: '#/components/responses/503'
'/consents/{ID}/error':
/consents/{ID}/error:
parameters:
- $ref: '#/components/parameters/ID'
- $ref: '#/components/parameters/Content-Type'
Expand Down Expand Up @@ -230,7 +230,7 @@ paths:
$ref: '#/components/responses/501'
'503':
$ref: '#/components/responses/503'
'/participants/{Type}/{ID}':
/participants/{Type}/{ID}:
parameters:
- $ref: '#/components/parameters/Type'
- $ref: '#/components/parameters/ID'
Expand Down Expand Up @@ -399,7 +399,7 @@ paths:
$ref: '#/components/responses/501'
'503':
$ref: '#/components/responses/503'
'/thirdpartyRequests/verifications/{ID}':
/thirdpartyRequests/verifications/{ID}:
parameters:
- $ref: '#/components/parameters/ID'
- $ref: '#/components/parameters/Content-Type'
Expand All @@ -417,18 +417,17 @@ paths:
- sampled
operationId: PutThirdpartyRequestsVerificationsById
summary: PutThirdpartyRequestsVerificationsById
description: >
description: >-
The HTTP request `PUT /thirdpartyRequests/verifications/{ID}` is used by
the Auth-Service to inform
the DFSP of a successful result in validating the verification of a
Thirdparty Transaction Request.
the Auth-Service to inform the DFSP of a successful result in validating
the verification of a Thirdparty Transaction Request.
If the validation fails, The Auth-Service MUST use `PUT
/thirdpartyRequests/verifications/{ID}/error`
If the validation fails, the auth-service will send back `PUT
/thirdpartyRequests/verifications/{ID}` with `authenticationResponse:
'REJECTED'`.
instead.
In unplanned error cases the Auth-Service MUST use `PUT
/thirdpartyRequests/verifications/{ID}/error`.
parameters:
- $ref: '#/components/parameters/Content-Length'
requestBody:
Expand Down Expand Up @@ -460,7 +459,7 @@ paths:
$ref: '#/components/responses/501'
'503':
$ref: '#/components/responses/503'
'/thirdpartyRequests/verifications/{ID}/error':
/thirdpartyRequests/verifications/{ID}/error:
parameters:
- $ref: '#/components/parameters/ID'
- $ref: '#/components/parameters/Content-Type'
Expand Down Expand Up @@ -650,7 +649,7 @@ components:
required: true
schema:
type: string
description: 'The type of the party identifier. For example, `MSISDN`, `PERSONAL_ID`.'
description: The type of the party identifier. For example, `MSISDN`, `PERSONAL_ID`.
responses:
'200':
description: OK
Expand Down Expand Up @@ -767,7 +766,7 @@ components:
ErrorCode:
title: ErrorCode
type: string
pattern: '^[1-9]\d{3}$'
pattern: ^[1-9]\d{3}$
description: >-
The API data type ErrorCode is a JSON String of four characters,
consisting of digits only. Negative numbers are not allowed. A leading
Expand Down Expand Up @@ -856,7 +855,7 @@ components:
be Bank Account Number or anything that may expose a User's private bank
account information.
pattern: '^([0-9A-Za-z_~\-\.]+[0-9A-Za-z_~\-])$'
pattern: ^([0-9A-Za-z_~\-\.]+[0-9A-Za-z_~\-])$
minLength: 1
maxLength: 1023
ConsentScopeType:
Expand Down Expand Up @@ -946,7 +945,7 @@ components:
additionalProperties: false
type:
type: string
description: 'response type, we need only the type of public-key'
description: response type, we need only the type of public-key
enum:
- public-key
required:
Expand Down Expand Up @@ -1029,7 +1028,7 @@ components:
type: string
enum:
- VERIFIED
description: 'The Credential is valid, and ready to be used by the PISP.'
description: The Credential is valid, and ready to be used by the PISP.
payload:
$ref: '#/components/schemas/FIDOPublicKeyCredentialAttestation'
required:
Expand Down Expand Up @@ -1105,7 +1104,7 @@ components:
of the format is yyyy-MM-ddTHH:mm:ss.SSS[-HH:MM]. Examples are
"2016-05-24T08:38:08.699-04:00", "2016-05-24T08:38:08.699Z" (where Z
indicates Zulu time zone, same as UTC).
example: '2016-05-24T08:38:08.699-04:00'
example: 2016-05-24T08:38:08.699-04:00
ConsentsIDPatchResponseRevoked:
title: ConsentsIDPatchResponseRevoked
description: |
Expand Down Expand Up @@ -1335,6 +1334,16 @@ components:
$ref: '#/components/schemas/ExtensionList'
required:
- fspId
AuthenticationResponse:
title: AuthenticationResponse
type: string
enum:
- VERIFIED
- REJECTED
description: |-
Below are the allowed values for the enumeration AuthenticationResponse.
- VERIFIED - The challenge was correctly signed.
- REJECTED - The challenge was not correctly signed.
ThirdpartyRequestsVerificationsIDPutResponse:
title: ThirdpartyRequestsVerificationsIDPutResponse
type: object
Expand All @@ -1343,9 +1352,6 @@ components:
request.
properties:
authenticationResponse:
type: string
enum:
- VERIFIED
description: The verification passed
$ref: '#/components/schemas/AuthenticationResponse'
required:
- authenticationResponse
Loading

0 comments on commit c97e75e

Please sign in to comment.