@mocanetwork/airkit 1.9.0-beta.1 → 1.9.0-beta.3
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 +123 -20
- package/dist/airkit.esm.js +123 -20
- package/dist/airkit.umd.js +123 -20
- package/dist/types/airService.d.ts +6 -3
- package/dist/types/airWalletProvider.d.ts +3 -1
- package/dist/types/common/air/messaging/auth.d.ts +13 -1
- package/dist/types/common/air/messaging/credential.d.ts +4 -5
- package/dist/types/common/air/messaging/messageServiceBase.d.ts +1 -1
- package/dist/types/common/air/messaging/provider.d.ts +1 -1
- package/dist/types/common/air/messaging/recovery.d.ts +24 -1
- package/dist/types/common/const.d.ts +1 -1
- package/dist/types/common/realm/smart-session/types.d.ts +3 -3
- package/dist/types/common/realm/user/types.d.ts +8 -1
- package/dist/types/common/utils.d.ts +9 -0
- package/dist/types/interfaces.d.ts +11 -1
- package/dist/types/recoveryMessageService.d.ts +8 -1
- 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.9.0-beta.
|
|
100
|
+
var version = "1.9.0-beta.3";
|
|
101
101
|
var airkitPackage = {
|
|
102
102
|
version: version};
|
|
103
103
|
|
|
@@ -141,6 +141,10 @@ const AirAuthMessageTypes = {
|
|
|
141
141
|
RECOVERY_RESPONSE: "air_auth_recovery_response",
|
|
142
142
|
ISSUE_ON_BEHALF_NEW_USER_CONFIRMATION_REQUEST: "air_auth_issue_on_behalf_new_user_confirmation_request",
|
|
143
143
|
ISSUE_ON_BEHALF_NEW_USER_CONFIRMATION_RESPONSE: "air_auth_issue_on_behalf_new_user_confirmation_response",
|
|
144
|
+
REMOVE_SIGNER_SIGNATURE_REQUEST: "air_auth_remove_signer_signature_request",
|
|
145
|
+
REMOVE_SIGNER_SIGNATURE_RESPONSE: "air_auth_remove_signer_signature_response",
|
|
146
|
+
RESET_WALLET_REQUEST: "air_auth_reset_wallet_request",
|
|
147
|
+
RESET_WALLET_RESPONSE: "air_auth_reset_wallet_response",
|
|
144
148
|
EXPIRED_LOGOUT_REQUEST: "air_auth_expired_logout_request"
|
|
145
149
|
};
|
|
146
150
|
|
|
@@ -173,6 +177,12 @@ const AirRecoveryMessageTypes = {
|
|
|
173
177
|
RECOVERY_IFRAME_VISIBILITY_REQUEST: "air_recovery_iframe_visibility_request",
|
|
174
178
|
UPDATE_SESSION_CONFIG_REQUEST: "air_recovery_update_session_config_request",
|
|
175
179
|
UPDATE_SESSION_CONFIG_RESPONSE: "air_recovery_update_session_config_response",
|
|
180
|
+
GET_AGENT_KEYS_REQUEST: "air_recovery_get_agent_keys_request",
|
|
181
|
+
GET_AGENT_KEYS_RESPONSE: "air_recovery_get_agent_keys_response",
|
|
182
|
+
REGISTER_AGENT_KEY_REQUEST: "air_recovery_register_agent_key_request",
|
|
183
|
+
REGISTER_AGENT_KEY_RESPONSE: "air_recovery_register_agent_key_response",
|
|
184
|
+
REMOVE_AGENT_KEY_REQUEST: "air_recovery_remove_agent_key_request",
|
|
185
|
+
REMOVE_AGENT_KEY_RESPONSE: "air_recovery_remove_agent_key_response",
|
|
176
186
|
LOGOUT_REQUEST: "air_recovery_logout_request",
|
|
177
187
|
LOGOUT_RESPONSE: "air_recovery_logout_response"
|
|
178
188
|
};
|
|
@@ -648,7 +658,7 @@ const mocaTestnet = {
|
|
|
648
658
|
rpcUrls: {
|
|
649
659
|
default: {
|
|
650
660
|
http: ["https://rpc.testnet.mocachain.dev"],
|
|
651
|
-
webSocket: ["wss://
|
|
661
|
+
webSocket: ["wss://ws.testnet.mocachain.dev"]
|
|
652
662
|
}
|
|
653
663
|
},
|
|
654
664
|
blockExplorers: {
|
|
@@ -1997,7 +2007,7 @@ class ProviderMessageService extends MessageServiceBase {
|
|
|
1997
2007
|
await super._open({ window, origin });
|
|
1998
2008
|
}
|
|
1999
2009
|
async sendWalletProviderRequest(payload) {
|
|
2000
|
-
const response = firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirWalletProviderMessageTypes.RESPONSE), filter((msg) => msg.payload.method === payload.method)));
|
|
2010
|
+
const response = firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirWalletProviderMessageTypes.RESPONSE), filter((msg) => msg.payload.method === payload.method && msg.payload.requestId === payload.requestId)));
|
|
2001
2011
|
await this.sendMessage({
|
|
2002
2012
|
type: AirWalletProviderMessageTypes.REQUEST,
|
|
2003
2013
|
payload,
|
|
@@ -2008,7 +2018,7 @@ class ProviderMessageService extends MessageServiceBase {
|
|
|
2008
2018
|
_a$4 = ProviderMessageService;
|
|
2009
2019
|
_ProviderMessageService_instance = { value: void 0 };
|
|
2010
2020
|
|
|
2011
|
-
var _AirWalletProvider_instances, _AirWalletProvider_providerMessageService, _AirWalletProvider_isWalletInitialized, _AirWalletProvider_getLoginResult, _AirWalletProvider_ensureWallet, _AirWalletProvider_eventListeners, _AirWalletProvider_emit;
|
|
2021
|
+
var _AirWalletProvider_instances, _AirWalletProvider_providerMessageService, _AirWalletProvider_isWalletInitialized, _AirWalletProvider_getLoginResult, _AirWalletProvider_ensureWallet, _AirWalletProvider_eventListeners, _AirWalletProvider_currentChainId, _AirWalletProvider_emit, _AirWalletProvider_getAddressForCurrentChain, _AirWalletProvider_parseChainId;
|
|
2012
2022
|
class AirWalletProvider {
|
|
2013
2023
|
constructor({ ensureWallet, isWalletInitialized, getLoginResult, }) {
|
|
2014
2024
|
_AirWalletProvider_instances.add(this);
|
|
@@ -2017,11 +2027,18 @@ class AirWalletProvider {
|
|
|
2017
2027
|
_AirWalletProvider_getLoginResult.set(this, void 0);
|
|
2018
2028
|
_AirWalletProvider_ensureWallet.set(this, void 0);
|
|
2019
2029
|
_AirWalletProvider_eventListeners.set(this, void 0);
|
|
2030
|
+
_AirWalletProvider_currentChainId.set(this, null);
|
|
2020
2031
|
this.startEventMessageListening = async (walletIframe) => {
|
|
2021
2032
|
await __classPrivateFieldGet(this, _AirWalletProvider_providerMessageService, "f").open(walletIframe);
|
|
2022
2033
|
__classPrivateFieldGet(this, _AirWalletProvider_providerMessageService, "f").messages$
|
|
2023
2034
|
.pipe(filter((msg) => msg.type === AirWalletProviderMessageTypes.EVENT))
|
|
2024
2035
|
.subscribe((message) => {
|
|
2036
|
+
if (message.payload.event === "chainChanged") {
|
|
2037
|
+
const parsedChainId = __classPrivateFieldGet(this, _AirWalletProvider_instances, "m", _AirWalletProvider_parseChainId).call(this, message.payload.data);
|
|
2038
|
+
if (parsedChainId !== null) {
|
|
2039
|
+
__classPrivateFieldSet(this, _AirWalletProvider_currentChainId, parsedChainId, "f");
|
|
2040
|
+
}
|
|
2041
|
+
}
|
|
2025
2042
|
__classPrivateFieldGet(this, _AirWalletProvider_instances, "m", _AirWalletProvider_emit).call(this, message.payload.event, ...[message.payload.data]);
|
|
2026
2043
|
});
|
|
2027
2044
|
};
|
|
@@ -2057,10 +2074,13 @@ class AirWalletProvider {
|
|
|
2057
2074
|
if (!loginResult) {
|
|
2058
2075
|
throw new UnauthorizedProviderError("User is not logged in");
|
|
2059
2076
|
}
|
|
2077
|
+
// Early return optimization: return cached address from login result if wallet not yet initialized
|
|
2060
2078
|
if ((method === "eth_accounts" || method === "eth_requestAccounts") &&
|
|
2061
|
-
!__classPrivateFieldGet(this, _AirWalletProvider_isWalletInitialized, "f").call(this)
|
|
2062
|
-
loginResult
|
|
2063
|
-
|
|
2079
|
+
!__classPrivateFieldGet(this, _AirWalletProvider_isWalletInitialized, "f").call(this)) {
|
|
2080
|
+
const address = __classPrivateFieldGet(this, _AirWalletProvider_instances, "m", _AirWalletProvider_getAddressForCurrentChain).call(this, loginResult);
|
|
2081
|
+
if (address) {
|
|
2082
|
+
return [address];
|
|
2083
|
+
}
|
|
2064
2084
|
}
|
|
2065
2085
|
const skipWalletLoginMethods = ["eth_chainId"];
|
|
2066
2086
|
try {
|
|
@@ -2082,6 +2102,12 @@ class AirWalletProvider {
|
|
|
2082
2102
|
if (!response.success) {
|
|
2083
2103
|
throw ensureProviderRpcError(response.payload);
|
|
2084
2104
|
}
|
|
2105
|
+
if (method === "eth_chainId") {
|
|
2106
|
+
const parsedChainId = __classPrivateFieldGet(this, _AirWalletProvider_instances, "m", _AirWalletProvider_parseChainId).call(this, response.payload.response);
|
|
2107
|
+
if (parsedChainId !== null) {
|
|
2108
|
+
__classPrivateFieldSet(this, _AirWalletProvider_currentChainId, parsedChainId, "f");
|
|
2109
|
+
}
|
|
2110
|
+
}
|
|
2085
2111
|
return response.payload.response;
|
|
2086
2112
|
}
|
|
2087
2113
|
on(eventName, listener) {
|
|
@@ -2105,7 +2131,7 @@ class AirWalletProvider {
|
|
|
2105
2131
|
}, "f");
|
|
2106
2132
|
}
|
|
2107
2133
|
}
|
|
2108
|
-
_AirWalletProvider_providerMessageService = new WeakMap(), _AirWalletProvider_isWalletInitialized = new WeakMap(), _AirWalletProvider_getLoginResult = new WeakMap(), _AirWalletProvider_ensureWallet = new WeakMap(), _AirWalletProvider_eventListeners = new WeakMap(), _AirWalletProvider_instances = new WeakSet(), _AirWalletProvider_emit = function _AirWalletProvider_emit(eventName, ...args) {
|
|
2134
|
+
_AirWalletProvider_providerMessageService = new WeakMap(), _AirWalletProvider_isWalletInitialized = new WeakMap(), _AirWalletProvider_getLoginResult = new WeakMap(), _AirWalletProvider_ensureWallet = new WeakMap(), _AirWalletProvider_eventListeners = new WeakMap(), _AirWalletProvider_currentChainId = new WeakMap(), _AirWalletProvider_instances = new WeakSet(), _AirWalletProvider_emit = function _AirWalletProvider_emit(eventName, ...args) {
|
|
2109
2135
|
(__classPrivateFieldGet(this, _AirWalletProvider_eventListeners, "f")[eventName] || []).forEach((listener) => {
|
|
2110
2136
|
try {
|
|
2111
2137
|
return listener(...args);
|
|
@@ -2114,6 +2140,32 @@ _AirWalletProvider_providerMessageService = new WeakMap(), _AirWalletProvider_is
|
|
|
2114
2140
|
log.warn(error);
|
|
2115
2141
|
}
|
|
2116
2142
|
});
|
|
2143
|
+
}, _AirWalletProvider_getAddressForCurrentChain = function _AirWalletProvider_getAddressForCurrentChain(loginResult) {
|
|
2144
|
+
const currentChainId = __classPrivateFieldGet(this, _AirWalletProvider_currentChainId, "f");
|
|
2145
|
+
// If we have the new addresses array and current chainId, look up by chain
|
|
2146
|
+
if (loginResult.abstractAccountAddresses && currentChainId !== null) {
|
|
2147
|
+
const chainIdStr = String(currentChainId);
|
|
2148
|
+
const addressEntry = loginResult.abstractAccountAddresses.find((entry) => entry.chainIds.includes(chainIdStr));
|
|
2149
|
+
if (addressEntry) {
|
|
2150
|
+
return addressEntry.address;
|
|
2151
|
+
}
|
|
2152
|
+
}
|
|
2153
|
+
// Fallback to legacy single address (backward compatibility)
|
|
2154
|
+
return loginResult.abstractAccountAddress;
|
|
2155
|
+
}, _AirWalletProvider_parseChainId = function _AirWalletProvider_parseChainId(chainId) {
|
|
2156
|
+
if (typeof chainId === "number") {
|
|
2157
|
+
return Number.isFinite(chainId) ? chainId : null;
|
|
2158
|
+
}
|
|
2159
|
+
if (typeof chainId === "bigint") {
|
|
2160
|
+
return Number(chainId);
|
|
2161
|
+
}
|
|
2162
|
+
if (typeof chainId !== "string" || !chainId) {
|
|
2163
|
+
return null;
|
|
2164
|
+
}
|
|
2165
|
+
const parsed = chainId.startsWith("0x")
|
|
2166
|
+
? parseInt(chainId, 16)
|
|
2167
|
+
: parseInt(chainId, 10);
|
|
2168
|
+
return Number.isNaN(parsed) ? null : parsed;
|
|
2117
2169
|
};
|
|
2118
2170
|
|
|
2119
2171
|
var _a$3, _AuthMessageService_instance;
|
|
@@ -2427,6 +2479,29 @@ class RecoveryMessageService extends MessageServiceBase {
|
|
|
2427
2479
|
await this.sendMessage({ type: AirRecoveryMessageTypes.LOGOUT_REQUEST });
|
|
2428
2480
|
return response;
|
|
2429
2481
|
}
|
|
2482
|
+
async sendGetAgentKeysRequest() {
|
|
2483
|
+
const response = firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirRecoveryMessageTypes.GET_AGENT_KEYS_RESPONSE)));
|
|
2484
|
+
await this.sendMessage({
|
|
2485
|
+
type: AirRecoveryMessageTypes.GET_AGENT_KEYS_REQUEST,
|
|
2486
|
+
});
|
|
2487
|
+
return response;
|
|
2488
|
+
}
|
|
2489
|
+
async sendRegisterAgentKeyRequest(payload) {
|
|
2490
|
+
const response = firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirRecoveryMessageTypes.REGISTER_AGENT_KEY_RESPONSE)));
|
|
2491
|
+
await this.sendMessage({
|
|
2492
|
+
type: AirRecoveryMessageTypes.REGISTER_AGENT_KEY_REQUEST,
|
|
2493
|
+
payload,
|
|
2494
|
+
});
|
|
2495
|
+
return response;
|
|
2496
|
+
}
|
|
2497
|
+
async sendRemoveAgentKeyRequest(payload) {
|
|
2498
|
+
const response = firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirRecoveryMessageTypes.REMOVE_AGENT_KEY_RESPONSE)));
|
|
2499
|
+
await this.sendMessage({
|
|
2500
|
+
type: AirRecoveryMessageTypes.REMOVE_AGENT_KEY_REQUEST,
|
|
2501
|
+
payload,
|
|
2502
|
+
});
|
|
2503
|
+
return response;
|
|
2504
|
+
}
|
|
2430
2505
|
async open(element) {
|
|
2431
2506
|
await this._open({ window: element.contentWindow, origin: new URL(element.src).origin });
|
|
2432
2507
|
}
|
|
@@ -2915,7 +2990,6 @@ class AirService {
|
|
|
2915
2990
|
}
|
|
2916
2991
|
case AirAuthMessageTypes.SETUP_CREDENTIAL_REQUEST: {
|
|
2917
2992
|
try {
|
|
2918
|
-
await __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureWallet).call(this, { skipWalletLogin: true });
|
|
2919
2993
|
await __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureCredential).call(this);
|
|
2920
2994
|
await __classPrivateFieldGet(this, _AirService_authMessagingService, "f").sendSetupCredentialSuccessResponse();
|
|
2921
2995
|
}
|
|
@@ -2986,10 +3060,6 @@ class AirService {
|
|
|
2986
3060
|
});
|
|
2987
3061
|
if (payload.success === true) {
|
|
2988
3062
|
__classPrivateFieldSet(this, _AirService_loginResult, __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_createLoginResult).call(this, payload), "f");
|
|
2989
|
-
if (payload.needsWalletRestart === true) {
|
|
2990
|
-
await Promise.all([__classPrivateFieldGet(this, _AirService_instances, "m", _AirService_cleanUpWallet).call(this), __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_cleanUpCredential).call(this)]);
|
|
2991
|
-
void __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureCredential).call(this);
|
|
2992
|
-
}
|
|
2993
3063
|
__classPrivateFieldGet(this, _AirService_instances, "m", _AirService_triggerAirAuthLoggedIn).call(this);
|
|
2994
3064
|
return __classPrivateFieldGet(this, _AirService_loginResult, "f");
|
|
2995
3065
|
}
|
|
@@ -3083,7 +3153,7 @@ class AirService {
|
|
|
3083
3153
|
decimals: result.payload.decimals,
|
|
3084
3154
|
address: result.payload.address,
|
|
3085
3155
|
recipientAddress: result.payload.recipientAddress,
|
|
3086
|
-
amount: result.payload.amount
|
|
3156
|
+
amount: result.payload.amount,
|
|
3087
3157
|
};
|
|
3088
3158
|
}
|
|
3089
3159
|
/**
|
|
@@ -3098,6 +3168,35 @@ class AirService {
|
|
|
3098
3168
|
throw new AirServiceError(result.payload.errorName, result.payload.errorMessage);
|
|
3099
3169
|
}
|
|
3100
3170
|
}
|
|
3171
|
+
async getAgentKeys() {
|
|
3172
|
+
await __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureRecovery).call(this);
|
|
3173
|
+
const { payload } = await __classPrivateFieldGet(this, _AirService_recoveryMessagingService, "f").sendGetAgentKeysRequest();
|
|
3174
|
+
if (payload.success === false) {
|
|
3175
|
+
throw new AirServiceError(payload.errorName, payload.errorMessage);
|
|
3176
|
+
}
|
|
3177
|
+
return payload.agentKeys;
|
|
3178
|
+
}
|
|
3179
|
+
async registerAgentKey(publicKey) {
|
|
3180
|
+
await __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureRecovery).call(this);
|
|
3181
|
+
const { payload } = await __classPrivateFieldGet(this, _AirService_recoveryMessagingService, "f").sendRegisterAgentKeyRequest({
|
|
3182
|
+
publicKey,
|
|
3183
|
+
});
|
|
3184
|
+
if (payload.success === false) {
|
|
3185
|
+
throw new AirServiceError(payload.errorName, payload.errorMessage);
|
|
3186
|
+
}
|
|
3187
|
+
return {
|
|
3188
|
+
id: payload.id,
|
|
3189
|
+
publicKey: payload.publicKey,
|
|
3190
|
+
createdAt: payload.createdAt,
|
|
3191
|
+
};
|
|
3192
|
+
}
|
|
3193
|
+
async removeAgentKey(id) {
|
|
3194
|
+
await __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureRecovery).call(this);
|
|
3195
|
+
const { payload } = await __classPrivateFieldGet(this, _AirService_recoveryMessagingService, "f").sendRemoveAgentKeyRequest({ id });
|
|
3196
|
+
if (payload.success === false) {
|
|
3197
|
+
throw new AirServiceError(payload.errorName, payload.errorMessage);
|
|
3198
|
+
}
|
|
3199
|
+
}
|
|
3101
3200
|
async getUserInfo() {
|
|
3102
3201
|
__classPrivateFieldGet(this, _AirService_instances, "m", _AirService_assertLoggedIn).call(this);
|
|
3103
3202
|
const info = await __classPrivateFieldGet(this, _AirService_authMessagingService, "f").sendPartnerUserInfoRequest();
|
|
@@ -3112,7 +3211,7 @@ class AirService {
|
|
|
3112
3211
|
id: info.payload.user.id,
|
|
3113
3212
|
abstractAccountAddress: info.payload.user.abstractAccountAddress,
|
|
3114
3213
|
email: info.payload.user.email,
|
|
3115
|
-
isMFASetup: info.payload.user.
|
|
3214
|
+
isMFASetup: info.payload.user.activeMfaMethods.length > 0,
|
|
3116
3215
|
},
|
|
3117
3216
|
};
|
|
3118
3217
|
}
|
|
@@ -3228,13 +3327,16 @@ class AirService {
|
|
|
3228
3327
|
cakPublicKey: payload.cakPublicKey,
|
|
3229
3328
|
};
|
|
3230
3329
|
}
|
|
3231
|
-
async verifyCredential({ authToken, programId, redirectUrl,
|
|
3330
|
+
async verifyCredential({ authToken, programId, redirectUrl, fieldsToDisclose, offchain, }) {
|
|
3331
|
+
if (Array.isArray(fieldsToDisclose) && fieldsToDisclose.length === 0) {
|
|
3332
|
+
throw new AirServiceError("CLIENT_ERROR", "fieldsToDisclose array must contain at least one field");
|
|
3333
|
+
}
|
|
3232
3334
|
await __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureCredential).call(this);
|
|
3233
3335
|
const { payload } = await __classPrivateFieldGet(this, _AirService_credentialMessagingService, "f").sendVerifyCredentialRequest({
|
|
3234
3336
|
partnerToken: authToken,
|
|
3235
3337
|
programId,
|
|
3236
3338
|
redirectUrl,
|
|
3237
|
-
|
|
3339
|
+
fieldsToDisclose,
|
|
3238
3340
|
offchain,
|
|
3239
3341
|
});
|
|
3240
3342
|
if (payload.success === false) {
|
|
@@ -3252,7 +3354,7 @@ _AirService_loginResult = new WeakMap(), _AirService_buildEnv = new WeakMap(), _
|
|
|
3252
3354
|
throw new AirServiceError("NOT_LOGGED_IN", "User not logged in");
|
|
3253
3355
|
}, _AirService_ensureCredential = async function _AirService_ensureCredential() {
|
|
3254
3356
|
__classPrivateFieldGet(this, _AirService_instances, "m", _AirService_assertInitialized).call(this);
|
|
3255
|
-
void __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureWallet).call(this);
|
|
3357
|
+
void __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureWallet).call(this, { skipWalletLogin: true });
|
|
3256
3358
|
try {
|
|
3257
3359
|
if (!__classPrivateFieldGet(this, _AirService_credentialsInitialization, "f"))
|
|
3258
3360
|
__classPrivateFieldSet(this, _AirService_credentialsInitialization, __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_initializeCredentials).call(this), "f");
|
|
@@ -3487,8 +3589,9 @@ _AirService_loginResult = new WeakMap(), _AirService_buildEnv = new WeakMap(), _
|
|
|
3487
3589
|
isLoggedIn: true,
|
|
3488
3590
|
id: payload.id,
|
|
3489
3591
|
abstractAccountAddress: payload.abstractAccountAddress,
|
|
3592
|
+
abstractAccountAddresses: payload.abstractAccountAddresses,
|
|
3490
3593
|
token: payload.partnerAccessToken,
|
|
3491
|
-
isMFASetup: payload.
|
|
3594
|
+
isMFASetup: payload.activeMfaMethods.length > 0,
|
|
3492
3595
|
};
|
|
3493
3596
|
}, _AirService_createWalletInitializedResult = function _AirService_createWalletInitializedResult(payload) {
|
|
3494
3597
|
if ("isWalletLoggedIn" in payload && !payload.isWalletLoggedIn) {
|
|
@@ -3499,7 +3602,7 @@ _AirService_loginResult = new WeakMap(), _AirService_buildEnv = new WeakMap(), _
|
|
|
3499
3602
|
}
|
|
3500
3603
|
return {
|
|
3501
3604
|
abstractAccountAddress: payload.addresses.aa,
|
|
3502
|
-
isMFASetup: payload.
|
|
3605
|
+
isMFASetup: payload.activeMfaMethods.length > 0,
|
|
3503
3606
|
};
|
|
3504
3607
|
}, _AirService_cleanUpAuth = async function _AirService_cleanUpAuth() {
|
|
3505
3608
|
// Logout auth session
|
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.9.0-beta.
|
|
98
|
+
var version = "1.9.0-beta.3";
|
|
99
99
|
var airkitPackage = {
|
|
100
100
|
version: version};
|
|
101
101
|
|
|
@@ -139,6 +139,10 @@ const AirAuthMessageTypes = {
|
|
|
139
139
|
RECOVERY_RESPONSE: "air_auth_recovery_response",
|
|
140
140
|
ISSUE_ON_BEHALF_NEW_USER_CONFIRMATION_REQUEST: "air_auth_issue_on_behalf_new_user_confirmation_request",
|
|
141
141
|
ISSUE_ON_BEHALF_NEW_USER_CONFIRMATION_RESPONSE: "air_auth_issue_on_behalf_new_user_confirmation_response",
|
|
142
|
+
REMOVE_SIGNER_SIGNATURE_REQUEST: "air_auth_remove_signer_signature_request",
|
|
143
|
+
REMOVE_SIGNER_SIGNATURE_RESPONSE: "air_auth_remove_signer_signature_response",
|
|
144
|
+
RESET_WALLET_REQUEST: "air_auth_reset_wallet_request",
|
|
145
|
+
RESET_WALLET_RESPONSE: "air_auth_reset_wallet_response",
|
|
142
146
|
EXPIRED_LOGOUT_REQUEST: "air_auth_expired_logout_request"
|
|
143
147
|
};
|
|
144
148
|
|
|
@@ -171,6 +175,12 @@ const AirRecoveryMessageTypes = {
|
|
|
171
175
|
RECOVERY_IFRAME_VISIBILITY_REQUEST: "air_recovery_iframe_visibility_request",
|
|
172
176
|
UPDATE_SESSION_CONFIG_REQUEST: "air_recovery_update_session_config_request",
|
|
173
177
|
UPDATE_SESSION_CONFIG_RESPONSE: "air_recovery_update_session_config_response",
|
|
178
|
+
GET_AGENT_KEYS_REQUEST: "air_recovery_get_agent_keys_request",
|
|
179
|
+
GET_AGENT_KEYS_RESPONSE: "air_recovery_get_agent_keys_response",
|
|
180
|
+
REGISTER_AGENT_KEY_REQUEST: "air_recovery_register_agent_key_request",
|
|
181
|
+
REGISTER_AGENT_KEY_RESPONSE: "air_recovery_register_agent_key_response",
|
|
182
|
+
REMOVE_AGENT_KEY_REQUEST: "air_recovery_remove_agent_key_request",
|
|
183
|
+
REMOVE_AGENT_KEY_RESPONSE: "air_recovery_remove_agent_key_response",
|
|
174
184
|
LOGOUT_REQUEST: "air_recovery_logout_request",
|
|
175
185
|
LOGOUT_RESPONSE: "air_recovery_logout_response"
|
|
176
186
|
};
|
|
@@ -646,7 +656,7 @@ const mocaTestnet = {
|
|
|
646
656
|
rpcUrls: {
|
|
647
657
|
default: {
|
|
648
658
|
http: ["https://rpc.testnet.mocachain.dev"],
|
|
649
|
-
webSocket: ["wss://
|
|
659
|
+
webSocket: ["wss://ws.testnet.mocachain.dev"]
|
|
650
660
|
}
|
|
651
661
|
},
|
|
652
662
|
blockExplorers: {
|
|
@@ -1995,7 +2005,7 @@ class ProviderMessageService extends MessageServiceBase {
|
|
|
1995
2005
|
await super._open({ window, origin });
|
|
1996
2006
|
}
|
|
1997
2007
|
async sendWalletProviderRequest(payload) {
|
|
1998
|
-
const response = firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirWalletProviderMessageTypes.RESPONSE), filter((msg) => msg.payload.method === payload.method)));
|
|
2008
|
+
const response = firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirWalletProviderMessageTypes.RESPONSE), filter((msg) => msg.payload.method === payload.method && msg.payload.requestId === payload.requestId)));
|
|
1999
2009
|
await this.sendMessage({
|
|
2000
2010
|
type: AirWalletProviderMessageTypes.REQUEST,
|
|
2001
2011
|
payload,
|
|
@@ -2006,7 +2016,7 @@ class ProviderMessageService extends MessageServiceBase {
|
|
|
2006
2016
|
_a$4 = ProviderMessageService;
|
|
2007
2017
|
_ProviderMessageService_instance = { value: void 0 };
|
|
2008
2018
|
|
|
2009
|
-
var _AirWalletProvider_instances, _AirWalletProvider_providerMessageService, _AirWalletProvider_isWalletInitialized, _AirWalletProvider_getLoginResult, _AirWalletProvider_ensureWallet, _AirWalletProvider_eventListeners, _AirWalletProvider_emit;
|
|
2019
|
+
var _AirWalletProvider_instances, _AirWalletProvider_providerMessageService, _AirWalletProvider_isWalletInitialized, _AirWalletProvider_getLoginResult, _AirWalletProvider_ensureWallet, _AirWalletProvider_eventListeners, _AirWalletProvider_currentChainId, _AirWalletProvider_emit, _AirWalletProvider_getAddressForCurrentChain, _AirWalletProvider_parseChainId;
|
|
2010
2020
|
class AirWalletProvider {
|
|
2011
2021
|
constructor({ ensureWallet, isWalletInitialized, getLoginResult, }) {
|
|
2012
2022
|
_AirWalletProvider_instances.add(this);
|
|
@@ -2015,11 +2025,18 @@ class AirWalletProvider {
|
|
|
2015
2025
|
_AirWalletProvider_getLoginResult.set(this, void 0);
|
|
2016
2026
|
_AirWalletProvider_ensureWallet.set(this, void 0);
|
|
2017
2027
|
_AirWalletProvider_eventListeners.set(this, void 0);
|
|
2028
|
+
_AirWalletProvider_currentChainId.set(this, null);
|
|
2018
2029
|
this.startEventMessageListening = async (walletIframe) => {
|
|
2019
2030
|
await __classPrivateFieldGet(this, _AirWalletProvider_providerMessageService, "f").open(walletIframe);
|
|
2020
2031
|
__classPrivateFieldGet(this, _AirWalletProvider_providerMessageService, "f").messages$
|
|
2021
2032
|
.pipe(filter((msg) => msg.type === AirWalletProviderMessageTypes.EVENT))
|
|
2022
2033
|
.subscribe((message) => {
|
|
2034
|
+
if (message.payload.event === "chainChanged") {
|
|
2035
|
+
const parsedChainId = __classPrivateFieldGet(this, _AirWalletProvider_instances, "m", _AirWalletProvider_parseChainId).call(this, message.payload.data);
|
|
2036
|
+
if (parsedChainId !== null) {
|
|
2037
|
+
__classPrivateFieldSet(this, _AirWalletProvider_currentChainId, parsedChainId, "f");
|
|
2038
|
+
}
|
|
2039
|
+
}
|
|
2023
2040
|
__classPrivateFieldGet(this, _AirWalletProvider_instances, "m", _AirWalletProvider_emit).call(this, message.payload.event, ...[message.payload.data]);
|
|
2024
2041
|
});
|
|
2025
2042
|
};
|
|
@@ -2055,10 +2072,13 @@ class AirWalletProvider {
|
|
|
2055
2072
|
if (!loginResult) {
|
|
2056
2073
|
throw new UnauthorizedProviderError("User is not logged in");
|
|
2057
2074
|
}
|
|
2075
|
+
// Early return optimization: return cached address from login result if wallet not yet initialized
|
|
2058
2076
|
if ((method === "eth_accounts" || method === "eth_requestAccounts") &&
|
|
2059
|
-
!__classPrivateFieldGet(this, _AirWalletProvider_isWalletInitialized, "f").call(this)
|
|
2060
|
-
loginResult
|
|
2061
|
-
|
|
2077
|
+
!__classPrivateFieldGet(this, _AirWalletProvider_isWalletInitialized, "f").call(this)) {
|
|
2078
|
+
const address = __classPrivateFieldGet(this, _AirWalletProvider_instances, "m", _AirWalletProvider_getAddressForCurrentChain).call(this, loginResult);
|
|
2079
|
+
if (address) {
|
|
2080
|
+
return [address];
|
|
2081
|
+
}
|
|
2062
2082
|
}
|
|
2063
2083
|
const skipWalletLoginMethods = ["eth_chainId"];
|
|
2064
2084
|
try {
|
|
@@ -2080,6 +2100,12 @@ class AirWalletProvider {
|
|
|
2080
2100
|
if (!response.success) {
|
|
2081
2101
|
throw ensureProviderRpcError(response.payload);
|
|
2082
2102
|
}
|
|
2103
|
+
if (method === "eth_chainId") {
|
|
2104
|
+
const parsedChainId = __classPrivateFieldGet(this, _AirWalletProvider_instances, "m", _AirWalletProvider_parseChainId).call(this, response.payload.response);
|
|
2105
|
+
if (parsedChainId !== null) {
|
|
2106
|
+
__classPrivateFieldSet(this, _AirWalletProvider_currentChainId, parsedChainId, "f");
|
|
2107
|
+
}
|
|
2108
|
+
}
|
|
2083
2109
|
return response.payload.response;
|
|
2084
2110
|
}
|
|
2085
2111
|
on(eventName, listener) {
|
|
@@ -2103,7 +2129,7 @@ class AirWalletProvider {
|
|
|
2103
2129
|
}, "f");
|
|
2104
2130
|
}
|
|
2105
2131
|
}
|
|
2106
|
-
_AirWalletProvider_providerMessageService = new WeakMap(), _AirWalletProvider_isWalletInitialized = new WeakMap(), _AirWalletProvider_getLoginResult = new WeakMap(), _AirWalletProvider_ensureWallet = new WeakMap(), _AirWalletProvider_eventListeners = new WeakMap(), _AirWalletProvider_instances = new WeakSet(), _AirWalletProvider_emit = function _AirWalletProvider_emit(eventName, ...args) {
|
|
2132
|
+
_AirWalletProvider_providerMessageService = new WeakMap(), _AirWalletProvider_isWalletInitialized = new WeakMap(), _AirWalletProvider_getLoginResult = new WeakMap(), _AirWalletProvider_ensureWallet = new WeakMap(), _AirWalletProvider_eventListeners = new WeakMap(), _AirWalletProvider_currentChainId = new WeakMap(), _AirWalletProvider_instances = new WeakSet(), _AirWalletProvider_emit = function _AirWalletProvider_emit(eventName, ...args) {
|
|
2107
2133
|
(__classPrivateFieldGet(this, _AirWalletProvider_eventListeners, "f")[eventName] || []).forEach((listener) => {
|
|
2108
2134
|
try {
|
|
2109
2135
|
return listener(...args);
|
|
@@ -2112,6 +2138,32 @@ _AirWalletProvider_providerMessageService = new WeakMap(), _AirWalletProvider_is
|
|
|
2112
2138
|
log.warn(error);
|
|
2113
2139
|
}
|
|
2114
2140
|
});
|
|
2141
|
+
}, _AirWalletProvider_getAddressForCurrentChain = function _AirWalletProvider_getAddressForCurrentChain(loginResult) {
|
|
2142
|
+
const currentChainId = __classPrivateFieldGet(this, _AirWalletProvider_currentChainId, "f");
|
|
2143
|
+
// If we have the new addresses array and current chainId, look up by chain
|
|
2144
|
+
if (loginResult.abstractAccountAddresses && currentChainId !== null) {
|
|
2145
|
+
const chainIdStr = String(currentChainId);
|
|
2146
|
+
const addressEntry = loginResult.abstractAccountAddresses.find((entry) => entry.chainIds.includes(chainIdStr));
|
|
2147
|
+
if (addressEntry) {
|
|
2148
|
+
return addressEntry.address;
|
|
2149
|
+
}
|
|
2150
|
+
}
|
|
2151
|
+
// Fallback to legacy single address (backward compatibility)
|
|
2152
|
+
return loginResult.abstractAccountAddress;
|
|
2153
|
+
}, _AirWalletProvider_parseChainId = function _AirWalletProvider_parseChainId(chainId) {
|
|
2154
|
+
if (typeof chainId === "number") {
|
|
2155
|
+
return Number.isFinite(chainId) ? chainId : null;
|
|
2156
|
+
}
|
|
2157
|
+
if (typeof chainId === "bigint") {
|
|
2158
|
+
return Number(chainId);
|
|
2159
|
+
}
|
|
2160
|
+
if (typeof chainId !== "string" || !chainId) {
|
|
2161
|
+
return null;
|
|
2162
|
+
}
|
|
2163
|
+
const parsed = chainId.startsWith("0x")
|
|
2164
|
+
? parseInt(chainId, 16)
|
|
2165
|
+
: parseInt(chainId, 10);
|
|
2166
|
+
return Number.isNaN(parsed) ? null : parsed;
|
|
2115
2167
|
};
|
|
2116
2168
|
|
|
2117
2169
|
var _a$3, _AuthMessageService_instance;
|
|
@@ -2425,6 +2477,29 @@ class RecoveryMessageService extends MessageServiceBase {
|
|
|
2425
2477
|
await this.sendMessage({ type: AirRecoveryMessageTypes.LOGOUT_REQUEST });
|
|
2426
2478
|
return response;
|
|
2427
2479
|
}
|
|
2480
|
+
async sendGetAgentKeysRequest() {
|
|
2481
|
+
const response = firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirRecoveryMessageTypes.GET_AGENT_KEYS_RESPONSE)));
|
|
2482
|
+
await this.sendMessage({
|
|
2483
|
+
type: AirRecoveryMessageTypes.GET_AGENT_KEYS_REQUEST,
|
|
2484
|
+
});
|
|
2485
|
+
return response;
|
|
2486
|
+
}
|
|
2487
|
+
async sendRegisterAgentKeyRequest(payload) {
|
|
2488
|
+
const response = firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirRecoveryMessageTypes.REGISTER_AGENT_KEY_RESPONSE)));
|
|
2489
|
+
await this.sendMessage({
|
|
2490
|
+
type: AirRecoveryMessageTypes.REGISTER_AGENT_KEY_REQUEST,
|
|
2491
|
+
payload,
|
|
2492
|
+
});
|
|
2493
|
+
return response;
|
|
2494
|
+
}
|
|
2495
|
+
async sendRemoveAgentKeyRequest(payload) {
|
|
2496
|
+
const response = firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirRecoveryMessageTypes.REMOVE_AGENT_KEY_RESPONSE)));
|
|
2497
|
+
await this.sendMessage({
|
|
2498
|
+
type: AirRecoveryMessageTypes.REMOVE_AGENT_KEY_REQUEST,
|
|
2499
|
+
payload,
|
|
2500
|
+
});
|
|
2501
|
+
return response;
|
|
2502
|
+
}
|
|
2428
2503
|
async open(element) {
|
|
2429
2504
|
await this._open({ window: element.contentWindow, origin: new URL(element.src).origin });
|
|
2430
2505
|
}
|
|
@@ -2913,7 +2988,6 @@ class AirService {
|
|
|
2913
2988
|
}
|
|
2914
2989
|
case AirAuthMessageTypes.SETUP_CREDENTIAL_REQUEST: {
|
|
2915
2990
|
try {
|
|
2916
|
-
await __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureWallet).call(this, { skipWalletLogin: true });
|
|
2917
2991
|
await __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureCredential).call(this);
|
|
2918
2992
|
await __classPrivateFieldGet(this, _AirService_authMessagingService, "f").sendSetupCredentialSuccessResponse();
|
|
2919
2993
|
}
|
|
@@ -2984,10 +3058,6 @@ class AirService {
|
|
|
2984
3058
|
});
|
|
2985
3059
|
if (payload.success === true) {
|
|
2986
3060
|
__classPrivateFieldSet(this, _AirService_loginResult, __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_createLoginResult).call(this, payload), "f");
|
|
2987
|
-
if (payload.needsWalletRestart === true) {
|
|
2988
|
-
await Promise.all([__classPrivateFieldGet(this, _AirService_instances, "m", _AirService_cleanUpWallet).call(this), __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_cleanUpCredential).call(this)]);
|
|
2989
|
-
void __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureCredential).call(this);
|
|
2990
|
-
}
|
|
2991
3061
|
__classPrivateFieldGet(this, _AirService_instances, "m", _AirService_triggerAirAuthLoggedIn).call(this);
|
|
2992
3062
|
return __classPrivateFieldGet(this, _AirService_loginResult, "f");
|
|
2993
3063
|
}
|
|
@@ -3081,7 +3151,7 @@ class AirService {
|
|
|
3081
3151
|
decimals: result.payload.decimals,
|
|
3082
3152
|
address: result.payload.address,
|
|
3083
3153
|
recipientAddress: result.payload.recipientAddress,
|
|
3084
|
-
amount: result.payload.amount
|
|
3154
|
+
amount: result.payload.amount,
|
|
3085
3155
|
};
|
|
3086
3156
|
}
|
|
3087
3157
|
/**
|
|
@@ -3096,6 +3166,35 @@ class AirService {
|
|
|
3096
3166
|
throw new AirServiceError(result.payload.errorName, result.payload.errorMessage);
|
|
3097
3167
|
}
|
|
3098
3168
|
}
|
|
3169
|
+
async getAgentKeys() {
|
|
3170
|
+
await __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureRecovery).call(this);
|
|
3171
|
+
const { payload } = await __classPrivateFieldGet(this, _AirService_recoveryMessagingService, "f").sendGetAgentKeysRequest();
|
|
3172
|
+
if (payload.success === false) {
|
|
3173
|
+
throw new AirServiceError(payload.errorName, payload.errorMessage);
|
|
3174
|
+
}
|
|
3175
|
+
return payload.agentKeys;
|
|
3176
|
+
}
|
|
3177
|
+
async registerAgentKey(publicKey) {
|
|
3178
|
+
await __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureRecovery).call(this);
|
|
3179
|
+
const { payload } = await __classPrivateFieldGet(this, _AirService_recoveryMessagingService, "f").sendRegisterAgentKeyRequest({
|
|
3180
|
+
publicKey,
|
|
3181
|
+
});
|
|
3182
|
+
if (payload.success === false) {
|
|
3183
|
+
throw new AirServiceError(payload.errorName, payload.errorMessage);
|
|
3184
|
+
}
|
|
3185
|
+
return {
|
|
3186
|
+
id: payload.id,
|
|
3187
|
+
publicKey: payload.publicKey,
|
|
3188
|
+
createdAt: payload.createdAt,
|
|
3189
|
+
};
|
|
3190
|
+
}
|
|
3191
|
+
async removeAgentKey(id) {
|
|
3192
|
+
await __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureRecovery).call(this);
|
|
3193
|
+
const { payload } = await __classPrivateFieldGet(this, _AirService_recoveryMessagingService, "f").sendRemoveAgentKeyRequest({ id });
|
|
3194
|
+
if (payload.success === false) {
|
|
3195
|
+
throw new AirServiceError(payload.errorName, payload.errorMessage);
|
|
3196
|
+
}
|
|
3197
|
+
}
|
|
3099
3198
|
async getUserInfo() {
|
|
3100
3199
|
__classPrivateFieldGet(this, _AirService_instances, "m", _AirService_assertLoggedIn).call(this);
|
|
3101
3200
|
const info = await __classPrivateFieldGet(this, _AirService_authMessagingService, "f").sendPartnerUserInfoRequest();
|
|
@@ -3110,7 +3209,7 @@ class AirService {
|
|
|
3110
3209
|
id: info.payload.user.id,
|
|
3111
3210
|
abstractAccountAddress: info.payload.user.abstractAccountAddress,
|
|
3112
3211
|
email: info.payload.user.email,
|
|
3113
|
-
isMFASetup: info.payload.user.
|
|
3212
|
+
isMFASetup: info.payload.user.activeMfaMethods.length > 0,
|
|
3114
3213
|
},
|
|
3115
3214
|
};
|
|
3116
3215
|
}
|
|
@@ -3226,13 +3325,16 @@ class AirService {
|
|
|
3226
3325
|
cakPublicKey: payload.cakPublicKey,
|
|
3227
3326
|
};
|
|
3228
3327
|
}
|
|
3229
|
-
async verifyCredential({ authToken, programId, redirectUrl,
|
|
3328
|
+
async verifyCredential({ authToken, programId, redirectUrl, fieldsToDisclose, offchain, }) {
|
|
3329
|
+
if (Array.isArray(fieldsToDisclose) && fieldsToDisclose.length === 0) {
|
|
3330
|
+
throw new AirServiceError("CLIENT_ERROR", "fieldsToDisclose array must contain at least one field");
|
|
3331
|
+
}
|
|
3230
3332
|
await __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureCredential).call(this);
|
|
3231
3333
|
const { payload } = await __classPrivateFieldGet(this, _AirService_credentialMessagingService, "f").sendVerifyCredentialRequest({
|
|
3232
3334
|
partnerToken: authToken,
|
|
3233
3335
|
programId,
|
|
3234
3336
|
redirectUrl,
|
|
3235
|
-
|
|
3337
|
+
fieldsToDisclose,
|
|
3236
3338
|
offchain,
|
|
3237
3339
|
});
|
|
3238
3340
|
if (payload.success === false) {
|
|
@@ -3250,7 +3352,7 @@ _AirService_loginResult = new WeakMap(), _AirService_buildEnv = new WeakMap(), _
|
|
|
3250
3352
|
throw new AirServiceError("NOT_LOGGED_IN", "User not logged in");
|
|
3251
3353
|
}, _AirService_ensureCredential = async function _AirService_ensureCredential() {
|
|
3252
3354
|
__classPrivateFieldGet(this, _AirService_instances, "m", _AirService_assertInitialized).call(this);
|
|
3253
|
-
void __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureWallet).call(this);
|
|
3355
|
+
void __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureWallet).call(this, { skipWalletLogin: true });
|
|
3254
3356
|
try {
|
|
3255
3357
|
if (!__classPrivateFieldGet(this, _AirService_credentialsInitialization, "f"))
|
|
3256
3358
|
__classPrivateFieldSet(this, _AirService_credentialsInitialization, __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_initializeCredentials).call(this), "f");
|
|
@@ -3485,8 +3587,9 @@ _AirService_loginResult = new WeakMap(), _AirService_buildEnv = new WeakMap(), _
|
|
|
3485
3587
|
isLoggedIn: true,
|
|
3486
3588
|
id: payload.id,
|
|
3487
3589
|
abstractAccountAddress: payload.abstractAccountAddress,
|
|
3590
|
+
abstractAccountAddresses: payload.abstractAccountAddresses,
|
|
3488
3591
|
token: payload.partnerAccessToken,
|
|
3489
|
-
isMFASetup: payload.
|
|
3592
|
+
isMFASetup: payload.activeMfaMethods.length > 0,
|
|
3490
3593
|
};
|
|
3491
3594
|
}, _AirService_createWalletInitializedResult = function _AirService_createWalletInitializedResult(payload) {
|
|
3492
3595
|
if ("isWalletLoggedIn" in payload && !payload.isWalletLoggedIn) {
|
|
@@ -3497,7 +3600,7 @@ _AirService_loginResult = new WeakMap(), _AirService_buildEnv = new WeakMap(), _
|
|
|
3497
3600
|
}
|
|
3498
3601
|
return {
|
|
3499
3602
|
abstractAccountAddress: payload.addresses.aa,
|
|
3500
|
-
isMFASetup: payload.
|
|
3603
|
+
isMFASetup: payload.activeMfaMethods.length > 0,
|
|
3501
3604
|
};
|
|
3502
3605
|
}, _AirService_cleanUpAuth = async function _AirService_cleanUpAuth() {
|
|
3503
3606
|
// Logout auth session
|
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.9.0-beta.
|
|
104
|
+
var version = "1.9.0-beta.3";
|
|
105
105
|
var airkitPackage = {
|
|
106
106
|
version: version};
|
|
107
107
|
|
|
@@ -145,6 +145,10 @@
|
|
|
145
145
|
RECOVERY_RESPONSE: "air_auth_recovery_response",
|
|
146
146
|
ISSUE_ON_BEHALF_NEW_USER_CONFIRMATION_REQUEST: "air_auth_issue_on_behalf_new_user_confirmation_request",
|
|
147
147
|
ISSUE_ON_BEHALF_NEW_USER_CONFIRMATION_RESPONSE: "air_auth_issue_on_behalf_new_user_confirmation_response",
|
|
148
|
+
REMOVE_SIGNER_SIGNATURE_REQUEST: "air_auth_remove_signer_signature_request",
|
|
149
|
+
REMOVE_SIGNER_SIGNATURE_RESPONSE: "air_auth_remove_signer_signature_response",
|
|
150
|
+
RESET_WALLET_REQUEST: "air_auth_reset_wallet_request",
|
|
151
|
+
RESET_WALLET_RESPONSE: "air_auth_reset_wallet_response",
|
|
148
152
|
EXPIRED_LOGOUT_REQUEST: "air_auth_expired_logout_request"
|
|
149
153
|
};
|
|
150
154
|
|
|
@@ -177,6 +181,12 @@
|
|
|
177
181
|
RECOVERY_IFRAME_VISIBILITY_REQUEST: "air_recovery_iframe_visibility_request",
|
|
178
182
|
UPDATE_SESSION_CONFIG_REQUEST: "air_recovery_update_session_config_request",
|
|
179
183
|
UPDATE_SESSION_CONFIG_RESPONSE: "air_recovery_update_session_config_response",
|
|
184
|
+
GET_AGENT_KEYS_REQUEST: "air_recovery_get_agent_keys_request",
|
|
185
|
+
GET_AGENT_KEYS_RESPONSE: "air_recovery_get_agent_keys_response",
|
|
186
|
+
REGISTER_AGENT_KEY_REQUEST: "air_recovery_register_agent_key_request",
|
|
187
|
+
REGISTER_AGENT_KEY_RESPONSE: "air_recovery_register_agent_key_response",
|
|
188
|
+
REMOVE_AGENT_KEY_REQUEST: "air_recovery_remove_agent_key_request",
|
|
189
|
+
REMOVE_AGENT_KEY_RESPONSE: "air_recovery_remove_agent_key_response",
|
|
180
190
|
LOGOUT_REQUEST: "air_recovery_logout_request",
|
|
181
191
|
LOGOUT_RESPONSE: "air_recovery_logout_response"
|
|
182
192
|
};
|
|
@@ -652,7 +662,7 @@
|
|
|
652
662
|
rpcUrls: {
|
|
653
663
|
default: {
|
|
654
664
|
http: ["https://rpc.testnet.mocachain.dev"],
|
|
655
|
-
webSocket: ["wss://
|
|
665
|
+
webSocket: ["wss://ws.testnet.mocachain.dev"]
|
|
656
666
|
}
|
|
657
667
|
},
|
|
658
668
|
blockExplorers: {
|
|
@@ -2001,7 +2011,7 @@
|
|
|
2001
2011
|
await super._open({ window, origin });
|
|
2002
2012
|
}
|
|
2003
2013
|
async sendWalletProviderRequest(payload) {
|
|
2004
|
-
const response = firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirWalletProviderMessageTypes.RESPONSE), filter((msg) => msg.payload.method === payload.method)));
|
|
2014
|
+
const response = firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirWalletProviderMessageTypes.RESPONSE), filter((msg) => msg.payload.method === payload.method && msg.payload.requestId === payload.requestId)));
|
|
2005
2015
|
await this.sendMessage({
|
|
2006
2016
|
type: AirWalletProviderMessageTypes.REQUEST,
|
|
2007
2017
|
payload,
|
|
@@ -2012,7 +2022,7 @@
|
|
|
2012
2022
|
_a$4 = ProviderMessageService;
|
|
2013
2023
|
_ProviderMessageService_instance = { value: void 0 };
|
|
2014
2024
|
|
|
2015
|
-
var _AirWalletProvider_instances, _AirWalletProvider_providerMessageService, _AirWalletProvider_isWalletInitialized, _AirWalletProvider_getLoginResult, _AirWalletProvider_ensureWallet, _AirWalletProvider_eventListeners, _AirWalletProvider_emit;
|
|
2025
|
+
var _AirWalletProvider_instances, _AirWalletProvider_providerMessageService, _AirWalletProvider_isWalletInitialized, _AirWalletProvider_getLoginResult, _AirWalletProvider_ensureWallet, _AirWalletProvider_eventListeners, _AirWalletProvider_currentChainId, _AirWalletProvider_emit, _AirWalletProvider_getAddressForCurrentChain, _AirWalletProvider_parseChainId;
|
|
2016
2026
|
class AirWalletProvider {
|
|
2017
2027
|
constructor({ ensureWallet, isWalletInitialized, getLoginResult, }) {
|
|
2018
2028
|
_AirWalletProvider_instances.add(this);
|
|
@@ -2021,11 +2031,18 @@
|
|
|
2021
2031
|
_AirWalletProvider_getLoginResult.set(this, void 0);
|
|
2022
2032
|
_AirWalletProvider_ensureWallet.set(this, void 0);
|
|
2023
2033
|
_AirWalletProvider_eventListeners.set(this, void 0);
|
|
2034
|
+
_AirWalletProvider_currentChainId.set(this, null);
|
|
2024
2035
|
this.startEventMessageListening = async (walletIframe) => {
|
|
2025
2036
|
await __classPrivateFieldGet(this, _AirWalletProvider_providerMessageService, "f").open(walletIframe);
|
|
2026
2037
|
__classPrivateFieldGet(this, _AirWalletProvider_providerMessageService, "f").messages$
|
|
2027
2038
|
.pipe(filter((msg) => msg.type === AirWalletProviderMessageTypes.EVENT))
|
|
2028
2039
|
.subscribe((message) => {
|
|
2040
|
+
if (message.payload.event === "chainChanged") {
|
|
2041
|
+
const parsedChainId = __classPrivateFieldGet(this, _AirWalletProvider_instances, "m", _AirWalletProvider_parseChainId).call(this, message.payload.data);
|
|
2042
|
+
if (parsedChainId !== null) {
|
|
2043
|
+
__classPrivateFieldSet(this, _AirWalletProvider_currentChainId, parsedChainId, "f");
|
|
2044
|
+
}
|
|
2045
|
+
}
|
|
2029
2046
|
__classPrivateFieldGet(this, _AirWalletProvider_instances, "m", _AirWalletProvider_emit).call(this, message.payload.event, ...[message.payload.data]);
|
|
2030
2047
|
});
|
|
2031
2048
|
};
|
|
@@ -2061,10 +2078,13 @@
|
|
|
2061
2078
|
if (!loginResult) {
|
|
2062
2079
|
throw new UnauthorizedProviderError("User is not logged in");
|
|
2063
2080
|
}
|
|
2081
|
+
// Early return optimization: return cached address from login result if wallet not yet initialized
|
|
2064
2082
|
if ((method === "eth_accounts" || method === "eth_requestAccounts") &&
|
|
2065
|
-
!__classPrivateFieldGet(this, _AirWalletProvider_isWalletInitialized, "f").call(this)
|
|
2066
|
-
loginResult
|
|
2067
|
-
|
|
2083
|
+
!__classPrivateFieldGet(this, _AirWalletProvider_isWalletInitialized, "f").call(this)) {
|
|
2084
|
+
const address = __classPrivateFieldGet(this, _AirWalletProvider_instances, "m", _AirWalletProvider_getAddressForCurrentChain).call(this, loginResult);
|
|
2085
|
+
if (address) {
|
|
2086
|
+
return [address];
|
|
2087
|
+
}
|
|
2068
2088
|
}
|
|
2069
2089
|
const skipWalletLoginMethods = ["eth_chainId"];
|
|
2070
2090
|
try {
|
|
@@ -2086,6 +2106,12 @@
|
|
|
2086
2106
|
if (!response.success) {
|
|
2087
2107
|
throw ensureProviderRpcError(response.payload);
|
|
2088
2108
|
}
|
|
2109
|
+
if (method === "eth_chainId") {
|
|
2110
|
+
const parsedChainId = __classPrivateFieldGet(this, _AirWalletProvider_instances, "m", _AirWalletProvider_parseChainId).call(this, response.payload.response);
|
|
2111
|
+
if (parsedChainId !== null) {
|
|
2112
|
+
__classPrivateFieldSet(this, _AirWalletProvider_currentChainId, parsedChainId, "f");
|
|
2113
|
+
}
|
|
2114
|
+
}
|
|
2089
2115
|
return response.payload.response;
|
|
2090
2116
|
}
|
|
2091
2117
|
on(eventName, listener) {
|
|
@@ -2109,7 +2135,7 @@
|
|
|
2109
2135
|
}, "f");
|
|
2110
2136
|
}
|
|
2111
2137
|
}
|
|
2112
|
-
_AirWalletProvider_providerMessageService = new WeakMap(), _AirWalletProvider_isWalletInitialized = new WeakMap(), _AirWalletProvider_getLoginResult = new WeakMap(), _AirWalletProvider_ensureWallet = new WeakMap(), _AirWalletProvider_eventListeners = new WeakMap(), _AirWalletProvider_instances = new WeakSet(), _AirWalletProvider_emit = function _AirWalletProvider_emit(eventName, ...args) {
|
|
2138
|
+
_AirWalletProvider_providerMessageService = new WeakMap(), _AirWalletProvider_isWalletInitialized = new WeakMap(), _AirWalletProvider_getLoginResult = new WeakMap(), _AirWalletProvider_ensureWallet = new WeakMap(), _AirWalletProvider_eventListeners = new WeakMap(), _AirWalletProvider_currentChainId = new WeakMap(), _AirWalletProvider_instances = new WeakSet(), _AirWalletProvider_emit = function _AirWalletProvider_emit(eventName, ...args) {
|
|
2113
2139
|
(__classPrivateFieldGet(this, _AirWalletProvider_eventListeners, "f")[eventName] || []).forEach((listener) => {
|
|
2114
2140
|
try {
|
|
2115
2141
|
return listener(...args);
|
|
@@ -2118,6 +2144,32 @@
|
|
|
2118
2144
|
log.warn(error);
|
|
2119
2145
|
}
|
|
2120
2146
|
});
|
|
2147
|
+
}, _AirWalletProvider_getAddressForCurrentChain = function _AirWalletProvider_getAddressForCurrentChain(loginResult) {
|
|
2148
|
+
const currentChainId = __classPrivateFieldGet(this, _AirWalletProvider_currentChainId, "f");
|
|
2149
|
+
// If we have the new addresses array and current chainId, look up by chain
|
|
2150
|
+
if (loginResult.abstractAccountAddresses && currentChainId !== null) {
|
|
2151
|
+
const chainIdStr = String(currentChainId);
|
|
2152
|
+
const addressEntry = loginResult.abstractAccountAddresses.find((entry) => entry.chainIds.includes(chainIdStr));
|
|
2153
|
+
if (addressEntry) {
|
|
2154
|
+
return addressEntry.address;
|
|
2155
|
+
}
|
|
2156
|
+
}
|
|
2157
|
+
// Fallback to legacy single address (backward compatibility)
|
|
2158
|
+
return loginResult.abstractAccountAddress;
|
|
2159
|
+
}, _AirWalletProvider_parseChainId = function _AirWalletProvider_parseChainId(chainId) {
|
|
2160
|
+
if (typeof chainId === "number") {
|
|
2161
|
+
return Number.isFinite(chainId) ? chainId : null;
|
|
2162
|
+
}
|
|
2163
|
+
if (typeof chainId === "bigint") {
|
|
2164
|
+
return Number(chainId);
|
|
2165
|
+
}
|
|
2166
|
+
if (typeof chainId !== "string" || !chainId) {
|
|
2167
|
+
return null;
|
|
2168
|
+
}
|
|
2169
|
+
const parsed = chainId.startsWith("0x")
|
|
2170
|
+
? parseInt(chainId, 16)
|
|
2171
|
+
: parseInt(chainId, 10);
|
|
2172
|
+
return Number.isNaN(parsed) ? null : parsed;
|
|
2121
2173
|
};
|
|
2122
2174
|
|
|
2123
2175
|
var _a$3, _AuthMessageService_instance;
|
|
@@ -2431,6 +2483,29 @@
|
|
|
2431
2483
|
await this.sendMessage({ type: AirRecoveryMessageTypes.LOGOUT_REQUEST });
|
|
2432
2484
|
return response;
|
|
2433
2485
|
}
|
|
2486
|
+
async sendGetAgentKeysRequest() {
|
|
2487
|
+
const response = firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirRecoveryMessageTypes.GET_AGENT_KEYS_RESPONSE)));
|
|
2488
|
+
await this.sendMessage({
|
|
2489
|
+
type: AirRecoveryMessageTypes.GET_AGENT_KEYS_REQUEST,
|
|
2490
|
+
});
|
|
2491
|
+
return response;
|
|
2492
|
+
}
|
|
2493
|
+
async sendRegisterAgentKeyRequest(payload) {
|
|
2494
|
+
const response = firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirRecoveryMessageTypes.REGISTER_AGENT_KEY_RESPONSE)));
|
|
2495
|
+
await this.sendMessage({
|
|
2496
|
+
type: AirRecoveryMessageTypes.REGISTER_AGENT_KEY_REQUEST,
|
|
2497
|
+
payload,
|
|
2498
|
+
});
|
|
2499
|
+
return response;
|
|
2500
|
+
}
|
|
2501
|
+
async sendRemoveAgentKeyRequest(payload) {
|
|
2502
|
+
const response = firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirRecoveryMessageTypes.REMOVE_AGENT_KEY_RESPONSE)));
|
|
2503
|
+
await this.sendMessage({
|
|
2504
|
+
type: AirRecoveryMessageTypes.REMOVE_AGENT_KEY_REQUEST,
|
|
2505
|
+
payload,
|
|
2506
|
+
});
|
|
2507
|
+
return response;
|
|
2508
|
+
}
|
|
2434
2509
|
async open(element) {
|
|
2435
2510
|
await this._open({ window: element.contentWindow, origin: new URL(element.src).origin });
|
|
2436
2511
|
}
|
|
@@ -2919,7 +2994,6 @@
|
|
|
2919
2994
|
}
|
|
2920
2995
|
case AirAuthMessageTypes.SETUP_CREDENTIAL_REQUEST: {
|
|
2921
2996
|
try {
|
|
2922
|
-
await __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureWallet).call(this, { skipWalletLogin: true });
|
|
2923
2997
|
await __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureCredential).call(this);
|
|
2924
2998
|
await __classPrivateFieldGet(this, _AirService_authMessagingService, "f").sendSetupCredentialSuccessResponse();
|
|
2925
2999
|
}
|
|
@@ -2990,10 +3064,6 @@
|
|
|
2990
3064
|
});
|
|
2991
3065
|
if (payload.success === true) {
|
|
2992
3066
|
__classPrivateFieldSet(this, _AirService_loginResult, __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_createLoginResult).call(this, payload), "f");
|
|
2993
|
-
if (payload.needsWalletRestart === true) {
|
|
2994
|
-
await Promise.all([__classPrivateFieldGet(this, _AirService_instances, "m", _AirService_cleanUpWallet).call(this), __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_cleanUpCredential).call(this)]);
|
|
2995
|
-
void __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureCredential).call(this);
|
|
2996
|
-
}
|
|
2997
3067
|
__classPrivateFieldGet(this, _AirService_instances, "m", _AirService_triggerAirAuthLoggedIn).call(this);
|
|
2998
3068
|
return __classPrivateFieldGet(this, _AirService_loginResult, "f");
|
|
2999
3069
|
}
|
|
@@ -3087,7 +3157,7 @@
|
|
|
3087
3157
|
decimals: result.payload.decimals,
|
|
3088
3158
|
address: result.payload.address,
|
|
3089
3159
|
recipientAddress: result.payload.recipientAddress,
|
|
3090
|
-
amount: result.payload.amount
|
|
3160
|
+
amount: result.payload.amount,
|
|
3091
3161
|
};
|
|
3092
3162
|
}
|
|
3093
3163
|
/**
|
|
@@ -3102,6 +3172,35 @@
|
|
|
3102
3172
|
throw new AirServiceError(result.payload.errorName, result.payload.errorMessage);
|
|
3103
3173
|
}
|
|
3104
3174
|
}
|
|
3175
|
+
async getAgentKeys() {
|
|
3176
|
+
await __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureRecovery).call(this);
|
|
3177
|
+
const { payload } = await __classPrivateFieldGet(this, _AirService_recoveryMessagingService, "f").sendGetAgentKeysRequest();
|
|
3178
|
+
if (payload.success === false) {
|
|
3179
|
+
throw new AirServiceError(payload.errorName, payload.errorMessage);
|
|
3180
|
+
}
|
|
3181
|
+
return payload.agentKeys;
|
|
3182
|
+
}
|
|
3183
|
+
async registerAgentKey(publicKey) {
|
|
3184
|
+
await __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureRecovery).call(this);
|
|
3185
|
+
const { payload } = await __classPrivateFieldGet(this, _AirService_recoveryMessagingService, "f").sendRegisterAgentKeyRequest({
|
|
3186
|
+
publicKey,
|
|
3187
|
+
});
|
|
3188
|
+
if (payload.success === false) {
|
|
3189
|
+
throw new AirServiceError(payload.errorName, payload.errorMessage);
|
|
3190
|
+
}
|
|
3191
|
+
return {
|
|
3192
|
+
id: payload.id,
|
|
3193
|
+
publicKey: payload.publicKey,
|
|
3194
|
+
createdAt: payload.createdAt,
|
|
3195
|
+
};
|
|
3196
|
+
}
|
|
3197
|
+
async removeAgentKey(id) {
|
|
3198
|
+
await __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureRecovery).call(this);
|
|
3199
|
+
const { payload } = await __classPrivateFieldGet(this, _AirService_recoveryMessagingService, "f").sendRemoveAgentKeyRequest({ id });
|
|
3200
|
+
if (payload.success === false) {
|
|
3201
|
+
throw new AirServiceError(payload.errorName, payload.errorMessage);
|
|
3202
|
+
}
|
|
3203
|
+
}
|
|
3105
3204
|
async getUserInfo() {
|
|
3106
3205
|
__classPrivateFieldGet(this, _AirService_instances, "m", _AirService_assertLoggedIn).call(this);
|
|
3107
3206
|
const info = await __classPrivateFieldGet(this, _AirService_authMessagingService, "f").sendPartnerUserInfoRequest();
|
|
@@ -3116,7 +3215,7 @@
|
|
|
3116
3215
|
id: info.payload.user.id,
|
|
3117
3216
|
abstractAccountAddress: info.payload.user.abstractAccountAddress,
|
|
3118
3217
|
email: info.payload.user.email,
|
|
3119
|
-
isMFASetup: info.payload.user.
|
|
3218
|
+
isMFASetup: info.payload.user.activeMfaMethods.length > 0,
|
|
3120
3219
|
},
|
|
3121
3220
|
};
|
|
3122
3221
|
}
|
|
@@ -3232,13 +3331,16 @@
|
|
|
3232
3331
|
cakPublicKey: payload.cakPublicKey,
|
|
3233
3332
|
};
|
|
3234
3333
|
}
|
|
3235
|
-
async verifyCredential({ authToken, programId, redirectUrl,
|
|
3334
|
+
async verifyCredential({ authToken, programId, redirectUrl, fieldsToDisclose, offchain, }) {
|
|
3335
|
+
if (Array.isArray(fieldsToDisclose) && fieldsToDisclose.length === 0) {
|
|
3336
|
+
throw new AirServiceError("CLIENT_ERROR", "fieldsToDisclose array must contain at least one field");
|
|
3337
|
+
}
|
|
3236
3338
|
await __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureCredential).call(this);
|
|
3237
3339
|
const { payload } = await __classPrivateFieldGet(this, _AirService_credentialMessagingService, "f").sendVerifyCredentialRequest({
|
|
3238
3340
|
partnerToken: authToken,
|
|
3239
3341
|
programId,
|
|
3240
3342
|
redirectUrl,
|
|
3241
|
-
|
|
3343
|
+
fieldsToDisclose,
|
|
3242
3344
|
offchain,
|
|
3243
3345
|
});
|
|
3244
3346
|
if (payload.success === false) {
|
|
@@ -3256,7 +3358,7 @@
|
|
|
3256
3358
|
throw new AirServiceError("NOT_LOGGED_IN", "User not logged in");
|
|
3257
3359
|
}, _AirService_ensureCredential = async function _AirService_ensureCredential() {
|
|
3258
3360
|
__classPrivateFieldGet(this, _AirService_instances, "m", _AirService_assertInitialized).call(this);
|
|
3259
|
-
void __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureWallet).call(this);
|
|
3361
|
+
void __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureWallet).call(this, { skipWalletLogin: true });
|
|
3260
3362
|
try {
|
|
3261
3363
|
if (!__classPrivateFieldGet(this, _AirService_credentialsInitialization, "f"))
|
|
3262
3364
|
__classPrivateFieldSet(this, _AirService_credentialsInitialization, __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_initializeCredentials).call(this), "f");
|
|
@@ -3491,8 +3593,9 @@
|
|
|
3491
3593
|
isLoggedIn: true,
|
|
3492
3594
|
id: payload.id,
|
|
3493
3595
|
abstractAccountAddress: payload.abstractAccountAddress,
|
|
3596
|
+
abstractAccountAddresses: payload.abstractAccountAddresses,
|
|
3494
3597
|
token: payload.partnerAccessToken,
|
|
3495
|
-
isMFASetup: payload.
|
|
3598
|
+
isMFASetup: payload.activeMfaMethods.length > 0,
|
|
3496
3599
|
};
|
|
3497
3600
|
}, _AirService_createWalletInitializedResult = function _AirService_createWalletInitializedResult(payload) {
|
|
3498
3601
|
if ("isWalletLoggedIn" in payload && !payload.isWalletLoggedIn) {
|
|
@@ -3503,7 +3606,7 @@
|
|
|
3503
3606
|
}
|
|
3504
3607
|
return {
|
|
3505
3608
|
abstractAccountAddress: payload.addresses.aa,
|
|
3506
|
-
isMFASetup: payload.
|
|
3609
|
+
isMFASetup: payload.activeMfaMethods.length > 0,
|
|
3507
3610
|
};
|
|
3508
3611
|
}, _AirService_cleanUpAuth = async function _AirService_cleanUpAuth() {
|
|
3509
3612
|
// Logout auth session
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AirAuthStartRecoveryRequestPayload } from "@mocanetwork/common/src/air/messaging/auth";
|
|
2
2
|
import { Token } from "@mocanetwork/common/src/types";
|
|
3
|
-
import { AirEventListener, AirLoginResult, AirSessionConfig, AirUserDetails, BUILD_ENV, BUILD_ENV_TYPE, ClaimAirIdOptions, ClaimAirIdResult, CredentialNetwork, CredentialVerificationResult, EIP1193Provider, ShowSwapUIOptions, ShowTransferUIOptions, ShowTransferUIResult } from "./interfaces";
|
|
3
|
+
import { AgentPublicKey, AirEventListener, AirLoginResult, AirSessionConfig, AirUserDetails, BUILD_ENV, BUILD_ENV_TYPE, ClaimAirIdOptions, ClaimAirIdResult, CredentialNetwork, CredentialVerificationResult, EIP1193Provider, ShowSwapUIOptions, ShowTransferUIOptions, ShowTransferUIResult } from "./interfaces";
|
|
4
4
|
declare class AirService {
|
|
5
5
|
#private;
|
|
6
6
|
constructor({ partnerId }: {
|
|
@@ -73,6 +73,9 @@ declare class AirService {
|
|
|
73
73
|
* @experimental This feature has not been officially released and might change in the future.
|
|
74
74
|
*/
|
|
75
75
|
showReceiveUI(): Promise<void>;
|
|
76
|
+
getAgentKeys(): Promise<AgentPublicKey[]>;
|
|
77
|
+
registerAgentKey(publicKey: string): Promise<AgentPublicKey>;
|
|
78
|
+
removeAgentKey(id: string): Promise<void>;
|
|
76
79
|
getUserInfo(): Promise<AirUserDetails>;
|
|
77
80
|
updateSessionConfig(config: Partial<AirSessionConfig>): Promise<AirSessionConfig>;
|
|
78
81
|
goToPartner(partnerUrl: string): Promise<{
|
|
@@ -97,11 +100,11 @@ declare class AirService {
|
|
|
97
100
|
}): Promise<{
|
|
98
101
|
cakPublicKey?: string;
|
|
99
102
|
}>;
|
|
100
|
-
verifyCredential({ authToken, programId, redirectUrl,
|
|
103
|
+
verifyCredential({ authToken, programId, redirectUrl, fieldsToDisclose, offchain, }: {
|
|
101
104
|
authToken: string;
|
|
102
105
|
programId: string;
|
|
103
106
|
redirectUrl?: string;
|
|
104
|
-
|
|
107
|
+
fieldsToDisclose?: "*" | string[];
|
|
105
108
|
offchain?: boolean;
|
|
106
109
|
}): Promise<CredentialVerificationResult>;
|
|
107
110
|
}
|
|
@@ -4,7 +4,9 @@ declare class AirWalletProvider implements EIP1193Provider {
|
|
|
4
4
|
#private;
|
|
5
5
|
constructor({ ensureWallet, isWalletInitialized, getLoginResult, }: {
|
|
6
6
|
isWalletInitialized: () => boolean;
|
|
7
|
-
ensureWallet: (
|
|
7
|
+
ensureWallet: (option?: {
|
|
8
|
+
skipWalletLogin: boolean;
|
|
9
|
+
}) => Promise<AirWalletInitializedResult>;
|
|
8
10
|
getLoginResult: () => AirLoginResult;
|
|
9
11
|
});
|
|
10
12
|
request(request: AirProviderParameters): Promise<unknown>;
|
|
@@ -41,6 +41,10 @@ export declare const AirAuthMessageTypes: {
|
|
|
41
41
|
readonly RECOVERY_RESPONSE: "air_auth_recovery_response";
|
|
42
42
|
readonly ISSUE_ON_BEHALF_NEW_USER_CONFIRMATION_REQUEST: "air_auth_issue_on_behalf_new_user_confirmation_request";
|
|
43
43
|
readonly ISSUE_ON_BEHALF_NEW_USER_CONFIRMATION_RESPONSE: "air_auth_issue_on_behalf_new_user_confirmation_response";
|
|
44
|
+
readonly REMOVE_SIGNER_SIGNATURE_REQUEST: "air_auth_remove_signer_signature_request";
|
|
45
|
+
readonly REMOVE_SIGNER_SIGNATURE_RESPONSE: "air_auth_remove_signer_signature_response";
|
|
46
|
+
readonly RESET_WALLET_REQUEST: "air_auth_reset_wallet_request";
|
|
47
|
+
readonly RESET_WALLET_RESPONSE: "air_auth_reset_wallet_response";
|
|
44
48
|
readonly EXPIRED_LOGOUT_REQUEST: "air_auth_expired_logout_request";
|
|
45
49
|
};
|
|
46
50
|
export type AirAuthMessageType = (typeof AirAuthMessageTypes)[keyof typeof AirAuthMessageTypes];
|
|
@@ -214,5 +218,13 @@ export type AirAuthIssueOnBehalfNewUserConfirmationRequestMessage = AirAuthMessa
|
|
|
214
218
|
export type AirAuthIssueOnBehalfNewUserConfirmationResponseMessage = AirAuthMessageBase<"air_auth_issue_on_behalf_new_user_confirmation_response", AirMessageSuccessPayload & {
|
|
215
219
|
needsWalletRestart: boolean;
|
|
216
220
|
} | AirMessageErrorPayload>;
|
|
217
|
-
export type
|
|
221
|
+
export type SignerResponsePayload = {
|
|
222
|
+
signature: string;
|
|
223
|
+
privyAccessToken: string;
|
|
224
|
+
};
|
|
225
|
+
export type AirAuthRemoveSignerSignatureRequestMessage = AirAuthMessageBaseWithoutPayload<"air_auth_remove_signer_signature_request">;
|
|
226
|
+
export type AirAuthRemoveSignerSignatureResponseMessage = AirAuthMessageBase<"air_auth_remove_signer_signature_response", (AirMessageSuccessPayload & SignerResponsePayload) | AirMessageErrorPayload>;
|
|
227
|
+
export type AirAuthResetWalletRequestMessage = AirAuthMessageBaseWithoutPayload<"air_auth_reset_wallet_request">;
|
|
228
|
+
export type AirAuthResetWalletResponseMessage = AirAuthMessageBase<"air_auth_reset_wallet_response", AirMessageSuccessPayload | AirMessageErrorPayload>;
|
|
229
|
+
export type AirAuthMessage = AirAuthSetupCompletedMessage | AirAuthInitializationRequestMessage | AirAuthInitializationResponseMessage | AirAuthLoginRequestMessage | AirAuthLoginResponseToEmbedMessage | AirAuthLoginResponseToAirServiceMessage | AirAuthLoginStatusRequestMessage | AirAuthLoginStatusResponseMessage | AirAuthUpdateSessionConfigRequestMessage | AirAuthUpdateSessionConfigResponseMessage | 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 | AirAuthSetupCredentialRequestMessage | AirAuthSetupCredentialResponseMessage | AirAuthIssueOnBehalfNewUserConfirmationRequestMessage | AirAuthIssueOnBehalfNewUserConfirmationResponseMessage | AirAuthRemoveSignerSignatureRequestMessage | AirAuthRemoveSignerSignatureResponseMessage | AirAuthResetWalletRequestMessage | AirAuthResetWalletResponseMessage;
|
|
218
230
|
export {};
|
|
@@ -50,7 +50,6 @@ export type AirIssueCredentialRequestMessage = AirCredentialMessageBase<"air_cre
|
|
|
50
50
|
credentialId: string;
|
|
51
51
|
credentialSubject: Record<string, unknown>;
|
|
52
52
|
curve?: "secp256r1" | "secp256k1";
|
|
53
|
-
/** When true, credential is stored offchain only (OSS, no blockchain). Status = STORED. */
|
|
54
53
|
offchain?: boolean;
|
|
55
54
|
}>;
|
|
56
55
|
export type AirVerifyCredentialRequestMessage = AirCredentialMessageBase<"air_credential_verify_request", {
|
|
@@ -58,11 +57,11 @@ export type AirVerifyCredentialRequestMessage = AirCredentialMessageBase<"air_cr
|
|
|
58
57
|
programId: string;
|
|
59
58
|
redirectUrl?: string;
|
|
60
59
|
/**
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
* If
|
|
60
|
+
* Fields to disclose from the credential.
|
|
61
|
+
* Use "*" for full disclosure, or an array of field names (min length 1) for selective disclosure.
|
|
62
|
+
* If undefined, no disclosure is requested.
|
|
64
63
|
*/
|
|
65
|
-
|
|
64
|
+
fieldsToDisclose?: "*" | string[];
|
|
66
65
|
/** When true, verification skips ZKP and on-chain proof, using offchain flow instead. Works with both ONCHAIN and STORED credentials. */
|
|
67
66
|
offchain?: boolean;
|
|
68
67
|
}>;
|
|
@@ -27,7 +27,7 @@ export declare abstract class MessageServiceBase<TMessage extends AirMessageBase
|
|
|
27
27
|
type: T;
|
|
28
28
|
payload: {
|
|
29
29
|
success: false;
|
|
30
|
-
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" | "SWAP_TO_ONRAMP" | "USER_REJECTED" | 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;
|
|
31
31
|
errorMessage: string;
|
|
32
32
|
};
|
|
33
33
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AirProviderParameters, EIP1193EventMap } from "../../provider/types";
|
|
2
2
|
export declare const enum AirWalletProviderMessageTypes {
|
|
3
3
|
REQUEST = "JRPC_REQUEST",
|
|
4
4
|
RESPONSE = "JRPC_RESPONSE",
|
|
@@ -7,6 +7,12 @@ export declare const AirRecoveryMessageTypes: {
|
|
|
7
7
|
readonly RECOVERY_IFRAME_VISIBILITY_REQUEST: "air_recovery_iframe_visibility_request";
|
|
8
8
|
readonly UPDATE_SESSION_CONFIG_REQUEST: "air_recovery_update_session_config_request";
|
|
9
9
|
readonly UPDATE_SESSION_CONFIG_RESPONSE: "air_recovery_update_session_config_response";
|
|
10
|
+
readonly GET_AGENT_KEYS_REQUEST: "air_recovery_get_agent_keys_request";
|
|
11
|
+
readonly GET_AGENT_KEYS_RESPONSE: "air_recovery_get_agent_keys_response";
|
|
12
|
+
readonly REGISTER_AGENT_KEY_REQUEST: "air_recovery_register_agent_key_request";
|
|
13
|
+
readonly REGISTER_AGENT_KEY_RESPONSE: "air_recovery_register_agent_key_response";
|
|
14
|
+
readonly REMOVE_AGENT_KEY_REQUEST: "air_recovery_remove_agent_key_request";
|
|
15
|
+
readonly REMOVE_AGENT_KEY_RESPONSE: "air_recovery_remove_agent_key_response";
|
|
10
16
|
readonly LOGOUT_REQUEST: "air_recovery_logout_request";
|
|
11
17
|
readonly LOGOUT_RESPONSE: "air_recovery_logout_response";
|
|
12
18
|
};
|
|
@@ -30,6 +36,23 @@ export type AirRecoveryIframeVisibilityRequestMessage = AirRecoveryMessageBase<"
|
|
|
30
36
|
}>;
|
|
31
37
|
export type AirRecoveryUpdateSessionConfigRequestMessage = AirRecoveryMessageBase<"air_recovery_update_session_config_request", Partial<SessionConfig>>;
|
|
32
38
|
export type AirRecoveryUpdateSessionConfigResponseMessage = AirRecoveryMessageBase<"air_recovery_update_session_config_response", (AirMessageSuccessPayload & SessionConfig) | AirMessageErrorPayload>;
|
|
39
|
+
export type AgentPublicKey = {
|
|
40
|
+
id: string;
|
|
41
|
+
publicKey: string;
|
|
42
|
+
createdAt: string;
|
|
43
|
+
};
|
|
44
|
+
export type AirGetAgentKeysRequestMessage = AirRecoveryMessageBaseWithoutPayload<"air_recovery_get_agent_keys_request">;
|
|
45
|
+
export type AirGetAgentKeysResponseMessage = AirRecoveryMessageBase<"air_recovery_get_agent_keys_response", (AirMessageSuccessPayload & {
|
|
46
|
+
agentKeys: AgentPublicKey[];
|
|
47
|
+
}) | AirMessageErrorPayload>;
|
|
48
|
+
export type AirRegisterAgentKeyRequestMessage = AirRecoveryMessageBase<"air_recovery_register_agent_key_request", {
|
|
49
|
+
publicKey: string;
|
|
50
|
+
}>;
|
|
51
|
+
export type AirRegisterAgentKeyResponseMessage = AirRecoveryMessageBase<"air_recovery_register_agent_key_response", (AirMessageSuccessPayload & AgentPublicKey) | AirMessageErrorPayload>;
|
|
52
|
+
export type AirRemoveAgentKeyRequestMessage = AirRecoveryMessageBase<"air_recovery_remove_agent_key_request", {
|
|
53
|
+
id: string;
|
|
54
|
+
}>;
|
|
55
|
+
export type AirRemoveAgentKeyResponseMessage = AirRecoveryMessageBase<"air_recovery_remove_agent_key_response", AirMessageSuccessPayload | AirMessageErrorPayload>;
|
|
33
56
|
export type AirLogoutRequestMessage = AirRecoveryMessageBaseWithoutPayload<"air_recovery_logout_request">;
|
|
34
57
|
export type AirLogoutResponseMessage = AirRecoveryMessageBase<"air_recovery_logout_response", AirMessageSuccessPayload | AirMessageErrorPayload>;
|
|
35
|
-
export type AirRecoveryMessage = AirInitializationRequestMessage | AirInitializationResponseMessage | AirRecoveryInitializedMessage | AirRecoveryIframeVisibilityRequestMessage | AirRecoveryUpdateSessionConfigRequestMessage | AirRecoveryUpdateSessionConfigResponseMessage | AirLogoutRequestMessage | AirLogoutResponseMessage;
|
|
58
|
+
export type AirRecoveryMessage = AirInitializationRequestMessage | AirInitializationResponseMessage | AirRecoveryInitializedMessage | AirRecoveryIframeVisibilityRequestMessage | AirRecoveryUpdateSessionConfigRequestMessage | AirRecoveryUpdateSessionConfigResponseMessage | AirGetAgentKeysRequestMessage | AirGetAgentKeysResponseMessage | AirRegisterAgentKeyRequestMessage | AirRegisterAgentKeyResponseMessage | AirRemoveAgentKeyRequestMessage | AirRemoveAgentKeyResponseMessage | AirLogoutRequestMessage | AirLogoutResponseMessage;
|
|
@@ -37,7 +37,7 @@ export declare const mocaTestnet: {
|
|
|
37
37
|
readonly rpcUrls: {
|
|
38
38
|
readonly default: {
|
|
39
39
|
readonly http: readonly ["https://rpc.testnet.mocachain.dev"];
|
|
40
|
-
readonly webSocket: readonly ["wss://
|
|
40
|
+
readonly webSocket: readonly ["wss://ws.testnet.mocachain.dev"];
|
|
41
41
|
};
|
|
42
42
|
};
|
|
43
43
|
readonly blockExplorers: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Abi
|
|
1
|
+
import type { Abi } from "abitype";
|
|
2
2
|
import { Hex } from "../../types";
|
|
3
3
|
import { Rule } from "./rule";
|
|
4
4
|
export type Address = Hex;
|
|
@@ -41,7 +41,7 @@ export type ActionPolicyInfo = {
|
|
|
41
41
|
sudo?: boolean;
|
|
42
42
|
} & OneOf<{
|
|
43
43
|
/** The specific function selector from the contract to be included in the policy */
|
|
44
|
-
functionSelector: string
|
|
44
|
+
functionSelector: string;
|
|
45
45
|
/** Array of rules for the policy */
|
|
46
46
|
rules?: Rule[];
|
|
47
47
|
} | {
|
|
@@ -53,4 +53,4 @@ export type Call = {
|
|
|
53
53
|
data?: Hex | undefined;
|
|
54
54
|
value?: bigint | undefined;
|
|
55
55
|
};
|
|
56
|
-
export {
|
|
56
|
+
export {};
|
|
@@ -10,9 +10,14 @@ export type AirIdDetails = {
|
|
|
10
10
|
chainId: number;
|
|
11
11
|
imageUrl?: string;
|
|
12
12
|
};
|
|
13
|
+
export type AbstractAccountAddressEntry = {
|
|
14
|
+
readonly address: string;
|
|
15
|
+
readonly chainIds: readonly string[];
|
|
16
|
+
};
|
|
13
17
|
export type GlobalId = {
|
|
14
18
|
id: string;
|
|
15
19
|
abstractAccountAddress?: string;
|
|
20
|
+
abstractAccountAddresses?: readonly AbstractAccountAddressEntry[];
|
|
16
21
|
signerQuorumId?: string | null;
|
|
17
22
|
};
|
|
18
23
|
export type LoggedInLoginResponse = {
|
|
@@ -43,8 +48,10 @@ type EmailVerificationRequiredLoginResponse = {
|
|
|
43
48
|
type LoginRequiredLoginResponse = {
|
|
44
49
|
status: "login_required";
|
|
45
50
|
};
|
|
51
|
+
export type MfaMethod = "pin";
|
|
46
52
|
export type MFASetup = {
|
|
47
|
-
|
|
53
|
+
activeMfaMethods: MfaMethod[];
|
|
54
|
+
pinSalt?: string | null;
|
|
48
55
|
};
|
|
49
56
|
export type LoginResponse = LoggedInLoginResponse | PartnerLinkageRequiredLoginResponse | EmailRequiredLoginResponse | EmailVerificationRequiredLoginResponse | LoginRequiredLoginResponse;
|
|
50
57
|
export type CredentialConfigResponse = {
|
|
@@ -6,6 +6,15 @@ export type PromiseHandle<T> = {
|
|
|
6
6
|
export declare function promiseCreator<T>(): PromiseHandle<T>;
|
|
7
7
|
export declare const sleep: (ms: number) => Promise<unknown>;
|
|
8
8
|
export declare const formatPublicKey: (publicKey: string) => string;
|
|
9
|
+
export type PublicKeyValidationResult = {
|
|
10
|
+
ok: true;
|
|
11
|
+
format: 'pem' | 'base64';
|
|
12
|
+
normalizedKey: string;
|
|
13
|
+
} | {
|
|
14
|
+
ok: false;
|
|
15
|
+
reason: string;
|
|
16
|
+
};
|
|
17
|
+
export declare function validateAndNormalizePublicKey(input: string): PublicKeyValidationResult;
|
|
9
18
|
/**
|
|
10
19
|
* Returns a random number. Don't use for cryptographic purposes.
|
|
11
20
|
* @returns a random number
|
|
@@ -39,10 +39,15 @@ export type AirSessionConfig = {
|
|
|
39
39
|
currency: SupportedCurrencyCode;
|
|
40
40
|
};
|
|
41
41
|
export type CredentialNetwork = "devnet" | "testnet";
|
|
42
|
+
export type AbstractAccountAddressEntry = {
|
|
43
|
+
readonly address: string;
|
|
44
|
+
readonly chainIds: readonly string[];
|
|
45
|
+
};
|
|
42
46
|
export type AirLoginResult = {
|
|
43
47
|
isLoggedIn: boolean;
|
|
44
48
|
id: string;
|
|
45
49
|
abstractAccountAddress?: string;
|
|
50
|
+
abstractAccountAddresses?: readonly AbstractAccountAddressEntry[];
|
|
46
51
|
token: string;
|
|
47
52
|
isMFASetup: boolean;
|
|
48
53
|
};
|
|
@@ -53,6 +58,11 @@ export type AirWalletInitializedResult = {
|
|
|
53
58
|
export type ClaimAirIdResult = {
|
|
54
59
|
airId: AirIdDetails;
|
|
55
60
|
};
|
|
61
|
+
export type AgentPublicKey = {
|
|
62
|
+
id: string;
|
|
63
|
+
publicKey: string;
|
|
64
|
+
createdAt: string;
|
|
65
|
+
};
|
|
56
66
|
export type AirEventOnInitialized = {
|
|
57
67
|
event: "initialized";
|
|
58
68
|
result: AirInitializationResult;
|
|
@@ -71,7 +81,7 @@ export type AirEventOnWalletInitialized = {
|
|
|
71
81
|
export type CredentialVerificationResult = AirVerifyCredentialSuccessResponsePayload["verificationResult"];
|
|
72
82
|
/**
|
|
73
83
|
* Re-export DisclosedCredentialData and CredentialProof for SDK consumers
|
|
74
|
-
* These types represent the decrypted credential data returned during full disclosure verification
|
|
84
|
+
* These types represent the decrypted credential data returned during full or selective disclosure verification
|
|
75
85
|
*/
|
|
76
86
|
export type { DisclosedCredentialData, CredentialProof };
|
|
77
87
|
export type AirEventData = AirEventOnInitialized | AirEventOnLoggedIn | AirEventOnWalletInitialized | AirEventOnLoggedOut;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MessageServiceBase } from "./common/air/messaging/messageServiceBase";
|
|
2
|
-
import { AirInitializationRequestMessage, AirRecoveryMessage, AirRecoveryUpdateSessionConfigRequestMessage } from "./common/air/messaging/recovery";
|
|
2
|
+
import { AirGetAgentKeysResponseMessage, AirInitializationRequestMessage, AirRecoveryMessage, AirRegisterAgentKeyResponseMessage, AirRemoveAgentKeyResponseMessage, AirRecoveryUpdateSessionConfigRequestMessage } from "./common/air/messaging/recovery";
|
|
3
3
|
export declare class RecoveryMessageService extends MessageServiceBase<AirRecoveryMessage> {
|
|
4
4
|
#private;
|
|
5
5
|
static create(): RecoveryMessageService;
|
|
@@ -7,6 +7,13 @@ export declare class RecoveryMessageService extends MessageServiceBase<AirRecove
|
|
|
7
7
|
onInitialized(): Promise<import("./common/air/messaging/recovery").AirRecoveryInitializedMessage>;
|
|
8
8
|
sendUpdateSessionConfigRequest(payload?: AirRecoveryUpdateSessionConfigRequestMessage["payload"]): Promise<import("./common/air/messaging/recovery").AirRecoveryUpdateSessionConfigResponseMessage>;
|
|
9
9
|
logout(): Promise<import("./common/air/messaging/recovery").AirLogoutResponseMessage>;
|
|
10
|
+
sendGetAgentKeysRequest(): Promise<AirGetAgentKeysResponseMessage>;
|
|
11
|
+
sendRegisterAgentKeyRequest(payload: {
|
|
12
|
+
publicKey: string;
|
|
13
|
+
}): Promise<AirRegisterAgentKeyResponseMessage>;
|
|
14
|
+
sendRemoveAgentKeyRequest(payload: {
|
|
15
|
+
id: string;
|
|
16
|
+
}): Promise<AirRemoveAgentKeyResponseMessage>;
|
|
10
17
|
open(element: HTMLIFrameElement): Promise<void>;
|
|
11
18
|
close(): Promise<void>;
|
|
12
19
|
}
|