Skip to content

Commit c20b72f

Browse files
Merge branch 'main' into update-node-modules
2 parents 9696e17 + cc11cf2 commit c20b72f

File tree

9 files changed

+29
-153
lines changed

9 files changed

+29
-153
lines changed

.github/workflows/CI-appsec-blackduck-master.yml

Lines changed: 0 additions & 75 deletions
This file was deleted.

.github/workflows/CI-appsec-blackduck-pr.yml

Lines changed: 0 additions & 62 deletions
This file was deleted.

.github/workflows/CI.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ jobs:
77
runs-on: ubuntu-latest
88
steps:
99
- uses: actions/checkout@v2
10-
- uses: actions/setup-node@v1
10+
- uses: actions/setup-node@v4
1111
with:
12-
node-version: 16.x
12+
node-version: 18
1313
- run: npm ci
1414
- run: npm run lint
1515
- run: npm run build

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@unit-finance/unit-node-sdk",
3-
"version": "1.3.4",
3+
"version": "1.3.5",
44
"description": "",
55
"main": "dist/unit.js",
66
"types": "dist/unit.d.ts",

resources/webhooks.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,11 @@ export class Webhooks extends BaseResource {
4242
}
4343

4444
public verify(signature: string, secret: string, payload: any) {
45+
const signatureBuffer = Buffer.from(signature, "base64")
4546
const hmac = crypto.createHmac("sha1", secret)
4647
hmac.update(JSON.stringify(payload))
47-
return hmac.digest("base64") == signature
48+
49+
return crypto.timingSafeEqual(hmac.digest(), signatureBuffer)
4850
}
4951
}
5052

tests/orgTokens.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ describe("Create API Tokens", () => {
1414
"attributes": {
1515
"description": "test token",
1616
"scope": "customers applications",
17-
"expiration": "2025-09-01T13:47:17.000Z",
17+
"expiration": "2026-09-01T13:47:17.000Z",
1818
"resources": [resource]
1919
}
2020
}

tests/webhooks.spec.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,15 @@ describe("Get Webhook Test", () => {
2222
expect(res.data.type === "webhook").toBeTruthy()
2323
})
2424
})
25+
})
26+
27+
describe("Verify Webhook test", () => {
28+
test("verify webhook signature", () => {
29+
const signature = "UUNz8ch1Ovjg+ijXUEwlAlWEktU="
30+
const secret = "OB2HL5E3B4HJ7IVXRNL4YQKYIQIVJK36ZZLPZEFWZVSDSC7LLFJQ===="
31+
const payload = {"data":[{"id":"46306092","type":"application.approved","attributes":{"createdAt":"2025-08-05T06:48:38.957Z","tags":{"key":"another-tag","test":"webhook-tag","number":"111"}},"relationships":{"application":{"data":{"id":"3895367","type":"individualApplication"}},"customer":{"data":{"id":"3310133","type":"individualCustomer"}}}}]}
32+
33+
const verifyResult = unit.webhooks.verify(signature, secret, payload)
34+
expect(verifyResult).toBeTruthy()
35+
})
2536
})

types/applicationForm.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -346,47 +346,47 @@ export interface ApplicationFormSettingsOverride {
346346
/**
347347
* URL that is presented to the user when an application has been submitted
348348
*/
349-
redirectUrl: string
349+
redirectUrl?: string
350350

351351
/**
352352
* Privacy Policy
353353
*/
354-
privacyPolicyUrl: string
354+
privacyPolicyUrl?: string
355355

356356
/**
357357
* Consent to Electronic Disclosures
358358
*/
359-
electronicDisclosuresUrl: string
359+
electronicDisclosuresUrl?: string
360360

361361
/**
362362
* Deposit Terms & Conditions
363363
*/
364-
depositTermsUrl: string
364+
depositTermsUrl?: string
365365

366366
/**
367367
* Client Terms of Service
368368
*/
369-
clientTermsUrl: string
369+
clientTermsUrl?: string
370370

371371
/**
372372
* Cardholder Terms and Conditions
373373
*/
374-
cardholderTermsUrl: string
374+
cardholderTermsUrl?: string
375375

376376
/**
377377
* Cash Advance Terms and Conditions
378378
*/
379-
cashAdvancedTermsUrl: string
379+
cashAdvancedTermsUrl?: string
380380

381381
/**
382382
* Debit Card Disclosure
383383
*/
384-
debitCardDisclosureUrl: string
384+
debitCardDisclosureUrl?: string
385385

386386
/**
387387
* Array of additional disclosures that were not covered by the above links
388388
*/
389-
additionalDisclosures: Record<string, string>[]
389+
additionalDisclosures?: Record<string, string>[]
390390

391391
/**
392392
* Optional. If true, the applicant will be required to complete the selfie verification process when an ID document is required.

0 commit comments

Comments
 (0)