@zyphe-sdk/core 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
 
2
2
  
3
- > @zyphe-sdk/core@0.1.6 build /Users/mtumiati/dev/zyphe/zyphe-sdk/packages/core
3
+ > @zyphe-sdk/core@0.1.7 build /Users/mtumiati/dev/zyphe/zyphe-sdk/packages/core
4
4
  > tsup
5
5
 
6
6
  CLI Building entry: src/index.ts
@@ -17,6 +17,6 @@
17
17
  CJS dist/index.cjs.map 9.63 KB
18
18
  CJS ⚡️ Build success in 13ms
19
19
  DTS Build start
20
- DTS ⚡️ Build success in 636ms
20
+ DTS ⚡️ Build success in 609ms
21
21
  DTS dist/index.d.ts 61.70 KB
22
22
  DTS dist/index.d.cts 61.70 KB
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # Zyphe SDK – Core Webhook Signature Verification
1
+ # Zyphe SDK – Core
2
2
 
3
- This is the core SDK package for Zyphe. It contains utilities to interact with Zyphe platform.
3
+ This is the core SDK package for Zyphe. It contains utilities to interact with the Zyphe platform, including webhook signature verification and verification session management.
4
4
 
5
5
  ## Installing package
6
6
 
@@ -12,14 +12,13 @@ pnpm install @zyphe-sdk/core
12
12
 
13
13
  Then import and use the package in your project as described in the Usage section.
14
14
 
15
- ## Usage: Verifying a Webhook Signature
15
+ ---
16
16
 
17
- ### Webhook Signature Verification
18
- This package provides the core webhook signature verification logic for Zyphe. It enables secure verification of incoming webhook requests in both Node.js and browser environments using HMAC-SHA256 signatures.
17
+ ## 1. Webhook Signature Verification
19
18
 
20
- The main function exported by this package is `verifyWebhookSignature`, which allows you to securely verify incoming webhook requests.
19
+ This package provides the core webhook signature verification logic for Zyphe. It enables secure verification of incoming webhook requests in both Node.js and browser environments using HMAC-SHA256 signatures.
21
20
 
22
- #### Example
21
+ ### Basic Usage
23
22
 
24
23
  ```ts
25
24
  import { verifyWebhookSignature } from "@zyphe-sdk/core";
@@ -41,8 +40,69 @@ if (isValid) {
41
40
  - `signatureHeader`: The signature header string, e.g. `t=1234567890,v0=abcdef...`.
42
41
  - Returns: A Promise that resolves to `true` if the signature is valid, or `false` otherwise.
43
42
 
44
- This function works in both Node.js and modern browsers. It automatically selects the appropriate implementation for the environment.
43
+ #### Advanced Utilities
44
+ - `parseSignatureHeader(signatureHeader)` – Parse the signature header into timestamp and signature.
45
+ - `hexToBytes(hex)` / `bufferToHex(buffer)` – Convert between hex and bytes.
46
+ - `timingSafeEqual(a, b)` – Constant-time string comparison.
47
+ - Error codes/messages for robust error handling.
48
+
49
+ ---
50
+
51
+ ## 2. Verification Session Management
52
+
53
+ You can programmatically create verification sessions and construct user-facing URLs for onboarding flows.
54
+
55
+ ### Create a Verification Session
56
+ ```ts
57
+ import { createVerificationSession } from "@zyphe-sdk/core";
58
+
59
+ const response = await createVerificationSession(
60
+ "user@example.com", // email
61
+ "<flowId>", // flowId
62
+ "<flowStepId>", // flowStepId
63
+ false, // isSandbox
64
+ {
65
+ apiKey: "<your-api-key>",
66
+ environment: "staging", // or "production", "local"
67
+ }
68
+ );
69
+ ```
70
+
71
+ ### Construct a Verification Session URL
72
+ ```ts
73
+ import { constructVerificationSessionUrl } from "@zyphe-sdk/core";
74
+
75
+ const url = constructVerificationSessionUrl({
76
+ flowParams: {
77
+ flowId: "...",
78
+ flowStepId: "...",
79
+ email: "user@example.com",
80
+ product: "kyc",
81
+ isSandbox: false,
82
+ },
83
+ verificationSession: response.data, // from createVerificationSession
84
+ opts: {
85
+ apiKey: "<your-api-key>",
86
+ environment: "staging",
87
+ handoffBaseUrl: "https://your-app.com",
88
+ primaryColor: "#000000",
89
+ secondaryColor: "#ffffff",
90
+ isFullscreen: true,
91
+ },
92
+ });
93
+ ```
94
+
95
+ ---
96
+
97
+ ## 3. Types and Configuration
98
+
99
+ - `InitializeZypheFlowParams`, `SDKOptions`, `SdkCreateVerificationRequestResponse` – for type-safe integration.
100
+ - `Environments`, `EnvironmentConfigs`, `API_KEY_HEADER` – for environment and API configuration.
101
+
102
+ ---
45
103
 
104
+ ## Resources
105
+ - See the dedicated middleware packages for Express, Fastify, Hono, and NestJS for webhook signature verification in those frameworks.
46
106
 
47
107
  ---
48
108
  Made with ❤️ by Zyphe Inc
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyphe-sdk/core",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Simplifies interaction with the Zyphe platform for creating and managing digital identities and digital onboarding flows with ease",
5
5
  "author": "Zyphe",
6
6
  "license": "MIT",