@wireapp/core-crypto 1.0.0-rc.20 → 1.0.0-rc.22

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -92,7 +92,7 @@ cargo make "copy-jvm-resources"
92
92
  cargo make "copy-android-resources"
93
93
 
94
94
  # builds iOS framework
95
- cargo make "create-swift-package"
95
+ cargo make "ios-create-xcframework"
96
96
 
97
97
  # builds wasm binary & TS bindings
98
98
  cargo make wasm
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wireapp/core-crypto",
3
- "version": "1.0.0-rc.20",
3
+ "version": "1.0.0-rc.22",
4
4
  "description": "CoreCrypto bindings for the Web",
5
5
  "type": "module",
6
6
  "module": "platforms/web/corecrypto.js",
@@ -679,6 +679,10 @@ export interface CoreCryptoCallbacks {
679
679
  */
680
680
  export declare class CoreCrypto {
681
681
  #private;
682
+ /**
683
+ * Should only be used internally
684
+ */
685
+ inner(): unknown;
682
686
  /**
683
687
  * This is your entrypoint to initialize {@link CoreCrypto}!
684
688
  *
@@ -1204,7 +1208,7 @@ export declare class CoreCrypto {
1204
1208
  * Creates an enrollment instance with private key material you can use in order to fetch
1205
1209
  * a new x509 certificate from the acme server.
1206
1210
  *
1207
- * @param clientId - client identifier with user b64Url encoded & clientId hex encoded e.g. `t6wRpI8BRSeviBwwiFp5MQ:6add501bacd1d90e@example.com`
1211
+ * @param clientId - client identifier e.g. `b7ac11a4-8f01-4527-af88-1c30885a7931:6add501bacd1d90e@example.com`
1208
1212
  * @param displayName - human-readable name displayed in the application e.g. `Smith, Alice M (QA)`
1209
1213
  * @param handle - user handle e.g. `alice.smith.qa@example.com`
1210
1214
  * @param expiryDays - generated x509 certificate expiry
@@ -1217,7 +1221,6 @@ export declare class CoreCrypto {
1217
1221
  * Generates an E2EI enrollment instance for a "regular" client (with a Basic credential) willing to migrate to E2EI.
1218
1222
  * Once the enrollment is finished, use the instance in {@link CoreCrypto.e2eiRotateAll} to do the rotation.
1219
1223
  *
1220
- * @param clientId - client identifier with user b64Url encoded & clientId hex encoded e.g. `t6wRpI8BRSeviBwwiFp5MQ:6add501bacd1d90e@example.com`
1221
1224
  * @param displayName - human-readable name displayed in the application e.g. `Smith, Alice M (QA)`
1222
1225
  * @param handle - user handle e.g. `alice.smith.qa@example.com`
1223
1226
  * @param expiryDays - generated x509 certificate expiry
@@ -1225,14 +1228,13 @@ export declare class CoreCrypto {
1225
1228
  * @param team - name of the Wire team a user belongs to
1226
1229
  * @returns The new {@link E2eiEnrollment} enrollment instance to use with {@link CoreCrypto.e2eiRotateAll}
1227
1230
  */
1228
- e2eiNewActivationEnrollment(clientId: string, displayName: string, handle: string, expiryDays: number, ciphersuite: Ciphersuite, team?: string): Promise<E2eiEnrollment>;
1231
+ e2eiNewActivationEnrollment(displayName: string, handle: string, expiryDays: number, ciphersuite: Ciphersuite, team?: string): Promise<E2eiEnrollment>;
1229
1232
  /**
1230
1233
  * Generates an E2EI enrollment instance for a E2EI client (with a X509 certificate credential)
1231
1234
  * having to change/rotate their credential, either because the former one is expired or it
1232
1235
  * has been revoked. It lets you change the DisplayName or the handle
1233
1236
  * if you need to. Once the enrollment is finished, use the instance in {@link CoreCrypto.e2eiRotateAll} to do the rotation.
1234
1237
  *
1235
- * @param clientId - client identifier with user b64Url encoded & clientId hex encoded e.g. `t6wRpI8BRSeviBwwiFp5MQ:6add501bacd1d90e@example.com`
1236
1238
  * @param expiryDays - generated x509 certificate expiry
1237
1239
  * @param ciphersuite - for generating signing key material
1238
1240
  * @param displayName - human-readable name displayed in the application e.g. `Smith, Alice M (QA)`
@@ -1240,7 +1242,7 @@ export declare class CoreCrypto {
1240
1242
  * @param team - name of the Wire team a user belongs to
1241
1243
  * @returns The new {@link E2eiEnrollment} enrollment instance to use with {@link CoreCrypto.e2eiRotateAll}
1242
1244
  */
1243
- e2eiNewRotateEnrollment(clientId: string, expiryDays: number, ciphersuite: Ciphersuite, displayName?: string, handle?: string, team?: string): Promise<E2eiEnrollment>;
1245
+ e2eiNewRotateEnrollment(expiryDays: number, ciphersuite: Ciphersuite, displayName?: string, handle?: string, team?: string): Promise<E2eiEnrollment>;
1244
1246
  /**
1245
1247
  * Use this method to initialize end-to-end identity when a client signs up and the grace period is already expired ;
1246
1248
  * that means he cannot initialize with a Basic credential
@@ -1278,7 +1280,7 @@ export declare class CoreCrypto {
1278
1280
  */
1279
1281
  e2eiEnrollmentStashPop(handle: Uint8Array): Promise<E2eiEnrollment>;
1280
1282
  /**
1281
- * Indicates when to mark a conversation as degraded i.e. when not all its members have a X509.
1283
+ * Indicates when to mark a conversation as not verified i.e. when not all its members have a X509.
1282
1284
  * Credential generated by Wire's end-to-end identity enrollment
1283
1285
  *
1284
1286
  * @param conversationId The group's ID
@@ -1307,10 +1309,19 @@ export declare class CoreCrypto {
1307
1309
  * If no member has a x509 certificate, it will return an empty Vec.
1308
1310
  *
1309
1311
  * @param conversationId - identifier of the conversation
1310
- * @param userIds - user identifiers e.g. t6wRpI8BRSeviBwwiFp5MQ which is a base64UrlUnpadded UUIDv4
1312
+ * @param userIds - user identifiers hyphenated UUIDv4 e.g. 'bd4c7053-1c5a-4020-9559-cd7bf7961954'
1311
1313
  * @returns a Map with all the identities for a given users. Consumers are then recommended to reduce those identities to determine the actual status of a user.
1312
1314
  */
1313
1315
  getUserIdentities(conversationId: ConversationId, userIds: string[]): Promise<Map<string, WireIdentity[]>>;
1316
+ /**
1317
+ * Gets the e2ei conversation state from a `GroupInfo`. Useful to check if the group has e2ei
1318
+ * turned on or not before joining it.
1319
+ *
1320
+ * @param groupInfo - a TLS encoded GroupInfo fetched from the Delivery Service
1321
+ * @param credentialType - kind of Credential to check usage of. Defaults to X509 for now as no other value will give any result.
1322
+ * @returns see {@link E2eiConversationState}
1323
+ */
1324
+ getCredentialInUse(groupInfo: Uint8Array, credentialType?: CredentialType): Promise<E2eiConversationState>;
1314
1325
  /**
1315
1326
  * Returns the current version of {@link CoreCrypto}
1316
1327
  *
@@ -1336,7 +1347,7 @@ export declare class E2eiEnrollment {
1336
1347
  * @param directory HTTP response body
1337
1348
  * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.1.1
1338
1349
  */
1339
- directoryResponse(directory: JsonRawData): AcmeDirectory;
1350
+ directoryResponse(directory: JsonRawData): Promise<AcmeDirectory>;
1340
1351
  /**
1341
1352
  * For creating a new acme account. This returns a signed JWS-alike request body to send to
1342
1353
  * `POST /acme/{provisioner-name}/new-account`.
@@ -1344,27 +1355,27 @@ export declare class E2eiEnrollment {
1344
1355
  * @param previousNonce you got from calling `HEAD {@link AcmeDirectory.newNonce}`
1345
1356
  * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.3
1346
1357
  */
1347
- newAccountRequest(previousNonce: string): JsonRawData;
1358
+ newAccountRequest(previousNonce: string): Promise<JsonRawData>;
1348
1359
  /**
1349
1360
  * Parses the response from `POST /acme/{provisioner-name}/new-account`.
1350
1361
  * @param account HTTP response body
1351
1362
  * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.3
1352
1363
  */
1353
- newAccountResponse(account: JsonRawData): void;
1364
+ newAccountResponse(account: JsonRawData): Promise<void>;
1354
1365
  /**
1355
1366
  * Creates a new acme order for the handle (userId + display name) and the clientId.
1356
1367
  *
1357
1368
  * @param previousNonce `replay-nonce` response header from `POST /acme/{provisioner-name}/new-account`
1358
1369
  * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.4
1359
1370
  */
1360
- newOrderRequest(previousNonce: string): JsonRawData;
1371
+ newOrderRequest(previousNonce: string): Promise<JsonRawData>;
1361
1372
  /**
1362
1373
  * Parses the response from `POST /acme/{provisioner-name}/new-order`.
1363
1374
  *
1364
1375
  * @param order HTTP response body
1365
1376
  * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.4
1366
1377
  */
1367
- newOrderResponse(order: JsonRawData): NewAcmeOrder;
1378
+ newOrderResponse(order: JsonRawData): Promise<NewAcmeOrder>;
1368
1379
  /**
1369
1380
  * Creates a new authorization request.
1370
1381
  *
@@ -1373,14 +1384,14 @@ export declare class E2eiEnrollment {
1373
1384
  * previous to this method if you are creating the second authorization)
1374
1385
  * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.5
1375
1386
  */
1376
- newAuthzRequest(url: string, previousNonce: string): JsonRawData;
1387
+ newAuthzRequest(url: string, previousNonce: string): Promise<JsonRawData>;
1377
1388
  /**
1378
1389
  * Parses the response from `POST /acme/{provisioner-name}/authz/{authz-id}`
1379
1390
  *
1380
1391
  * @param authz HTTP response body
1381
1392
  * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.5
1382
1393
  */
1383
- newAuthzResponse(authz: JsonRawData): NewAcmeAuthz;
1394
+ newAuthzResponse(authz: JsonRawData): Promise<NewAcmeAuthz>;
1384
1395
  /**
1385
1396
  * Generates a new client Dpop JWT token. It demonstrates proof of possession of the nonces
1386
1397
  * (from wire-server & acme server) and will be verified by the acme server when verifying the
@@ -1392,7 +1403,7 @@ export declare class E2eiEnrollment {
1392
1403
  * @param expirySecs of the client Dpop JWT. This should be equal to the grace period set in Team Management
1393
1404
  * @param backendNonce you get by calling `GET /clients/token/nonce` on wire-server as defined here {@link https://staging-nginz-https.zinfra.io/api/swagger-ui/#/default/get_clients__client__nonce}
1394
1405
  */
1395
- createDpopToken(expirySecs: number, backendNonce: string): Uint8Array;
1406
+ createDpopToken(expirySecs: number, backendNonce: string): Promise<Uint8Array>;
1396
1407
  /**
1397
1408
  * Creates a new challenge request for Wire Dpop challenge.
1398
1409
  *
@@ -1400,22 +1411,31 @@ export declare class E2eiEnrollment {
1400
1411
  * @param previousNonce `replay-nonce` response header from `POST /acme/{provisioner-name}/authz/{authz-id}`
1401
1412
  * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.5.1
1402
1413
  */
1403
- newDpopChallengeRequest(accessToken: string, previousNonce: string): JsonRawData;
1414
+ newDpopChallengeRequest(accessToken: string, previousNonce: string): Promise<JsonRawData>;
1415
+ /**
1416
+ * Parses the response from `POST /acme/{provisioner-name}/challenge/{challenge-id}` for the DPoP challenge.
1417
+ *
1418
+ * @param challenge HTTP response body
1419
+ * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.5.1
1420
+ */
1421
+ newDpopChallengeResponse(challenge: JsonRawData): Promise<void>;
1404
1422
  /**
1405
1423
  * Creates a new challenge request for Wire Oidc challenge.
1406
1424
  *
1407
1425
  * @param idToken you get back from Identity Provider
1426
+ * @param refreshToken you get back from Identity Provider to renew the access token
1408
1427
  * @param previousNonce `replay-nonce` response header from `POST /acme/{provisioner-name}/authz/{authz-id}`
1409
1428
  * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.5.1
1410
1429
  */
1411
- newOidcChallengeRequest(idToken: string, previousNonce: string): JsonRawData;
1430
+ newOidcChallengeRequest(idToken: string, refreshToken: string, previousNonce: string): Promise<JsonRawData>;
1412
1431
  /**
1413
- * Parses the response from `POST /acme/{provisioner-name}/challenge/{challenge-id}`.
1432
+ * Parses the response from `POST /acme/{provisioner-name}/challenge/{challenge-id}` for the OIDC challenge.
1414
1433
  *
1434
+ * @param cc the CoreCrypto instance
1415
1435
  * @param challenge HTTP response body
1416
1436
  * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.5.1
1417
1437
  */
1418
- newChallengeResponse(challenge: JsonRawData): void;
1438
+ newOidcChallengeResponse(cc: CoreCrypto, challenge: JsonRawData): Promise<void>;
1419
1439
  /**
1420
1440
  * Verifies that the previous challenge has been completed.
1421
1441
  *
@@ -1423,7 +1443,7 @@ export declare class E2eiEnrollment {
1423
1443
  * @param previousNonce `replay-nonce` response header from `POST /acme/{provisioner-name}/challenge/{challenge-id}`
1424
1444
  * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.4
1425
1445
  */
1426
- checkOrderRequest(orderUrl: string, previousNonce: string): JsonRawData;
1446
+ checkOrderRequest(orderUrl: string, previousNonce: string): Promise<JsonRawData>;
1427
1447
  /**
1428
1448
  * Parses the response from `POST /acme/{provisioner-name}/order/{order-id}`.
1429
1449
  *
@@ -1431,14 +1451,14 @@ export declare class E2eiEnrollment {
1431
1451
  * @return finalize url to use with {@link finalizeRequest}
1432
1452
  * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.4
1433
1453
  */
1434
- checkOrderResponse(order: JsonRawData): string;
1454
+ checkOrderResponse(order: JsonRawData): Promise<string>;
1435
1455
  /**
1436
1456
  * Final step before fetching the certificate.
1437
1457
  *
1438
1458
  * @param previousNonce - `replay-nonce` response header from `POST /acme/{provisioner-name}/order/{order-id}`
1439
1459
  * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.4
1440
1460
  */
1441
- finalizeRequest(previousNonce: string): JsonRawData;
1461
+ finalizeRequest(previousNonce: string): Promise<JsonRawData>;
1442
1462
  /**
1443
1463
  * Parses the response from `POST /acme/{provisioner-name}/order/{order-id}/finalize`.
1444
1464
  *
@@ -1446,14 +1466,20 @@ export declare class E2eiEnrollment {
1446
1466
  * @return the certificate url to use with {@link certificateRequest}
1447
1467
  * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.4
1448
1468
  */
1449
- finalizeResponse(finalize: JsonRawData): string;
1469
+ finalizeResponse(finalize: JsonRawData): Promise<string>;
1450
1470
  /**
1451
1471
  * Creates a request for finally fetching the x509 certificate.
1452
1472
  *
1453
1473
  * @param previousNonce `replay-nonce` response header from `POST /acme/{provisioner-name}/order/{order-id}/finalize`
1454
1474
  * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.4.2
1455
1475
  */
1456
- certificateRequest(previousNonce: string): JsonRawData;
1476
+ certificateRequest(previousNonce: string): Promise<JsonRawData>;
1477
+ /**
1478
+ * Lets clients retrieve the OIDC refresh token to try to renew the user's authorization.
1479
+ * If it's expired, the user needs to reauthenticate and they will update the refresh token
1480
+ * in {@link newOidcChallengeRequest}
1481
+ */
1482
+ getRefreshToken(): Promise<String>;
1457
1483
  }
1458
1484
  /**
1459
1485
  * Indicates the state of a Conversation regarding end-to-end identity.
@@ -1468,9 +1494,9 @@ export declare enum E2eiConversationState {
1468
1494
  /**
1469
1495
  * Some clients are either still Basic or their certificate is expired
1470
1496
  */
1471
- Degraded = 2,
1497
+ NotVerified = 2,
1472
1498
  /**
1473
- * All clients are still Basic. If all client have expired certificates, Degraded is returned.
1499
+ * All clients are still Basic. If all client have expired certificates, NotVerified is returned.
1474
1500
  */
1475
1501
  NotEnabled = 3
1476
1502
  }
