From 07826bd49b4a90c99cdb97c02760a3f07bf6f183 Mon Sep 17 00:00:00 2001 From: Roy Keene Date: Tue, 4 Nov 2025 11:50:30 -0600 Subject: [PATCH] Start of "waitForCertificates" --- src/services/kyc/client.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/services/kyc/client.ts b/src/services/kyc/client.ts index 95b63778..43fcef2c 100644 --- a/src/services/kyc/client.ts +++ b/src/services/kyc/client.ts @@ -273,6 +273,22 @@ class KeetaKYCVerification { ...this.request })); } + + /** + * Wait for the certificates to be available, polling at the given interval + * and timing out after the given timeout period. + */ + async waitForCertificates(pollInterval: number = 500, timeout: number = 600000): Promise { + for (const startTime = Date.now(); Date.now() - startTime < timeout; ) { + try { + return(await this.getCertificates()); + } catch (getCertificatesError) { + /* XXX:TODO */ + throw(getCertificatesError); + } + } + throw(new Error('Timeout waiting for KYC certificates')); + } } /**