From 16bdc47efc36dd7f4efd52050aeeb1e73f7ca584 Mon Sep 17 00:00:00 2001 From: Davide Vacca Date: Mon, 3 Jun 2024 14:58:16 +0200 Subject: [PATCH 1/3] Fix title of Id Photos list for consistency --- paths/id_photos.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/paths/id_photos.yaml b/paths/id_photos.yaml index 214bc915..9857615f 100644 --- a/paths/id_photos.yaml +++ b/paths/id_photos.yaml @@ -19,7 +19,7 @@ id_photos: application/json: schema: type: object - title: ID Photos list + title: Id Photos list required: - id_photos properties: From fcaf5e6d5c113e72a5cc3810cf0a899f534cb35c Mon Sep 17 00:00:00 2001 From: Davide Vacca Date: Mon, 3 Jun 2024 16:50:06 +0200 Subject: [PATCH 2/3] Improve webhook verification section in generated README.md files --- generators/java/okhttp-gson/templates/README.mustache | 6 ++++-- generators/php/templates/README.mustache | 2 +- generators/python/urllib3/templates/README.mustache | 2 +- generators/ruby/faraday/templates/README.mustache | 8 ++++---- generators/typescript-axios/templates/README.mustache | 3 ++- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/generators/java/okhttp-gson/templates/README.mustache b/generators/java/okhttp-gson/templates/README.mustache index 9eba2ca8..1ec17d5f 100644 --- a/generators/java/okhttp-gson/templates/README.mustache +++ b/generators/java/okhttp-gson/templates/README.mustache @@ -143,11 +143,13 @@ Webhook events payload needs to be verified before it can be accessed. Library a ```java try { - WebhookEventVerifier verifier = new WebhookEventVerifier("_ABC123abc...3ABC123_"); + WebhookEventVerifier verifier = new WebhookEventVerifier( + System.getenv("ONFIDO_WEBHOOK_SECRET_TOKEN") + ); String signature = "a0...760e"; - WebhookEvent event = verifier.readPayload("{\"payload\":{\"r...3\"}}}", signature); + WebhookEvent event = verifier.readPayload("{\"payload\":{\"r...3\"}}", signature); } catch( OnfidoInvalidSignatureError e ) { // Invalid webhook signature } diff --git a/generators/php/templates/README.mustache b/generators/php/templates/README.mustache index f0105161..e3e3c07c 100644 --- a/generators/php/templates/README.mustache +++ b/generators/php/templates/README.mustache @@ -94,7 +94,7 @@ Webhook events payload needs to be verified before it can be accessed. Library a ```php try { - $verifier = new Onfido\WebhookEventVerifier('_ABC123abc...3ABC123_'); + $verifier = new Onfido\WebhookEventVerifier(getenv('ONFIDO_WEBHOOK_SECRET_TOKEN')); $signature = 'a0...760e'; diff --git a/generators/python/urllib3/templates/README.mustache b/generators/python/urllib3/templates/README.mustache index 8bcebee3..0377977c 100644 --- a/generators/python/urllib3/templates/README.mustache +++ b/generators/python/urllib3/templates/README.mustache @@ -96,7 +96,7 @@ Webhook events payload needs to be verified before it can be accessed. Library a ```python try: - verifier = {{{packageName}}}.WebhookEventVerifier("_ABC123abc...3ABC123_") + verifier = {{{packageName}}}.WebhookEventVerifier(os.environ["ONFIDO_WEBHOOK_SECRET_TOKEN"]) signature = "a0...760e" diff --git a/generators/ruby/faraday/templates/README.mustache b/generators/ruby/faraday/templates/README.mustache index b335df10..059a4342 100644 --- a/generators/ruby/faraday/templates/README.mustache +++ b/generators/ruby/faraday/templates/README.mustache @@ -23,7 +23,7 @@ Configure with your API token, region and optional timeout (default value is 30) require {{{gemName}}} Onfido.configure do |config| - config.api_token = ENV["ONFIDO_API_TOKEN"] + config.api_token = ENV["ONFIDO_WEBHOOK_SECRET_TOKEN"] config.region = config.region[:EU] config.timeout = 30 end @@ -78,9 +78,9 @@ Webhook events payload needs to be verified before it can be accessed. Library a event = verifier.read_payload('{"payload":{"r...3"}}', signature) rescue Onfido::OnfidoInvalidSignatureError => e - e.type - e.fields - e.response_code + e.type + e.fields + e.response_code end ``` diff --git a/generators/typescript-axios/templates/README.mustache b/generators/typescript-axios/templates/README.mustache index 8085dd05..c1b38e6a 100644 --- a/generators/typescript-axios/templates/README.mustache +++ b/generators/typescript-axios/templates/README.mustache @@ -162,7 +162,8 @@ Webhook events payload needs to be verified before it can be accessed. Library a ```js (async () => { try { - const verifier = new WebhookEventVerifier("_ABC123abc...3ABC123_"); + const token = process.env.ONFIDO_WEBHOOK_SECRET_TOKEN; + const verifier = new WebhookEventVerifier(token); const signature = "a0...760e"; const event = verifier.readPayload(`{"payload":{"r...3"}}`, signature); From 2496a5338c5ad994f459eb960ada6943f0c803e2 Mon Sep 17 00:00:00 2001 From: Davide Vacca Date: Tue, 4 Jun 2024 16:38:40 +0200 Subject: [PATCH 3/3] Fix regex in tasks definitions --- schemas/tasks/definitions.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/schemas/tasks/definitions.yaml b/schemas/tasks/definitions.yaml index 6146beab..dfe83c16 100644 --- a/schemas/tasks/definitions.yaml +++ b/schemas/tasks/definitions.yaml @@ -1,10 +1,10 @@ task_id: type: string - pattern: ^[0-9a-z-_]+$ + pattern: ^[0-9a-z_-]+$ description: The identifier for the Task. example: profile_123 task_def_id: type: string - pattern: ^[0-9a-z-_]+$ + pattern: ^[0-9a-z_-]+$ description: The identifier for the Task Definition. example: task_123