@@ -27,6 +27,10 @@ var getUint8Memory0 = function() {
27
27
  }
28
28
  return cachedUint8Memory0;
29
29
  };
30
+ var getStringFromWasm0 = function(ptr, len) {
31
+ ptr = ptr >>> 0;
32
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
33
+ };
30
34
  var passStringToWasm0 = function(arg, malloc, realloc) {
31
35
  if (realloc === undefined) {
32
36
  const buf = cachedTextEncoder.encode(arg);
@@ -72,10 +76,6 @@ var getFloat64Memory0 = function() {
72
76
  }
73
77
  return cachedFloat64Memory0;
74
78
  };
75
- var getStringFromWasm0 = function(ptr, len) {
76
- ptr = ptr >>> 0;
77
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
78
- };
79
79
  var getBigInt64Memory0 = function() {
80
80
  if (cachedBigInt64Memory0 === null || cachedBigInt64Memory0.byteLength === 0) {
81
81
  cachedBigInt64Memory0 = new BigInt64Array(wasm.memory.buffer);
@@ -156,13 +156,13 @@ var makeMutClosure = function(arg0, arg1, dtor, f) {
156
156
  real.original = state;
157
157
  return real;
158
158
  };
159
- var __wbg_adapter_52 = function(arg0, arg1, arg2) {
160
- wasm.wasm_bindgen__convert__closures__invoke1_mut__h0b5345ebc12af5e6(arg0, arg1, addHeapObject(arg2));
159
+ var __wbg_adapter_54 = function(arg0, arg1, arg2) {
160
+ wasm.wasm_bindgen__convert__closures__invoke1_mut__hee2344b2c4dec822(arg0, arg1, addHeapObject(arg2));
161
161
  };
162
- var __wbg_adapter_55 = function(arg0, arg1, arg2) {
162
+ var __wbg_adapter_57 = function(arg0, arg1, arg2) {
163
163
  try {
164
164
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
165
- wasm.wasm_bindgen__convert__closures__invoke1_mut__h6255f70396e441c6(retptr, arg0, arg1, addHeapObject(arg2));
165
+ wasm.wasm_bindgen__convert__closures__invoke1_mut__h0822694acdee5799(retptr, arg0, arg1, addHeapObject(arg2));
166
166
  var r0 = getInt32Memory0()[retptr / 4 + 0];
167
167
  var r1 = getInt32Memory0()[retptr / 4 + 1];
168
168
  if (r1) {
@@ -232,8 +232,8 @@ var handleError = function(f, args) {
232
232
  wasm.__wbindgen_exn_store(addHeapObject(e));
233
233
  }
234
234
  };
235
- var __wbg_adapter_395 = function(arg0, arg1, arg2, arg3) {
236
- wasm.wasm_bindgen__convert__closures__invoke2_mut__h636d2f832c212b5e(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
235
+ var __wbg_adapter_406 = function(arg0, arg1, arg2, arg3) {
236
+ wasm.wasm_bindgen__convert__closures__invoke2_mut__hb07ea52845d244dd(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
237
237
  };
238
238
  async function __wbg_load(module, imports) {
239
239
  if (typeof Response === "function" && module instanceof Response) {
@@ -262,49 +262,65 @@ async function __wbg_load(module, imports) {
262
262
  var __wbg_get_imports = function() {
263
263
  const imports = {};
264
264
  imports.wbg = {};
265
- imports.wbg.__wbindgen_number_new = function(arg0) {
266
- const ret = arg0;
265
+ imports.wbg.__wbg_proteusautoprekeybundle_new = function(arg0) {
266
+ const ret = ProteusAutoPrekeyBundle.__wrap(arg0);
267
267
  return addHeapObject(ret);
268
268
  };
269
- imports.wbg.__wbg_ffiwiree2eidentity_new = function(arg0) {
270
- const ret = FfiWireE2EIdentity.__wrap(arg0);
269
+ imports.wbg.__wbg_acmedirectory_new = function(arg0) {
270
+ const ret = AcmeDirectory.__wrap(arg0);
271
271
  return addHeapObject(ret);
272
272
  };
273
273
  imports.wbg.__wbg_proposalbundle_new = function(arg0) {
274
274
  const ret = ProposalBundle.__wrap(arg0);
275
275
  return addHeapObject(ret);
276
276
  };
277
- imports.wbg.__wbg_buffereddecryptedmessage_new = function(arg0) {
278
- const ret = BufferedDecryptedMessage.__wrap(arg0);
277
+ imports.wbg.__wbg_newacmeauthz_new = function(arg0) {
278
+ const ret = NewAcmeAuthz.__wrap(arg0);
279
279
  return addHeapObject(ret);
280
280
  };
281
- imports.wbg.__wbg_proteusautoprekeybundle_new = function(arg0) {
282
- const ret = ProteusAutoPrekeyBundle.__wrap(arg0);
281
+ imports.wbg.__wbg_commitbundle_new = function(arg0) {
282
+ const ret = CommitBundle.__wrap(arg0);
283
283
  return addHeapObject(ret);
284
284
  };
285
- imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
286
- takeObject(arg0);
285
+ imports.wbg.__wbg_newacmeorder_new = function(arg0) {
286
+ const ret = NewAcmeOrder.__wrap(arg0);
287
+ return addHeapObject(ret);
287
288
  };
288
- imports.wbg.__wbg_commitbundle_new = function(arg0) {
289
- const ret = CommitBundle.__wrap(arg0);
289
+ imports.wbg.__wbindgen_number_new = function(arg0) {
290
+ const ret = arg0;
291
+ return addHeapObject(ret);
292
+ };
293
+ imports.wbg.__wbg_buffereddecryptedmessage_new = function(arg0) {
294
+ const ret = BufferedDecryptedMessage.__wrap(arg0);
290
295
  return addHeapObject(ret);
291
296
  };
292
297
  imports.wbg.__wbg_corecrypto_new = function(arg0) {
293
298
  const ret = CoreCrypto.__wrap(arg0);
294
299
  return addHeapObject(ret);
295
300
  };
296
- imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
297
- const ret = getObject(arg0);
301
+ imports.wbg.__wbg_ffiwiree2eidentity_new = function(arg0) {
302
+ const ret = FfiWireE2EIdentity.__wrap(arg0);
298
303
  return addHeapObject(ret);
299
304
  };
300
- imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
301
- const ret = BigInt.asUintN(64, arg0);
305
+ imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
306
+ takeObject(arg0);
307
+ };
308
+ imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
309
+ const ret = getObject(arg0);
302
310
  return addHeapObject(ret);
303
311
  };
304
312
  imports.wbg.__wbindgen_is_null = function(arg0) {
305
313
  const ret = getObject(arg0) === null;
306
314
  return ret;
307
315
  };
316
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
317
+ const ret = getStringFromWasm0(arg0, arg1);
318
+ return addHeapObject(ret);
319
+ };
320
+ imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
321
+ const ret = BigInt.asUintN(64, arg0);
322
+ return addHeapObject(ret);
323
+ };
308
324
  imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
309
325
  const obj = getObject(arg1);
310
326
  const ret = typeof obj === "string" ? obj : undefined;
@@ -349,10 +365,6 @@ var __wbg_get_imports = function() {
349
365
  const ret = typeof val === "object" && val !== null;
350
366
  return ret;
351
367
  };
352
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
353
- const ret = getStringFromWasm0(arg0, arg1);
354
- return addHeapObject(ret);
355
- };
356
368
  imports.wbg.__wbg_queueMicrotask_adae4bc085237231 = function(arg0) {
357
369
  const ret = getObject(arg0).queueMicrotask;
358
370
  return addHeapObject(ret);
@@ -385,18 +397,22 @@ var __wbg_get_imports = function() {
385
397
  const ret = getObject(arg0) == getObject(arg1);
386
398
  return ret;
387
399
  };
388
- imports.wbg.__wbg_String_917f38a1211cf44b = function(arg0, arg1) {
400
+ imports.wbg.__wbindgen_as_number = function(arg0) {
401
+ const ret = +getObject(arg0);
402
+ return ret;
403
+ };
404
+ imports.wbg.__wbg_String_389b54bd9d25375f = function(arg0, arg1) {
389
405
  const ret = String(getObject(arg1));
390
406
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
391
407
  const len1 = WASM_VECTOR_LEN;
392
408
  getInt32Memory0()[arg0 / 4 + 1] = len1;
393
409
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
394
410
  };
395
- imports.wbg.__wbg_getwithrefkey_3b3c46ba20582127 = function(arg0, arg1) {
411
+ imports.wbg.__wbg_getwithrefkey_4a92a5eca60879b9 = function(arg0, arg1) {
396
412
  const ret = getObject(arg0)[getObject(arg1)];
397
413
  return addHeapObject(ret);
398
414
  };
399
- imports.wbg.__wbg_set_8761474ad72b9bf1 = function(arg0, arg1, arg2) {
415
+ imports.wbg.__wbg_set_9182712abebf82ef = function(arg0, arg1, arg2) {
400
416
  getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
401
417
  };
402
418
  imports.wbg.__wbindgen_is_falsy = function(arg0) {
@@ -870,7 +886,7 @@ var __wbg_get_imports = function() {
870
886
  const a = state0.a;
871
887
  state0.a = 0;
872
888
  try {
873
- return __wbg_adapter_395(a, state0.b, arg02, arg12);
889
+ return __wbg_adapter_406(a, state0.b, arg02, arg12);
874
890
  } finally {
875
891
  state0.a = a;
876
892
  }
@@ -950,12 +966,12 @@ var __wbg_get_imports = function() {
950
966
  const ret = wasm.memory;
951
967
  return addHeapObject(ret);
952
968
  };
953
- imports.wbg.__wbindgen_closure_wrapper2198 = function(arg0, arg1, arg2) {
954
- const ret = makeMutClosure(arg0, arg1, 356, __wbg_adapter_52);
969
+ imports.wbg.__wbindgen_closure_wrapper2304 = function(arg0, arg1, arg2) {
970
+ const ret = makeMutClosure(arg0, arg1, 424, __wbg_adapter_54);
955
971
  return addHeapObject(ret);
956
972
  };
957
- imports.wbg.__wbindgen_closure_wrapper9921 = function(arg0, arg1, arg2) {
958
- const ret = makeMutClosure(arg0, arg1, 1327, __wbg_adapter_55);
973
+ imports.wbg.__wbindgen_closure_wrapper10033 = function(arg0, arg1, arg2) {
974
+ const ret = makeMutClosure(arg0, arg1, 1396, __wbg_adapter_57);
959
975
  return addHeapObject(ret);
960
976
  };
961
977
  return imports;
@@ -991,8 +1007,14 @@ var wasm;
991
1007
  var heap = new Array(128).fill(undefined);
992
1008
  heap.push(undefined, null, true, false);
993
1009
  var heap_next = heap.length;
994
- var WASM_VECTOR_LEN = 0;
1010
+ var cachedTextDecoder = typeof TextDecoder !== "undefined" ? new TextDecoder("utf-8", { ignoreBOM: true, fatal: true }) : { decode: () => {
1011
+ throw Error("TextDecoder not available");
1012
+ } };
1013
+ if (typeof TextDecoder !== "undefined") {
1014
+ cachedTextDecoder.decode();
1015
+ }
995
1016
  var cachedUint8Memory0 = null;
1017
+ var WASM_VECTOR_LEN = 0;
996
1018
  var cachedTextEncoder = typeof TextEncoder !== "undefined" ? new TextEncoder("utf-8") : { encode: () => {
997
1019
  throw Error("TextEncoder not available");
998
1020
  } };
@@ -1008,12 +1030,6 @@ var encodeString = typeof cachedTextEncoder.encodeInto === "function" ? function
1008
1030
  };
1009
1031
  var cachedInt32Memory0 = null;
1010
1032
  var cachedFloat64Memory0 = null;
1011
- var cachedTextDecoder = typeof TextDecoder !== "undefined" ? new TextDecoder("utf-8", { ignoreBOM: true, fatal: true }) : { decode: () => {
1012
- throw Error("TextDecoder not available");
1013
- } };
1014
- if (typeof TextDecoder !== "undefined") {
1015
- cachedTextDecoder.decode();
1016
- }
1017
1033
  var cachedBigInt64Memory0 = null;
1018
1034
  var cachedUint32Memory0 = null;
1019
1035
  var cachedUint16Memory0 = null;
@@ -1031,6 +1047,12 @@ var CredentialType = Object.freeze({
1031
1047
  X509: 2,
1032
1048
  "2": "X509"
1033
1049
  });
1050
+ var WirePolicy = Object.freeze({
1051
+ Plaintext: 1,
1052
+ "1": "Plaintext",
1053
+ Ciphertext: 2,
1054
+ "2": "Ciphertext"
1055
+ });
1034
1056
  var Ciphersuite = Object.freeze({
1035
1057
  MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519: 1,
1036
1058
  "1": "MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519",
@@ -1049,12 +1071,6 @@ var Ciphersuite = Object.freeze({
1049
1071
  MLS_128_X25519KYBER768DRAFT00_AES128GCM_SHA256_Ed25519: 61489,
1050
1072
  "61489": "MLS_128_X25519KYBER768DRAFT00_AES128GCM_SHA256_Ed25519"
1051
1073
  });
1052
- var WirePolicy = Object.freeze({
1053
- Plaintext: 1,
1054
- "1": "Plaintext",
1055
- Ciphertext: 2,
1056
- "2": "Ciphertext"
1057
- });
1058
1074
 
1059
1075
  class AcmeChallenge {
1060
1076
  static __wrap(ptr) {
@@ -1341,28 +1357,24 @@ class CoreCrypto {
1341
1357
  const ret = wasm.corecrypto_e2ei_new_enrollment(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, expiry_days, ciphersuite);
1342
1358
  return takeObject(ret);
1343
1359
  }
1344
- e2ei_new_activation_enrollment(client_id, display_name, handle, team, expiry_days, ciphersuite) {
1345
- const ptr0 = passStringToWasm0(client_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1360
+ e2ei_new_activation_enrollment(display_name, handle, team, expiry_days, ciphersuite) {
1361
+ const ptr0 = passStringToWasm0(display_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1346
1362
  const len0 = WASM_VECTOR_LEN;
1347
- const ptr1 = passStringToWasm0(display_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1363
+ const ptr1 = passStringToWasm0(handle, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1348
1364
  const len1 = WASM_VECTOR_LEN;
1349
- const ptr2 = passStringToWasm0(handle, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1350
- const len2 = WASM_VECTOR_LEN;
1351
- var ptr3 = isLikeNone(team) ? 0 : passStringToWasm0(team, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1352
- var len3 = WASM_VECTOR_LEN;
1353
- const ret = wasm.corecrypto_e2ei_new_activation_enrollment(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, expiry_days, ciphersuite);
1365
+ var ptr2 = isLikeNone(team) ? 0 : passStringToWasm0(team, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1366
+ var len2 = WASM_VECTOR_LEN;
1367
+ const ret = wasm.corecrypto_e2ei_new_activation_enrollment(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, expiry_days, ciphersuite);
1354
1368
  return takeObject(ret);
1355
1369
  }
1356
- e2ei_new_rotate_enrollment(client_id, display_name, handle, team, expiry_days, ciphersuite) {
1357
- const ptr0 = passStringToWasm0(client_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1358
- const len0 = WASM_VECTOR_LEN;
1359
- var ptr1 = isLikeNone(display_name) ? 0 : passStringToWasm0(display_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1370
+ e2ei_new_rotate_enrollment(display_name, handle, team, expiry_days, ciphersuite) {
1371
+ var ptr0 = isLikeNone(display_name) ? 0 : passStringToWasm0(display_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1372
+ var len0 = WASM_VECTOR_LEN;
1373
+ var ptr1 = isLikeNone(handle) ? 0 : passStringToWasm0(handle, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1360
1374
  var len1 = WASM_VECTOR_LEN;
1361
- var ptr2 = isLikeNone(handle) ? 0 : passStringToWasm0(handle, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1375
+ var ptr2 = isLikeNone(team) ? 0 : passStringToWasm0(team, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1362
1376
  var len2 = WASM_VECTOR_LEN;
1363
- var ptr3 = isLikeNone(team) ? 0 : passStringToWasm0(team, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1364
- var len3 = WASM_VECTOR_LEN;
1365
- const ret = wasm.corecrypto_e2ei_new_rotate_enrollment(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, expiry_days, ciphersuite);
1377
+ const ret = wasm.corecrypto_e2ei_new_rotate_enrollment(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, expiry_days, ciphersuite);
1366
1378
  return takeObject(ret);
1367
1379
  }
1368
1380
  e2ei_mls_init_only(enrollment, certificate_chain, nb_key_package) {
@@ -1419,6 +1431,12 @@ class CoreCrypto {
1419
1431
  const ret = wasm.corecrypto_get_user_identities(this.__wbg_ptr, ptr0, len0, ptr1, len1);
1420
1432
  return takeObject(ret);
1421
1433
  }
1434
+ get_credential_in_use(group_info, credential_type) {
1435
+ const ptr0 = passArray8ToWasm0(group_info, wasm.__wbindgen_malloc);
1436
+ const len0 = WASM_VECTOR_LEN;
1437
+ const ret = wasm.corecrypto_get_credential_in_use(this.__wbg_ptr, ptr0, len0, credential_type);
1438
+ return takeObject(ret);
1439
+ }
1422
1440
  static version() {
1423
1441
  let deferred1_0;
1424
1442
  let deferred1_1;
@@ -1901,292 +1919,108 @@ class FfiWireE2EIdentity {
1901
1919
  wasm.__wbg_ffiwiree2eidentity_free(ptr);
1902
1920
  }
1903
1921
  directory_response(directory) {
1904
- try {
1905
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1906
- const ptr0 = passArray8ToWasm0(directory, wasm.__wbindgen_malloc);
1907
- const len0 = WASM_VECTOR_LEN;
1908
- wasm.ffiwiree2eidentity_directory_response(retptr, this.__wbg_ptr, ptr0, len0);
1909
- var r0 = getInt32Memory0()[retptr / 4 + 0];
1910
- var r1 = getInt32Memory0()[retptr / 4 + 1];
1911
- var r2 = getInt32Memory0()[retptr / 4 + 2];
1912
- if (r2) {
1913
- throw takeObject(r1);
1914
- }
1915
- return AcmeDirectory.__wrap(r0);
1916
- } finally {
1917
- wasm.__wbindgen_add_to_stack_pointer(16);
1918
- }
1922
+ const ptr0 = passArray8ToWasm0(directory, wasm.__wbindgen_malloc);
1923
+ const len0 = WASM_VECTOR_LEN;
1924
+ const ret = wasm.ffiwiree2eidentity_directory_response(this.__wbg_ptr, ptr0, len0);
1925
+ return takeObject(ret);
1919
1926
  }
1920
1927
  new_account_request(previous_nonce) {
1921
- try {
1922
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1923
- const ptr0 = passStringToWasm0(previous_nonce, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1924
- const len0 = WASM_VECTOR_LEN;
1925
- wasm.ffiwiree2eidentity_new_account_request(retptr, this.__wbg_ptr, ptr0, len0);
1926
- var r0 = getInt32Memory0()[retptr / 4 + 0];
1927
- var r1 = getInt32Memory0()[retptr / 4 + 1];
1928
- var r2 = getInt32Memory0()[retptr / 4 + 2];
1929
- if (r2) {
1930
- throw takeObject(r1);
1931
- }
1932
- return takeObject(r0);
1933
- } finally {
1934
- wasm.__wbindgen_add_to_stack_pointer(16);
1935
- }
1928
+ const ptr0 = passStringToWasm0(previous_nonce, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1929
+ const len0 = WASM_VECTOR_LEN;
1930
+ const ret = wasm.ffiwiree2eidentity_new_account_request(this.__wbg_ptr, ptr0, len0);
1931
+ return takeObject(ret);
1936
1932
  }
1937
1933
  new_account_response(account) {
1938
- try {
1939
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1940
- wasm.ffiwiree2eidentity_new_account_response(retptr, this.__wbg_ptr, addHeapObject(account));
1941
- var r0 = getInt32Memory0()[retptr / 4 + 0];
1942
- var r1 = getInt32Memory0()[retptr / 4 + 1];
1943
- var r2 = getInt32Memory0()[retptr / 4 + 2];
1944
- if (r2) {
1945
- throw takeObject(r1);
1946
- }
1947
- return takeObject(r0);
1948
- } finally {
1949
- wasm.__wbindgen_add_to_stack_pointer(16);
1950
- }
1934
+ const ret = wasm.ffiwiree2eidentity_new_account_response(this.__wbg_ptr, addHeapObject(account));
1935
+ return takeObject(ret);
1951
1936
  }
1952
1937
  new_order_request(previous_nonce) {
1953
- try {
1954
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1955
- const ptr0 = passStringToWasm0(previous_nonce, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1956
- const len0 = WASM_VECTOR_LEN;
1957
- wasm.ffiwiree2eidentity_new_order_request(retptr, this.__wbg_ptr, ptr0, len0);
1958
- var r0 = getInt32Memory0()[retptr / 4 + 0];
1959
- var r1 = getInt32Memory0()[retptr / 4 + 1];
1960
- var r2 = getInt32Memory0()[retptr / 4 + 2];
1961
- if (r2) {
1962
- throw takeObject(r1);
1963
- }
1964
- return takeObject(r0);
1965
- } finally {
1966
- wasm.__wbindgen_add_to_stack_pointer(16);
1967
- }
1938
+ const ptr0 = passStringToWasm0(previous_nonce, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1939
+ const len0 = WASM_VECTOR_LEN;
1940
+ const ret = wasm.ffiwiree2eidentity_new_order_request(this.__wbg_ptr, ptr0, len0);
1941
+ return takeObject(ret);
1968
1942
  }
1969
1943
  new_order_response(order) {
1970
- try {
1971
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1972
- wasm.ffiwiree2eidentity_new_order_response(retptr, this.__wbg_ptr, addHeapObject(order));
1973
- var r0 = getInt32Memory0()[retptr / 4 + 0];
1974
- var r1 = getInt32Memory0()[retptr / 4 + 1];
1975
- var r2 = getInt32Memory0()[retptr / 4 + 2];
1976
- if (r2) {
1977
- throw takeObject(r1);
1978
- }
1979
- return NewAcmeOrder.__wrap(r0);
1980
- } finally {
1981
- wasm.__wbindgen_add_to_stack_pointer(16);
1982
- }
1944
+ const ret = wasm.ffiwiree2eidentity_new_order_response(this.__wbg_ptr, addHeapObject(order));
1945
+ return takeObject(ret);
1983
1946
  }
1984
1947
  new_authz_request(url, previous_nonce) {
1985
- try {
1986
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1987
- const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1988
- const len0 = WASM_VECTOR_LEN;
1989
- const ptr1 = passStringToWasm0(previous_nonce, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1990
- const len1 = WASM_VECTOR_LEN;
1991
- wasm.ffiwiree2eidentity_new_authz_request(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
1992
- var r0 = getInt32Memory0()[retptr / 4 + 0];
1993
- var r1 = getInt32Memory0()[retptr / 4 + 1];
1994
- var r2 = getInt32Memory0()[retptr / 4 + 2];
1995
- if (r2) {
1996
- throw takeObject(r1);
1997
- }
1998
- return takeObject(r0);
1999
- } finally {
2000
- wasm.__wbindgen_add_to_stack_pointer(16);
2001
- }
1948
+ const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1949
+ const len0 = WASM_VECTOR_LEN;
1950
+ const ptr1 = passStringToWasm0(previous_nonce, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1951
+ const len1 = WASM_VECTOR_LEN;
1952
+ const ret = wasm.ffiwiree2eidentity_new_authz_request(this.__wbg_ptr, ptr0, len0, ptr1, len1);
1953
+ return takeObject(ret);
2002
1954
  }
2003
1955
  new_authz_response(authz) {
2004
- try {
2005
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2006
- wasm.ffiwiree2eidentity_new_authz_response(retptr, this.__wbg_ptr, addHeapObject(authz));
2007
- var r0 = getInt32Memory0()[retptr / 4 + 0];
2008
- var r1 = getInt32Memory0()[retptr / 4 + 1];
2009
- var r2 = getInt32Memory0()[retptr / 4 + 2];
2010
- if (r2) {
2011
- throw takeObject(r1);
2012
- }
2013
- return NewAcmeAuthz.__wrap(r0);
2014
- } finally {
2015
- wasm.__wbindgen_add_to_stack_pointer(16);
2016
- }
1956
+ const ret = wasm.ffiwiree2eidentity_new_authz_response(this.__wbg_ptr, addHeapObject(authz));
1957
+ return takeObject(ret);
2017
1958
  }
2018
1959
  create_dpop_token(expiry_secs, backend_nonce) {
2019
- try {
2020
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2021
- const ptr0 = passStringToWasm0(backend_nonce, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2022
- const len0 = WASM_VECTOR_LEN;
2023
- wasm.ffiwiree2eidentity_create_dpop_token(retptr, this.__wbg_ptr, expiry_secs, ptr0, len0);
2024
- var r0 = getInt32Memory0()[retptr / 4 + 0];
2025
- var r1 = getInt32Memory0()[retptr / 4 + 1];
2026
- var r2 = getInt32Memory0()[retptr / 4 + 2];
2027
- if (r2) {
2028
- throw takeObject(r1);
2029
- }
2030
- return takeObject(r0);
2031
- } finally {
2032
- wasm.__wbindgen_add_to_stack_pointer(16);
2033
- }
1960
+ const ptr0 = passStringToWasm0(backend_nonce, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1961
+ const len0 = WASM_VECTOR_LEN;
1962
+ const ret = wasm.ffiwiree2eidentity_create_dpop_token(this.__wbg_ptr, expiry_secs, ptr0, len0);
1963
+ return takeObject(ret);
2034
1964
  }
2035
1965
  new_dpop_challenge_request(access_token, previous_nonce) {
2036
- try {
2037
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2038
- const ptr0 = passStringToWasm0(access_token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2039
- const len0 = WASM_VECTOR_LEN;
2040
- const ptr1 = passStringToWasm0(previous_nonce, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2041
- const len1 = WASM_VECTOR_LEN;
2042
- wasm.ffiwiree2eidentity_new_dpop_challenge_request(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
2043
- var r0 = getInt32Memory0()[retptr / 4 + 0];
2044
- var r1 = getInt32Memory0()[retptr / 4 + 1];
2045
- var r2 = getInt32Memory0()[retptr / 4 + 2];
2046
- if (r2) {
2047
- throw takeObject(r1);
2048
- }
2049
- return takeObject(r0);
2050
- } finally {
2051
- wasm.__wbindgen_add_to_stack_pointer(16);
2052
- }
1966
+ const ptr0 = passStringToWasm0(access_token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1967
+ const len0 = WASM_VECTOR_LEN;
1968
+ const ptr1 = passStringToWasm0(previous_nonce, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1969
+ const len1 = WASM_VECTOR_LEN;
1970
+ const ret = wasm.ffiwiree2eidentity_new_dpop_challenge_request(this.__wbg_ptr, ptr0, len0, ptr1, len1);
1971
+ return takeObject(ret);
2053
1972
  }
2054
- new_oidc_challenge_request(id_token, previous_nonce) {
2055
- try {
2056
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2057
- const ptr0 = passStringToWasm0(id_token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2058
- const len0 = WASM_VECTOR_LEN;
2059
- const ptr1 = passStringToWasm0(previous_nonce, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2060
- const len1 = WASM_VECTOR_LEN;
2061
- wasm.ffiwiree2eidentity_new_oidc_challenge_request(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
2062
- var r0 = getInt32Memory0()[retptr / 4 + 0];
2063
- var r1 = getInt32Memory0()[retptr / 4 + 1];
2064
- var r2 = getInt32Memory0()[retptr / 4 + 2];
2065
- if (r2) {
2066
- throw takeObject(r1);
2067
- }
2068
- return takeObject(r0);
2069
- } finally {
2070
- wasm.__wbindgen_add_to_stack_pointer(16);
2071
- }
1973
+ new_dpop_challenge_response(challenge) {
1974
+ const ret = wasm.ffiwiree2eidentity_new_dpop_challenge_response(this.__wbg_ptr, addHeapObject(challenge));
1975
+ return takeObject(ret);
2072
1976
  }
2073
- new_challenge_response(challenge) {
2074
- try {
2075
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2076
- wasm.ffiwiree2eidentity_new_challenge_response(retptr, this.__wbg_ptr, addHeapObject(challenge));
2077
- var r0 = getInt32Memory0()[retptr / 4 + 0];
2078
- var r1 = getInt32Memory0()[retptr / 4 + 1];
2079
- var r2 = getInt32Memory0()[retptr / 4 + 2];
2080
- if (r2) {
2081
- throw takeObject(r1);
2082
- }
2083
- return takeObject(r0);
2084
- } finally {
2085
- wasm.__wbindgen_add_to_stack_pointer(16);
2086
- }
1977
+ new_oidc_challenge_request(id_token, refresh_token, previous_nonce) {
1978
+ const ptr0 = passStringToWasm0(id_token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1979
+ const len0 = WASM_VECTOR_LEN;
1980
+ const ptr1 = passStringToWasm0(refresh_token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1981
+ const len1 = WASM_VECTOR_LEN;
1982
+ const ptr2 = passStringToWasm0(previous_nonce, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1983
+ const len2 = WASM_VECTOR_LEN;
1984
+ const ret = wasm.ffiwiree2eidentity_new_oidc_challenge_request(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
1985
+ return takeObject(ret);
1986
+ }
1987
+ new_oidc_challenge_response(cc, challenge) {
1988
+ _assertClass(cc, CoreCrypto);
1989
+ var ptr0 = cc.__destroy_into_raw();
1990
+ const ret = wasm.ffiwiree2eidentity_new_oidc_challenge_response(this.__wbg_ptr, ptr0, addHeapObject(challenge));
1991
+ return takeObject(ret);
2087
1992
  }
2088
1993
  check_order_request(order_url, previous_nonce) {
2089
- try {
2090
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2091
- const ptr0 = passStringToWasm0(order_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2092
- const len0 = WASM_VECTOR_LEN;
2093
- const ptr1 = passStringToWasm0(previous_nonce, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2094
- const len1 = WASM_VECTOR_LEN;
2095
- wasm.ffiwiree2eidentity_check_order_request(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
2096
- var r0 = getInt32Memory0()[retptr / 4 + 0];
2097
- var r1 = getInt32Memory0()[retptr / 4 + 1];
2098
- var r2 = getInt32Memory0()[retptr / 4 + 2];
2099
- if (r2) {
2100
- throw takeObject(r1);
2101
- }
2102
- return takeObject(r0);
2103
- } finally {
2104
- wasm.__wbindgen_add_to_stack_pointer(16);
2105
- }
1994
+ const ptr0 = passStringToWasm0(order_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1995
+ const len0 = WASM_VECTOR_LEN;
1996
+ const ptr1 = passStringToWasm0(previous_nonce, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1997
+ const len1 = WASM_VECTOR_LEN;
1998
+ const ret = wasm.ffiwiree2eidentity_check_order_request(this.__wbg_ptr, ptr0, len0, ptr1, len1);
1999
+ return takeObject(ret);
2106
2000
  }
2107
2001
  check_order_response(order) {
2108
- let deferred2_0;
2109
- let deferred2_1;
2110
- try {
2111
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2112
- wasm.ffiwiree2eidentity_check_order_response(retptr, this.__wbg_ptr, addHeapObject(order));
2113
- var r0 = getInt32Memory0()[retptr / 4 + 0];
2114
- var r1 = getInt32Memory0()[retptr / 4 + 1];
2115
- var r2 = getInt32Memory0()[retptr / 4 + 2];
2116
- var r3 = getInt32Memory0()[retptr / 4 + 3];
2117
- var ptr1 = r0;
2118
- var len1 = r1;
2119
- if (r3) {
2120
- ptr1 = 0;
2121
- len1 = 0;
2122
- throw takeObject(r2);
2123
- }
2124
- deferred2_0 = ptr1;
2125
- deferred2_1 = len1;
2126
- return getStringFromWasm0(ptr1, len1);
2127
- } finally {
2128
- wasm.__wbindgen_add_to_stack_pointer(16);
2129
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
2130
- }
2002
+ const ret = wasm.ffiwiree2eidentity_check_order_response(this.__wbg_ptr, addHeapObject(order));
2003
+ return takeObject(ret);
2131
2004
  }
2132
2005
  finalize_request(previous_nonce) {
2133
- try {
2134
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2135
- const ptr0 = passStringToWasm0(previous_nonce, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2136
- const len0 = WASM_VECTOR_LEN;
2137
- wasm.ffiwiree2eidentity_finalize_request(retptr, this.__wbg_ptr, ptr0, len0);
2138
- var r0 = getInt32Memory0()[retptr / 4 + 0];
2139
- var r1 = getInt32Memory0()[retptr / 4 + 1];
2140
- var r2 = getInt32Memory0()[retptr / 4 + 2];
2141
- if (r2) {
2142
- throw takeObject(r1);
2143
- }
2144
- return takeObject(r0);
2145
- } finally {
2146
- wasm.__wbindgen_add_to_stack_pointer(16);
2147
- }
2006
+ const ptr0 = passStringToWasm0(previous_nonce, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2007
+ const len0 = WASM_VECTOR_LEN;
2008
+ const ret = wasm.ffiwiree2eidentity_finalize_request(this.__wbg_ptr, ptr0, len0);
2009
+ return takeObject(ret);
2148
2010
  }
2149
2011
  finalize_response(finalize) {
2150
- let deferred2_0;
2151
- let deferred2_1;
2152
- try {
2153
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2154
- wasm.ffiwiree2eidentity_finalize_response(retptr, this.__wbg_ptr, addHeapObject(finalize));
2155
- var r0 = getInt32Memory0()[retptr / 4 + 0];
2156
- var r1 = getInt32Memory0()[retptr / 4 + 1];
2157
- var r2 = getInt32Memory0()[retptr / 4 + 2];
2158
- var r3 = getInt32Memory0()[retptr / 4 + 3];
2159
- var ptr1 = r0;
2160
- var len1 = r1;
2161
- if (r3) {
2162
- ptr1 = 0;
2163
- len1 = 0;
2164
- throw takeObject(r2);
2165
- }
2166
- deferred2_0 = ptr1;
2167
- deferred2_1 = len1;
2168
- return getStringFromWasm0(ptr1, len1);
2169
- } finally {
2170
- wasm.__wbindgen_add_to_stack_pointer(16);
2171
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
2172
- }
2012
+ const ret = wasm.ffiwiree2eidentity_finalize_response(this.__wbg_ptr, addHeapObject(finalize));
2013
+ return takeObject(ret);
2173
2014
  }
2174
2015
  certificate_request(previous_nonce) {
2175
- try {
2176
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2177
- const ptr0 = passStringToWasm0(previous_nonce, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2178
- const len0 = WASM_VECTOR_LEN;
2179
- wasm.ffiwiree2eidentity_certificate_request(retptr, this.__wbg_ptr, ptr0, len0);
2180
- var r0 = getInt32Memory0()[retptr / 4 + 0];
2181
- var r1 = getInt32Memory0()[retptr / 4 + 1];
2182
- var r2 = getInt32Memory0()[retptr / 4 + 2];
2183
- if (r2) {
2184
- throw takeObject(r1);
2185
- }
2186
- return takeObject(r0);
2187
- } finally {
2188
- wasm.__wbindgen_add_to_stack_pointer(16);
2189
- }
2016
+ const ptr0 = passStringToWasm0(previous_nonce, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2017
+ const len0 = WASM_VECTOR_LEN;
2018
+ const ret = wasm.ffiwiree2eidentity_certificate_request(this.__wbg_ptr, ptr0, len0);
2019
+ return takeObject(ret);
2020
+ }
2021
+ get_refresh_token() {
2022
+ const ret = wasm.ffiwiree2eidentity_get_refresh_token(this.__wbg_ptr);
2023
+ return takeObject(ret);
2190
2024
  }
2191
2025
  }
2192
2026
 
@@ -2584,6 +2418,9 @@ var ExternalProposalType;
2584
2418
  class CoreCrypto2 {
2585
2419
  static #module;
2586
2420
  #cc;
2421
+ inner() {
2422
+ return this.#cc;
2423
+ }
2587
2424
  static #assertModuleLoaded() {
2588
2425
  if (!this.#module) {
2589
2426
  throw new Error("Internal module hasn't been initialized. Please use `await CoreCrypto.init(params)` or `await CoreCrypto.deferredInit(params)` !");
@@ -2667,7 +2504,12 @@ class CoreCrypto2 {
2667
2504
  }
2668
2505
  async createConversation(conversationId, creatorCredentialType, configuration = {}) {
2669
2506
  try {
2670
- const { ciphersuite, externalSenders, custom = {}, perDomainTrustAnchors = [] } = configuration || {};
2507
+ const {
2508
+ ciphersuite,
2509
+ externalSenders,
2510
+ custom = {},
2511
+ perDomainTrustAnchors = []
2512
+ } = configuration || {};
2671
2513
  const config = new ConversationConfiguration(ciphersuite, externalSenders, custom?.keyRotationSpan, custom?.wirePolicy, perDomainTrustAnchors);
2672
2514
  const ret = await CoreCryptoError.asyncMapErr(this.#cc.create_conversation(conversationId, creatorCredentialType, config));
2673
2515
  return ret;
@@ -2972,12 +2814,12 @@ class CoreCrypto2 {
2972
2814
  const e2ei = await CoreCryptoError.asyncMapErr(this.#cc.e2ei_new_enrollment(clientId, displayName, handle, team, expiryDays, ciphersuite));
2973
2815
  return new E2eiEnrollment(e2ei);
2974
2816
  }
2975
- async e2eiNewActivationEnrollment(clientId, displayName, handle, expiryDays, ciphersuite, team) {
2976
- const e2ei = await CoreCryptoError.asyncMapErr(this.#cc.e2ei_new_activation_enrollment(clientId, displayName, handle, team, expiryDays, ciphersuite));
2817
+ async e2eiNewActivationEnrollment(displayName, handle, expiryDays, ciphersuite, team) {
2818
+ const e2ei = await CoreCryptoError.asyncMapErr(this.#cc.e2ei_new_activation_enrollment(displayName, handle, team, expiryDays, ciphersuite));
2977
2819
  return new E2eiEnrollment(e2ei);
2978
2820
  }
2979
- async e2eiNewRotateEnrollment(clientId, expiryDays, ciphersuite, displayName, handle, team) {
2980
- const e2ei = await CoreCryptoError.asyncMapErr(this.#cc.e2ei_new_rotate_enrollment(clientId, displayName, handle, team, expiryDays, ciphersuite));
2821
+ async e2eiNewRotateEnrollment(expiryDays, ciphersuite, displayName, handle, team) {
2822
+ const e2ei = await CoreCryptoError.asyncMapErr(this.#cc.e2ei_new_rotate_enrollment(displayName, handle, team, expiryDays, ciphersuite));
2981
2823
  return new E2eiEnrollment(e2ei);
2982
2824
  }
2983
2825
  async e2eiMlsInitOnly(enrollment, certificateChain, nbKeyPackage) {
@@ -3012,6 +2854,10 @@ class CoreCrypto2 {
3012
2854
  async getUserIdentities(conversationId, userIds) {
3013
2855
  return await CoreCryptoError.asyncMapErr(this.#cc.get_user_identities(conversationId, userIds));
3014
2856
  }
2857
+ async getCredentialInUse(groupInfo, credentialType = CredentialType2.X509) {
2858
+ let state = await CoreCryptoError.asyncMapErr(this.#cc.get_credential_in_use(groupInfo, credentialType));
2859
+ return E2eiConversationState[E2eiConversationState[state]];
2860
+ }
3015
2861
  static version() {
3016
2862
  this.#assertModuleLoaded();
3017
2863
  return CoreCrypto.version();
@@ -3029,123 +2875,65 @@ class E2eiEnrollment {
3029
2875
  inner() {
3030
2876
  return this.#enrollment;
3031
2877
  }
3032
- directoryResponse(directory) {
3033
- try {
3034
- return this.#enrollment.directory_response(directory);
3035
- } catch (e) {
3036
- throw CoreCryptoError.fromStdError(e);
3037
- }
2878
+ async directoryResponse(directory) {
2879
+ return await CoreCryptoError.asyncMapErr(this.#enrollment.directory_response(directory));
3038
2880
  }
3039
- newAccountRequest(previousNonce) {
3040
- try {
3041
- return this.#enrollment.new_account_request(previousNonce);
3042
- } catch (e) {
3043
- throw CoreCryptoError.fromStdError(e);
3044
- }
2881
+ async newAccountRequest(previousNonce) {
2882
+ return await CoreCryptoError.asyncMapErr(this.#enrollment.new_account_request(previousNonce));
3045
2883
  }
3046
- newAccountResponse(account) {
3047
- try {
3048
- return this.#enrollment.new_account_response(account);
3049
- } catch (e) {
3050
- throw CoreCryptoError.fromStdError(e);
3051
- }
2884
+ async newAccountResponse(account) {
2885
+ return await CoreCryptoError.asyncMapErr(this.#enrollment.new_account_response(account));
3052
2886
  }
3053
- newOrderRequest(previousNonce) {
3054
- try {
3055
- return this.#enrollment.new_order_request(previousNonce);
3056
- } catch (e) {
3057
- throw CoreCryptoError.fromStdError(e);
3058
- }
2887
+ async newOrderRequest(previousNonce) {
2888
+ return await CoreCryptoError.asyncMapErr(this.#enrollment.new_order_request(previousNonce));
3059
2889
  }
3060
- newOrderResponse(order) {
3061
- try {
3062
- return this.#enrollment.new_order_response(order);
3063
- } catch (e) {
3064
- throw CoreCryptoError.fromStdError(e);
3065
- }
2890
+ async newOrderResponse(order) {
2891
+ return await CoreCryptoError.asyncMapErr(this.#enrollment.new_order_response(order));
3066
2892
  }
3067
- newAuthzRequest(url, previousNonce) {
3068
- try {
3069
- return this.#enrollment.new_authz_request(url, previousNonce);
3070
- } catch (e) {
3071
- throw CoreCryptoError.fromStdError(e);
3072
- }
2893
+ async newAuthzRequest(url, previousNonce) {
2894
+ return await CoreCryptoError.asyncMapErr(this.#enrollment.new_authz_request(url, previousNonce));
3073
2895
  }
3074
- newAuthzResponse(authz) {
3075
- try {
3076
- return this.#enrollment.new_authz_response(authz);
3077
- } catch (e) {
3078
- throw CoreCryptoError.fromStdError(e);
3079
- }
2896
+ async newAuthzResponse(authz) {
2897
+ return await CoreCryptoError.asyncMapErr(this.#enrollment.new_authz_response(authz));
3080
2898
  }
3081
- createDpopToken(expirySecs, backendNonce) {
3082
- try {
3083
- return this.#enrollment.create_dpop_token(expirySecs, backendNonce);
3084
- } catch (e) {
3085
- throw CoreCryptoError.fromStdError(e);
3086
- }
2899
+ async createDpopToken(expirySecs, backendNonce) {
2900
+ return await CoreCryptoError.asyncMapErr(this.#enrollment.create_dpop_token(expirySecs, backendNonce));
3087
2901
  }
3088
- newDpopChallengeRequest(accessToken, previousNonce) {
3089
- try {
3090
- return this.#enrollment.new_dpop_challenge_request(accessToken, previousNonce);
3091
- } catch (e) {
3092
- throw CoreCryptoError.fromStdError(e);
3093
- }
2902
+ async newDpopChallengeRequest(accessToken, previousNonce) {
2903
+ return await CoreCryptoError.asyncMapErr(this.#enrollment.new_dpop_challenge_request(accessToken, previousNonce));
3094
2904
  }
3095
- newOidcChallengeRequest(idToken, previousNonce) {
3096
- try {
3097
- return this.#enrollment.new_oidc_challenge_request(idToken, previousNonce);
3098
- } catch (e) {
3099
- throw CoreCryptoError.fromStdError(e);
3100
- }
2905
+ async newDpopChallengeResponse(challenge) {
2906
+ return await CoreCryptoError.asyncMapErr(this.#enrollment.new_dpop_challenge_response(challenge));
3101
2907
  }
3102
- newChallengeResponse(challenge) {
3103
- try {
3104
- return this.#enrollment.new_challenge_response(challenge);
3105
- } catch (e) {
3106
- throw CoreCryptoError.fromStdError(e);
3107
- }
2908
+ async newOidcChallengeRequest(idToken, refreshToken, previousNonce) {
2909
+ return await CoreCryptoError.asyncMapErr(this.#enrollment.new_oidc_challenge_request(idToken, refreshToken, previousNonce));
3108
2910
  }
3109
- checkOrderRequest(orderUrl, previousNonce) {
3110
- try {
3111
- return this.#enrollment.check_order_request(orderUrl, previousNonce);
3112
- } catch (e) {
3113
- throw CoreCryptoError.fromStdError(e);
3114
- }
2911
+ async newOidcChallengeResponse(cc, challenge) {
2912
+ return await CoreCryptoError.asyncMapErr(this.#enrollment.new_oidc_challenge_response(cc.inner(), challenge));
3115
2913
  }
3116
- checkOrderResponse(order) {
3117
- try {
3118
- return this.#enrollment.check_order_response(order);
3119
- } catch (e) {
3120
- throw CoreCryptoError.fromStdError(e);
3121
- }
2914
+ async checkOrderRequest(orderUrl, previousNonce) {
2915
+ return await CoreCryptoError.asyncMapErr(this.#enrollment.check_order_request(orderUrl, previousNonce));
3122
2916
  }
3123
- finalizeRequest(previousNonce) {
3124
- try {
3125
- return this.#enrollment.finalize_request(previousNonce);
3126
- } catch (e) {
3127
- throw CoreCryptoError.fromStdError(e);
3128
- }
2917
+ async checkOrderResponse(order) {
2918
+ return await CoreCryptoError.asyncMapErr(this.#enrollment.check_order_response(order));
3129
2919
  }
3130
- finalizeResponse(finalize) {
3131
- try {
3132
- return this.#enrollment.finalize_response(finalize);
3133
- } catch (e) {
3134
- throw CoreCryptoError.fromStdError(e);
3135
- }
2920
+ async finalizeRequest(previousNonce) {
2921
+ return await CoreCryptoError.asyncMapErr(this.#enrollment.finalize_request(previousNonce));
3136
2922
  }
3137
- certificateRequest(previousNonce) {
3138
- try {
3139
- return this.#enrollment.certificate_request(previousNonce);
3140
- } catch (e) {
3141
- throw CoreCryptoError.fromStdError(e);
3142
- }
2923
+ async finalizeResponse(finalize) {
2924
+ return await CoreCryptoError.asyncMapErr(this.#enrollment.finalize_response(finalize));
2925
+ }
2926
+ async certificateRequest(previousNonce) {
2927
+ return await CoreCryptoError.asyncMapErr(this.#enrollment.certificate_request(previousNonce));
2928
+ }
2929
+ async getRefreshToken() {
2930
+ return await CoreCryptoError.asyncMapErr(this.#enrollment.get_refresh_token());
3143
2931
  }
3144
2932
  }
3145
2933
  var E2eiConversationState;
3146
2934
  (function(E2eiConversationState2) {
3147
2935
  E2eiConversationState2[E2eiConversationState2["Verified"] = 1] = "Verified";
3148
- E2eiConversationState2[E2eiConversationState2["Degraded"] = 2] = "Degraded";
2936
+ E2eiConversationState2[E2eiConversationState2["NotVerified"] = 2] = "NotVerified";
3149
2937
  E2eiConversationState2[E2eiConversationState2["NotEnabled"] = 3] = "NotEnabled";
3150
2938
  })(E2eiConversationState || (E2eiConversationState = {}));
3151
2939
  export {