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