@zkproofport-app/sdk 0.2.3 → 0.2.5

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
@@ -124,21 +124,44 @@ const relay = await sdk.createRelayRequest('coinbase_country_attestation', {
124
124
 
125
125
  ### `oidc_domain_attestation`
126
126
 
127
- Prove email domain affiliation via Google Sign-In. The mobile app handles authentication and proof generation entirely on-device — the user's email is never revealed.
127
+ Prove email domain affiliation via OIDC Sign-In. The mobile app handles authentication and proof generation entirely on-device — the user's email is never revealed.
128
128
 
129
129
  | Field | Type | Required | Description |
130
130
  |-------|------|----------|-------------|
131
131
  | `domain` | `string` | Yes | Target email domain to prove (e.g., `'google.com'`, `'company.com'`) |
132
132
  | `scope` | `string` | Yes | dApp scope identifier for proof uniqueness |
133
+ | `provider` | `'google' \| 'microsoft'` | No | OIDC workspace provider for organization membership verification. Supported: `'google'` (Google Workspace), `'microsoft'` (Microsoft 365). |
134
+
135
+ **Email domain verification (default):**
136
+
137
+ ```typescript
138
+ const relay = await sdk.createRelayRequest('oidc_domain_attestation', {
139
+ domain: 'gmail.com',
140
+ scope: 'myapp.com',
141
+ });
142
+ ```
143
+
144
+ **Organization membership verification (Google Workspace):**
145
+
146
+ ```typescript
147
+ const relay = await sdk.createRelayRequest('oidc_domain_attestation', {
148
+ domain: 'company.com',
149
+ scope: 'myapp.com',
150
+ provider: 'google',
151
+ });
152
+ ```
153
+
154
+ **Organization membership verification (Microsoft 365):**
133
155
 
134
156
  ```typescript
135
157
  const relay = await sdk.createRelayRequest('oidc_domain_attestation', {
136
158
  domain: 'company.com',
137
159
  scope: 'myapp.com',
160
+ provider: 'microsoft',
138
161
  });
139
162
  ```
140
163
 
141
- > The mobile app prompts Google Sign-In, generates the ZK proof locally, and returns the result via relay. The `domain` is a public input verifiers can confirm which domain was proven.
164
+ > When `provider` is set, the mobile app verifies the user's account is managed by the specified workspace provider (e.g., Google Workspace `hd` claim, Microsoft 365 `tid` claim). Without `provider`, only the email domain is verified.
142
165
 
143
166
  ## Integration Guide
144
167
 
@@ -213,6 +236,7 @@ const relay = await sdk.createRelayRequest('coinbase_attestation', {
213
236
  **OIDC Domain Attestation:**
214
237
 
215
238
  ```typescript
239
+ // Email domain verification
216
240
  const relay = await sdk.createRelayRequest('oidc_domain_attestation', {
217
241
  domain: 'company.com',
218
242
  scope: 'myapp.com',
@@ -221,9 +245,31 @@ const relay = await sdk.createRelayRequest('oidc_domain_attestation', {
221
245
  dappIcon: 'https://myapp.com/icon.png',
222
246
  message: 'Verify your email domain',
223
247
  });
248
+
249
+ // Organization membership verification (Google Workspace)
250
+ const relay = await sdk.createRelayRequest('oidc_domain_attestation', {
251
+ domain: 'company.com',
252
+ scope: 'myapp.com',
253
+ provider: 'google',
254
+ }, {
255
+ dappName: 'My DApp',
256
+ dappIcon: 'https://myapp.com/icon.png',
257
+ message: 'Verify your organization membership',
258
+ });
259
+
260
+ // Organization membership verification (Microsoft 365)
261
+ const relay = await sdk.createRelayRequest('oidc_domain_attestation', {
262
+ domain: 'company.com',
263
+ scope: 'myapp.com',
264
+ provider: 'microsoft',
265
+ }, {
266
+ dappName: 'My DApp',
267
+ dappIcon: 'https://myapp.com/icon.png',
268
+ message: 'Verify your organization membership',
269
+ });
224
270
  ```
225
271
 
226
- The mobile app will prompt the user to sign in with Google. The circuit proves the user's email ends with `@company.com` without revealing the full email address. The `domain` field is a **public input** verifiers can confirm which domain was proven.
272
+ The mobile app prompts OIDC Sign-In (Google or Microsoft) and generates the proof locally. When `provider` is set, the app additionally verifies organization membership (e.g., Google Workspace `hd` claim, Microsoft 365 `tid` claim).
227
273
 
228
274
  ### Step 4: Display QR Code
229
275
 
@@ -456,7 +502,7 @@ import type {
456
502
  | `ProofRequestStatus` | `'pending' \| 'completed' \| 'error' \| 'cancelled'` |
457
503
  | `CoinbaseKycInputs` | Inputs for `coinbase_attestation` (`{ scope, userAddress?, rawTransaction? }`) |
458
504
  | `CoinbaseCountryInputs` | Inputs for `coinbase_country_attestation` (`{ scope, countryList, isIncluded, ... }`) |
459
- | `OidcDomainInputs` | Inputs for `oidc_domain_attestation` (`{ domain, scope }`) |
505
+ | `OidcDomainInputs` | Inputs for `oidc_domain_attestation` (`{ domain, scope, provider? }`) |
460
506
  | `CircuitInputs` | Union: `CoinbaseKycInputs \| CoinbaseCountryInputs \| OidcDomainInputs` |
461
507
  | `ProofRequest` | Proof request object with `requestId`, `circuit`, `inputs`, metadata, and expiry |
462
508
  | `ProofResponse` | Proof response with `status`, `proof`, `publicInputs`, `verifierAddress`, `chainId` |
@@ -472,8 +518,9 @@ The `OidcDomainInputs` interface:
472
518
 
473
519
  ```typescript
474
520
  interface OidcDomainInputs {
475
- domain: string; // Target email domain (e.g., 'google.com')
476
- scope: string; // dApp scope identifier
521
+ domain: string; // Target email domain (e.g., 'company.com')
522
+ scope: string; // dApp scope identifier
523
+ provider?: 'google' | 'microsoft'; // Workspace provider for org membership
477
524
  }
478
525
  ```
479
526
 
package/dist/index.esm.js CHANGED
@@ -522,6 +522,9 @@ function validateProofRequest(request) {
522
522
  if (!inputs.scope || typeof inputs.scope !== 'string' || inputs.scope.trim() === '') {
523
523
  return { valid: false, error: 'scope is required and must be a non-empty string' };
524
524
  }
525
+ if (inputs.provider !== undefined && (typeof inputs.provider !== 'string' || inputs.provider.trim() === '')) {
526
+ return { valid: false, error: 'provider must be a non-empty string when specified' };
527
+ }
525
528
  }
526
529
  // Check expiry
527
530
  if (request.expiresAt && Date.now() > request.expiresAt) {