@zkproofport-app/sdk 0.2.4 → 0.2.6

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,13 +124,13 @@ 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` | `string` | No | OIDC workspace provider for organization membership verification. Currently supported: `'google'`. |
133
+ | `provider` | `'google' \| 'microsoft'` | No | OIDC workspace provider for organization membership verification. Supported: `'google'` (Google Workspace), `'microsoft'` (Microsoft 365). |
134
134
 
135
135
  **Email domain verification (default):**
136
136
 
@@ -151,7 +151,17 @@ const relay = await sdk.createRelayRequest('oidc_domain_attestation', {
151
151
  });
152
152
  ```
153
153
 
154
- > 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). Without `provider`, only the email domain is verified.
154
+ **Organization membership verification (Microsoft 365):**
155
+
156
+ ```typescript
157
+ const relay = await sdk.createRelayRequest('oidc_domain_attestation', {
158
+ domain: 'company.com',
159
+ scope: 'myapp.com',
160
+ provider: 'microsoft',
161
+ });
162
+ ```
163
+
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.
155
165
 
156
166
  ## Integration Guide
157
167
 
@@ -246,9 +256,20 @@ const relay = await sdk.createRelayRequest('oidc_domain_attestation', {
246
256
  dappIcon: 'https://myapp.com/icon.png',
247
257
  message: 'Verify your organization membership',
248
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
+ });
249
270
  ```
250
271
 
251
- The mobile app prompts Google Sign-In and generates the proof locally. When `provider` is set, the app additionally verifies organization membership (e.g., Google Workspace `hd` claim).
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).
252
273
 
253
274
  ### Step 4: Display QR Code
254
275
 
@@ -497,9 +518,9 @@ The `OidcDomainInputs` interface:
497
518
 
498
519
  ```typescript
499
520
  interface OidcDomainInputs {
500
- domain: string; // Target email domain (e.g., 'google.com')
501
- scope: string; // dApp scope identifier
502
- provider?: string; // Workspace provider for org membership (currently: 'google')
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
503
524
  }
504
525
  ```
505
526
 
@@ -184,14 +184,15 @@ export declare const COINBASE_COUNTRY_PUBLIC_INPUT_LAYOUT: {
184
184
  readonly NULLIFIER_END: 149;
185
185
  };
186
186
  /**
187
- * OIDC Domain Attestation circuit public input layout (byte offsets).
188
- * Defines the byte positions of each field in the flattened public inputs array.
187
+ * OIDC Domain Attestation circuit public input layout (field offsets).
188
+ * Defines the field positions in the flattened public inputs array (148 fields total).
189
189
  *
190
- * Public inputs are packed as individual field elements (one byte per element):
191
- * - pubkey_modulus_limbs: 18 x u128 = 18 x 16 bytes = 288 bytes → fields 0–287
192
- * - domain (BoundedVec<u8, 64>): 4-byte length (u32) + 64-byte storage = 68 fields → fields 288355
193
- * - scope: 32 bytes → fields 356387
194
- * - nullifier: 32 bytes → fields 388419
190
+ * Circuit public inputs (from main.nr):
191
+ * - pubkey_modulus_limbs: pub [u128; 18] 18 fields (0–17)
192
+ * - domain: pub BoundedVec<u8, 64> 1 len + 64 storage = 65 fields (1882)
193
+ * - scope: pub [u8; 32]32 fields (83114)
194
+ * - nullifier: pub [u8; 32]32 fields (115146)
195
+ * - provider: pub u8 → 1 field (147)
195
196
  *
196
197
  * @example
197
198
  * ```typescript
