@zyphe-sdk/core 0.2.2 → 0.3.1

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.
package/README.md CHANGED
@@ -20,10 +20,7 @@ pnpm install @zyphe-sdk/core
20
20
 
21
21
  ```ts
22
22
  // Correct: ESM import
23
- import {
24
- createVerificationSession,
25
- verifyWebhookSignature,
26
- } from "@zyphe-sdk/core";
23
+ import { createVerificationSession, verifyWebhookSignature } from '@zyphe-sdk/core'
27
24
 
28
25
  // ❌ Not supported:
29
26
  // const sdk = require("@zyphe-sdk/core");
@@ -40,17 +37,13 @@ This package provides the core webhook signature verification logic for Zyphe. I
40
37
  ### Basic Usage
41
38
 
42
39
  ```ts
43
- import { verifyWebhookSignature } from "@zyphe-sdk/core";
40
+ import { verifyWebhookSignature } from '@zyphe-sdk/core'
44
41
 
45
- const secretHex = "<your-hex-encoded-secret>";
46
- const rawBodyString = "..."; // The raw request body as a string
47
- const signatureHeader = "t=1234567890,v0=abcdef..."; // The signature header from the webhook
42
+ const secretHex = '<your-hex-encoded-secret>'
43
+ const rawBodyString = '...' // The raw request body as a string
44
+ const signatureHeader = 't=1234567890,v0=abcdef...' // The signature header from the webhook
48
45
 
49
- const isValid = await verifyWebhookSignature(
50
- secretHex,
51
- rawBodyString,
52
- signatureHeader,
53
- );
46
+ const isValid = await verifyWebhookSignature(secretHex, rawBodyString, signatureHeader)
54
47
  if (isValid) {
55
48
  // Signature is valid
56
49
  } else {
@@ -79,29 +72,28 @@ You can programmatically create verification sessions and construct user-facing
79
72
  ### Create a Verification Session
80
73
 
81
74
  ```ts
82
- import { createVerificationSession } from "@zyphe-sdk/core";
75
+ import { createVerificationSession } from '@zyphe-sdk/core'
83
76
 
84
77
  const response = await createVerificationSession(
85
78
  {
86
- email: "user@example.com", // required
87
- flowId: "<flowId>", // required
88
- flowStepId: "<flowStepId>", // required
79
+ email: 'user@example.com', // required
80
+ flowId: '<flowId>', // required
89
81
  isSandbox: false, // required
90
82
  customData: {
91
83
  // optional
92
- walletAddress: "0x123...",
84
+ walletAddress: '0x123...',
93
85
  // ...any extra data you want to pass
94
86
  },
95
87
  },
96
88
  {
97
- apiKey: "<your-api-key>",
98
- environment: "staging", // or "production", "local"
99
- handoffBaseUrl: "https://your-app.com", // optional
100
- primaryColor: "#000000", // optional
101
- secondaryColor: "#ffffff", // optional
89
+ apiKey: '<your-api-key>',
90
+ environment: 'staging', // or "production", "local"
91
+ handoffBaseUrl: 'https://your-app.com', // optional
92
+ primaryColor: '#000000', // optional
93
+ secondaryColor: '#ffffff', // optional
102
94
  isFullscreen: true, // optional
103
95
  },
104
- );
96
+ )
105
97
  ```
106
98
 
107
99
  - `customData` (optional): Pass any extra data you want to associate with the verification session. This will be available in the webhook payload and session data.
@@ -110,27 +102,25 @@ const response = await createVerificationSession(
110
102
  ### Construct a Verification Session URL
111
103
 
112
104
  ```ts
113
- import { constructVerificationSessionUrl } from "@zyphe-sdk/core";
105
+ import { constructVerificationSessionUrl } from '@zyphe-sdk/core'
114
106
 
115
107
  const url = constructVerificationSessionUrl({
116
108
  flowParams: {
117
- flowId: "...",
118
- flowStepId: "...",
119
- email: "user@example.com",
120
- product: "kyc", // or "kyb" if supported
109
+ flowId: '...',
110
+ email: 'user@example.com',
121
111
  isSandbox: false,
122
- customData: { walletAddress: "0x123..." }, // optional
112
+ customData: { walletAddress: '0x123...' }, // optional
123
113
  },
124
114
  verificationSession: response.data, // from createVerificationSession
125
115
  opts: {
126
- apiKey: "<your-api-key>",
127
- environment: "staging",
128
- handoffBaseUrl: "https://your-app.com", // optional
129
- primaryColor: "#000000", // optional
130
- secondaryColor: "#ffffff", // optional
116
+ apiKey: '<your-api-key>',
117
+ environment: 'staging',
118
+ handoffBaseUrl: 'https://your-app.com', // optional
119
+ primaryColor: '#000000', // optional
120
+ secondaryColor: '#ffffff', // optional
131
121
  isFullscreen: true, // optional
132
122
  },
133
- });
123
+ })
134
124
  ```
135
125
 
136
126
  - The constructed URL includes all relevant parameters and can be used to embed or redirect users to the verification flow.