@mocanetwork/airkit 1.6.0-beta.4 → 1.6.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/airkit.cjs.js +119 -8
- package/dist/airkit.esm.js +119 -8
- package/dist/airkit.umd.js +119 -8
- package/dist/types/authMessageService.d.ts +6 -0
- package/dist/types/common/air/messaging/auth.d.ts +13 -1
- package/dist/types/common/air/messaging/credential.d.ts +9 -1
- package/dist/types/common/air/messaging/messageServiceBase.d.ts +1 -2
- package/dist/types/common/air/messaging/recovery.d.ts +5 -2
- package/dist/types/common/air/messaging/wallet.d.ts +10 -2
- package/dist/types/credentialMessageService.d.ts +2 -0
- package/dist/types/recoveryMessageService.d.ts +1 -0
- package/dist/types/walletMessageService.d.ts +3 -0
- package/package.json +1 -1
package/dist/airkit.cjs.js
CHANGED
|
@@ -97,7 +97,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
97
97
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
98
98
|
};
|
|
99
99
|
|
|
100
|
-
var version = "1.6.0-beta.
|
|
100
|
+
var version = "1.6.0-beta.5";
|
|
101
101
|
var airkitPackage = {
|
|
102
102
|
version: version};
|
|
103
103
|
|
|
@@ -116,6 +116,7 @@ const AirAuthMessageTypes = {
|
|
|
116
116
|
REFRESH_TOKEN_RESPONSE: "air_auth_refresh_token_response",
|
|
117
117
|
WALLET_TOKEN_REQUEST: "air_auth_wallet_token_request",
|
|
118
118
|
WALLET_TOKEN_RESPONSE: "air_auth_wallet_token_response",
|
|
119
|
+
INIT_WALLET_COMMUNICATION: "air_auth_init_wallet_communication",
|
|
119
120
|
IFRAME_VISIBILITY_REQUEST: "air_auth_iframe_visibility_request",
|
|
120
121
|
SETUP_WALLET_REQUEST: "air_auth_setup_wallet_request",
|
|
121
122
|
SETUP_WALLET_RESPONSE: "air_auth_setup_wallet_response",
|
|
@@ -129,10 +130,15 @@ const AirAuthMessageTypes = {
|
|
|
129
130
|
PARTNER_ACCESS_TOKEN_RESPONSE: "air_auth_partner_access_token_response",
|
|
130
131
|
LOGOUT_REQUEST: "air_auth_logout_request",
|
|
131
132
|
LOGOUT_RESPONSE: "air_auth_logout_response",
|
|
133
|
+
RESET_WALLET_COMMUNICATION: "air_auth_reset_wallet_communication",
|
|
134
|
+
INIT_RECOVERY_COMMUNICATION: "air_auth_init_recovery_communication",
|
|
135
|
+
RESET_RECOVERY_COMMUNICATION: "air_auth_reset_recovery_communication",
|
|
132
136
|
START_RECOVERY_REQUEST: "air_start_recovery_request",
|
|
133
137
|
START_RECOVERY_RESPONSE: "air_start_recovery_response",
|
|
134
138
|
RECOVERY_REQUEST: "air_auth_recovery_request",
|
|
135
139
|
RECOVERY_RESPONSE: "air_auth_recovery_response",
|
|
140
|
+
INIT_CREDENTIAL_COMMUNICATION: "air_auth_init_credential_communication",
|
|
141
|
+
RESET_CREDENTIAL_COMMUNICATION: "air_auth_reset_credential_communication",
|
|
136
142
|
EXPIRED_LOGOUT_REQUEST: "air_auth_expired_logout_request"
|
|
137
143
|
};
|
|
138
144
|
|
|
@@ -140,6 +146,10 @@ const AirCredentialMessageTypes = {
|
|
|
140
146
|
SERVICE_STARTED: "air_credential_service_started",
|
|
141
147
|
INITIALIZATION_REQUEST: "air_credential_initialization_request",
|
|
142
148
|
INITIALIZATION_RESPONSE: "air_credential_initialization_response",
|
|
149
|
+
INIT_AUTH_COMMUNICATION: "air_credential_init_auth_communication",
|
|
150
|
+
CREDENTIAL_AUTH_INITIALIZED: "air_credential_auth_initialized",
|
|
151
|
+
INIT_WALLET_COMMUNICATION: "air_credential_init_wallet_communication",
|
|
152
|
+
CREDENTIAL_WALLET_INITIALIZED: "air_credential_wallet_initialized",
|
|
143
153
|
CREDENTIAL_IFRAME_VISIBILITY_REQUEST: "air_credential_iframe_visibility_request",
|
|
144
154
|
LOGOUT_REQUEST: "air_credential_logout_request",
|
|
145
155
|
LOGOUT_RESPONSE: "air_credential_logout_response",
|
|
@@ -155,6 +165,7 @@ const AirRecoveryMessageTypes = {
|
|
|
155
165
|
SERVICE_STARTED: "air_recovery_service_started",
|
|
156
166
|
INITIALIZATION_REQUEST: "air_recovery_initialization_request",
|
|
157
167
|
INITIALIZATION_RESPONSE: "air_recovery_initialization_response",
|
|
168
|
+
INIT_AUTH_COMMUNICATION: "air_recovery_init_auth_communication",
|
|
158
169
|
RECOVERY_INITIALIZED: "air_recovery_initialized",
|
|
159
170
|
RECOVERY_IFRAME_VISIBILITY_REQUEST: "air_recovery_iframe_visibility_request",
|
|
160
171
|
LOGOUT_REQUEST: "air_recovery_logout_request",
|
|
@@ -167,6 +178,7 @@ const AirWalletMessageTypes = {
|
|
|
167
178
|
INITIALIZATION_RESPONSE: "air_initialization_response",
|
|
168
179
|
CLOSE_MODAL_REQUEST: "air_close_modal_request",
|
|
169
180
|
CLOSE_MODAL_RESPONSE: "air_close_modal_response",
|
|
181
|
+
INIT_AUTH_COMMUNICATION: "air_init_auth_communication",
|
|
170
182
|
WALLET_INITIALIZED: "air_wallet_initialized",
|
|
171
183
|
WALLET_LOGIN_REQUEST: "air_wallet_login_request",
|
|
172
184
|
WALLET_LOGIN_RESPONSE: "air_wallet_login_response",
|
|
@@ -185,6 +197,8 @@ const AirWalletMessageTypes = {
|
|
|
185
197
|
IS_SMART_ACCOUNT_DEPLOYED_RESPONSE: "air_is_smart_account_deployed_response",
|
|
186
198
|
LOGOUT_REQUEST: "air_logout_request",
|
|
187
199
|
LOGOUT_RESPONSE: "air_logout_response",
|
|
200
|
+
INIT_CREDENTIAL_COMMUNICATION: "air_init_credential_communication",
|
|
201
|
+
RESET_CREDENTIAL_COMMUNICATION: "air_reset_credential_communication",
|
|
188
202
|
INTERNAL_PROVIDER_REQUEST: "air_internal_provider_request",
|
|
189
203
|
INTERNAL_PROVIDER_RESPONSE: "air_internal_provider_response"
|
|
190
204
|
};
|
|
@@ -1671,7 +1685,6 @@ class AirError extends BaseError {}
|
|
|
1671
1685
|
new Set(AirClientUserErrors);
|
|
1672
1686
|
new Set(Object.values(Codes));
|
|
1673
1687
|
|
|
1674
|
-
class OutgoingMessageEvent extends MessageEvent {}
|
|
1675
1688
|
class MessageServiceBase {
|
|
1676
1689
|
get events$() {
|
|
1677
1690
|
return this._events$;
|
|
@@ -1687,16 +1700,13 @@ class MessageServiceBase {
|
|
|
1687
1700
|
this.allowedMessageTypes = allowedMessageTypes;
|
|
1688
1701
|
this.closeListener = null;
|
|
1689
1702
|
}
|
|
1690
|
-
static _getName(name, targetName) {
|
|
1691
|
-
return `${name} Service: ${targetName} Channel`;
|
|
1692
|
-
}
|
|
1693
1703
|
async _open(target) {
|
|
1694
1704
|
await this.close();
|
|
1695
1705
|
this.eventSubject = new Subject();
|
|
1696
1706
|
this._events$ = this.eventSubject.asObservable();
|
|
1697
1707
|
this._messages$ = this.eventSubject.pipe(map(ev => ev.data));
|
|
1698
1708
|
this._events$.subscribe(event => {
|
|
1699
|
-
const sentOrReceived = event
|
|
1709
|
+
const sentOrReceived = event.origin === window.origin ? "sent" : "received";
|
|
1700
1710
|
log.debug(`[${this.name}] Message ${sentOrReceived}:`, JSON.stringify(event.data, bigIntReplacer));
|
|
1701
1711
|
});
|
|
1702
1712
|
const handleMessage = async ev => {
|
|
@@ -1768,7 +1778,7 @@ class MessageServiceBase {
|
|
|
1768
1778
|
log.debug(`[${this.name}] Not opened yet`);
|
|
1769
1779
|
return;
|
|
1770
1780
|
}
|
|
1771
|
-
this.eventSubject.next(new
|
|
1781
|
+
this.eventSubject.next(new MessageEvent("message", {
|
|
1772
1782
|
data: clonedMessage,
|
|
1773
1783
|
origin: window.origin
|
|
1774
1784
|
}));
|
|
@@ -1933,6 +1943,8 @@ const ALLOWED_AUTH_MESSAGES = [
|
|
|
1933
1943
|
AirAuthMessageTypes.LOGIN_RESPONSE,
|
|
1934
1944
|
AirAuthMessageTypes.SETUP_WALLET_REQUEST,
|
|
1935
1945
|
AirAuthMessageTypes.SETUP_RECOVERY_REQUEST,
|
|
1946
|
+
AirAuthMessageTypes.INIT_RECOVERY_COMMUNICATION,
|
|
1947
|
+
AirAuthMessageTypes.RESET_RECOVERY_COMMUNICATION,
|
|
1936
1948
|
AirAuthMessageTypes.LOGOUT_RESPONSE,
|
|
1937
1949
|
AirAuthMessageTypes.PARTNER_USER_INFO_RESPONSE,
|
|
1938
1950
|
AirAuthMessageTypes.CROSS_PARTNER_TOKEN_RESPONSE,
|
|
@@ -1953,6 +1965,11 @@ class AuthMessageService extends MessageServiceBase {
|
|
|
1953
1965
|
const window = authIframe.contentWindow;
|
|
1954
1966
|
await super._open({ window, origin });
|
|
1955
1967
|
}
|
|
1968
|
+
async initWalletCommunication() {
|
|
1969
|
+
await this.sendMessage({
|
|
1970
|
+
type: AirAuthMessageTypes.INIT_WALLET_COMMUNICATION,
|
|
1971
|
+
});
|
|
1972
|
+
}
|
|
1956
1973
|
async sendPartnerUserInfoRequest() {
|
|
1957
1974
|
const response = firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirAuthMessageTypes.PARTNER_USER_INFO_RESPONSE)));
|
|
1958
1975
|
await this.sendMessage({
|
|
@@ -1974,6 +1991,9 @@ class AuthMessageService extends MessageServiceBase {
|
|
|
1974
1991
|
await this.sendMessage({ type: AirAuthMessageTypes.LOGOUT_REQUEST });
|
|
1975
1992
|
return response;
|
|
1976
1993
|
}
|
|
1994
|
+
async resetWalletCommunication() {
|
|
1995
|
+
await this.sendMessage({ type: AirAuthMessageTypes.RESET_WALLET_COMMUNICATION });
|
|
1996
|
+
}
|
|
1977
1997
|
async sendInitializationRequest(payload) {
|
|
1978
1998
|
const response = firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirAuthMessageTypes.INITIALIZATION_RESPONSE)));
|
|
1979
1999
|
await this.sendMessage({ type: AirAuthMessageTypes.INITIALIZATION_REQUEST, payload });
|
|
@@ -1990,6 +2010,16 @@ class AuthMessageService extends MessageServiceBase {
|
|
|
1990
2010
|
async sendSetupWalletErrorResponse(error) {
|
|
1991
2011
|
await this.sendMessage(this.createErrorResponseMessage(AirAuthMessageTypes.SETUP_WALLET_RESPONSE, error));
|
|
1992
2012
|
}
|
|
2013
|
+
async initRecoveryCommunication() {
|
|
2014
|
+
await this.sendMessage({
|
|
2015
|
+
type: AirAuthMessageTypes.INIT_RECOVERY_COMMUNICATION,
|
|
2016
|
+
});
|
|
2017
|
+
}
|
|
2018
|
+
async resetRecoveryCommunication() {
|
|
2019
|
+
await this.sendMessage({
|
|
2020
|
+
type: AirAuthMessageTypes.RESET_RECOVERY_COMMUNICATION,
|
|
2021
|
+
});
|
|
2022
|
+
}
|
|
1993
2023
|
async sendSetupRecoverySuccessResponse() {
|
|
1994
2024
|
await this.sendMessage({
|
|
1995
2025
|
type: AirAuthMessageTypes.SETUP_RECOVERY_RESPONSE,
|
|
@@ -2026,6 +2056,19 @@ class AuthMessageService extends MessageServiceBase {
|
|
|
2026
2056
|
await this.sendMessage({ type: AirAuthMessageTypes.START_RECOVERY_REQUEST, payload });
|
|
2027
2057
|
return response;
|
|
2028
2058
|
}
|
|
2059
|
+
/*
|
|
2060
|
+
* Initialize credential communication
|
|
2061
|
+
*/
|
|
2062
|
+
async initCredentialCommunication() {
|
|
2063
|
+
await this.sendMessage({
|
|
2064
|
+
type: AirAuthMessageTypes.INIT_CREDENTIAL_COMMUNICATION,
|
|
2065
|
+
});
|
|
2066
|
+
}
|
|
2067
|
+
async resetCredentialCommunication() {
|
|
2068
|
+
await this.sendMessage({
|
|
2069
|
+
type: AirAuthMessageTypes.RESET_CREDENTIAL_COMMUNICATION,
|
|
2070
|
+
});
|
|
2071
|
+
}
|
|
2029
2072
|
}
|
|
2030
2073
|
_a$3 = AuthMessageService;
|
|
2031
2074
|
_AuthMessageService_instance = { value: void 0 };
|
|
@@ -2034,6 +2077,8 @@ var _a$2, _CredentialMessageService_instance;
|
|
|
2034
2077
|
const ALLOWED_CREDENTIAL_MESSAGES = [
|
|
2035
2078
|
AirCredentialMessageTypes.INITIALIZATION_RESPONSE,
|
|
2036
2079
|
AirCredentialMessageTypes.CREDENTIAL_IFRAME_VISIBILITY_REQUEST,
|
|
2080
|
+
AirCredentialMessageTypes.CREDENTIAL_AUTH_INITIALIZED,
|
|
2081
|
+
AirCredentialMessageTypes.CREDENTIAL_WALLET_INITIALIZED,
|
|
2037
2082
|
AirCredentialMessageTypes.LOGOUT_RESPONSE,
|
|
2038
2083
|
AirCredentialMessageTypes.ISSUE_CREDENTIAL_RESPONSE,
|
|
2039
2084
|
AirCredentialMessageTypes.VERIFY_CREDENTIAL_RESPONSE,
|
|
@@ -2059,6 +2104,20 @@ class CredentialMessageService extends MessageServiceBase {
|
|
|
2059
2104
|
});
|
|
2060
2105
|
return response;
|
|
2061
2106
|
}
|
|
2107
|
+
async initAuthCommunication() {
|
|
2108
|
+
const response = firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirCredentialMessageTypes.CREDENTIAL_AUTH_INITIALIZED)));
|
|
2109
|
+
await this.sendMessage({
|
|
2110
|
+
type: AirCredentialMessageTypes.INIT_AUTH_COMMUNICATION,
|
|
2111
|
+
});
|
|
2112
|
+
return response;
|
|
2113
|
+
}
|
|
2114
|
+
async initWalletCommunication() {
|
|
2115
|
+
const response = firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirCredentialMessageTypes.CREDENTIAL_WALLET_INITIALIZED)));
|
|
2116
|
+
await this.sendMessage({
|
|
2117
|
+
type: AirCredentialMessageTypes.INIT_WALLET_COMMUNICATION,
|
|
2118
|
+
});
|
|
2119
|
+
return response;
|
|
2120
|
+
}
|
|
2062
2121
|
async logout() {
|
|
2063
2122
|
const response = firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirCredentialMessageTypes.LOGOUT_RESPONSE)));
|
|
2064
2123
|
await this.sendMessage({
|
|
@@ -2179,6 +2238,11 @@ class RecoveryMessageService extends MessageServiceBase {
|
|
|
2179
2238
|
});
|
|
2180
2239
|
return response;
|
|
2181
2240
|
}
|
|
2241
|
+
async initAuthCommunication() {
|
|
2242
|
+
await this.sendMessage({
|
|
2243
|
+
type: AirRecoveryMessageTypes.INIT_AUTH_COMMUNICATION,
|
|
2244
|
+
});
|
|
2245
|
+
}
|
|
2182
2246
|
async onInitialized() {
|
|
2183
2247
|
return firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirRecoveryMessageTypes.RECOVERY_INITIALIZED)));
|
|
2184
2248
|
}
|
|
@@ -2225,6 +2289,14 @@ class WalletMessageService extends MessageServiceBase {
|
|
|
2225
2289
|
const window = walletIframe.contentWindow;
|
|
2226
2290
|
await super._open({ window, origin });
|
|
2227
2291
|
}
|
|
2292
|
+
async initAuthCommunication(skipWalletLogin) {
|
|
2293
|
+
await this.sendMessage({
|
|
2294
|
+
type: AirWalletMessageTypes.INIT_AUTH_COMMUNICATION,
|
|
2295
|
+
payload: {
|
|
2296
|
+
skipWalletLogin,
|
|
2297
|
+
},
|
|
2298
|
+
});
|
|
2299
|
+
}
|
|
2228
2300
|
async sendDeploySmartAccountRequest() {
|
|
2229
2301
|
const response = firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirWalletMessageTypes.DEPLOY_SMART_ACCOUNT_RESPONSE)));
|
|
2230
2302
|
await this.sendMessage({
|
|
@@ -2318,6 +2390,16 @@ class WalletMessageService extends MessageServiceBase {
|
|
|
2318
2390
|
});
|
|
2319
2391
|
return response;
|
|
2320
2392
|
}
|
|
2393
|
+
async initCredentialCommunication() {
|
|
2394
|
+
await this.sendMessage({
|
|
2395
|
+
type: AirWalletMessageTypes.INIT_CREDENTIAL_COMMUNICATION,
|
|
2396
|
+
});
|
|
2397
|
+
}
|
|
2398
|
+
async resetCredentialCommunication() {
|
|
2399
|
+
await this.sendMessage({
|
|
2400
|
+
type: AirWalletMessageTypes.RESET_CREDENTIAL_COMMUNICATION,
|
|
2401
|
+
});
|
|
2402
|
+
}
|
|
2321
2403
|
}
|
|
2322
2404
|
_a = WalletMessageService;
|
|
2323
2405
|
_WalletMessageService_instance = { value: void 0 };
|
|
@@ -2957,7 +3039,13 @@ _AirService_loginResult = new WeakMap(), _AirService_buildEnv = new WeakMap(), _
|
|
|
2957
3039
|
await __classPrivateFieldGet(this, _AirService_credentialMessagingService, "f").open(__classPrivateFieldGet(this, _AirService_credentialIframeController, "f").iframeElement);
|
|
2958
3040
|
__classPrivateFieldGet(this, _AirService_instances, "m", _AirService_subscribeToCredentialEvents).call(this);
|
|
2959
3041
|
await credentialInitRequestPromise;
|
|
3042
|
+
await __classPrivateFieldGet(this, _AirService_authMessagingService, "f").initCredentialCommunication();
|
|
3043
|
+
await __classPrivateFieldGet(this, _AirService_credentialMessagingService, "f").initAuthCommunication();
|
|
3044
|
+
log.info("[Embed] Credential auth channel initialized");
|
|
2960
3045
|
await __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureWallet).call(this);
|
|
3046
|
+
await __classPrivateFieldGet(this, _AirService_walletMessagingService, "f").initCredentialCommunication();
|
|
3047
|
+
await __classPrivateFieldGet(this, _AirService_credentialMessagingService, "f").initWalletCommunication();
|
|
3048
|
+
log.info("[Embed] Credential wallet channel initialized");
|
|
2961
3049
|
log.info("Credential service initialized successfully");
|
|
2962
3050
|
}
|
|
2963
3051
|
catch (error) {
|
|
@@ -2988,6 +3076,14 @@ _AirService_loginResult = new WeakMap(), _AirService_buildEnv = new WeakMap(), _
|
|
|
2988
3076
|
__classPrivateFieldGet(this, _AirService_credentialIframeController, "f").destroy();
|
|
2989
3077
|
__classPrivateFieldSet(this, _AirService_credentialIframeController, undefined, "f");
|
|
2990
3078
|
}
|
|
3079
|
+
const walletIframeElement = __classPrivateFieldGet(this, _AirService_walletIframeController, "f")?.iframeElement;
|
|
3080
|
+
if (isElement(walletIframeElement) && window.document.body.contains(walletIframeElement)) {
|
|
3081
|
+
await __classPrivateFieldGet(this, _AirService_walletMessagingService, "f").resetCredentialCommunication();
|
|
3082
|
+
}
|
|
3083
|
+
const authIframeElement = __classPrivateFieldGet(this, _AirService_authIframeController, "f")?.iframeElement;
|
|
3084
|
+
if (isElement(authIframeElement) && window.document.body.contains(authIframeElement)) {
|
|
3085
|
+
await __classPrivateFieldGet(this, _AirService_authMessagingService, "f").resetCredentialCommunication();
|
|
3086
|
+
}
|
|
2991
3087
|
await __classPrivateFieldGet(this, _AirService_credentialMessagingService, "f").close();
|
|
2992
3088
|
__classPrivateFieldSet(this, _AirService_credentialsInitialization, undefined, "f");
|
|
2993
3089
|
}, _AirService_ensureWallet = async function _AirService_ensureWallet(option) {
|
|
@@ -3054,6 +3150,8 @@ _AirService_loginResult = new WeakMap(), _AirService_buildEnv = new WeakMap(), _
|
|
|
3054
3150
|
if (!this.isLoggedIn && !option?.skipWalletLogin) {
|
|
3055
3151
|
await __classPrivateFieldGet(this, _AirService_authMessagingService, "f").onLoggedIn();
|
|
3056
3152
|
}
|
|
3153
|
+
await __classPrivateFieldGet(this, _AirService_authMessagingService, "f").initWalletCommunication();
|
|
3154
|
+
await __classPrivateFieldGet(this, _AirService_walletMessagingService, "f").initAuthCommunication(option?.skipWalletLogin ?? false);
|
|
3057
3155
|
const walletInitResult = await walletInitPromise;
|
|
3058
3156
|
if (walletInitResult.payload.success !== true) {
|
|
3059
3157
|
throw new AirServiceError(walletInitResult.payload.errorName, walletInitResult.payload.errorMessage);
|
|
@@ -3172,6 +3270,10 @@ _AirService_loginResult = new WeakMap(), _AirService_buildEnv = new WeakMap(), _
|
|
|
3172
3270
|
__classPrivateFieldGet(this, _AirService_walletIframeController, "f").destroy();
|
|
3173
3271
|
__classPrivateFieldSet(this, _AirService_walletIframeController, undefined, "f");
|
|
3174
3272
|
}
|
|
3273
|
+
const authIframeElement = __classPrivateFieldGet(this, _AirService_authIframeController, "f")?.iframeElement;
|
|
3274
|
+
if (isElement(authIframeElement) && window.document.body.contains(authIframeElement)) {
|
|
3275
|
+
await __classPrivateFieldGet(this, _AirService_authMessagingService, "f").resetWalletCommunication();
|
|
3276
|
+
}
|
|
3175
3277
|
// Close the message service
|
|
3176
3278
|
await __classPrivateFieldGet(this, _AirService_walletMessagingService, "f").close();
|
|
3177
3279
|
__classPrivateFieldSet(this, _AirService_walletLoggedInResult, undefined, "f");
|
|
@@ -3225,7 +3327,12 @@ _AirService_loginResult = new WeakMap(), _AirService_buildEnv = new WeakMap(), _
|
|
|
3225
3327
|
__classPrivateFieldGet(this, _AirService_instances, "m", _AirService_subscribeToRecoveryEvents).call(this);
|
|
3226
3328
|
const recoveryInitPromise = __classPrivateFieldGet(this, _AirService_recoveryMessagingService, "f").onInitialized();
|
|
3227
3329
|
await recoveryInitRequestPromise;
|
|
3228
|
-
await
|
|
3330
|
+
await __classPrivateFieldGet(this, _AirService_authMessagingService, "f").initRecoveryCommunication();
|
|
3331
|
+
await __classPrivateFieldGet(this, _AirService_recoveryMessagingService, "f").initAuthCommunication();
|
|
3332
|
+
const recoveryInitResult = await recoveryInitPromise;
|
|
3333
|
+
if (recoveryInitResult.payload.success !== true) {
|
|
3334
|
+
throw new AirServiceError(recoveryInitResult.payload.errorName, recoveryInitResult.payload.errorMessage);
|
|
3335
|
+
}
|
|
3229
3336
|
}
|
|
3230
3337
|
catch (error) {
|
|
3231
3338
|
log.error("Error initializing recovery", error);
|
|
@@ -3253,6 +3360,10 @@ _AirService_loginResult = new WeakMap(), _AirService_buildEnv = new WeakMap(), _
|
|
|
3253
3360
|
__classPrivateFieldGet(this, _AirService_recoveryIframeController, "f").destroy();
|
|
3254
3361
|
__classPrivateFieldSet(this, _AirService_recoveryIframeController, undefined, "f");
|
|
3255
3362
|
}
|
|
3363
|
+
const authIframeElement = __classPrivateFieldGet(this, _AirService_authIframeController, "f")?.iframeElement;
|
|
3364
|
+
if (isElement(authIframeElement) && window.document.body.contains(authIframeElement)) {
|
|
3365
|
+
await __classPrivateFieldGet(this, _AirService_authMessagingService, "f").resetRecoveryCommunication();
|
|
3366
|
+
}
|
|
3256
3367
|
// Close the message service
|
|
3257
3368
|
await __classPrivateFieldGet(this, _AirService_recoveryMessagingService, "f").close();
|
|
3258
3369
|
__classPrivateFieldSet(this, _AirService_recoveryInitialization, undefined, "f");
|
package/dist/airkit.esm.js
CHANGED
|
@@ -95,7 +95,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
95
95
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
96
96
|
};
|
|
97
97
|
|
|
98
|
-
var version = "1.6.0-beta.
|
|
98
|
+
var version = "1.6.0-beta.5";
|
|
99
99
|
var airkitPackage = {
|
|
100
100
|
version: version};
|
|
101
101
|
|
|
@@ -114,6 +114,7 @@ const AirAuthMessageTypes = {
|
|
|
114
114
|
REFRESH_TOKEN_RESPONSE: "air_auth_refresh_token_response",
|
|
115
115
|
WALLET_TOKEN_REQUEST: "air_auth_wallet_token_request",
|
|
116
116
|
WALLET_TOKEN_RESPONSE: "air_auth_wallet_token_response",
|
|
117
|
+
INIT_WALLET_COMMUNICATION: "air_auth_init_wallet_communication",
|
|
117
118
|
IFRAME_VISIBILITY_REQUEST: "air_auth_iframe_visibility_request",
|
|
118
119
|
SETUP_WALLET_REQUEST: "air_auth_setup_wallet_request",
|
|
119
120
|
SETUP_WALLET_RESPONSE: "air_auth_setup_wallet_response",
|
|
@@ -127,10 +128,15 @@ const AirAuthMessageTypes = {
|
|
|
127
128
|
PARTNER_ACCESS_TOKEN_RESPONSE: "air_auth_partner_access_token_response",
|
|
128
129
|
LOGOUT_REQUEST: "air_auth_logout_request",
|
|
129
130
|
LOGOUT_RESPONSE: "air_auth_logout_response",
|
|
131
|
+
RESET_WALLET_COMMUNICATION: "air_auth_reset_wallet_communication",
|
|
132
|
+
INIT_RECOVERY_COMMUNICATION: "air_auth_init_recovery_communication",
|
|
133
|
+
RESET_RECOVERY_COMMUNICATION: "air_auth_reset_recovery_communication",
|
|
130
134
|
START_RECOVERY_REQUEST: "air_start_recovery_request",
|
|
131
135
|
START_RECOVERY_RESPONSE: "air_start_recovery_response",
|
|
132
136
|
RECOVERY_REQUEST: "air_auth_recovery_request",
|
|
133
137
|
RECOVERY_RESPONSE: "air_auth_recovery_response",
|
|
138
|
+
INIT_CREDENTIAL_COMMUNICATION: "air_auth_init_credential_communication",
|
|
139
|
+
RESET_CREDENTIAL_COMMUNICATION: "air_auth_reset_credential_communication",
|
|
134
140
|
EXPIRED_LOGOUT_REQUEST: "air_auth_expired_logout_request"
|
|
135
141
|
};
|
|
136
142
|
|
|
@@ -138,6 +144,10 @@ const AirCredentialMessageTypes = {
|
|
|
138
144
|
SERVICE_STARTED: "air_credential_service_started",
|
|
139
145
|
INITIALIZATION_REQUEST: "air_credential_initialization_request",
|
|
140
146
|
INITIALIZATION_RESPONSE: "air_credential_initialization_response",
|
|
147
|
+
INIT_AUTH_COMMUNICATION: "air_credential_init_auth_communication",
|
|
148
|
+
CREDENTIAL_AUTH_INITIALIZED: "air_credential_auth_initialized",
|
|
149
|
+
INIT_WALLET_COMMUNICATION: "air_credential_init_wallet_communication",
|
|
150
|
+
CREDENTIAL_WALLET_INITIALIZED: "air_credential_wallet_initialized",
|
|
141
151
|
CREDENTIAL_IFRAME_VISIBILITY_REQUEST: "air_credential_iframe_visibility_request",
|
|
142
152
|
LOGOUT_REQUEST: "air_credential_logout_request",
|
|
143
153
|
LOGOUT_RESPONSE: "air_credential_logout_response",
|
|
@@ -153,6 +163,7 @@ const AirRecoveryMessageTypes = {
|
|
|
153
163
|
SERVICE_STARTED: "air_recovery_service_started",
|
|
154
164
|
INITIALIZATION_REQUEST: "air_recovery_initialization_request",
|
|
155
165
|
INITIALIZATION_RESPONSE: "air_recovery_initialization_response",
|
|
166
|
+
INIT_AUTH_COMMUNICATION: "air_recovery_init_auth_communication",
|
|
156
167
|
RECOVERY_INITIALIZED: "air_recovery_initialized",
|
|
157
168
|
RECOVERY_IFRAME_VISIBILITY_REQUEST: "air_recovery_iframe_visibility_request",
|
|
158
169
|
LOGOUT_REQUEST: "air_recovery_logout_request",
|
|
@@ -165,6 +176,7 @@ const AirWalletMessageTypes = {
|
|
|
165
176
|
INITIALIZATION_RESPONSE: "air_initialization_response",
|
|
166
177
|
CLOSE_MODAL_REQUEST: "air_close_modal_request",
|
|
167
178
|
CLOSE_MODAL_RESPONSE: "air_close_modal_response",
|
|
179
|
+
INIT_AUTH_COMMUNICATION: "air_init_auth_communication",
|
|
168
180
|
WALLET_INITIALIZED: "air_wallet_initialized",
|
|
169
181
|
WALLET_LOGIN_REQUEST: "air_wallet_login_request",
|
|
170
182
|
WALLET_LOGIN_RESPONSE: "air_wallet_login_response",
|
|
@@ -183,6 +195,8 @@ const AirWalletMessageTypes = {
|
|
|
183
195
|
IS_SMART_ACCOUNT_DEPLOYED_RESPONSE: "air_is_smart_account_deployed_response",
|
|
184
196
|
LOGOUT_REQUEST: "air_logout_request",
|
|
185
197
|
LOGOUT_RESPONSE: "air_logout_response",
|
|
198
|
+
INIT_CREDENTIAL_COMMUNICATION: "air_init_credential_communication",
|
|
199
|
+
RESET_CREDENTIAL_COMMUNICATION: "air_reset_credential_communication",
|
|
186
200
|
INTERNAL_PROVIDER_REQUEST: "air_internal_provider_request",
|
|
187
201
|
INTERNAL_PROVIDER_RESPONSE: "air_internal_provider_response"
|
|
188
202
|
};
|
|
@@ -1669,7 +1683,6 @@ class AirError extends BaseError {}
|
|
|
1669
1683
|
new Set(AirClientUserErrors);
|
|
1670
1684
|
new Set(Object.values(Codes));
|
|
1671
1685
|
|
|
1672
|
-
class OutgoingMessageEvent extends MessageEvent {}
|
|
1673
1686
|
class MessageServiceBase {
|
|
1674
1687
|
get events$() {
|
|
1675
1688
|
return this._events$;
|
|
@@ -1685,16 +1698,13 @@ class MessageServiceBase {
|
|
|
1685
1698
|
this.allowedMessageTypes = allowedMessageTypes;
|
|
1686
1699
|
this.closeListener = null;
|
|
1687
1700
|
}
|
|
1688
|
-
static _getName(name, targetName) {
|
|
1689
|
-
return `${name} Service: ${targetName} Channel`;
|
|
1690
|
-
}
|
|
1691
1701
|
async _open(target) {
|
|
1692
1702
|
await this.close();
|
|
1693
1703
|
this.eventSubject = new Subject();
|
|
1694
1704
|
this._events$ = this.eventSubject.asObservable();
|
|
1695
1705
|
this._messages$ = this.eventSubject.pipe(map(ev => ev.data));
|
|
1696
1706
|
this._events$.subscribe(event => {
|
|
1697
|
-
const sentOrReceived = event
|
|
1707
|
+
const sentOrReceived = event.origin === window.origin ? "sent" : "received";
|
|
1698
1708
|
log.debug(`[${this.name}] Message ${sentOrReceived}:`, JSON.stringify(event.data, bigIntReplacer));
|
|
1699
1709
|
});
|
|
1700
1710
|
const handleMessage = async ev => {
|
|
@@ -1766,7 +1776,7 @@ class MessageServiceBase {
|
|
|
1766
1776
|
log.debug(`[${this.name}] Not opened yet`);
|
|
1767
1777
|
return;
|
|
1768
1778
|
}
|
|
1769
|
-
this.eventSubject.next(new
|
|
1779
|
+
this.eventSubject.next(new MessageEvent("message", {
|
|
1770
1780
|
data: clonedMessage,
|
|
1771
1781
|
origin: window.origin
|
|
1772
1782
|
}));
|
|
@@ -1931,6 +1941,8 @@ const ALLOWED_AUTH_MESSAGES = [
|
|
|
1931
1941
|
AirAuthMessageTypes.LOGIN_RESPONSE,
|
|
1932
1942
|
AirAuthMessageTypes.SETUP_WALLET_REQUEST,
|
|
1933
1943
|
AirAuthMessageTypes.SETUP_RECOVERY_REQUEST,
|
|
1944
|
+
AirAuthMessageTypes.INIT_RECOVERY_COMMUNICATION,
|
|
1945
|
+
AirAuthMessageTypes.RESET_RECOVERY_COMMUNICATION,
|
|
1934
1946
|
AirAuthMessageTypes.LOGOUT_RESPONSE,
|
|
1935
1947
|
AirAuthMessageTypes.PARTNER_USER_INFO_RESPONSE,
|
|
1936
1948
|
AirAuthMessageTypes.CROSS_PARTNER_TOKEN_RESPONSE,
|
|
@@ -1951,6 +1963,11 @@ class AuthMessageService extends MessageServiceBase {
|
|
|
1951
1963
|
const window = authIframe.contentWindow;
|
|
1952
1964
|
await super._open({ window, origin });
|
|
1953
1965
|
}
|
|
1966
|
+
async initWalletCommunication() {
|
|
1967
|
+
await this.sendMessage({
|
|
1968
|
+
type: AirAuthMessageTypes.INIT_WALLET_COMMUNICATION,
|
|
1969
|
+
});
|
|
1970
|
+
}
|
|
1954
1971
|
async sendPartnerUserInfoRequest() {
|
|
1955
1972
|
const response = firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirAuthMessageTypes.PARTNER_USER_INFO_RESPONSE)));
|
|
1956
1973
|
await this.sendMessage({
|
|
@@ -1972,6 +1989,9 @@ class AuthMessageService extends MessageServiceBase {
|
|
|
1972
1989
|
await this.sendMessage({ type: AirAuthMessageTypes.LOGOUT_REQUEST });
|
|
1973
1990
|
return response;
|
|
1974
1991
|
}
|
|
1992
|
+
async resetWalletCommunication() {
|
|
1993
|
+
await this.sendMessage({ type: AirAuthMessageTypes.RESET_WALLET_COMMUNICATION });
|
|
1994
|
+
}
|
|
1975
1995
|
async sendInitializationRequest(payload) {
|
|
1976
1996
|
const response = firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirAuthMessageTypes.INITIALIZATION_RESPONSE)));
|
|
1977
1997
|
await this.sendMessage({ type: AirAuthMessageTypes.INITIALIZATION_REQUEST, payload });
|
|
@@ -1988,6 +2008,16 @@ class AuthMessageService extends MessageServiceBase {
|
|
|
1988
2008
|
async sendSetupWalletErrorResponse(error) {
|
|
1989
2009
|
await this.sendMessage(this.createErrorResponseMessage(AirAuthMessageTypes.SETUP_WALLET_RESPONSE, error));
|
|
1990
2010
|
}
|
|
2011
|
+
async initRecoveryCommunication() {
|
|
2012
|
+
await this.sendMessage({
|
|
2013
|
+
type: AirAuthMessageTypes.INIT_RECOVERY_COMMUNICATION,
|
|
2014
|
+
});
|
|
2015
|
+
}
|
|
2016
|
+
async resetRecoveryCommunication() {
|
|
2017
|
+
await this.sendMessage({
|
|
2018
|
+
type: AirAuthMessageTypes.RESET_RECOVERY_COMMUNICATION,
|
|
2019
|
+
});
|
|
2020
|
+
}
|
|
1991
2021
|
async sendSetupRecoverySuccessResponse() {
|
|
1992
2022
|
await this.sendMessage({
|
|
1993
2023
|
type: AirAuthMessageTypes.SETUP_RECOVERY_RESPONSE,
|
|
@@ -2024,6 +2054,19 @@ class AuthMessageService extends MessageServiceBase {
|
|
|
2024
2054
|
await this.sendMessage({ type: AirAuthMessageTypes.START_RECOVERY_REQUEST, payload });
|
|
2025
2055
|
return response;
|
|
2026
2056
|
}
|
|
2057
|
+
/*
|
|
2058
|
+
* Initialize credential communication
|
|
2059
|
+
*/
|
|
2060
|
+
async initCredentialCommunication() {
|
|
2061
|
+
await this.sendMessage({
|
|
2062
|
+
type: AirAuthMessageTypes.INIT_CREDENTIAL_COMMUNICATION,
|
|
2063
|
+
});
|
|
2064
|
+
}
|
|
2065
|
+
async resetCredentialCommunication() {
|
|
2066
|
+
await this.sendMessage({
|
|
2067
|
+
type: AirAuthMessageTypes.RESET_CREDENTIAL_COMMUNICATION,
|
|
2068
|
+
});
|
|
2069
|
+
}
|
|
2027
2070
|
}
|
|
2028
2071
|
_a$3 = AuthMessageService;
|
|
2029
2072
|
_AuthMessageService_instance = { value: void 0 };
|
|
@@ -2032,6 +2075,8 @@ var _a$2, _CredentialMessageService_instance;
|
|
|
2032
2075
|
const ALLOWED_CREDENTIAL_MESSAGES = [
|
|
2033
2076
|
AirCredentialMessageTypes.INITIALIZATION_RESPONSE,
|
|
2034
2077
|
AirCredentialMessageTypes.CREDENTIAL_IFRAME_VISIBILITY_REQUEST,
|
|
2078
|
+
AirCredentialMessageTypes.CREDENTIAL_AUTH_INITIALIZED,
|
|
2079
|
+
AirCredentialMessageTypes.CREDENTIAL_WALLET_INITIALIZED,
|
|
2035
2080
|
AirCredentialMessageTypes.LOGOUT_RESPONSE,
|
|
2036
2081
|
AirCredentialMessageTypes.ISSUE_CREDENTIAL_RESPONSE,
|
|
2037
2082
|
AirCredentialMessageTypes.VERIFY_CREDENTIAL_RESPONSE,
|
|
@@ -2057,6 +2102,20 @@ class CredentialMessageService extends MessageServiceBase {
|
|
|
2057
2102
|
});
|
|
2058
2103
|
return response;
|
|
2059
2104
|
}
|
|
2105
|
+
async initAuthCommunication() {
|
|
2106
|
+
const response = firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirCredentialMessageTypes.CREDENTIAL_AUTH_INITIALIZED)));
|
|
2107
|
+
await this.sendMessage({
|
|
2108
|
+
type: AirCredentialMessageTypes.INIT_AUTH_COMMUNICATION,
|
|
2109
|
+
});
|
|
2110
|
+
return response;
|
|
2111
|
+
}
|
|
2112
|
+
async initWalletCommunication() {
|
|
2113
|
+
const response = firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirCredentialMessageTypes.CREDENTIAL_WALLET_INITIALIZED)));
|
|
2114
|
+
await this.sendMessage({
|
|
2115
|
+
type: AirCredentialMessageTypes.INIT_WALLET_COMMUNICATION,
|
|
2116
|
+
});
|
|
2117
|
+
return response;
|
|
2118
|
+
}
|
|
2060
2119
|
async logout() {
|
|
2061
2120
|
const response = firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirCredentialMessageTypes.LOGOUT_RESPONSE)));
|
|
2062
2121
|
await this.sendMessage({
|
|
@@ -2177,6 +2236,11 @@ class RecoveryMessageService extends MessageServiceBase {
|
|
|
2177
2236
|
});
|
|
2178
2237
|
return response;
|
|
2179
2238
|
}
|
|
2239
|
+
async initAuthCommunication() {
|
|
2240
|
+
await this.sendMessage({
|
|
2241
|
+
type: AirRecoveryMessageTypes.INIT_AUTH_COMMUNICATION,
|
|
2242
|
+
});
|
|
2243
|
+
}
|
|
2180
2244
|
async onInitialized() {
|
|
2181
2245
|
return firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirRecoveryMessageTypes.RECOVERY_INITIALIZED)));
|
|
2182
2246
|
}
|
|
@@ -2223,6 +2287,14 @@ class WalletMessageService extends MessageServiceBase {
|
|
|
2223
2287
|
const window = walletIframe.contentWindow;
|
|
2224
2288
|
await super._open({ window, origin });
|
|
2225
2289
|
}
|
|
2290
|
+
async initAuthCommunication(skipWalletLogin) {
|
|
2291
|
+
await this.sendMessage({
|
|
2292
|
+
type: AirWalletMessageTypes.INIT_AUTH_COMMUNICATION,
|
|
2293
|
+
payload: {
|
|
2294
|
+
skipWalletLogin,
|
|
2295
|
+
},
|
|
2296
|
+
});
|
|
2297
|
+
}
|
|
2226
2298
|
async sendDeploySmartAccountRequest() {
|
|
2227
2299
|
const response = firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirWalletMessageTypes.DEPLOY_SMART_ACCOUNT_RESPONSE)));
|
|
2228
2300
|
await this.sendMessage({
|
|
@@ -2316,6 +2388,16 @@ class WalletMessageService extends MessageServiceBase {
|
|
|
2316
2388
|
});
|
|
2317
2389
|
return response;
|
|
2318
2390
|
}
|
|
2391
|
+
async initCredentialCommunication() {
|
|
2392
|
+
await this.sendMessage({
|
|
2393
|
+
type: AirWalletMessageTypes.INIT_CREDENTIAL_COMMUNICATION,
|
|
2394
|
+
});
|
|
2395
|
+
}
|
|
2396
|
+
async resetCredentialCommunication() {
|
|
2397
|
+
await this.sendMessage({
|
|
2398
|
+
type: AirWalletMessageTypes.RESET_CREDENTIAL_COMMUNICATION,
|
|
2399
|
+
});
|
|
2400
|
+
}
|
|
2319
2401
|
}
|
|
2320
2402
|
_a = WalletMessageService;
|
|
2321
2403
|
_WalletMessageService_instance = { value: void 0 };
|
|
@@ -2955,7 +3037,13 @@ _AirService_loginResult = new WeakMap(), _AirService_buildEnv = new WeakMap(), _
|
|
|
2955
3037
|
await __classPrivateFieldGet(this, _AirService_credentialMessagingService, "f").open(__classPrivateFieldGet(this, _AirService_credentialIframeController, "f").iframeElement);
|
|
2956
3038
|
__classPrivateFieldGet(this, _AirService_instances, "m", _AirService_subscribeToCredentialEvents).call(this);
|
|
2957
3039
|
await credentialInitRequestPromise;
|
|
3040
|
+
await __classPrivateFieldGet(this, _AirService_authMessagingService, "f").initCredentialCommunication();
|
|
3041
|
+
await __classPrivateFieldGet(this, _AirService_credentialMessagingService, "f").initAuthCommunication();
|
|
3042
|
+
log.info("[Embed] Credential auth channel initialized");
|
|
2958
3043
|
await __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureWallet).call(this);
|
|
3044
|
+
await __classPrivateFieldGet(this, _AirService_walletMessagingService, "f").initCredentialCommunication();
|
|
3045
|
+
await __classPrivateFieldGet(this, _AirService_credentialMessagingService, "f").initWalletCommunication();
|
|
3046
|
+
log.info("[Embed] Credential wallet channel initialized");
|
|
2959
3047
|
log.info("Credential service initialized successfully");
|
|
2960
3048
|
}
|
|
2961
3049
|
catch (error) {
|
|
@@ -2986,6 +3074,14 @@ _AirService_loginResult = new WeakMap(), _AirService_buildEnv = new WeakMap(), _
|
|
|
2986
3074
|
__classPrivateFieldGet(this, _AirService_credentialIframeController, "f").destroy();
|
|
2987
3075
|
__classPrivateFieldSet(this, _AirService_credentialIframeController, undefined, "f");
|
|
2988
3076
|
}
|
|
3077
|
+
const walletIframeElement = __classPrivateFieldGet(this, _AirService_walletIframeController, "f")?.iframeElement;
|
|
3078
|
+
if (isElement(walletIframeElement) && window.document.body.contains(walletIframeElement)) {
|
|
3079
|
+
await __classPrivateFieldGet(this, _AirService_walletMessagingService, "f").resetCredentialCommunication();
|
|
3080
|
+
}
|
|
3081
|
+
const authIframeElement = __classPrivateFieldGet(this, _AirService_authIframeController, "f")?.iframeElement;
|
|
3082
|
+
if (isElement(authIframeElement) && window.document.body.contains(authIframeElement)) {
|
|
3083
|
+
await __classPrivateFieldGet(this, _AirService_authMessagingService, "f").resetCredentialCommunication();
|
|
3084
|
+
}
|
|
2989
3085
|
await __classPrivateFieldGet(this, _AirService_credentialMessagingService, "f").close();
|
|
2990
3086
|
__classPrivateFieldSet(this, _AirService_credentialsInitialization, undefined, "f");
|
|
2991
3087
|
}, _AirService_ensureWallet = async function _AirService_ensureWallet(option) {
|
|
@@ -3052,6 +3148,8 @@ _AirService_loginResult = new WeakMap(), _AirService_buildEnv = new WeakMap(), _
|
|
|
3052
3148
|
if (!this.isLoggedIn && !option?.skipWalletLogin) {
|
|
3053
3149
|
await __classPrivateFieldGet(this, _AirService_authMessagingService, "f").onLoggedIn();
|
|
3054
3150
|
}
|
|
3151
|
+
await __classPrivateFieldGet(this, _AirService_authMessagingService, "f").initWalletCommunication();
|
|
3152
|
+
await __classPrivateFieldGet(this, _AirService_walletMessagingService, "f").initAuthCommunication(option?.skipWalletLogin ?? false);
|
|
3055
3153
|
const walletInitResult = await walletInitPromise;
|
|
3056
3154
|
if (walletInitResult.payload.success !== true) {
|
|
3057
3155
|
throw new AirServiceError(walletInitResult.payload.errorName, walletInitResult.payload.errorMessage);
|
|
@@ -3170,6 +3268,10 @@ _AirService_loginResult = new WeakMap(), _AirService_buildEnv = new WeakMap(), _
|
|
|
3170
3268
|
__classPrivateFieldGet(this, _AirService_walletIframeController, "f").destroy();
|
|
3171
3269
|
__classPrivateFieldSet(this, _AirService_walletIframeController, undefined, "f");
|
|
3172
3270
|
}
|
|
3271
|
+
const authIframeElement = __classPrivateFieldGet(this, _AirService_authIframeController, "f")?.iframeElement;
|
|
3272
|
+
if (isElement(authIframeElement) && window.document.body.contains(authIframeElement)) {
|
|
3273
|
+
await __classPrivateFieldGet(this, _AirService_authMessagingService, "f").resetWalletCommunication();
|
|
3274
|
+
}
|
|
3173
3275
|
// Close the message service
|
|
3174
3276
|
await __classPrivateFieldGet(this, _AirService_walletMessagingService, "f").close();
|
|
3175
3277
|
__classPrivateFieldSet(this, _AirService_walletLoggedInResult, undefined, "f");
|
|
@@ -3223,7 +3325,12 @@ _AirService_loginResult = new WeakMap(), _AirService_buildEnv = new WeakMap(), _
|
|
|
3223
3325
|
__classPrivateFieldGet(this, _AirService_instances, "m", _AirService_subscribeToRecoveryEvents).call(this);
|
|
3224
3326
|
const recoveryInitPromise = __classPrivateFieldGet(this, _AirService_recoveryMessagingService, "f").onInitialized();
|
|
3225
3327
|
await recoveryInitRequestPromise;
|
|
3226
|
-
await
|
|
3328
|
+
await __classPrivateFieldGet(this, _AirService_authMessagingService, "f").initRecoveryCommunication();
|
|
3329
|
+
await __classPrivateFieldGet(this, _AirService_recoveryMessagingService, "f").initAuthCommunication();
|
|
3330
|
+
const recoveryInitResult = await recoveryInitPromise;
|
|
3331
|
+
if (recoveryInitResult.payload.success !== true) {
|
|
3332
|
+
throw new AirServiceError(recoveryInitResult.payload.errorName, recoveryInitResult.payload.errorMessage);
|
|
3333
|
+
}
|
|
3227
3334
|
}
|
|
3228
3335
|
catch (error) {
|
|
3229
3336
|
log.error("Error initializing recovery", error);
|
|
@@ -3251,6 +3358,10 @@ _AirService_loginResult = new WeakMap(), _AirService_buildEnv = new WeakMap(), _
|
|
|
3251
3358
|
__classPrivateFieldGet(this, _AirService_recoveryIframeController, "f").destroy();
|
|
3252
3359
|
__classPrivateFieldSet(this, _AirService_recoveryIframeController, undefined, "f");
|
|
3253
3360
|
}
|
|
3361
|
+
const authIframeElement = __classPrivateFieldGet(this, _AirService_authIframeController, "f")?.iframeElement;
|
|
3362
|
+
if (isElement(authIframeElement) && window.document.body.contains(authIframeElement)) {
|
|
3363
|
+
await __classPrivateFieldGet(this, _AirService_authMessagingService, "f").resetRecoveryCommunication();
|
|
3364
|
+
}
|
|
3254
3365
|
// Close the message service
|
|
3255
3366
|
await __classPrivateFieldGet(this, _AirService_recoveryMessagingService, "f").close();
|
|
3256
3367
|
__classPrivateFieldSet(this, _AirService_recoveryInitialization, undefined, "f");
|
package/dist/airkit.umd.js
CHANGED
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
102
102
|
};
|
|
103
103
|
|
|
104
|
-
var version = "1.6.0-beta.
|
|
104
|
+
var version = "1.6.0-beta.5";
|
|
105
105
|
var airkitPackage = {
|
|
106
106
|
version: version};
|
|
107
107
|
|
|
@@ -120,6 +120,7 @@
|
|
|
120
120
|
REFRESH_TOKEN_RESPONSE: "air_auth_refresh_token_response",
|
|
121
121
|
WALLET_TOKEN_REQUEST: "air_auth_wallet_token_request",
|
|
122
122
|
WALLET_TOKEN_RESPONSE: "air_auth_wallet_token_response",
|
|
123
|
+
INIT_WALLET_COMMUNICATION: "air_auth_init_wallet_communication",
|
|
123
124
|
IFRAME_VISIBILITY_REQUEST: "air_auth_iframe_visibility_request",
|
|
124
125
|
SETUP_WALLET_REQUEST: "air_auth_setup_wallet_request",
|
|
125
126
|
SETUP_WALLET_RESPONSE: "air_auth_setup_wallet_response",
|
|
@@ -133,10 +134,15 @@
|
|
|
133
134
|
PARTNER_ACCESS_TOKEN_RESPONSE: "air_auth_partner_access_token_response",
|
|
134
135
|
LOGOUT_REQUEST: "air_auth_logout_request",
|
|
135
136
|
LOGOUT_RESPONSE: "air_auth_logout_response",
|
|
137
|
+
RESET_WALLET_COMMUNICATION: "air_auth_reset_wallet_communication",
|
|
138
|
+
INIT_RECOVERY_COMMUNICATION: "air_auth_init_recovery_communication",
|
|
139
|
+
RESET_RECOVERY_COMMUNICATION: "air_auth_reset_recovery_communication",
|
|
136
140
|
START_RECOVERY_REQUEST: "air_start_recovery_request",
|
|
137
141
|
START_RECOVERY_RESPONSE: "air_start_recovery_response",
|
|
138
142
|
RECOVERY_REQUEST: "air_auth_recovery_request",
|
|
139
143
|
RECOVERY_RESPONSE: "air_auth_recovery_response",
|
|
144
|
+
INIT_CREDENTIAL_COMMUNICATION: "air_auth_init_credential_communication",
|
|
145
|
+
RESET_CREDENTIAL_COMMUNICATION: "air_auth_reset_credential_communication",
|
|
140
146
|
EXPIRED_LOGOUT_REQUEST: "air_auth_expired_logout_request"
|
|
141
147
|
};
|
|
142
148
|
|
|
@@ -144,6 +150,10 @@
|
|
|
144
150
|
SERVICE_STARTED: "air_credential_service_started",
|
|
145
151
|
INITIALIZATION_REQUEST: "air_credential_initialization_request",
|
|
146
152
|
INITIALIZATION_RESPONSE: "air_credential_initialization_response",
|
|
153
|
+
INIT_AUTH_COMMUNICATION: "air_credential_init_auth_communication",
|
|
154
|
+
CREDENTIAL_AUTH_INITIALIZED: "air_credential_auth_initialized",
|
|
155
|
+
INIT_WALLET_COMMUNICATION: "air_credential_init_wallet_communication",
|
|
156
|
+
CREDENTIAL_WALLET_INITIALIZED: "air_credential_wallet_initialized",
|
|
147
157
|
CREDENTIAL_IFRAME_VISIBILITY_REQUEST: "air_credential_iframe_visibility_request",
|
|
148
158
|
LOGOUT_REQUEST: "air_credential_logout_request",
|
|
149
159
|
LOGOUT_RESPONSE: "air_credential_logout_response",
|
|
@@ -159,6 +169,7 @@
|
|
|
159
169
|
SERVICE_STARTED: "air_recovery_service_started",
|
|
160
170
|
INITIALIZATION_REQUEST: "air_recovery_initialization_request",
|
|
161
171
|
INITIALIZATION_RESPONSE: "air_recovery_initialization_response",
|
|
172
|
+
INIT_AUTH_COMMUNICATION: "air_recovery_init_auth_communication",
|
|
162
173
|
RECOVERY_INITIALIZED: "air_recovery_initialized",
|
|
163
174
|
RECOVERY_IFRAME_VISIBILITY_REQUEST: "air_recovery_iframe_visibility_request",
|
|
164
175
|
LOGOUT_REQUEST: "air_recovery_logout_request",
|
|
@@ -171,6 +182,7 @@
|
|
|
171
182
|
INITIALIZATION_RESPONSE: "air_initialization_response",
|
|
172
183
|
CLOSE_MODAL_REQUEST: "air_close_modal_request",
|
|
173
184
|
CLOSE_MODAL_RESPONSE: "air_close_modal_response",
|
|
185
|
+
INIT_AUTH_COMMUNICATION: "air_init_auth_communication",
|
|
174
186
|
WALLET_INITIALIZED: "air_wallet_initialized",
|
|
175
187
|
WALLET_LOGIN_REQUEST: "air_wallet_login_request",
|
|
176
188
|
WALLET_LOGIN_RESPONSE: "air_wallet_login_response",
|
|
@@ -189,6 +201,8 @@
|
|
|
189
201
|
IS_SMART_ACCOUNT_DEPLOYED_RESPONSE: "air_is_smart_account_deployed_response",
|
|
190
202
|
LOGOUT_REQUEST: "air_logout_request",
|
|
191
203
|
LOGOUT_RESPONSE: "air_logout_response",
|
|
204
|
+
INIT_CREDENTIAL_COMMUNICATION: "air_init_credential_communication",
|
|
205
|
+
RESET_CREDENTIAL_COMMUNICATION: "air_reset_credential_communication",
|
|
192
206
|
INTERNAL_PROVIDER_REQUEST: "air_internal_provider_request",
|
|
193
207
|
INTERNAL_PROVIDER_RESPONSE: "air_internal_provider_response"
|
|
194
208
|
};
|
|
@@ -1675,7 +1689,6 @@
|
|
|
1675
1689
|
new Set(AirClientUserErrors);
|
|
1676
1690
|
new Set(Object.values(Codes));
|
|
1677
1691
|
|
|
1678
|
-
class OutgoingMessageEvent extends MessageEvent {}
|
|
1679
1692
|
class MessageServiceBase {
|
|
1680
1693
|
get events$() {
|
|
1681
1694
|
return this._events$;
|
|
@@ -1691,16 +1704,13 @@
|
|
|
1691
1704
|
this.allowedMessageTypes = allowedMessageTypes;
|
|
1692
1705
|
this.closeListener = null;
|
|
1693
1706
|
}
|
|
1694
|
-
static _getName(name, targetName) {
|
|
1695
|
-
return `${name} Service: ${targetName} Channel`;
|
|
1696
|
-
}
|
|
1697
1707
|
async _open(target) {
|
|
1698
1708
|
await this.close();
|
|
1699
1709
|
this.eventSubject = new Subject();
|
|
1700
1710
|
this._events$ = this.eventSubject.asObservable();
|
|
1701
1711
|
this._messages$ = this.eventSubject.pipe(map(ev => ev.data));
|
|
1702
1712
|
this._events$.subscribe(event => {
|
|
1703
|
-
const sentOrReceived = event
|
|
1713
|
+
const sentOrReceived = event.origin === window.origin ? "sent" : "received";
|
|
1704
1714
|
log.debug(`[${this.name}] Message ${sentOrReceived}:`, JSON.stringify(event.data, bigIntReplacer));
|
|
1705
1715
|
});
|
|
1706
1716
|
const handleMessage = async ev => {
|
|
@@ -1772,7 +1782,7 @@
|
|
|
1772
1782
|
log.debug(`[${this.name}] Not opened yet`);
|
|
1773
1783
|
return;
|
|
1774
1784
|
}
|
|
1775
|
-
this.eventSubject.next(new
|
|
1785
|
+
this.eventSubject.next(new MessageEvent("message", {
|
|
1776
1786
|
data: clonedMessage,
|
|
1777
1787
|
origin: window.origin
|
|
1778
1788
|
}));
|
|
@@ -1937,6 +1947,8 @@
|
|
|
1937
1947
|
AirAuthMessageTypes.LOGIN_RESPONSE,
|
|
1938
1948
|
AirAuthMessageTypes.SETUP_WALLET_REQUEST,
|
|
1939
1949
|
AirAuthMessageTypes.SETUP_RECOVERY_REQUEST,
|
|
1950
|
+
AirAuthMessageTypes.INIT_RECOVERY_COMMUNICATION,
|
|
1951
|
+
AirAuthMessageTypes.RESET_RECOVERY_COMMUNICATION,
|
|
1940
1952
|
AirAuthMessageTypes.LOGOUT_RESPONSE,
|
|
1941
1953
|
AirAuthMessageTypes.PARTNER_USER_INFO_RESPONSE,
|
|
1942
1954
|
AirAuthMessageTypes.CROSS_PARTNER_TOKEN_RESPONSE,
|
|
@@ -1957,6 +1969,11 @@
|
|
|
1957
1969
|
const window = authIframe.contentWindow;
|
|
1958
1970
|
await super._open({ window, origin });
|
|
1959
1971
|
}
|
|
1972
|
+
async initWalletCommunication() {
|
|
1973
|
+
await this.sendMessage({
|
|
1974
|
+
type: AirAuthMessageTypes.INIT_WALLET_COMMUNICATION,
|
|
1975
|
+
});
|
|
1976
|
+
}
|
|
1960
1977
|
async sendPartnerUserInfoRequest() {
|
|
1961
1978
|
const response = firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirAuthMessageTypes.PARTNER_USER_INFO_RESPONSE)));
|
|
1962
1979
|
await this.sendMessage({
|
|
@@ -1978,6 +1995,9 @@
|
|
|
1978
1995
|
await this.sendMessage({ type: AirAuthMessageTypes.LOGOUT_REQUEST });
|
|
1979
1996
|
return response;
|
|
1980
1997
|
}
|
|
1998
|
+
async resetWalletCommunication() {
|
|
1999
|
+
await this.sendMessage({ type: AirAuthMessageTypes.RESET_WALLET_COMMUNICATION });
|
|
2000
|
+
}
|
|
1981
2001
|
async sendInitializationRequest(payload) {
|
|
1982
2002
|
const response = firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirAuthMessageTypes.INITIALIZATION_RESPONSE)));
|
|
1983
2003
|
await this.sendMessage({ type: AirAuthMessageTypes.INITIALIZATION_REQUEST, payload });
|
|
@@ -1994,6 +2014,16 @@
|
|
|
1994
2014
|
async sendSetupWalletErrorResponse(error) {
|
|
1995
2015
|
await this.sendMessage(this.createErrorResponseMessage(AirAuthMessageTypes.SETUP_WALLET_RESPONSE, error));
|
|
1996
2016
|
}
|
|
2017
|
+
async initRecoveryCommunication() {
|
|
2018
|
+
await this.sendMessage({
|
|
2019
|
+
type: AirAuthMessageTypes.INIT_RECOVERY_COMMUNICATION,
|
|
2020
|
+
});
|
|
2021
|
+
}
|
|
2022
|
+
async resetRecoveryCommunication() {
|
|
2023
|
+
await this.sendMessage({
|
|
2024
|
+
type: AirAuthMessageTypes.RESET_RECOVERY_COMMUNICATION,
|
|
2025
|
+
});
|
|
2026
|
+
}
|
|
1997
2027
|
async sendSetupRecoverySuccessResponse() {
|
|
1998
2028
|
await this.sendMessage({
|
|
1999
2029
|
type: AirAuthMessageTypes.SETUP_RECOVERY_RESPONSE,
|
|
@@ -2030,6 +2060,19 @@
|
|
|
2030
2060
|
await this.sendMessage({ type: AirAuthMessageTypes.START_RECOVERY_REQUEST, payload });
|
|
2031
2061
|
return response;
|
|
2032
2062
|
}
|
|
2063
|
+
/*
|
|
2064
|
+
* Initialize credential communication
|
|
2065
|
+
*/
|
|
2066
|
+
async initCredentialCommunication() {
|
|
2067
|
+
await this.sendMessage({
|
|
2068
|
+
type: AirAuthMessageTypes.INIT_CREDENTIAL_COMMUNICATION,
|
|
2069
|
+
});
|
|
2070
|
+
}
|
|
2071
|
+
async resetCredentialCommunication() {
|
|
2072
|
+
await this.sendMessage({
|
|
2073
|
+
type: AirAuthMessageTypes.RESET_CREDENTIAL_COMMUNICATION,
|
|
2074
|
+
});
|
|
2075
|
+
}
|
|
2033
2076
|
}
|
|
2034
2077
|
_a$3 = AuthMessageService;
|
|
2035
2078
|
_AuthMessageService_instance = { value: void 0 };
|
|
@@ -2038,6 +2081,8 @@
|
|
|
2038
2081
|
const ALLOWED_CREDENTIAL_MESSAGES = [
|
|
2039
2082
|
AirCredentialMessageTypes.INITIALIZATION_RESPONSE,
|
|
2040
2083
|
AirCredentialMessageTypes.CREDENTIAL_IFRAME_VISIBILITY_REQUEST,
|
|
2084
|
+
AirCredentialMessageTypes.CREDENTIAL_AUTH_INITIALIZED,
|
|
2085
|
+
AirCredentialMessageTypes.CREDENTIAL_WALLET_INITIALIZED,
|
|
2041
2086
|
AirCredentialMessageTypes.LOGOUT_RESPONSE,
|
|
2042
2087
|
AirCredentialMessageTypes.ISSUE_CREDENTIAL_RESPONSE,
|
|
2043
2088
|
AirCredentialMessageTypes.VERIFY_CREDENTIAL_RESPONSE,
|
|
@@ -2063,6 +2108,20 @@
|
|
|
2063
2108
|
});
|
|
2064
2109
|
return response;
|
|
2065
2110
|
}
|
|
2111
|
+
async initAuthCommunication() {
|
|
2112
|
+
const response = firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirCredentialMessageTypes.CREDENTIAL_AUTH_INITIALIZED)));
|
|
2113
|
+
await this.sendMessage({
|
|
2114
|
+
type: AirCredentialMessageTypes.INIT_AUTH_COMMUNICATION,
|
|
2115
|
+
});
|
|
2116
|
+
return response;
|
|
2117
|
+
}
|
|
2118
|
+
async initWalletCommunication() {
|
|
2119
|
+
const response = firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirCredentialMessageTypes.CREDENTIAL_WALLET_INITIALIZED)));
|
|
2120
|
+
await this.sendMessage({
|
|
2121
|
+
type: AirCredentialMessageTypes.INIT_WALLET_COMMUNICATION,
|
|
2122
|
+
});
|
|
2123
|
+
return response;
|
|
2124
|
+
}
|
|
2066
2125
|
async logout() {
|
|
2067
2126
|
const response = firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirCredentialMessageTypes.LOGOUT_RESPONSE)));
|
|
2068
2127
|
await this.sendMessage({
|
|
@@ -2183,6 +2242,11 @@
|
|
|
2183
2242
|
});
|
|
2184
2243
|
return response;
|
|
2185
2244
|
}
|
|
2245
|
+
async initAuthCommunication() {
|
|
2246
|
+
await this.sendMessage({
|
|
2247
|
+
type: AirRecoveryMessageTypes.INIT_AUTH_COMMUNICATION,
|
|
2248
|
+
});
|
|
2249
|
+
}
|
|
2186
2250
|
async onInitialized() {
|
|
2187
2251
|
return firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirRecoveryMessageTypes.RECOVERY_INITIALIZED)));
|
|
2188
2252
|
}
|
|
@@ -2229,6 +2293,14 @@
|
|
|
2229
2293
|
const window = walletIframe.contentWindow;
|
|
2230
2294
|
await super._open({ window, origin });
|
|
2231
2295
|
}
|
|
2296
|
+
async initAuthCommunication(skipWalletLogin) {
|
|
2297
|
+
await this.sendMessage({
|
|
2298
|
+
type: AirWalletMessageTypes.INIT_AUTH_COMMUNICATION,
|
|
2299
|
+
payload: {
|
|
2300
|
+
skipWalletLogin,
|
|
2301
|
+
},
|
|
2302
|
+
});
|
|
2303
|
+
}
|
|
2232
2304
|
async sendDeploySmartAccountRequest() {
|
|
2233
2305
|
const response = firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirWalletMessageTypes.DEPLOY_SMART_ACCOUNT_RESPONSE)));
|
|
2234
2306
|
await this.sendMessage({
|
|
@@ -2322,6 +2394,16 @@
|
|
|
2322
2394
|
});
|
|
2323
2395
|
return response;
|
|
2324
2396
|
}
|
|
2397
|
+
async initCredentialCommunication() {
|
|
2398
|
+
await this.sendMessage({
|
|
2399
|
+
type: AirWalletMessageTypes.INIT_CREDENTIAL_COMMUNICATION,
|
|
2400
|
+
});
|
|
2401
|
+
}
|
|
2402
|
+
async resetCredentialCommunication() {
|
|
2403
|
+
await this.sendMessage({
|
|
2404
|
+
type: AirWalletMessageTypes.RESET_CREDENTIAL_COMMUNICATION,
|
|
2405
|
+
});
|
|
2406
|
+
}
|
|
2325
2407
|
}
|
|
2326
2408
|
_a = WalletMessageService;
|
|
2327
2409
|
_WalletMessageService_instance = { value: void 0 };
|
|
@@ -2961,7 +3043,13 @@
|
|
|
2961
3043
|
await __classPrivateFieldGet(this, _AirService_credentialMessagingService, "f").open(__classPrivateFieldGet(this, _AirService_credentialIframeController, "f").iframeElement);
|
|
2962
3044
|
__classPrivateFieldGet(this, _AirService_instances, "m", _AirService_subscribeToCredentialEvents).call(this);
|
|
2963
3045
|
await credentialInitRequestPromise;
|
|
3046
|
+
await __classPrivateFieldGet(this, _AirService_authMessagingService, "f").initCredentialCommunication();
|
|
3047
|
+
await __classPrivateFieldGet(this, _AirService_credentialMessagingService, "f").initAuthCommunication();
|
|
3048
|
+
log.info("[Embed] Credential auth channel initialized");
|
|
2964
3049
|
await __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureWallet).call(this);
|
|
3050
|
+
await __classPrivateFieldGet(this, _AirService_walletMessagingService, "f").initCredentialCommunication();
|
|
3051
|
+
await __classPrivateFieldGet(this, _AirService_credentialMessagingService, "f").initWalletCommunication();
|
|
3052
|
+
log.info("[Embed] Credential wallet channel initialized");
|
|
2965
3053
|
log.info("Credential service initialized successfully");
|
|
2966
3054
|
}
|
|
2967
3055
|
catch (error) {
|
|
@@ -2992,6 +3080,14 @@
|
|
|
2992
3080
|
__classPrivateFieldGet(this, _AirService_credentialIframeController, "f").destroy();
|
|
2993
3081
|
__classPrivateFieldSet(this, _AirService_credentialIframeController, undefined, "f");
|
|
2994
3082
|
}
|
|
3083
|
+
const walletIframeElement = __classPrivateFieldGet(this, _AirService_walletIframeController, "f")?.iframeElement;
|
|
3084
|
+
if (isElement(walletIframeElement) && window.document.body.contains(walletIframeElement)) {
|
|
3085
|
+
await __classPrivateFieldGet(this, _AirService_walletMessagingService, "f").resetCredentialCommunication();
|
|
3086
|
+
}
|
|
3087
|
+
const authIframeElement = __classPrivateFieldGet(this, _AirService_authIframeController, "f")?.iframeElement;
|
|
3088
|
+
if (isElement(authIframeElement) && window.document.body.contains(authIframeElement)) {
|
|
3089
|
+
await __classPrivateFieldGet(this, _AirService_authMessagingService, "f").resetCredentialCommunication();
|
|
3090
|
+
}
|
|
2995
3091
|
await __classPrivateFieldGet(this, _AirService_credentialMessagingService, "f").close();
|
|
2996
3092
|
__classPrivateFieldSet(this, _AirService_credentialsInitialization, undefined, "f");
|
|
2997
3093
|
}, _AirService_ensureWallet = async function _AirService_ensureWallet(option) {
|
|
@@ -3058,6 +3154,8 @@
|
|
|
3058
3154
|
if (!this.isLoggedIn && !option?.skipWalletLogin) {
|
|
3059
3155
|
await __classPrivateFieldGet(this, _AirService_authMessagingService, "f").onLoggedIn();
|
|
3060
3156
|
}
|
|
3157
|
+
await __classPrivateFieldGet(this, _AirService_authMessagingService, "f").initWalletCommunication();
|
|
3158
|
+
await __classPrivateFieldGet(this, _AirService_walletMessagingService, "f").initAuthCommunication(option?.skipWalletLogin ?? false);
|
|
3061
3159
|
const walletInitResult = await walletInitPromise;
|
|
3062
3160
|
if (walletInitResult.payload.success !== true) {
|
|
3063
3161
|
throw new AirServiceError(walletInitResult.payload.errorName, walletInitResult.payload.errorMessage);
|
|
@@ -3176,6 +3274,10 @@
|
|
|
3176
3274
|
__classPrivateFieldGet(this, _AirService_walletIframeController, "f").destroy();
|
|
3177
3275
|
__classPrivateFieldSet(this, _AirService_walletIframeController, undefined, "f");
|
|
3178
3276
|
}
|
|
3277
|
+
const authIframeElement = __classPrivateFieldGet(this, _AirService_authIframeController, "f")?.iframeElement;
|
|
3278
|
+
if (isElement(authIframeElement) && window.document.body.contains(authIframeElement)) {
|
|
3279
|
+
await __classPrivateFieldGet(this, _AirService_authMessagingService, "f").resetWalletCommunication();
|
|
3280
|
+
}
|
|
3179
3281
|
// Close the message service
|
|
3180
3282
|
await __classPrivateFieldGet(this, _AirService_walletMessagingService, "f").close();
|
|
3181
3283
|
__classPrivateFieldSet(this, _AirService_walletLoggedInResult, undefined, "f");
|
|
@@ -3229,7 +3331,12 @@
|
|
|
3229
3331
|
__classPrivateFieldGet(this, _AirService_instances, "m", _AirService_subscribeToRecoveryEvents).call(this);
|
|
3230
3332
|
const recoveryInitPromise = __classPrivateFieldGet(this, _AirService_recoveryMessagingService, "f").onInitialized();
|
|
3231
3333
|
await recoveryInitRequestPromise;
|
|
3232
|
-
await
|
|
3334
|
+
await __classPrivateFieldGet(this, _AirService_authMessagingService, "f").initRecoveryCommunication();
|
|
3335
|
+
await __classPrivateFieldGet(this, _AirService_recoveryMessagingService, "f").initAuthCommunication();
|
|
3336
|
+
const recoveryInitResult = await recoveryInitPromise;
|
|
3337
|
+
if (recoveryInitResult.payload.success !== true) {
|
|
3338
|
+
throw new AirServiceError(recoveryInitResult.payload.errorName, recoveryInitResult.payload.errorMessage);
|
|
3339
|
+
}
|
|
3233
3340
|
}
|
|
3234
3341
|
catch (error) {
|
|
3235
3342
|
log.error("Error initializing recovery", error);
|
|
@@ -3257,6 +3364,10 @@
|
|
|
3257
3364
|
__classPrivateFieldGet(this, _AirService_recoveryIframeController, "f").destroy();
|
|
3258
3365
|
__classPrivateFieldSet(this, _AirService_recoveryIframeController, undefined, "f");
|
|
3259
3366
|
}
|
|
3367
|
+
const authIframeElement = __classPrivateFieldGet(this, _AirService_authIframeController, "f")?.iframeElement;
|
|
3368
|
+
if (isElement(authIframeElement) && window.document.body.contains(authIframeElement)) {
|
|
3369
|
+
await __classPrivateFieldGet(this, _AirService_authMessagingService, "f").resetRecoveryCommunication();
|
|
3370
|
+
}
|
|
3260
3371
|
// Close the message service
|
|
3261
3372
|
await __classPrivateFieldGet(this, _AirService_recoveryMessagingService, "f").close();
|
|
3262
3373
|
__classPrivateFieldSet(this, _AirService_recoveryInitialization, undefined, "f");
|
|
@@ -4,16 +4,22 @@ export declare class AuthMessageService extends MessageServiceBase<AirAuthMessag
|
|
|
4
4
|
#private;
|
|
5
5
|
static create(): AuthMessageService;
|
|
6
6
|
open(authIframe: HTMLIFrameElement): Promise<void>;
|
|
7
|
+
initWalletCommunication(): Promise<void>;
|
|
7
8
|
sendPartnerUserInfoRequest(): Promise<import("./common/air/messaging/auth").AirAuthPartnerUserInfoResponseMessage>;
|
|
8
9
|
sendLoginRequest(payload?: AirAuthLoginRequestMessage["payload"]): Promise<import("./common/air/messaging/auth").AirAuthLoginResponseToEmbedMessage>;
|
|
9
10
|
onLoggedIn(): Promise<AirAuthMessage>;
|
|
10
11
|
logout(): Promise<import("./common/air/messaging/auth").AirAuthLogoutResponseMessage>;
|
|
12
|
+
resetWalletCommunication(): Promise<void>;
|
|
11
13
|
sendInitializationRequest(payload: AirAuthInitializationRequestMessage["payload"]): Promise<import("./common/air/messaging/auth").AirAuthInitializationResponseMessage>;
|
|
12
14
|
sendSetupWalletSuccessResponse(): Promise<void>;
|
|
13
15
|
sendSetupWalletErrorResponse(error: Error): Promise<void>;
|
|
16
|
+
initRecoveryCommunication(): Promise<void>;
|
|
17
|
+
resetRecoveryCommunication(): Promise<void>;
|
|
14
18
|
sendSetupRecoverySuccessResponse(): Promise<void>;
|
|
15
19
|
sendSetupRecoveryErrorResponse(error: Error): Promise<void>;
|
|
16
20
|
sendCrossPartnerTokenRequest(targetPartnerUrl: string): Promise<import("./common/air/messaging/auth").AirAuthCrossPartnerTokenResponseMessage>;
|
|
17
21
|
sendPartnerAccessTokenRequest(): Promise<import("./common/air/messaging/auth").AirAuthPartnerAccessTokenResponseMessage>;
|
|
18
22
|
sendAccountRecoveryRequest(payload: AirAuthStartRecoveryRequestPayload): Promise<import("./common/air/messaging/auth").AirStartRecoveryResponseMessage>;
|
|
23
|
+
initCredentialCommunication(): Promise<void>;
|
|
24
|
+
resetCredentialCommunication(): Promise<void>;
|
|
19
25
|
}
|
|
@@ -16,6 +16,7 @@ export declare const AirAuthMessageTypes: {
|
|
|
16
16
|
readonly REFRESH_TOKEN_RESPONSE: "air_auth_refresh_token_response";
|
|
17
17
|
readonly WALLET_TOKEN_REQUEST: "air_auth_wallet_token_request";
|
|
18
18
|
readonly WALLET_TOKEN_RESPONSE: "air_auth_wallet_token_response";
|
|
19
|
+
readonly INIT_WALLET_COMMUNICATION: "air_auth_init_wallet_communication";
|
|
19
20
|
readonly IFRAME_VISIBILITY_REQUEST: "air_auth_iframe_visibility_request";
|
|
20
21
|
readonly SETUP_WALLET_REQUEST: "air_auth_setup_wallet_request";
|
|
21
22
|
readonly SETUP_WALLET_RESPONSE: "air_auth_setup_wallet_response";
|
|
@@ -29,10 +30,15 @@ export declare const AirAuthMessageTypes: {
|
|
|
29
30
|
readonly PARTNER_ACCESS_TOKEN_RESPONSE: "air_auth_partner_access_token_response";
|
|
30
31
|
readonly LOGOUT_REQUEST: "air_auth_logout_request";
|
|
31
32
|
readonly LOGOUT_RESPONSE: "air_auth_logout_response";
|
|
33
|
+
readonly RESET_WALLET_COMMUNICATION: "air_auth_reset_wallet_communication";
|
|
34
|
+
readonly INIT_RECOVERY_COMMUNICATION: "air_auth_init_recovery_communication";
|
|
35
|
+
readonly RESET_RECOVERY_COMMUNICATION: "air_auth_reset_recovery_communication";
|
|
32
36
|
readonly START_RECOVERY_REQUEST: "air_start_recovery_request";
|
|
33
37
|
readonly START_RECOVERY_RESPONSE: "air_start_recovery_response";
|
|
34
38
|
readonly RECOVERY_REQUEST: "air_auth_recovery_request";
|
|
35
39
|
readonly RECOVERY_RESPONSE: "air_auth_recovery_response";
|
|
40
|
+
readonly INIT_CREDENTIAL_COMMUNICATION: "air_auth_init_credential_communication";
|
|
41
|
+
readonly RESET_CREDENTIAL_COMMUNICATION: "air_auth_reset_credential_communication";
|
|
36
42
|
readonly EXPIRED_LOGOUT_REQUEST: "air_auth_expired_logout_request";
|
|
37
43
|
};
|
|
38
44
|
export type AirAuthMessageType = (typeof AirAuthMessageTypes)[keyof typeof AirAuthMessageTypes];
|
|
@@ -123,6 +129,7 @@ export type AirAuthRefreshTokenResponseMessage = AirAuthMessageBase<"air_auth_re
|
|
|
123
129
|
export type AirAuthWalletTokenRequestMessage = AirAuthMessageBase<"air_auth_wallet_token_request", AirAuthWalletTokenRequestPayload>;
|
|
124
130
|
export type AirAuthWalletTokenResponseMessage = AirAuthMessageBase<"air_auth_wallet_token_response", AirAuthWalletTokenResponsePayload>;
|
|
125
131
|
export type AirAuthSetupCompletedMessage = AirAuthMessageBaseWithoutPayload<"air_auth_setup_completed">;
|
|
132
|
+
export type AirAuthInitWalletCommunicationMessage = AirAuthMessageBaseWithoutPayload<"air_auth_init_wallet_communication">;
|
|
126
133
|
export type AirAuthSetupWalletRequestMessage = AirAuthMessageBaseWithoutPayload<"air_auth_setup_wallet_request">;
|
|
127
134
|
export type AirAuthSetupWalletResponseMessage = AirAuthMessageBase<"air_auth_setup_wallet_response", AirAuthSetupWalletResponsePayload>;
|
|
128
135
|
export type AirAuthSignSiweMessageRequestMessage = AirAuthMessageBase<"air_auth_sign_siwe_message_request", AirAuthSignSiweMessageRequestPayload>;
|
|
@@ -131,6 +138,7 @@ export type AirAuthCrossPartnerTokenRequestMessage = AirAuthMessageBase<"air_aut
|
|
|
131
138
|
export type AirAuthCrossPartnerTokenResponseMessage = AirAuthMessageBase<"air_auth_cross_partner_token_response", AirAuthCrossPartnerTokenSuccessPayload | AirMessageErrorPayload>;
|
|
132
139
|
export type AirAuthLogoutRequestMessage = AirAuthMessageBaseWithoutPayload<"air_auth_logout_request">;
|
|
133
140
|
export type AirAuthLogoutResponseMessage = AirAuthMessageBaseWithoutPayload<"air_auth_logout_response">;
|
|
141
|
+
export type AirAuthResetWalletCommunicationRequestMessage = AirAuthMessageBaseWithoutPayload<"air_auth_reset_wallet_communication">;
|
|
134
142
|
export type AirAuthIframeVisibilityRequestMessage = AirAuthMessageBase<"air_auth_iframe_visibility_request", {
|
|
135
143
|
visible: boolean;
|
|
136
144
|
}>;
|
|
@@ -142,6 +150,8 @@ export type AirAuthPartnerAccessTokenResponseMessage = AirAuthMessageBase<"air_a
|
|
|
142
150
|
export type AirAuthSetupRecoveryResponsePayload = AirMessageSuccessPayload | AirMessageErrorPayload;
|
|
143
151
|
export type AirAuthSetupRecoveryRequestMessage = AirAuthMessageBaseWithoutPayload<"air_auth_setup_recovery_request">;
|
|
144
152
|
export type AirAuthSetupRecoveryResponseMessage = AirAuthMessageBase<"air_auth_setup_recovery_response", AirAuthSetupRecoveryResponsePayload>;
|
|
153
|
+
export type AirAuthInitRecoveryCommunicationMessage = AirAuthMessageBaseWithoutPayload<"air_auth_init_recovery_communication">;
|
|
154
|
+
export type AirAuthResetRecoveryCommunicationMessage = AirAuthMessageBaseWithoutPayload<"air_auth_reset_recovery_communication">;
|
|
145
155
|
export type StartRecoveryOptions = {
|
|
146
156
|
type?: "import" | "update" | "delete" | "recovery" | "setup";
|
|
147
157
|
};
|
|
@@ -182,5 +192,7 @@ export type AirAuthRecoverySuccessPayload = AirMessageSuccessPayload & {
|
|
|
182
192
|
};
|
|
183
193
|
export type AirAuthRecoveryResponseMessage = AirAuthMessageBase<"air_auth_recovery_response", AirAuthRecoverySuccessPayload | AirMessageErrorPayload>;
|
|
184
194
|
export type AirAuthExpiredLogoutRequestMessage = AirAuthMessageBaseWithoutPayload<"air_auth_expired_logout_request">;
|
|
185
|
-
export type
|
|
195
|
+
export type AirAuthInitCredentialCommunicationMessage = AirAuthMessageBaseWithoutPayload<"air_auth_init_credential_communication">;
|
|
196
|
+
export type AirAuthResetCredentialCommunicationMessage = AirAuthMessageBaseWithoutPayload<"air_auth_reset_credential_communication">;
|
|
197
|
+
export type AirAuthMessage = AirAuthSetupCompletedMessage | AirAuthInitializationRequestMessage | AirAuthInitializationResponseMessage | AirAuthLoginRequestMessage | AirAuthLoginResponseToEmbedMessage | AirAuthLoginResponseToWalletServiceMessage | AirAuthUserInfoRequestMessage | AirAuthUserInfoResponseMessage | AirAuthPartnerUserInfoRequestMessage | AirAuthPartnerUserInfoResponseMessage | AirAuthRefreshTokenRequestMessage | AirAuthRefreshTokenResponseMessage | AirAuthWalletTokenRequestMessage | AirAuthWalletTokenResponseMessage | AirAuthInitWalletCommunicationMessage | AirAuthSetupWalletRequestMessage | AirAuthSetupWalletResponseMessage | AirAuthSignSiweMessageRequestMessage | AirAuthSignSiweMessageResponseMessage | AirAuthCrossPartnerTokenRequestMessage | AirAuthCrossPartnerTokenResponseMessage | AirAuthLogoutRequestMessage | AirAuthLogoutResponseMessage | AirAuthIframeVisibilityRequestMessage | AirAuthResetWalletCommunicationRequestMessage | AirAuthPartnerAccessTokenRequestMessage | AirAuthPartnerAccessTokenResponseMessage | AirAuthSetupRecoveryRequestMessage | AirAuthSetupRecoveryResponseMessage | AirAuthInitRecoveryCommunicationMessage | AirAuthResetRecoveryCommunicationMessage | AirStartRecoveryRequestMessage | AirStartRecoveryResponseMessage | AirAuthRecoveryRequestMessage | AirAuthRecoveryResponseMessage | AirAuthInitCredentialCommunicationMessage | AirAuthResetCredentialCommunicationMessage | AirAuthExpiredLogoutRequestMessage;
|
|
186
198
|
export {};
|
|
@@ -3,6 +3,10 @@ export declare const AirCredentialMessageTypes: {
|
|
|
3
3
|
readonly SERVICE_STARTED: "air_credential_service_started";
|
|
4
4
|
readonly INITIALIZATION_REQUEST: "air_credential_initialization_request";
|
|
5
5
|
readonly INITIALIZATION_RESPONSE: "air_credential_initialization_response";
|
|
6
|
+
readonly INIT_AUTH_COMMUNICATION: "air_credential_init_auth_communication";
|
|
7
|
+
readonly CREDENTIAL_AUTH_INITIALIZED: "air_credential_auth_initialized";
|
|
8
|
+
readonly INIT_WALLET_COMMUNICATION: "air_credential_init_wallet_communication";
|
|
9
|
+
readonly CREDENTIAL_WALLET_INITIALIZED: "air_credential_wallet_initialized";
|
|
6
10
|
readonly CREDENTIAL_IFRAME_VISIBILITY_REQUEST: "air_credential_iframe_visibility_request";
|
|
7
11
|
readonly LOGOUT_REQUEST: "air_credential_logout_request";
|
|
8
12
|
readonly LOGOUT_RESPONSE: "air_credential_logout_response";
|
|
@@ -26,6 +30,10 @@ export type AirInitializationErrorResponseMessage = AirCredentialMessageBase<"ai
|
|
|
26
30
|
closeDApp?: boolean;
|
|
27
31
|
}>;
|
|
28
32
|
export type AirInitializationResponseMessage = AirInitializationSuccessResponseMessage | AirInitializationErrorResponseMessage;
|
|
33
|
+
export type AirInitAuthCommunicationMessage = AirCredentialMessageBaseWithoutPayload<"air_credential_init_auth_communication">;
|
|
34
|
+
export type AirCredentialAuthInitializedMessage = AirCredentialMessageBase<"air_credential_auth_initialized", AirMessageSuccessPayload | AirMessageErrorPayload>;
|
|
35
|
+
export type AirAuthInitWalletCommunicationMessage = AirCredentialMessageBaseWithoutPayload<"air_credential_init_wallet_communication">;
|
|
36
|
+
export type AirCredentialWalletInitializedMessage = AirCredentialMessageBase<"air_credential_wallet_initialized", AirMessageSuccessPayload | AirMessageErrorPayload>;
|
|
29
37
|
export type AirCredentialIframeVisibilityRequestMessage = AirCredentialMessageBase<"air_credential_iframe_visibility_request", {
|
|
30
38
|
visible: boolean;
|
|
31
39
|
}>;
|
|
@@ -53,5 +61,5 @@ export type AirVerifyCredentialSuccessResponsePayload = {
|
|
|
53
61
|
};
|
|
54
62
|
} & AirMessageSuccessPayload;
|
|
55
63
|
export type AirVerifyCredentialResponseMessage = AirCredentialMessageBase<"air_credential_verify_response", AirVerifyCredentialSuccessResponsePayload | AirMessageErrorPayload>;
|
|
56
|
-
export type AirCredentialMessage = AirInitializationRequestMessage | AirInitializationResponseMessage | AirCredentialIframeVisibilityRequestMessage | AirLogoutRequestMessage | AirLogoutResponseMessage | AirIssueCredentialRequestMessage | AirVerifyCredentialRequestMessage | AirIssueCredentialResponseMessage | AirVerifyCredentialResponseMessage;
|
|
64
|
+
export type AirCredentialMessage = AirInitializationRequestMessage | AirInitializationResponseMessage | AirInitAuthCommunicationMessage | AirAuthInitWalletCommunicationMessage | AirCredentialIframeVisibilityRequestMessage | AirCredentialAuthInitializedMessage | AirCredentialWalletInitializedMessage | AirLogoutRequestMessage | AirLogoutResponseMessage | AirIssueCredentialRequestMessage | AirVerifyCredentialRequestMessage | AirIssueCredentialResponseMessage | AirVerifyCredentialResponseMessage;
|
|
57
65
|
export {};
|
|
@@ -15,7 +15,6 @@ export declare abstract class MessageServiceBase<TMessage extends AirMessageBase
|
|
|
15
15
|
get messages$(): Observable<TMessage>;
|
|
16
16
|
get isOpen(): boolean;
|
|
17
17
|
protected constructor(name: string, allowedMessageTypes: string[]);
|
|
18
|
-
protected static _getName(name: string, targetName: string): string;
|
|
19
18
|
protected _open(target: {
|
|
20
19
|
window: Window;
|
|
21
20
|
origin: string;
|
|
@@ -27,7 +26,7 @@ export declare abstract class MessageServiceBase<TMessage extends AirMessageBase
|
|
|
27
26
|
type: T;
|
|
28
27
|
payload: {
|
|
29
28
|
success: false;
|
|
30
|
-
errorName:
|
|
29
|
+
errorName: import("../error/codes").AuthErrorName | import("../error/codes").PartnerAccessTokenErrorName | import("../error/codes").RealmIDErrorName | import("../error/codes").ParameterErrorName | import("../error/codes").ServerErrorName | import("../error/codes").PasskeyErrorName | import("../error/codes").PasswordlessErrorName | import("../error/codes").AuthWalletErrorName | import("../error/codes").WalletLinkErrorName | import("../error/codes").IntentErrorName | import("../error/codes").PrivyErrorName | import("../error/codes").AirIDErrorName | import("../error/codes").WindowErrorName | "USER_CANCELLED" | "CONFIG_ERROR" | "CLIENT_ERROR" | "UNKNOWN_ERROR" | "PERMISSION_NOT_ENABLED" | "SMART_ACCOUNT_NOT_DEPLOYED" | "ACCOUNT_DELETION_PENDING";
|
|
31
30
|
errorMessage: string;
|
|
32
31
|
};
|
|
33
32
|
};
|
|
@@ -3,6 +3,7 @@ export declare const AirRecoveryMessageTypes: {
|
|
|
3
3
|
readonly SERVICE_STARTED: "air_recovery_service_started";
|
|
4
4
|
readonly INITIALIZATION_REQUEST: "air_recovery_initialization_request";
|
|
5
5
|
readonly INITIALIZATION_RESPONSE: "air_recovery_initialization_response";
|
|
6
|
+
readonly INIT_AUTH_COMMUNICATION: "air_recovery_init_auth_communication";
|
|
6
7
|
readonly RECOVERY_INITIALIZED: "air_recovery_initialized";
|
|
7
8
|
readonly RECOVERY_IFRAME_VISIBILITY_REQUEST: "air_recovery_iframe_visibility_request";
|
|
8
9
|
readonly LOGOUT_REQUEST: "air_recovery_logout_request";
|
|
@@ -19,10 +20,12 @@ export type AirInitializationRequestMessage = AirRecoveryMessageBase<"air_recove
|
|
|
19
20
|
enableAutomation: boolean;
|
|
20
21
|
}>;
|
|
21
22
|
export type AirInitializationResponseMessage = AirRecoveryMessageBase<"air_recovery_initialization_response", AirInitializationResponsePayload>;
|
|
22
|
-
export type
|
|
23
|
+
export type AirRecoveryInitializedPayload = AirMessageSuccessPayload | AirMessageErrorPayload;
|
|
24
|
+
export type AirRecoveryInitializedMessage = AirRecoveryMessageBase<"air_recovery_initialized", AirRecoveryInitializedPayload>;
|
|
25
|
+
export type AirInitAuthCommunicationMessage = AirRecoveryMessageBaseWithoutPayload<"air_recovery_init_auth_communication">;
|
|
23
26
|
export type AirRecoveryIframeVisibilityRequestMessage = AirRecoveryMessageBase<"air_recovery_iframe_visibility_request", {
|
|
24
27
|
visible: boolean;
|
|
25
28
|
}>;
|
|
26
29
|
export type AirLogoutRequestMessage = AirRecoveryMessageBaseWithoutPayload<"air_recovery_logout_request">;
|
|
27
30
|
export type AirLogoutResponseMessage = AirRecoveryMessageBase<"air_recovery_logout_response", AirMessageSuccessPayload | AirMessageErrorPayload>;
|
|
28
|
-
export type AirRecoveryMessage = AirInitializationRequestMessage | AirInitializationResponseMessage | AirRecoveryInitializedMessage | AirRecoveryIframeVisibilityRequestMessage | AirLogoutRequestMessage | AirLogoutResponseMessage;
|
|
31
|
+
export type AirRecoveryMessage = AirInitializationRequestMessage | AirInitializationResponseMessage | AirRecoveryInitializedMessage | AirInitAuthCommunicationMessage | AirRecoveryIframeVisibilityRequestMessage | AirLogoutRequestMessage | AirLogoutResponseMessage;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AirIdDetails, MFASetup } from "../../realm/user/types";
|
|
2
|
-
import {
|
|
2
|
+
import { AirWalletProviderMessageRequest, AirWalletProviderMessageSuccessResponse, AirWalletProviderMessageErrorResponse } from "./provider";
|
|
3
3
|
import { AirMessageBase, AirMessageBaseWithoutPayload, AirMessageErrorPayload, AirMessageSuccessPayload } from "./types";
|
|
4
4
|
export declare const AirWalletMessageTypes: {
|
|
5
5
|
readonly SERVICE_STARTED: "air_service_started";
|
|
@@ -7,6 +7,7 @@ export declare const AirWalletMessageTypes: {
|
|
|
7
7
|
readonly INITIALIZATION_RESPONSE: "air_initialization_response";
|
|
8
8
|
readonly CLOSE_MODAL_REQUEST: "air_close_modal_request";
|
|
9
9
|
readonly CLOSE_MODAL_RESPONSE: "air_close_modal_response";
|
|
10
|
+
readonly INIT_AUTH_COMMUNICATION: "air_init_auth_communication";
|
|
10
11
|
readonly WALLET_INITIALIZED: "air_wallet_initialized";
|
|
11
12
|
readonly WALLET_LOGIN_REQUEST: "air_wallet_login_request";
|
|
12
13
|
readonly WALLET_LOGIN_RESPONSE: "air_wallet_login_response";
|
|
@@ -25,6 +26,8 @@ export declare const AirWalletMessageTypes: {
|
|
|
25
26
|
readonly IS_SMART_ACCOUNT_DEPLOYED_RESPONSE: "air_is_smart_account_deployed_response";
|
|
26
27
|
readonly LOGOUT_REQUEST: "air_logout_request";
|
|
27
28
|
readonly LOGOUT_RESPONSE: "air_logout_response";
|
|
29
|
+
readonly INIT_CREDENTIAL_COMMUNICATION: "air_init_credential_communication";
|
|
30
|
+
readonly RESET_CREDENTIAL_COMMUNICATION: "air_reset_credential_communication";
|
|
28
31
|
readonly INTERNAL_PROVIDER_REQUEST: "air_internal_provider_request";
|
|
29
32
|
readonly INTERNAL_PROVIDER_RESPONSE: "air_internal_provider_response";
|
|
30
33
|
};
|
|
@@ -79,6 +82,9 @@ export type AirShowOnRampUIRequestMessage = AirWalletMessageBase<"air_show_on_ra
|
|
|
79
82
|
targetCurrencyCode?: string;
|
|
80
83
|
}>;
|
|
81
84
|
export type AirShowOnRampUIResponseMessage = AirWalletMessageBase<"air_show_on_ramp_ui_response", AirMessageSuccessPayload | AirMessageErrorPayload>;
|
|
85
|
+
export type AirInitAuthCommunicationMessage = AirWalletMessageBase<"air_init_auth_communication", {
|
|
86
|
+
skipWalletLogin: boolean;
|
|
87
|
+
}>;
|
|
82
88
|
export type AirIsSmartAccountDeployedResponseMessage = AirWalletMessageBase<"air_is_smart_account_deployed_response", (AirMessageSuccessPayload & {
|
|
83
89
|
isDeployed: boolean;
|
|
84
90
|
}) | AirMessageErrorPayload>;
|
|
@@ -94,6 +100,8 @@ export type AirLogoutRequestMessage = AirWalletMessageBaseWithoutPayload<"air_lo
|
|
|
94
100
|
export type AirLogoutResponseMessage = AirWalletMessageBase<"air_logout_response", AirMessageSuccessPayload | AirMessageErrorPayload>;
|
|
95
101
|
export type AirCloseModalRequestMessage = AirWalletMessageBaseWithoutPayload<"air_close_modal_request">;
|
|
96
102
|
export type AirCloseModalResponseMessage = AirWalletMessageBase<"air_close_modal_response", AirMessageSuccessPayload | AirMessageErrorPayload>;
|
|
103
|
+
export type AirInitCredentialCommunicationMessage = AirWalletMessageBaseWithoutPayload<"air_init_credential_communication">;
|
|
104
|
+
export type AirResetCredentialCommunicationMessage = AirWalletMessageBaseWithoutPayload<"air_reset_credential_communication">;
|
|
97
105
|
export type AirInternalProviderRequestMessage = AirWalletMessageBase<"air_internal_provider_request", AirWalletProviderMessageRequest["payload"]>;
|
|
98
106
|
export type AirInternalProviderResponseSuccessMessage = AirWalletMessageBase<"air_internal_provider_response", AirWalletProviderMessageSuccessResponse["payload"] & {
|
|
99
107
|
success: true;
|
|
@@ -102,5 +110,5 @@ export type AirInternalProviderResponseErrorMessage = AirWalletMessageBase<"air_
|
|
|
102
110
|
success: false;
|
|
103
111
|
}>;
|
|
104
112
|
export type AirInternalProviderResponseMessage = AirInternalProviderResponseSuccessMessage | AirInternalProviderResponseErrorMessage;
|
|
105
|
-
export type AirWalletMessage = AirInitializationRequestMessage | AirInitializationResponseMessage | AirWalletInitializedMessage | AirWalletLoginRequestMessage | AirWalletLoginResponseMessage | AirSetupOrUpdateMfaRequestMessage | AirSetupOrUpdateMfaResponseMessage | AirClaimIdRequestMessage | AirClaimIdResponseMessage | AirShowSwapUIRequestMessage | AirShowSwapUIResponseMessage | AirShowOnRampUIRequestMessage | AirShowOnRampUIResponseMessage | AirIsSmartAccountDeployedRequestMessage | AirIsSmartAccountDeployedResponseMessage | AirDeploySmartAccountRequestMessage | AirDeploySmartAccountResponseMessage | AirWalletIframeVisibilityRequestMessage | AirLogoutRequestMessage | AirLogoutResponseMessage | AirCloseModalRequestMessage | AirCloseModalResponseMessage | AirInternalProviderRequestMessage | AirInternalProviderResponseMessage;
|
|
113
|
+
export type AirWalletMessage = AirInitializationRequestMessage | AirInitializationResponseMessage | AirWalletInitializedMessage | AirWalletLoginRequestMessage | AirWalletLoginResponseMessage | AirSetupOrUpdateMfaRequestMessage | AirSetupOrUpdateMfaResponseMessage | AirClaimIdRequestMessage | AirClaimIdResponseMessage | AirShowSwapUIRequestMessage | AirShowSwapUIResponseMessage | AirShowOnRampUIRequestMessage | AirShowOnRampUIResponseMessage | AirInitAuthCommunicationMessage | AirIsSmartAccountDeployedRequestMessage | AirIsSmartAccountDeployedResponseMessage | AirDeploySmartAccountRequestMessage | AirDeploySmartAccountResponseMessage | AirWalletIframeVisibilityRequestMessage | AirLogoutRequestMessage | AirLogoutResponseMessage | AirCloseModalRequestMessage | AirCloseModalResponseMessage | AirInitCredentialCommunicationMessage | AirResetCredentialCommunicationMessage | AirInternalProviderRequestMessage | AirInternalProviderResponseMessage;
|
|
106
114
|
export {};
|
|
@@ -11,6 +11,8 @@ export declare class CredentialMessageService extends MessageServiceBase<AirCred
|
|
|
11
11
|
partnerDAppUrl: string;
|
|
12
12
|
enableAutomation: boolean;
|
|
13
13
|
}): Promise<import("@mocanetwork/common/src/air/messaging/credential").AirInitializationResponseMessage>;
|
|
14
|
+
initAuthCommunication(): Promise<import("@mocanetwork/common/src/air/messaging/credential").AirCredentialAuthInitializedMessage>;
|
|
15
|
+
initWalletCommunication(): Promise<import("@mocanetwork/common/src/air/messaging/credential").AirCredentialWalletInitializedMessage>;
|
|
14
16
|
logout(): Promise<import("@mocanetwork/common/src/air/messaging/credential").AirLogoutResponseMessage>;
|
|
15
17
|
sendIssueCredentialRequest(payload: AirIssueCredentialRequestMessage["payload"]): Promise<import("@mocanetwork/common/src/air/messaging/credential").AirIssueCredentialResponseMessage>;
|
|
16
18
|
sendVerifyCredentialRequest(payload: AirVerifyCredentialRequestMessage["payload"]): Promise<import("@mocanetwork/common/src/air/messaging/credential").AirVerifyCredentialResponseMessage>;
|
|
@@ -9,6 +9,7 @@ export declare class RecoveryMessageService extends MessageServiceBase<AirRecove
|
|
|
9
9
|
sdkVersion: string;
|
|
10
10
|
enableAutomation: boolean;
|
|
11
11
|
}): Promise<import("./common/air/messaging/recovery").AirInitializationResponseMessage>;
|
|
12
|
+
initAuthCommunication(): Promise<void>;
|
|
12
13
|
onInitialized(): Promise<import("./common/air/messaging/recovery").AirRecoveryInitializedMessage>;
|
|
13
14
|
logout(): Promise<import("./common/air/messaging/recovery").AirLogoutResponseMessage>;
|
|
14
15
|
open(element: HTMLIFrameElement): Promise<void>;
|
|
@@ -5,6 +5,7 @@ export declare class WalletMessageService extends MessageServiceBase<AirWalletMe
|
|
|
5
5
|
#private;
|
|
6
6
|
static create(): WalletMessageService;
|
|
7
7
|
open(walletIframe: HTMLIFrameElement): Promise<void>;
|
|
8
|
+
initAuthCommunication(skipWalletLogin: boolean): Promise<void>;
|
|
8
9
|
sendDeploySmartAccountRequest(): Promise<import("./common/air/messaging/wallet").AirDeploySmartAccountResponseMessage>;
|
|
9
10
|
sendIsSmartAccountDeployedRequest(): Promise<import("./common/air/messaging/wallet").AirIsSmartAccountDeployedResponseMessage>;
|
|
10
11
|
logout(): Promise<import("./common/air/messaging/wallet").AirLogoutResponseMessage>;
|
|
@@ -22,4 +23,6 @@ export declare class WalletMessageService extends MessageServiceBase<AirWalletMe
|
|
|
22
23
|
displayCurrencyCode: string;
|
|
23
24
|
targetCurrencyCode?: string;
|
|
24
25
|
}): Promise<import("./common/air/messaging/wallet").AirShowOnRampUIResponseMessage>;
|
|
26
|
+
initCredentialCommunication(): Promise<void>;
|
|
27
|
+
resetCredentialCommunication(): Promise<void>;
|
|
25
28
|
}
|