@wireapp/core-crypto 5.0.0 → 5.2.0
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/package.json +1 -1
- package/src/core-crypto-ffi_bg.wasm +0 -0
- package/src/core-crypto-ffi_bg.wasm.d.ts +3 -3
- package/src/corecrypto.d.ts +100 -80
- package/src/corecrypto.js +31 -29
package/package.json
CHANGED
Binary file
|
@@ -234,7 +234,7 @@ export const __wbindgen_export_6: WebAssembly.Table;
|
|
234
234
|
export const __externref_drop_slice: (a: number, b: number) => void;
|
235
235
|
export const __externref_table_dealloc: (a: number) => void;
|
236
236
|
export const closure896_externref_shim: (a: number, b: number, c: any) => void;
|
237
|
-
export const
|
238
|
-
export const
|
239
|
-
export const
|
237
|
+
export const closure2581_externref_shim: (a: number, b: number, c: any) => void;
|
238
|
+
export const closure2776_externref_shim: (a: number, b: number, c: any) => void;
|
239
|
+
export const closure2865_externref_shim: (a: number, b: number, c: any, d: any) => void;
|
240
240
|
export const __wbindgen_start: () => void;
|
package/src/corecrypto.d.ts
CHANGED
@@ -1,30 +1,39 @@
|
|
1
1
|
// Generated by dts-bundle-generator v9.5.1
|
2
2
|
|
3
|
-
export interface CoreCryptoRichError {
|
4
|
-
message: string;
|
5
|
-
error_name?: string;
|
6
|
-
error_stack?: string[];
|
7
|
-
proteus_error_code?: number;
|
8
|
-
}
|
9
3
|
/**
|
10
|
-
*
|
11
|
-
*
|
12
|
-
* Whenever you're supposed to get this class (that extends `Error`) you might end up with a base `Error`
|
13
|
-
* in case the parsing of the message structure fails. This is unlikely but the case is still covered and fall backs automatically.
|
14
|
-
* More information will be found in the base `Error.cause` to inform you why the parsing has failed.
|
15
|
-
*
|
16
|
-
* Please note that in this case the extra properties will not be available.
|
4
|
+
* see [core_crypto::prelude::CiphersuiteName]
|
17
5
|
*/
|
18
|
-
export declare
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
6
|
+
export declare enum Ciphersuite {
|
7
|
+
/**
|
8
|
+
* DH KEM x25519 | AES-GCM 128 | SHA2-256 | Ed25519
|
9
|
+
*/
|
10
|
+
MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519 = 1,
|
11
|
+
/**
|
12
|
+
* DH KEM P256 | AES-GCM 128 | SHA2-256 | EcDSA P256
|
13
|
+
*/
|
14
|
+
MLS_128_DHKEMP256_AES128GCM_SHA256_P256 = 2,
|
15
|
+
/**
|
16
|
+
* DH KEM x25519 | Chacha20Poly1305 | SHA2-256 | Ed25519
|
17
|
+
*/
|
18
|
+
MLS_128_DHKEMX25519_CHACHA20POLY1305_SHA256_Ed25519 = 3,
|
19
|
+
/**
|
20
|
+
* DH KEM x448 | AES-GCM 256 | SHA2-512 | Ed448
|
21
|
+
*/
|
22
|
+
MLS_256_DHKEMX448_AES256GCM_SHA512_Ed448 = 4,
|
23
|
+
/**
|
24
|
+
* DH KEM P521 | AES-GCM 256 | SHA2-512 | EcDSA P521
|
25
|
+
*/
|
26
|
+
MLS_256_DHKEMP521_AES256GCM_SHA512_P521 = 5,
|
27
|
+
/**
|
28
|
+
* DH KEM x448 | Chacha20Poly1305 | SHA2-512 | Ed448
|
29
|
+
*/
|
30
|
+
MLS_256_DHKEMX448_CHACHA20POLY1305_SHA512_Ed448 = 6,
|
31
|
+
/**
|
32
|
+
* DH KEM P384 | AES-GCM 256 | SHA2-384 | EcDSA P384
|
33
|
+
*/
|
34
|
+
MLS_256_DHKEMP384_AES256GCM_SHA384_P384 = 7
|
26
35
|
}
|
27
|
-
declare enum Ciphersuite {
|
36
|
+
declare enum Ciphersuite$1 {
|
28
37
|
/**
|
29
38
|
* DH KEM x25519 | AES-GCM 128 | SHA2-256 | Ed25519
|
30
39
|
*/
|
@@ -74,7 +83,11 @@ declare enum WirePolicy {
|
|
74
83
|
*/
|
75
84
|
Ciphertext = 2
|
76
85
|
}
|
77
|
-
|
86
|
+
/**
|
87
|
+
* For creating a challenge.
|
88
|
+
* @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.5.1
|
89
|
+
*/
|
90
|
+
export class AcmeChallenge {
|
78
91
|
private constructor();
|
79
92
|
free(): void;
|
80
93
|
/**
|
@@ -142,13 +155,9 @@ export class BuildMetadata {
|
|
142
155
|
*/
|
143
156
|
readonly gitDirty: string;
|
144
157
|
}
|
145
|
-
|
146
|
-
* Configuration object for new conversations
|
147
|
-
* see [core_crypto::prelude::MlsConversationConfiguration]
|
148
|
-
*/
|
149
|
-
export class ConversationConfiguration {
|
158
|
+
declare class ConversationConfiguration {
|
150
159
|
free(): void;
|
151
|
-
constructor(ciphersuite?: Ciphersuite, external_senders?: (Uint8Array)[], key_rotation_span?: number, wire_policy?: WirePolicy);
|
160
|
+
constructor(ciphersuite?: Ciphersuite$1, external_senders?: (Uint8Array)[], key_rotation_span?: number, wire_policy?: WirePolicy);
|
152
161
|
/**
|
153
162
|
* List of client IDs that are allowed to be external senders
|
154
163
|
*/
|
@@ -156,7 +165,7 @@ export class ConversationConfiguration {
|
|
156
165
|
/**
|
157
166
|
* Conversation ciphersuite
|
158
167
|
*/
|
159
|
-
readonly ciphersuite: Ciphersuite | undefined;
|
168
|
+
readonly ciphersuite: Ciphersuite$1 | undefined;
|
160
169
|
/**
|
161
170
|
* Additional configuration
|
162
171
|
*/
|
@@ -198,19 +207,19 @@ declare class CoreCryptoContext {
|
|
198
207
|
*
|
199
208
|
* see [core_crypto::mls::context::CentralContext::client_public_key]
|
200
209
|
*/
|
201
|
-
client_public_key(ciphersuite: Ciphersuite, credential_type: CredentialType): Promise<any>;
|
210
|
+
client_public_key(ciphersuite: Ciphersuite$1, credential_type: CredentialType): Promise<any>;
|
202
211
|
/**
|
203
212
|
* Returns: [`WasmCryptoResult<js_sys::Array<js_sys::Uint8Array>>`]
|
204
213
|
*
|
205
214
|
* see [core_crypto::mls::context::CentralContext::get_or_create_client_keypackages]
|
206
215
|
*/
|
207
|
-
client_keypackages(ciphersuite: Ciphersuite, credential_type: CredentialType, amount_requested: number): Promise<any>;
|
216
|
+
client_keypackages(ciphersuite: Ciphersuite$1, credential_type: CredentialType, amount_requested: number): Promise<any>;
|
208
217
|
/**
|
209
218
|
* Returns: [`WasmCryptoResult<usize>`]
|
210
219
|
*
|
211
220
|
* see [core_crypto::mls::context::CentralContext::client_valid_key_packages_count]
|
212
221
|
*/
|
213
|
-
client_valid_keypackages_count(ciphersuite: Ciphersuite, credential_type: CredentialType): Promise<any>;
|
222
|
+
client_valid_keypackages_count(ciphersuite: Ciphersuite$1, credential_type: CredentialType): Promise<any>;
|
214
223
|
/**
|
215
224
|
* Returns: [`WasmCryptoResult<usize>`]
|
216
225
|
*
|
@@ -440,19 +449,19 @@ declare class CoreCryptoContext {
|
|
440
449
|
*
|
441
450
|
* see [core_crypto::mls::context::CentralContext::e2ei_new_enrollment]
|
442
451
|
*/
|
443
|
-
e2ei_new_enrollment(client_id: string, display_name: string, handle: string, team: string | undefined, expiry_sec: number, ciphersuite: Ciphersuite): Promise<any>;
|
452
|
+
e2ei_new_enrollment(client_id: string, display_name: string, handle: string, team: string | undefined, expiry_sec: number, ciphersuite: Ciphersuite$1): Promise<any>;
|
444
453
|
/**
|
445
454
|
* Returns: [`WasmCryptoResult<E2eiEnrollment>`]
|
446
455
|
*
|
447
456
|
* see [core_crypto::mls::context::CentralContext::e2ei_new_activation_enrollment]
|
448
457
|
*/
|
449
|
-
e2ei_new_activation_enrollment(display_name: string, handle: string, team: string | undefined, expiry_sec: number, ciphersuite: Ciphersuite): Promise<any>;
|
458
|
+
e2ei_new_activation_enrollment(display_name: string, handle: string, team: string | undefined, expiry_sec: number, ciphersuite: Ciphersuite$1): Promise<any>;
|
450
459
|
/**
|
451
460
|
* Returns: [`WasmCryptoResult<E2eiEnrollment>`]
|
452
461
|
*
|
453
462
|
* see [core_crypto::mls::context::CentralContext::e2ei_new_rotate_enrollment]
|
454
463
|
*/
|
455
|
-
e2ei_new_rotate_enrollment(display_name: string | undefined, handle: string | undefined, team: string | undefined, expiry_sec: number, ciphersuite: Ciphersuite): Promise<any>;
|
464
|
+
e2ei_new_rotate_enrollment(display_name: string | undefined, handle: string | undefined, team: string | undefined, expiry_sec: number, ciphersuite: Ciphersuite$1): Promise<any>;
|
456
465
|
/**
|
457
466
|
* See [core_crypto::mls::context::CentralContext::e2ei_dump_pki_env]
|
458
467
|
*/
|
@@ -494,7 +503,7 @@ declare class CoreCryptoContext {
|
|
494
503
|
*
|
495
504
|
* see [core_crypto::context::CentralContext::delete_stale_key_packages]
|
496
505
|
*/
|
497
|
-
delete_stale_key_packages(cipher_suite: Ciphersuite): Promise<any>;
|
506
|
+
delete_stale_key_packages(cipher_suite: Ciphersuite$1): Promise<any>;
|
498
507
|
/**
|
499
508
|
* see [core_crypto::mls::context::CentralContext::e2ei_enrollment_stash]
|
500
509
|
*/
|
@@ -514,7 +523,7 @@ declare class CoreCryptoContext {
|
|
514
523
|
*
|
515
524
|
* see [core_crypto::mls::context::CentralContext::e2ei_is_enabled]
|
516
525
|
*/
|
517
|
-
e2ei_is_enabled(ciphersuite: Ciphersuite): Promise<any>;
|
526
|
+
e2ei_is_enabled(ciphersuite: Ciphersuite$1): Promise<any>;
|
518
527
|
/**
|
519
528
|
* Returns [`WasmCryptoResult<Vec<WireIdentity>>`]
|
520
529
|
*
|
@@ -738,38 +747,49 @@ export class X509Identity {
|
|
738
747
|
*/
|
739
748
|
readonly notAfter: bigint;
|
740
749
|
}
|
741
|
-
|
742
|
-
* see [core_crypto::prelude::CiphersuiteName]
|
743
|
-
*/
|
744
|
-
declare enum Ciphersuite$1 {
|
745
|
-
/**
|
746
|
-
* DH KEM x25519 | AES-GCM 128 | SHA2-256 | Ed25519
|
747
|
-
*/
|
748
|
-
MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519 = 1,
|
749
|
-
/**
|
750
|
-
* DH KEM P256 | AES-GCM 128 | SHA2-256 | EcDSA P256
|
751
|
-
*/
|
752
|
-
MLS_128_DHKEMP256_AES128GCM_SHA256_P256 = 2,
|
753
|
-
/**
|
754
|
-
* DH KEM x25519 | Chacha20Poly1305 | SHA2-256 | Ed25519
|
755
|
-
*/
|
756
|
-
MLS_128_DHKEMX25519_CHACHA20POLY1305_SHA256_Ed25519 = 3,
|
750
|
+
interface ConversationConfiguration$1 {
|
757
751
|
/**
|
758
|
-
*
|
752
|
+
* The ciphersuite which should be used to encrypt this conversation.
|
759
753
|
*/
|
760
|
-
|
754
|
+
ciphersuite?: Ciphersuite;
|
761
755
|
/**
|
762
|
-
*
|
756
|
+
* List of client IDs that are allowed to be external senders
|
763
757
|
*/
|
764
|
-
|
758
|
+
externalSenders?: Uint8Array[];
|
765
759
|
/**
|
766
|
-
*
|
760
|
+
* Duration in seconds after which we will automatically force a self-update commit
|
761
|
+
* Note: This isn't currently implemented
|
767
762
|
*/
|
768
|
-
|
763
|
+
keyRotationSpan?: number;
|
769
764
|
/**
|
770
|
-
*
|
765
|
+
* Defines if handshake messages are encrypted or not
|
766
|
+
* Note: encrypted handshake messages are not supported by wire-server
|
771
767
|
*/
|
772
|
-
|
768
|
+
wirePolicy?: WirePolicy;
|
769
|
+
}
|
770
|
+
export interface CoreCryptoRichError {
|
771
|
+
message: string;
|
772
|
+
error_name?: string;
|
773
|
+
error_stack?: string[];
|
774
|
+
proteus_error_code?: number;
|
775
|
+
}
|
776
|
+
/**
|
777
|
+
* Error wrapper that takes care of extracting rich error details across the FFI (through JSON parsing)
|
778
|
+
*
|
779
|
+
* Whenever you're supposed to get this class (that extends `Error`) you might end up with a base `Error`
|
780
|
+
* in case the parsing of the message structure fails. This is unlikely but the case is still covered and fall backs automatically.
|
781
|
+
* More information will be found in the base `Error.cause` to inform you why the parsing has failed.
|
782
|
+
*
|
783
|
+
* Please note that in this case the extra properties will not be available.
|
784
|
+
*/
|
785
|
+
export declare class CoreCryptoError extends Error {
|
786
|
+
errorStack: string[];
|
787
|
+
proteusErrorCode: number | null;
|
788
|
+
private constructor();
|
789
|
+
private static fallback;
|
790
|
+
static build(msg: string, ...params: unknown[]): CoreCryptoError | Error;
|
791
|
+
static fromStdError(e: Error): CoreCryptoError | Error;
|
792
|
+
static asyncMapErr<T>(p: Promise<T>): Promise<T>;
|
773
793
|
}
|
774
794
|
declare enum CredentialType$1 {
|
775
795
|
/**
|
@@ -1280,7 +1300,7 @@ declare class CoreCryptoContext$1 {
|
|
1280
1300
|
* @param ciphersuites - All the ciphersuites supported by this MLS client
|
1281
1301
|
* @param nbKeyPackage - number of initial KeyPackage to create when initializing the client
|
1282
1302
|
*/
|
1283
|
-
mlsInit(clientId: ClientId, ciphersuites: Ciphersuite
|
1303
|
+
mlsInit(clientId: ClientId, ciphersuites: Ciphersuite[], nbKeyPackage?: number): Promise<void>;
|
1284
1304
|
/**
|
1285
1305
|
* Generates a MLS KeyPair/CredentialBundle with a temporary, random client ID.
|
1286
1306
|
* This method is designed to be used in conjunction with {@link CoreCryptoContext.mlsInitWithClientId} and represents the first step in this process
|
@@ -1288,7 +1308,7 @@ declare class CoreCryptoContext$1 {
|
|
1288
1308
|
* @param ciphersuites - All the ciphersuites supported by this MLS client
|
1289
1309
|
* @returns This returns the TLS-serialized identity key (i.e. the signature keypair's public key)
|
1290
1310
|
*/
|
1291
|
-
mlsGenerateKeypair(ciphersuites: Ciphersuite
|
1311
|
+
mlsGenerateKeypair(ciphersuites: Ciphersuite[]): Promise<Uint8Array[]>;
|
1292
1312
|
/**
|
1293
1313
|
* Updates the current temporary Client ID with the newly provided one. This is the second step in the externally-generated clients process
|
1294
1314
|
*
|
@@ -1298,7 +1318,7 @@ declare class CoreCryptoContext$1 {
|
|
1298
1318
|
* @param signaturePublicKeys - The public key you were given at the first step; This is for authentication purposes
|
1299
1319
|
* @param ciphersuites - All the ciphersuites supported by this MLS client
|
1300
1320
|
*/
|
1301
|
-
mlsInitWithClientId(clientId: ClientId, signaturePublicKeys: Uint8Array[], ciphersuites: Ciphersuite
|
1321
|
+
mlsInitWithClientId(clientId: ClientId, signaturePublicKeys: Uint8Array[], ciphersuites: Ciphersuite[]): Promise<void>;
|
1302
1322
|
/**
|
1303
1323
|
* Checks if the Client is member of a given conversation and if the MLS Group is loaded up
|
1304
1324
|
*
|
@@ -1342,7 +1362,7 @@ declare class CoreCryptoContext$1 {
|
|
1342
1362
|
*
|
1343
1363
|
* @returns the ciphersuite of the conversation
|
1344
1364
|
*/
|
1345
|
-
conversationCiphersuite(conversationId: ConversationId): Promise<Ciphersuite
|
1365
|
+
conversationCiphersuite(conversationId: ConversationId): Promise<Ciphersuite>;
|
1346
1366
|
/**
|
1347
1367
|
* Wipes and destroys the local storage of a given conversation / MLS group
|
1348
1368
|
*
|
@@ -1360,7 +1380,7 @@ declare class CoreCryptoContext$1 {
|
|
1360
1380
|
* @param configuration.externalSenders - Array of Client IDs that are qualified as external senders within the group
|
1361
1381
|
* @param configuration.custom - {@link CustomConfiguration}
|
1362
1382
|
*/
|
1363
|
-
createConversation(conversationId: ConversationId, creatorCredentialType: CredentialType$1, configuration?:
|
1383
|
+
createConversation(conversationId: ConversationId, creatorCredentialType: CredentialType$1, configuration?: ConversationConfiguration$1): Promise<any>;
|
1364
1384
|
/**
|
1365
1385
|
* Decrypts a message for a given conversation.
|
1366
1386
|
*
|
@@ -1403,14 +1423,14 @@ declare class CoreCryptoContext$1 {
|
|
1403
1423
|
* @param credentialType - of the public key to look for
|
1404
1424
|
* @returns the client's public signature key
|
1405
1425
|
*/
|
1406
|
-
clientPublicKey(ciphersuite: Ciphersuite
|
1426
|
+
clientPublicKey(ciphersuite: Ciphersuite, credentialType: CredentialType$1): Promise<Uint8Array>;
|
1407
1427
|
/**
|
1408
1428
|
*
|
1409
1429
|
* @param ciphersuite - of the KeyPackages to count
|
1410
1430
|
* @param credentialType - of the KeyPackages to count
|
1411
1431
|
* @returns The amount of valid, non-expired KeyPackages that are persisted in the backing storage
|
1412
1432
|
*/
|
1413
|
-
clientValidKeypackagesCount(ciphersuite: Ciphersuite
|
1433
|
+
clientValidKeypackagesCount(ciphersuite: Ciphersuite, credentialType: CredentialType$1): Promise<number>;
|
1414
1434
|
/**
|
1415
1435
|
* Fetches a requested amount of keypackages
|
1416
1436
|
*
|
@@ -1419,7 +1439,7 @@ declare class CoreCryptoContext$1 {
|
|
1419
1439
|
* @param amountRequested - The amount of keypackages requested
|
1420
1440
|
* @returns An array of length `amountRequested` containing TLS-serialized KeyPackages
|
1421
1441
|
*/
|
1422
|
-
clientKeypackages(ciphersuite: Ciphersuite
|
1442
|
+
clientKeypackages(ciphersuite: Ciphersuite, credentialType: CredentialType$1, amountRequested: number): Promise<Array<Uint8Array>>;
|
1423
1443
|
/**
|
1424
1444
|
* Prunes local KeyPackages after making sure they also have been deleted on the backend side
|
1425
1445
|
* You should only use this after calling {@link CoreCryptoContext.e2eiRotate} on all conversations.
|
@@ -1650,7 +1670,7 @@ declare class CoreCryptoContext$1 {
|
|
1650
1670
|
* @param team - name of the Wire team a user belongs to
|
1651
1671
|
* @returns The new {@link E2eiEnrollment} enrollment instance to use with {@link CoreCryptoContext.e2eiMlsInitOnly}
|
1652
1672
|
*/
|
1653
|
-
e2eiNewEnrollment(clientId: string, displayName: string, handle: string, expirySec: number, ciphersuite: Ciphersuite
|
1673
|
+
e2eiNewEnrollment(clientId: string, displayName: string, handle: string, expirySec: number, ciphersuite: Ciphersuite, team?: string): Promise<E2eiEnrollment>;
|
1654
1674
|
/**
|
1655
1675
|
* Generates an E2EI enrollment instance for a "regular" client (with a Basic credential) willing to migrate to E2EI.
|
1656
1676
|
* Once the enrollment is finished, use {@link CoreCryptoContext.e2eiRotate} to do key rotation.
|
@@ -1662,7 +1682,7 @@ declare class CoreCryptoContext$1 {
|
|
1662
1682
|
* @param team - name of the Wire team a user belongs to
|
1663
1683
|
* @returns The new {@link E2eiEnrollment} enrollment instance to use with {@link CoreCryptoContext.e2eiRotate}
|
1664
1684
|
*/
|
1665
|
-
e2eiNewActivationEnrollment(displayName: string, handle: string, expirySec: number, ciphersuite: Ciphersuite
|
1685
|
+
e2eiNewActivationEnrollment(displayName: string, handle: string, expirySec: number, ciphersuite: Ciphersuite, team?: string): Promise<E2eiEnrollment>;
|
1666
1686
|
/**
|
1667
1687
|
* Generates an E2EI enrollment instance for a E2EI client (with a X509 certificate credential)
|
1668
1688
|
* having to change/rotate their credential, either because the former one is expired or it
|
@@ -1677,7 +1697,7 @@ declare class CoreCryptoContext$1 {
|
|
1677
1697
|
* @param team - name of the Wire team a user belongs to
|
1678
1698
|
* @returns The new {@link E2eiEnrollment} enrollment instance to use with {@link CoreCryptoContext.e2eiRotate}
|
1679
1699
|
*/
|
1680
|
-
e2eiNewRotateEnrollment(expirySec: number, ciphersuite: Ciphersuite
|
1700
|
+
e2eiNewRotateEnrollment(expirySec: number, ciphersuite: Ciphersuite, displayName?: string, handle?: string, team?: string): Promise<E2eiEnrollment>;
|
1681
1701
|
/**
|
1682
1702
|
* Use this method to initialize end-to-end identity when a client signs up and the grace period is already expired ;
|
1683
1703
|
* that means he cannot initialize with a Basic credential
|
@@ -1763,7 +1783,7 @@ declare class CoreCryptoContext$1 {
|
|
1763
1783
|
* saved x509 credential and the provided signature scheme.
|
1764
1784
|
* @param cipherSuite
|
1765
1785
|
*/
|
1766
|
-
deleteStaleKeyPackages(cipherSuite: Ciphersuite
|
1786
|
+
deleteStaleKeyPackages(cipherSuite: Ciphersuite): Promise<void>;
|
1767
1787
|
/**
|
1768
1788
|
* Allows persisting an active enrollment (for example while redirecting the user during OAuth) in order to resume
|
1769
1789
|
* it later with {@link e2eiEnrollmentStashPop}
|
@@ -1793,7 +1813,7 @@ declare class CoreCryptoContext$1 {
|
|
1793
1813
|
* @param ciphersuite of the credential to check
|
1794
1814
|
* @returns true if end-to-end identity is enabled for the given ciphersuite
|
1795
1815
|
*/
|
1796
|
-
e2eiIsEnabled(ciphersuite: Ciphersuite
|
1816
|
+
e2eiIsEnabled(ciphersuite: Ciphersuite): Promise<boolean>;
|
1797
1817
|
/**
|
1798
1818
|
* From a given conversation, get the identity of the members supplied. Identity is only present for members with a
|
1799
1819
|
* Certificate Credential (after turning on end-to-end identity).
|
@@ -1860,7 +1880,7 @@ export interface CoreCryptoParams extends CoreCryptoDeferredParams {
|
|
1860
1880
|
/**
|
1861
1881
|
* All the ciphersuites this MLS client can support
|
1862
1882
|
*/
|
1863
|
-
ciphersuites: Ciphersuite
|
1883
|
+
ciphersuites: Ciphersuite[];
|
1864
1884
|
/**
|
1865
1885
|
* Number of initial KeyPackage to create when initializing the client
|
1866
1886
|
*/
|
@@ -2025,7 +2045,7 @@ export declare class CoreCrypto {
|
|
2025
2045
|
*
|
2026
2046
|
* @returns the ciphersuite of the conversation
|
2027
2047
|
*/
|
2028
|
-
conversationCiphersuite(conversationId: ConversationId): Promise<Ciphersuite
|
2048
|
+
conversationCiphersuite(conversationId: ConversationId): Promise<Ciphersuite>;
|
2029
2049
|
/**
|
2030
2050
|
* See {@link CoreCryptoContext.clientPublicKey}.
|
2031
2051
|
*
|
@@ -2033,7 +2053,7 @@ export declare class CoreCrypto {
|
|
2033
2053
|
* @param credentialType - of the public key to look for
|
2034
2054
|
* @returns the client's public signature key
|
2035
2055
|
*/
|
2036
|
-
clientPublicKey(ciphersuite: Ciphersuite
|
2056
|
+
clientPublicKey(ciphersuite: Ciphersuite, credentialType: CredentialType$1): Promise<Uint8Array>;
|
2037
2057
|
/**
|
2038
2058
|
* See {@link CoreCryptoContext.exportSecretKey}.
|
2039
2059
|
*
|
@@ -2131,7 +2151,7 @@ export declare class CoreCrypto {
|
|
2131
2151
|
* @param ciphersuite of the credential to check
|
2132
2152
|
* @returns true if end-to-end identity is enabled for the given ciphersuite
|
2133
2153
|
*/
|
2134
|
-
e2eiIsEnabled(ciphersuite: Ciphersuite
|
2154
|
+
e2eiIsEnabled(ciphersuite: Ciphersuite): Promise<boolean>;
|
2135
2155
|
/**
|
2136
2156
|
* See {@link CoreCryptoContext.getDeviceIdentities}.
|
2137
2157
|
*
|
@@ -2166,7 +2186,7 @@ export declare class CoreCrypto {
|
|
2166
2186
|
}
|
2167
2187
|
|
2168
2188
|
export {
|
2169
|
-
|
2189
|
+
ConversationConfiguration$1 as ConversationConfiguration,
|
2170
2190
|
CoreCryptoContext$1 as CoreCryptoContext,
|
2171
2191
|
CredentialType$1 as CredentialType,
|
2172
2192
|
WirePolicy$1 as WirePolicy,
|
package/src/corecrypto.js
CHANGED
@@ -22,6 +22,17 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
22
22
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
23
23
|
});
|
24
24
|
|
25
|
+
// src/Ciphersuite.ts
|
26
|
+
var Ciphersuite;
|
27
|
+
((Ciphersuite2) => {
|
28
|
+
Ciphersuite2[Ciphersuite2["MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519"] = 1] = "MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519";
|
29
|
+
Ciphersuite2[Ciphersuite2["MLS_128_DHKEMP256_AES128GCM_SHA256_P256"] = 2] = "MLS_128_DHKEMP256_AES128GCM_SHA256_P256";
|
30
|
+
Ciphersuite2[Ciphersuite2["MLS_128_DHKEMX25519_CHACHA20POLY1305_SHA256_Ed25519"] = 3] = "MLS_128_DHKEMX25519_CHACHA20POLY1305_SHA256_Ed25519";
|
31
|
+
Ciphersuite2[Ciphersuite2["MLS_256_DHKEMX448_AES256GCM_SHA512_Ed448"] = 4] = "MLS_256_DHKEMX448_AES256GCM_SHA512_Ed448";
|
32
|
+
Ciphersuite2[Ciphersuite2["MLS_256_DHKEMP521_AES256GCM_SHA512_P521"] = 5] = "MLS_256_DHKEMP521_AES256GCM_SHA512_P521";
|
33
|
+
Ciphersuite2[Ciphersuite2["MLS_256_DHKEMX448_CHACHA20POLY1305_SHA512_Ed448"] = 6] = "MLS_256_DHKEMX448_CHACHA20POLY1305_SHA512_Ed448";
|
34
|
+
Ciphersuite2[Ciphersuite2["MLS_256_DHKEMP384_AES256GCM_SHA384_P384"] = 7] = "MLS_256_DHKEMP384_AES256GCM_SHA384_P384";
|
35
|
+
})(Ciphersuite ||= {});
|
25
36
|
// src/CoreCryptoError.ts
|
26
37
|
class CoreCryptoError extends Error {
|
27
38
|
errorStack;
|
@@ -299,15 +310,15 @@ function __wbg_adapter_60(arg0, arg1, arg2) {
|
|
299
310
|
wasm.closure896_externref_shim(arg0, arg1, arg2);
|
300
311
|
}
|
301
312
|
function __wbg_adapter_63(arg0, arg1, arg2) {
|
302
|
-
wasm.
|
313
|
+
wasm.closure2581_externref_shim(arg0, arg1, arg2);
|
303
314
|
}
|
304
315
|
function __wbg_adapter_66(arg0, arg1, arg2) {
|
305
|
-
wasm.
|
316
|
+
wasm.closure2776_externref_shim(arg0, arg1, arg2);
|
306
317
|
}
|
307
318
|
function __wbg_adapter_506(arg0, arg1, arg2, arg3) {
|
308
|
-
wasm.
|
319
|
+
wasm.closure2865_externref_shim(arg0, arg1, arg2, arg3);
|
309
320
|
}
|
310
|
-
var
|
321
|
+
var Ciphersuite2 = Object.freeze({
|
311
322
|
MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519: 1,
|
312
323
|
"1": "MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519",
|
313
324
|
MLS_128_DHKEMP256_AES128GCM_SHA256_P256: 2,
|
@@ -2094,7 +2105,7 @@ function __wbg_get_imports() {
|
|
2094
2105
|
const ret = Object.entries(arg0);
|
2095
2106
|
return ret;
|
2096
2107
|
};
|
2097
|
-
imports.wbg.
|
2108
|
+
imports.wbg.__wbg_epochchanged_e8c8becbe2fbb9d4 = function() {
|
2098
2109
|
return handleError(function(arg0, arg1, arg2, arg3) {
|
2099
2110
|
var v0 = getArrayU8FromWasm0(arg1, arg2).slice();
|
2100
2111
|
wasm.__wbindgen_free(arg1, arg2 * 1, 1);
|
@@ -2126,7 +2137,7 @@ function __wbg_get_imports() {
|
|
2126
2137
|
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
2127
2138
|
}, arguments);
|
2128
2139
|
};
|
2129
|
-
imports.wbg.
|
2140
|
+
imports.wbg.__wbg_execute_e839de2fc4a6dc9b = function() {
|
2130
2141
|
return handleError(function(arg0, arg1) {
|
2131
2142
|
const ret = arg0.execute(CoreCryptoContext.__wrap(arg1));
|
2132
2143
|
return ret;
|
@@ -2709,12 +2720,12 @@ function __wbg_get_imports() {
|
|
2709
2720
|
const ret = false;
|
2710
2721
|
return ret;
|
2711
2722
|
};
|
2712
|
-
imports.wbg.
|
2713
|
-
const ret = makeMutClosure(arg0, arg1,
|
2723
|
+
imports.wbg.__wbindgen_closure_wrapper13824 = function(arg0, arg1, arg2) {
|
2724
|
+
const ret = makeMutClosure(arg0, arg1, 2582, __wbg_adapter_63);
|
2714
2725
|
return ret;
|
2715
2726
|
};
|
2716
|
-
imports.wbg.
|
2717
|
-
const ret = makeMutClosure(arg0, arg1,
|
2727
|
+
imports.wbg.__wbindgen_closure_wrapper14861 = function(arg0, arg1, arg2) {
|
2728
|
+
const ret = makeMutClosure(arg0, arg1, 2777, __wbg_adapter_66);
|
2718
2729
|
return ret;
|
2719
2730
|
};
|
2720
2731
|
imports.wbg.__wbindgen_closure_wrapper3692 = function(arg0, arg1, arg2) {
|
@@ -2849,16 +2860,6 @@ async function __wbg_init(module_or_path) {
|
|
2849
2860
|
var core_crypto_ffi_default = __wbg_init;
|
2850
2861
|
|
2851
2862
|
// src/CoreCryptoMLS.ts
|
2852
|
-
var Ciphersuite2;
|
2853
|
-
((Ciphersuite3) => {
|
2854
|
-
Ciphersuite3[Ciphersuite3["MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519"] = 1] = "MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519";
|
2855
|
-
Ciphersuite3[Ciphersuite3["MLS_128_DHKEMP256_AES128GCM_SHA256_P256"] = 2] = "MLS_128_DHKEMP256_AES128GCM_SHA256_P256";
|
2856
|
-
Ciphersuite3[Ciphersuite3["MLS_128_DHKEMX25519_CHACHA20POLY1305_SHA256_Ed25519"] = 3] = "MLS_128_DHKEMX25519_CHACHA20POLY1305_SHA256_Ed25519";
|
2857
|
-
Ciphersuite3[Ciphersuite3["MLS_256_DHKEMX448_AES256GCM_SHA512_Ed448"] = 4] = "MLS_256_DHKEMX448_AES256GCM_SHA512_Ed448";
|
2858
|
-
Ciphersuite3[Ciphersuite3["MLS_256_DHKEMP521_AES256GCM_SHA512_P521"] = 5] = "MLS_256_DHKEMP521_AES256GCM_SHA512_P521";
|
2859
|
-
Ciphersuite3[Ciphersuite3["MLS_256_DHKEMX448_CHACHA20POLY1305_SHA512_Ed448"] = 6] = "MLS_256_DHKEMX448_CHACHA20POLY1305_SHA512_Ed448";
|
2860
|
-
Ciphersuite3[Ciphersuite3["MLS_256_DHKEMP384_AES256GCM_SHA384_P384"] = 7] = "MLS_256_DHKEMP384_AES256GCM_SHA384_P384";
|
2861
|
-
})(Ciphersuite2 ||= {});
|
2862
2863
|
var CredentialType2;
|
2863
2864
|
((CredentialType3) => {
|
2864
2865
|
CredentialType3[CredentialType3["Basic"] = 1] = "Basic";
|
@@ -2994,6 +2995,12 @@ var E2eiConversationState;
|
|
2994
2995
|
E2eiConversationState2[E2eiConversationState2["NotEnabled"] = 3] = "NotEnabled";
|
2995
2996
|
})(E2eiConversationState ||= {});
|
2996
2997
|
|
2998
|
+
// src/ConversationConfiguration.ts
|
2999
|
+
function conversationConfigurationToFfi(cc) {
|
3000
|
+
const ciphersuite = cc.ciphersuite ? normalizeEnum(Ciphersuite2, cc.ciphersuite) : undefined;
|
3001
|
+
return new ConversationConfiguration(ciphersuite, cc.externalSenders, cc.keyRotationSpan, cc.wirePolicy);
|
3002
|
+
}
|
3003
|
+
|
2997
3004
|
// src/CoreCryptoContext.ts
|
2998
3005
|
class CoreCryptoContext2 {
|
2999
3006
|
#ctx;
|
@@ -3037,12 +3044,7 @@ class CoreCryptoContext2 {
|
|
3037
3044
|
return await CoreCryptoError.asyncMapErr(this.#ctx.wipe_conversation(conversationId));
|
3038
3045
|
}
|
3039
3046
|
async createConversation(conversationId, creatorCredentialType, configuration = {}) {
|
3040
|
-
const
|
3041
|
-
ciphersuite,
|
3042
|
-
externalSenders,
|
3043
|
-
custom = {}
|
3044
|
-
} = configuration || {};
|
3045
|
-
const config = new ConversationConfiguration(ciphersuite, externalSenders, custom?.keyRotationSpan, custom?.wirePolicy);
|
3047
|
+
const config = conversationConfigurationToFfi(configuration);
|
3046
3048
|
return await CoreCryptoError.asyncMapErr(this.#ctx.create_conversation(conversationId, creatorCredentialType, config));
|
3047
3049
|
}
|
3048
3050
|
async decryptMessage(conversationId, payload) {
|
@@ -3509,7 +3511,7 @@ export {
|
|
3509
3511
|
CoreCryptoError,
|
3510
3512
|
CoreCryptoContext2 as CoreCryptoContext,
|
3511
3513
|
CoreCrypto2 as CoreCrypto,
|
3512
|
-
|
3513
|
-
|
3514
|
-
|
3514
|
+
Ciphersuite,
|
3515
|
+
BuildMetadata2 as BuildMetadata,
|
3516
|
+
AcmeChallenge
|
3515
3517
|
};
|