@wireapp/core-crypto 0.7.0-rc.3 → 0.7.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
CHANGED
Binary file
|
@@ -321,6 +321,33 @@ export interface DecryptedMessage {
|
|
321
321
|
* true when the decrypted message resulted in an epoch change i.e. it was a commit
|
322
322
|
*/
|
323
323
|
hasEpochChanged: boolean;
|
324
|
+
/**
|
325
|
+
* Identity claims present in the sender credential
|
326
|
+
* Only present when the credential is a x509 certificate
|
327
|
+
* Present for all messages
|
328
|
+
*/
|
329
|
+
identity?: WireIdentity;
|
330
|
+
}
|
331
|
+
/**
|
332
|
+
* Represents the identity claims identifying a client. Those claims are verifiable by any member in the group
|
333
|
+
*/
|
334
|
+
export interface WireIdentity {
|
335
|
+
/**
|
336
|
+
* Represents the identity claims identifying a client. Those claims are verifiable by any member in the group
|
337
|
+
*/
|
338
|
+
clientId: string;
|
339
|
+
/**
|
340
|
+
* user handle e.g. `john_wire`
|
341
|
+
*/
|
342
|
+
handle: string;
|
343
|
+
/**
|
344
|
+
* Name as displayed in the messaging application e.g. `John Fitzgerald Kennedy`
|
345
|
+
*/
|
346
|
+
displayName: string;
|
347
|
+
/**
|
348
|
+
* DNS domain for which this identity proof was generated e.g. `whitehouse.gov`
|
349
|
+
*/
|
350
|
+
domain: string;
|
324
351
|
}
|
325
352
|
/**
|
326
353
|
* Returned by all methods creating proposals. Contains a proposal message and an identifier to roll back the proposal
|
@@ -520,12 +547,12 @@ export declare class CoreCrypto {
|
|
520
547
|
/** @hidden */
|
521
548
|
private constructor();
|
522
549
|
/**
|
523
|
-
* If this returns
|
550
|
+
* If this returns `true` you **cannot** call {@link CoreCrypto.wipe} or {@link CoreCrypto.close} as they will produce an error because of the
|
524
551
|
* outstanding references that were detected.
|
525
552
|
*
|
526
553
|
* @returns the count of strong refs for this CoreCrypto instance
|
527
554
|
*/
|
528
|
-
|
555
|
+
isLocked(): boolean;
|
529
556
|
/**
|
530
557
|
* Wipes the {@link CoreCrypto} backing storage (i.e. {@link https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API | IndexedDB} database)
|
531
558
|
*
|
@@ -934,13 +961,22 @@ export declare class CoreCrypto {
|
|
934
961
|
/**
|
935
962
|
* Creates an enrollment instance with private key material you can use in order to fetch
|
936
963
|
* a new x509 certificate from the acme server.
|
937
|
-
* Make sure to call {@link WireE2eIdentity.free} to dispose this instance and its associated
|
938
|
-
* keying material.
|
939
964
|
*
|
965
|
+
* @param clientId client identifier with user b64Url encoded & clientId hex encoded e.g. `NDUyMGUyMmY2YjA3NGU3NjkyZjE1NjJjZTAwMmQ2NTQ:6add501bacd1d90e@example.com`
|
966
|
+
* @param displayName human readable name displayed in the application e.g. `Smith, Alice M (QA)`
|
967
|
+
* @param handle user handle e.g. `alice.smith.qa@example.com`
|
968
|
+
* @param expiryDays generated x509 certificate expiry
|
940
969
|
* @param ciphersuite - For generating signing key material. Only {@link Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519} is supported currently
|
941
970
|
* @returns The new {@link WireE2eIdentity} object
|
942
971
|
*/
|
943
|
-
newAcmeEnrollment(ciphersuite?: Ciphersuite): Promise<WireE2eIdentity>;
|
972
|
+
newAcmeEnrollment(clientId: string, displayName: string, handle: string, expiryDays: number, ciphersuite?: Ciphersuite): Promise<WireE2eIdentity>;
|
973
|
+
/**
|
974
|
+
* Parses the ACME server response from the endpoint fetching x509 certificates and uses it to initialize the MLS client with a certificate
|
975
|
+
*
|
976
|
+
* @param e2ei - the enrollment instance used to fetch the certificates
|
977
|
+
* @param certificateChain - the raw response from ACME server
|
978
|
+
*/
|
979
|
+
e2eiMlsInit(e2ei: WireE2eIdentity, certificateChain: string): Promise<void>;
|
944
980
|
/**
|
945
981
|
* Returns the current version of {@link CoreCrypto}
|
946
982
|
*
|
@@ -949,13 +985,15 @@ export declare class CoreCrypto {
|
|
949
985
|
static version(): string;
|
950
986
|
}
|
951
987
|
type JsonRawData = Uint8Array;
|
952
|
-
type AcmeAccount = Uint8Array;
|
953
|
-
type AcmeOrder = Uint8Array;
|
954
988
|
export declare class WireE2eIdentity {
|
955
989
|
#private;
|
956
990
|
/** @hidden */
|
957
991
|
constructor(e2ei: unknown);
|
958
992
|
free(): void;
|
993
|
+
/**
|
994
|
+
* Should only be used internally
|
995
|
+
*/
|
996
|
+
inner(): unknown;
|
959
997
|
/**
|
960
998
|
* Parses the response from `GET /acme/{provisioner-name}/directory`.
|
961
999
|
* Use this {@link AcmeDirectory} in the next step to fetch the first nonce from the acme server. Use
|
@@ -969,30 +1007,23 @@ export declare class WireE2eIdentity {
|
|
969
1007
|
* For creating a new acme account. This returns a signed JWS-alike request body to send to
|
970
1008
|
* `POST /acme/{provisioner-name}/new-account`.
|
971
1009
|
*
|
972
|
-
* @param directory you got from {@link directoryResponse}
|
973
1010
|
* @param previousNonce you got from calling `HEAD {@link AcmeDirectory.newNonce}`
|
974
1011
|
* @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.3
|
975
1012
|
*/
|
976
|
-
newAccountRequest(
|
1013
|
+
newAccountRequest(previousNonce: string): JsonRawData;
|
977
1014
|
/**
|
978
1015
|
* Parses the response from `POST /acme/{provisioner-name}/new-account`.
|
979
1016
|
* @param account HTTP response body
|
980
1017
|
* @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.3
|
981
1018
|
*/
|
982
|
-
newAccountResponse(account: JsonRawData):
|
1019
|
+
newAccountResponse(account: JsonRawData): void;
|
983
1020
|
/**
|
984
1021
|
* Creates a new acme order for the handle (userId + display name) and the clientId.
|
985
1022
|
*
|
986
|
-
* @param displayName human readable name displayed in the application e.g. `Smith, Alice M (QA)`
|
987
|
-
* @param clientId client identifier with user b64Url encoded & clientId hex encoded e.g. `NDUyMGUyMmY2YjA3NGU3NjkyZjE1NjJjZTAwMmQ2NTQ:6add501bacd1d90e@example.com`
|
988
|
-
* @param handle user handle e.g. `alice.smith.qa@example.com`
|
989
|
-
* @param expiryDays generated x509 certificate expiry
|
990
|
-
* @param directory you got from {@link directoryResponse}
|
991
|
-
* @param account you got from {@link newAccountResponse}
|
992
1023
|
* @param previousNonce `replay-nonce` response header from `POST /acme/{provisioner-name}/new-account`
|
993
1024
|
* @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.4
|
994
1025
|
*/
|
995
|
-
newOrderRequest(
|
1026
|
+
newOrderRequest(previousNonce: string): JsonRawData;
|
996
1027
|
/**
|
997
1028
|
* Parses the response from `POST /acme/{provisioner-name}/new-order`.
|
998
1029
|
*
|
@@ -1004,12 +1035,11 @@ export declare class WireE2eIdentity {
|
|
1004
1035
|
* Creates a new authorization request.
|
1005
1036
|
*
|
1006
1037
|
* @param url one of the URL in new order's authorizations (use {@link NewAcmeOrder.authorizations} from {@link newOrderResponse})
|
1007
|
-
* @param account you got from {@link newAccountResponse}
|
1008
1038
|
* @param previousNonce `replay-nonce` response header from `POST /acme/{provisioner-name}/new-order` (or from the
|
1009
1039
|
* previous to this method if you are creating the second authorization)
|
1010
1040
|
* @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.5
|
1011
1041
|
*/
|
1012
|
-
newAuthzRequest(url: string,
|
1042
|
+
newAuthzRequest(url: string, previousNonce: string): JsonRawData;
|
1013
1043
|
/**
|
1014
1044
|
* Parses the response from `POST /acme/{provisioner-name}/authz/{authz-id}`
|
1015
1045
|
*
|
@@ -1026,32 +1056,25 @@ export declare class WireE2eIdentity {
|
|
1026
1056
|
* {@link https://staging-nginz-https.zinfra.io/api/swagger-ui/#/default/post_clients__cid__access_token} on wire-server.
|
1027
1057
|
*
|
1028
1058
|
* @param accessTokenUrl backend endpoint where this token will be sent. Should be this one {@link https://staging-nginz-https.zinfra.io/api/swagger-ui/#/default/post_clients__cid__access_token}
|
1029
|
-
* @param clientId client identifier with user b64Url encoded & clientId hex encoded e.g. `NDUyMGUyMmY2YjA3NGU3NjkyZjE1NjJjZTAwMmQ2NTQ:6add501bacd1d90e@example.com`
|
1030
|
-
* @param dpopChallenge you found after {@link newAuthzResponse}
|
1031
1059
|
* @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}
|
1032
|
-
* @param expiryDays token expiry in days
|
1033
1060
|
*/
|
1034
|
-
createDpopToken(accessTokenUrl: string,
|
1061
|
+
createDpopToken(accessTokenUrl: string, backendNonce: string): Uint8Array;
|
1035
1062
|
/**
|
1036
1063
|
* Creates a new challenge request for Wire Dpop challenge.
|
1037
1064
|
*
|
1038
1065
|
* @param accessToken returned by wire-server from https://staging-nginz-https.zinfra.io/api/swagger-ui/#/default/post_clients__cid__access_token
|
1039
|
-
* @param dpopChallenge you found after {@link newAuthzResponse}
|
1040
|
-
* @param account you found after {@link newAccountResponse}
|
1041
1066
|
* @param previousNonce `replay-nonce` response header from `POST /acme/{provisioner-name}/authz/{authz-id}`
|
1042
1067
|
* @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.5.1
|
1043
1068
|
*/
|
1044
|
-
newDpopChallengeRequest(accessToken: string,
|
1069
|
+
newDpopChallengeRequest(accessToken: string, previousNonce: string): JsonRawData;
|
1045
1070
|
/**
|
1046
1071
|
* Creates a new challenge request for Wire Oidc challenge.
|
1047
1072
|
*
|
1048
1073
|
* @param idToken you get back from Identity Provider
|
1049
|
-
* @param oidcChallenge you found after {@link newAuthzResponse}
|
1050
|
-
* @param account you found after {@link newAccountResponse}
|
1051
1074
|
* @param previousNonce `replay-nonce` response header from `POST /acme/{provisioner-name}/authz/{authz-id}`
|
1052
1075
|
* @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.5.1
|
1053
1076
|
*/
|
1054
|
-
newOidcChallengeRequest(idToken: string,
|
1077
|
+
newOidcChallengeRequest(idToken: string, previousNonce: string): JsonRawData;
|
1055
1078
|
/**
|
1056
1079
|
* Parses the response from `POST /acme/{provisioner-name}/challenge/{challenge-id}`.
|
1057
1080
|
*
|
@@ -1067,46 +1090,36 @@ export declare class WireE2eIdentity {
|
|
1067
1090
|
* @param previousNonce `replay-nonce` response header from `POST /acme/{provisioner-name}/challenge/{challenge-id}`
|
1068
1091
|
* @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.4
|
1069
1092
|
*/
|
1070
|
-
checkOrderRequest(orderUrl: string,
|
1093
|
+
checkOrderRequest(orderUrl: string, previousNonce: string): JsonRawData;
|
1071
1094
|
/**
|
1072
1095
|
* Parses the response from `POST /acme/{provisioner-name}/order/{order-id}`.
|
1073
1096
|
*
|
1074
1097
|
* @param order HTTP response body
|
1075
1098
|
* @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.4
|
1076
1099
|
*/
|
1077
|
-
checkOrderResponse(order: JsonRawData):
|
1100
|
+
checkOrderResponse(order: JsonRawData): void;
|
1078
1101
|
/**
|
1079
1102
|
* Final step before fetching the certificate.
|
1080
1103
|
*
|
1081
1104
|
* @param order - order you got from {@link checkOrderResponse}
|
1082
|
-
* @param account - account you found after {@link newAccountResponse}
|
1083
1105
|
* @param previousNonce - `replay-nonce` response header from `POST /acme/{provisioner-name}/order/{order-id}`
|
1084
1106
|
* @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.4
|
1085
1107
|
*/
|
1086
|
-
finalizeRequest(
|
1108
|
+
finalizeRequest(previousNonce: string): JsonRawData;
|
1087
1109
|
/**
|
1088
1110
|
* Parses the response from `POST /acme/{provisioner-name}/order/{order-id}/finalize`.
|
1089
1111
|
*
|
1090
1112
|
* @param finalize HTTP response body
|
1091
1113
|
* @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.4
|
1092
1114
|
*/
|
1093
|
-
finalizeResponse(finalize: JsonRawData):
|
1115
|
+
finalizeResponse(finalize: JsonRawData): void;
|
1094
1116
|
/**
|
1095
1117
|
* Creates a request for finally fetching the x509 certificate.
|
1096
1118
|
*
|
1097
|
-
* @param finalize you got from {@link finalizeResponse}
|
1098
|
-
* @param account you got from {@link newAccountResponse}
|
1099
1119
|
* @param previousNonce `replay-nonce` response header from `POST /acme/{provisioner-name}/order/{order-id}/finalize`
|
1100
1120
|
* @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.4.2
|
1101
1121
|
*/
|
1102
|
-
certificateRequest(
|
1103
|
-
/**
|
1104
|
-
* Parses the response from `POST /acme/{provisioner-name}/certificate/{certificate-id}`.
|
1105
|
-
*
|
1106
|
-
* @param certificateChain HTTP string response body
|
1107
|
-
* @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.4.2
|
1108
|
-
*/
|
1109
|
-
certificateResponse(certificateChain: string): Uint8Array[];
|
1122
|
+
certificateRequest(previousNonce: string): JsonRawData;
|
1110
1123
|
}
|
1111
1124
|
/**
|
1112
1125
|
* Holds URLs of all the standard ACME endpoint supported on an ACME server.
|
@@ -1166,13 +1179,13 @@ export interface NewAcmeAuthz {
|
|
1166
1179
|
*
|
1167
1180
|
* @readonly
|
1168
1181
|
*/
|
1169
|
-
wireDpopChallenge
|
1182
|
+
wireDpopChallenge?: AcmeChallenge;
|
1170
1183
|
/**
|
1171
1184
|
* Challenge for the userId and displayName
|
1172
1185
|
*
|
1173
1186
|
* @readonly
|
1174
1187
|
*/
|
1175
|
-
wireOidcChallenge
|
1188
|
+
wireOidcChallenge?: AcmeChallenge;
|
1176
1189
|
}
|
1177
1190
|
/**
|
1178
1191
|
* For creating a challenge
|
@@ -1192,23 +1205,5 @@ export interface AcmeChallenge {
|
|
1192
1205
|
*/
|
1193
1206
|
url: string;
|
1194
1207
|
}
|
1195
|
-
/**
|
1196
|
-
* Result from finalize.
|
1197
|
-
* @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.4
|
1198
|
-
*/
|
1199
|
-
export interface AcmeFinalize {
|
1200
|
-
/**
|
1201
|
-
* Contains raw JSON data of this finalize. This is parsed by the underlying Rust library hence should not be accessed
|
1202
|
-
*
|
1203
|
-
* @readonly
|
1204
|
-
*/
|
1205
|
-
delegate: Uint8Array;
|
1206
|
-
/**
|
1207
|
-
* URL of to use for the last request to fetch the x509 certificate
|
1208
|
-
*
|
1209
|
-
* @readonly
|
1210
|
-
*/
|
1211
|
-
certificateUrl: string;
|
1212
|
-
}
|
1213
1208
|
|
1214
1209
|
export {};
|