@@ -203,11 +204,13 @@ export declare const COINBASE_COUNTRY_PUBLIC_INPUT_LAYOUT: {
203
204
  */
204
205
  export declare const OIDC_DOMAIN_ATTESTATION_PUBLIC_INPUT_LAYOUT: {
205
206
  readonly PUBKEY_MODULUS_START: 0;
206
- readonly PUBKEY_MODULUS_END: 287;
207
- readonly DOMAIN_START: 288;
208
- readonly DOMAIN_END: 355;
209
- readonly SCOPE_START: 356;
210
- readonly SCOPE_END: 387;
211
- readonly NULLIFIER_START: 388;
212
- readonly NULLIFIER_END: 419;
207
+ readonly PUBKEY_MODULUS_END: 17;
208
+ readonly DOMAIN_LEN: 18;
209
+ readonly DOMAIN_START: 19;
210
+ readonly DOMAIN_END: 82;
211
+ readonly SCOPE_START: 83;
212
+ readonly SCOPE_END: 114;
213
+ readonly NULLIFIER_START: 115;
214
+ readonly NULLIFIER_END: 146;
215
+ readonly PROVIDER: 147;
213
216
  };
package/dist/index.esm.js CHANGED
@@ -70,8 +70,8 @@ const CIRCUIT_METADATA = {
70
70
  oidc_domain_attestation: {
71
71
  name: 'OIDC Domain',
72
72
  description: 'Prove email domain affiliation via OIDC JWT',
73
- publicInputsCount: 420,
74
- publicInputNames: ['pubkey_modulus_limbs', 'domain', 'scope', 'nullifier'],
73
+ publicInputsCount: 148,
74
+ publicInputNames: ['pubkey_modulus_limbs', 'domain', 'scope', 'nullifier', 'provider'],
75
75
  },
76
76
  };
77
77
  /**
@@ -205,14 +205,15 @@ const COINBASE_COUNTRY_PUBLIC_INPUT_LAYOUT = {
205
205
  NULLIFIER_END: 149,
206
206
  };
207
207
  /**
208
- * OIDC Domain Attestation circuit public input layout (byte offsets).
209
- * Defines the byte positions of each field in the flattened public inputs array.
208
+ * OIDC Domain Attestation circuit public input layout (field offsets).
209
+ * Defines the field positions in the flattened public inputs array (148 fields total).
210
210
  *
211
- * Public inputs are packed as individual field elements (one byte per element):
212
- * - pubkey_modulus_limbs: 18 x u128 = 18 x 16 bytes = 288 bytes → fields 0–287
213
- * - domain (BoundedVec<u8, 64>): 4-byte length (u32) + 64-byte storage = 68 fields → fields 288355
214
- * - scope: 32 bytes → fields 356387
215
- * - nullifier: 32 bytes → fields 388419
211
+ * Circuit public inputs (from main.nr):
212
+ * - pubkey_modulus_limbs: pub [u128; 18] 18 fields (0–17)
213
+ * - domain: pub BoundedVec<u8, 64> 1 len + 64 storage = 65 fields (1882)
214
+ * - scope: pub [u8; 32]32 fields (83114)
215
+ * - nullifier: pub [u8; 32]32 fields (115146)
216
+ * - provider: pub u8 → 1 field (147)
216
217
  *
217
218
  * @example
218
219
  * ```typescript
@@ -224,13 +225,15 @@ const COINBASE_COUNTRY_PUBLIC_INPUT_LAYOUT = {
224
225
  */
225
226
  const OIDC_DOMAIN_ATTESTATION_PUBLIC_INPUT_LAYOUT = {
226
227
  PUBKEY_MODULUS_START: 0,
227
- PUBKEY_MODULUS_END: 287,
228
- DOMAIN_START: 288,
229
- DOMAIN_END: 355,
230
- SCOPE_START: 356,
231
- SCOPE_END: 387,
232
- NULLIFIER_START: 388,
233
- NULLIFIER_END: 419,
228
+ PUBKEY_MODULUS_END: 17,
229
+ DOMAIN_LEN: 18,
230
+ DOMAIN_START: 19,
231
+ DOMAIN_END: 82,
232
+ SCOPE_START: 83,
233
+ SCOPE_END: 114,
234
+ NULLIFIER_START: 115,
235
+ NULLIFIER_END: 146,
236
+ PROVIDER: 147,
234
237
  };
235
238
 
236
239
  /**
@@ -3828,8 +3831,8 @@ function extractScopeFromPublicInputs(publicInputsHex, circuit) {
3828
3831
  end = 117;
3829
3832
  }
3830
3833
  else if (circuit === 'oidc_domain_attestation') {
3831
- start = 356;
3832
- end = 387;
3834
+ start = 83;
3835
+ end = 114;
3833
3836
  }
3834
3837
  else {
3835
3838
  start = 64;
@@ -3865,8 +3868,8 @@ function extractNullifierFromPublicInputs(publicInputsHex, circuit) {
3865
3868
  end = 149;
3866
3869
  }
3867
3870
  else if (circuit === 'oidc_domain_attestation') {
3868
- start = 388;
3869
- end = 419;
3871
+ start = 115;
3872
+ end = 146;
3870
3873
  }
3871
3874
  else {
3872
3875
  start = 96;