@mocanetwork/airkit 1.9.0-beta.1 → 1.9.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 +17 -15
- package/dist/airkit.esm.js +17 -15
- package/dist/airkit.umd.js +17 -15
- package/dist/types/airService.d.ts +2 -2
- 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/provider.d.ts +1 -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 +3 -1
- package/dist/types/interfaces.d.ts +1 -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.2";
|
|
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
|
|
|
@@ -648,7 +652,7 @@ const mocaTestnet = {
|
|
|
648
652
|
rpcUrls: {
|
|
649
653
|
default: {
|
|
650
654
|
http: ["https://rpc.testnet.mocachain.dev"],
|
|
651
|
-
webSocket: ["wss://
|
|
655
|
+
webSocket: ["wss://ws.testnet.mocachain.dev"]
|
|
652
656
|
}
|
|
653
657
|
},
|
|
654
658
|
blockExplorers: {
|
|
@@ -1997,7 +2001,7 @@ class ProviderMessageService extends MessageServiceBase {
|
|
|
1997
2001
|
await super._open({ window, origin });
|
|
1998
2002
|
}
|
|
1999
2003
|
async sendWalletProviderRequest(payload) {
|
|
2000
|
-
const response = firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirWalletProviderMessageTypes.RESPONSE), filter((msg) => msg.payload.method === payload.method)));
|
|
2004
|
+
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
2005
|
await this.sendMessage({
|
|
2002
2006
|
type: AirWalletProviderMessageTypes.REQUEST,
|
|
2003
2007
|
payload,
|
|
@@ -2915,7 +2919,6 @@ class AirService {
|
|
|
2915
2919
|
}
|
|
2916
2920
|
case AirAuthMessageTypes.SETUP_CREDENTIAL_REQUEST: {
|
|
2917
2921
|
try {
|
|
2918
|
-
await __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureWallet).call(this, { skipWalletLogin: true });
|
|
2919
2922
|
await __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureCredential).call(this);
|
|
2920
2923
|
await __classPrivateFieldGet(this, _AirService_authMessagingService, "f").sendSetupCredentialSuccessResponse();
|
|
2921
2924
|
}
|
|
@@ -2986,10 +2989,6 @@ class AirService {
|
|
|
2986
2989
|
});
|
|
2987
2990
|
if (payload.success === true) {
|
|
2988
2991
|
__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
2992
|
__classPrivateFieldGet(this, _AirService_instances, "m", _AirService_triggerAirAuthLoggedIn).call(this);
|
|
2994
2993
|
return __classPrivateFieldGet(this, _AirService_loginResult, "f");
|
|
2995
2994
|
}
|
|
@@ -3083,7 +3082,7 @@ class AirService {
|
|
|
3083
3082
|
decimals: result.payload.decimals,
|
|
3084
3083
|
address: result.payload.address,
|
|
3085
3084
|
recipientAddress: result.payload.recipientAddress,
|
|
3086
|
-
amount: result.payload.amount
|
|
3085
|
+
amount: result.payload.amount,
|
|
3087
3086
|
};
|
|
3088
3087
|
}
|
|
3089
3088
|
/**
|
|
@@ -3112,7 +3111,7 @@ class AirService {
|
|
|
3112
3111
|
id: info.payload.user.id,
|
|
3113
3112
|
abstractAccountAddress: info.payload.user.abstractAccountAddress,
|
|
3114
3113
|
email: info.payload.user.email,
|
|
3115
|
-
isMFASetup: info.payload.user.
|
|
3114
|
+
isMFASetup: info.payload.user.activeMfaMethods.length > 0,
|
|
3116
3115
|
},
|
|
3117
3116
|
};
|
|
3118
3117
|
}
|
|
@@ -3228,13 +3227,16 @@ class AirService {
|
|
|
3228
3227
|
cakPublicKey: payload.cakPublicKey,
|
|
3229
3228
|
};
|
|
3230
3229
|
}
|
|
3231
|
-
async verifyCredential({ authToken, programId, redirectUrl,
|
|
3230
|
+
async verifyCredential({ authToken, programId, redirectUrl, fieldsToDisclose, offchain, }) {
|
|
3231
|
+
if (Array.isArray(fieldsToDisclose) && fieldsToDisclose.length === 0) {
|
|
3232
|
+
throw new AirServiceError("CLIENT_ERROR", "fieldsToDisclose array must contain at least one field");
|
|
3233
|
+
}
|
|
3232
3234
|
await __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureCredential).call(this);
|
|
3233
3235
|
const { payload } = await __classPrivateFieldGet(this, _AirService_credentialMessagingService, "f").sendVerifyCredentialRequest({
|
|
3234
3236
|
partnerToken: authToken,
|
|
3235
3237
|
programId,
|
|
3236
3238
|
redirectUrl,
|
|
3237
|
-
|
|
3239
|
+
fieldsToDisclose,
|
|
3238
3240
|
offchain,
|
|
3239
3241
|
});
|
|
3240
3242
|
if (payload.success === false) {
|
|
@@ -3252,7 +3254,7 @@ _AirService_loginResult = new WeakMap(), _AirService_buildEnv = new WeakMap(), _
|
|
|
3252
3254
|
throw new AirServiceError("NOT_LOGGED_IN", "User not logged in");
|
|
3253
3255
|
}, _AirService_ensureCredential = async function _AirService_ensureCredential() {
|
|
3254
3256
|
__classPrivateFieldGet(this, _AirService_instances, "m", _AirService_assertInitialized).call(this);
|
|
3255
|
-
void __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureWallet).call(this);
|
|
3257
|
+
void __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureWallet).call(this, { skipWalletLogin: true });
|
|
3256
3258
|
try {
|
|
3257
3259
|
if (!__classPrivateFieldGet(this, _AirService_credentialsInitialization, "f"))
|
|
3258
3260
|
__classPrivateFieldSet(this, _AirService_credentialsInitialization, __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_initializeCredentials).call(this), "f");
|
|
@@ -3488,7 +3490,7 @@ _AirService_loginResult = new WeakMap(), _AirService_buildEnv = new WeakMap(), _
|
|
|
3488
3490
|
id: payload.id,
|
|
3489
3491
|
abstractAccountAddress: payload.abstractAccountAddress,
|
|
3490
3492
|
token: payload.partnerAccessToken,
|
|
3491
|
-
isMFASetup: payload.
|
|
3493
|
+
isMFASetup: payload.activeMfaMethods.length > 0,
|
|
3492
3494
|
};
|
|
3493
3495
|
}, _AirService_createWalletInitializedResult = function _AirService_createWalletInitializedResult(payload) {
|
|
3494
3496
|
if ("isWalletLoggedIn" in payload && !payload.isWalletLoggedIn) {
|
|
@@ -3499,7 +3501,7 @@ _AirService_loginResult = new WeakMap(), _AirService_buildEnv = new WeakMap(), _
|
|
|
3499
3501
|
}
|
|
3500
3502
|
return {
|
|
3501
3503
|
abstractAccountAddress: payload.addresses.aa,
|
|
3502
|
-
isMFASetup: payload.
|
|
3504
|
+
isMFASetup: payload.activeMfaMethods.length > 0,
|
|
3503
3505
|
};
|
|
3504
3506
|
}, _AirService_cleanUpAuth = async function _AirService_cleanUpAuth() {
|
|
3505
3507
|
// 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.2";
|
|
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
|
|
|
@@ -646,7 +650,7 @@ const mocaTestnet = {
|
|
|
646
650
|
rpcUrls: {
|
|
647
651
|
default: {
|
|
648
652
|
http: ["https://rpc.testnet.mocachain.dev"],
|
|
649
|
-
webSocket: ["wss://
|
|
653
|
+
webSocket: ["wss://ws.testnet.mocachain.dev"]
|
|
650
654
|
}
|
|
651
655
|
},
|
|
652
656
|
blockExplorers: {
|
|
@@ -1995,7 +1999,7 @@ class ProviderMessageService extends MessageServiceBase {
|
|
|
1995
1999
|
await super._open({ window, origin });
|
|
1996
2000
|
}
|
|
1997
2001
|
async sendWalletProviderRequest(payload) {
|
|
1998
|
-
const response = firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirWalletProviderMessageTypes.RESPONSE), filter((msg) => msg.payload.method === payload.method)));
|
|
2002
|
+
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
2003
|
await this.sendMessage({
|
|
2000
2004
|
type: AirWalletProviderMessageTypes.REQUEST,
|
|
2001
2005
|
payload,
|
|
@@ -2913,7 +2917,6 @@ class AirService {
|
|
|
2913
2917
|
}
|
|
2914
2918
|
case AirAuthMessageTypes.SETUP_CREDENTIAL_REQUEST: {
|
|
2915
2919
|
try {
|
|
2916
|
-
await __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureWallet).call(this, { skipWalletLogin: true });
|
|
2917
2920
|
await __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureCredential).call(this);
|
|
2918
2921
|
await __classPrivateFieldGet(this, _AirService_authMessagingService, "f").sendSetupCredentialSuccessResponse();
|
|
2919
2922
|
}
|
|
@@ -2984,10 +2987,6 @@ class AirService {
|
|
|
2984
2987
|
});
|
|
2985
2988
|
if (payload.success === true) {
|
|
2986
2989
|
__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
2990
|
__classPrivateFieldGet(this, _AirService_instances, "m", _AirService_triggerAirAuthLoggedIn).call(this);
|
|
2992
2991
|
return __classPrivateFieldGet(this, _AirService_loginResult, "f");
|
|
2993
2992
|
}
|
|
@@ -3081,7 +3080,7 @@ class AirService {
|
|
|
3081
3080
|
decimals: result.payload.decimals,
|
|
3082
3081
|
address: result.payload.address,
|
|
3083
3082
|
recipientAddress: result.payload.recipientAddress,
|
|
3084
|
-
amount: result.payload.amount
|
|
3083
|
+
amount: result.payload.amount,
|
|
3085
3084
|
};
|
|
3086
3085
|
}
|
|
3087
3086
|
/**
|
|
@@ -3110,7 +3109,7 @@ class AirService {
|
|
|
3110
3109
|
id: info.payload.user.id,
|
|
3111
3110
|
abstractAccountAddress: info.payload.user.abstractAccountAddress,
|
|
3112
3111
|
email: info.payload.user.email,
|
|
3113
|
-
isMFASetup: info.payload.user.
|
|
3112
|
+
isMFASetup: info.payload.user.activeMfaMethods.length > 0,
|
|
3114
3113
|
},
|
|
3115
3114
|
};
|
|
3116
3115
|
}
|
|
@@ -3226,13 +3225,16 @@ class AirService {
|
|
|
3226
3225
|
cakPublicKey: payload.cakPublicKey,
|
|
3227
3226
|
};
|
|
3228
3227
|
}
|
|
3229
|
-
async verifyCredential({ authToken, programId, redirectUrl,
|
|
3228
|
+
async verifyCredential({ authToken, programId, redirectUrl, fieldsToDisclose, offchain, }) {
|
|
3229
|
+
if (Array.isArray(fieldsToDisclose) && fieldsToDisclose.length === 0) {
|
|
3230
|
+
throw new AirServiceError("CLIENT_ERROR", "fieldsToDisclose array must contain at least one field");
|
|
3231
|
+
}
|
|
3230
3232
|
await __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureCredential).call(this);
|
|
3231
3233
|
const { payload } = await __classPrivateFieldGet(this, _AirService_credentialMessagingService, "f").sendVerifyCredentialRequest({
|
|
3232
3234
|
partnerToken: authToken,
|
|
3233
3235
|
programId,
|
|
3234
3236
|
redirectUrl,
|
|
3235
|
-
|
|
3237
|
+
fieldsToDisclose,
|
|
3236
3238
|
offchain,
|
|
3237
3239
|
});
|
|
3238
3240
|
if (payload.success === false) {
|
|
@@ -3250,7 +3252,7 @@ _AirService_loginResult = new WeakMap(), _AirService_buildEnv = new WeakMap(), _
|
|
|
3250
3252
|
throw new AirServiceError("NOT_LOGGED_IN", "User not logged in");
|
|
3251
3253
|
}, _AirService_ensureCredential = async function _AirService_ensureCredential() {
|
|
3252
3254
|
__classPrivateFieldGet(this, _AirService_instances, "m", _AirService_assertInitialized).call(this);
|
|
3253
|
-
void __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureWallet).call(this);
|
|
3255
|
+
void __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureWallet).call(this, { skipWalletLogin: true });
|
|
3254
3256
|
try {
|
|
3255
3257
|
if (!__classPrivateFieldGet(this, _AirService_credentialsInitialization, "f"))
|
|
3256
3258
|
__classPrivateFieldSet(this, _AirService_credentialsInitialization, __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_initializeCredentials).call(this), "f");
|
|
@@ -3486,7 +3488,7 @@ _AirService_loginResult = new WeakMap(), _AirService_buildEnv = new WeakMap(), _
|
|
|
3486
3488
|
id: payload.id,
|
|
3487
3489
|
abstractAccountAddress: payload.abstractAccountAddress,
|
|
3488
3490
|
token: payload.partnerAccessToken,
|
|
3489
|
-
isMFASetup: payload.
|
|
3491
|
+
isMFASetup: payload.activeMfaMethods.length > 0,
|
|
3490
3492
|
};
|
|
3491
3493
|
}, _AirService_createWalletInitializedResult = function _AirService_createWalletInitializedResult(payload) {
|
|
3492
3494
|
if ("isWalletLoggedIn" in payload && !payload.isWalletLoggedIn) {
|
|
@@ -3497,7 +3499,7 @@ _AirService_loginResult = new WeakMap(), _AirService_buildEnv = new WeakMap(), _
|
|
|
3497
3499
|
}
|
|
3498
3500
|
return {
|
|
3499
3501
|
abstractAccountAddress: payload.addresses.aa,
|
|
3500
|
-
isMFASetup: payload.
|
|
3502
|
+
isMFASetup: payload.activeMfaMethods.length > 0,
|
|
3501
3503
|
};
|
|
3502
3504
|
}, _AirService_cleanUpAuth = async function _AirService_cleanUpAuth() {
|
|
3503
3505
|
// 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.2";
|
|
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
|
|
|
@@ -652,7 +656,7 @@
|
|
|
652
656
|
rpcUrls: {
|
|
653
657
|
default: {
|
|
654
658
|
http: ["https://rpc.testnet.mocachain.dev"],
|
|
655
|
-
webSocket: ["wss://
|
|
659
|
+
webSocket: ["wss://ws.testnet.mocachain.dev"]
|
|
656
660
|
}
|
|
657
661
|
},
|
|
658
662
|
blockExplorers: {
|
|
@@ -2001,7 +2005,7 @@
|
|
|
2001
2005
|
await super._open({ window, origin });
|
|
2002
2006
|
}
|
|
2003
2007
|
async sendWalletProviderRequest(payload) {
|
|
2004
|
-
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)));
|
|
2005
2009
|
await this.sendMessage({
|
|
2006
2010
|
type: AirWalletProviderMessageTypes.REQUEST,
|
|
2007
2011
|
payload,
|
|
@@ -2919,7 +2923,6 @@
|
|
|
2919
2923
|
}
|
|
2920
2924
|
case AirAuthMessageTypes.SETUP_CREDENTIAL_REQUEST: {
|
|
2921
2925
|
try {
|
|
2922
|
-
await __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureWallet).call(this, { skipWalletLogin: true });
|
|
2923
2926
|
await __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureCredential).call(this);
|
|
2924
2927
|
await __classPrivateFieldGet(this, _AirService_authMessagingService, "f").sendSetupCredentialSuccessResponse();
|
|
2925
2928
|
}
|
|
@@ -2990,10 +2993,6 @@
|
|
|
2990
2993
|
});
|
|
2991
2994
|
if (payload.success === true) {
|
|
2992
2995
|
__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
2996
|
__classPrivateFieldGet(this, _AirService_instances, "m", _AirService_triggerAirAuthLoggedIn).call(this);
|
|
2998
2997
|
return __classPrivateFieldGet(this, _AirService_loginResult, "f");
|
|
2999
2998
|
}
|
|
@@ -3087,7 +3086,7 @@
|
|
|
3087
3086
|
decimals: result.payload.decimals,
|
|
3088
3087
|
address: result.payload.address,
|
|
3089
3088
|
recipientAddress: result.payload.recipientAddress,
|
|
3090
|
-
amount: result.payload.amount
|
|
3089
|
+
amount: result.payload.amount,
|
|
3091
3090
|
};
|
|
3092
3091
|
}
|
|
3093
3092
|
/**
|
|
@@ -3116,7 +3115,7 @@
|
|
|
3116
3115
|
id: info.payload.user.id,
|
|
3117
3116
|
abstractAccountAddress: info.payload.user.abstractAccountAddress,
|
|
3118
3117
|
email: info.payload.user.email,
|
|
3119
|
-
isMFASetup: info.payload.user.
|
|
3118
|
+
isMFASetup: info.payload.user.activeMfaMethods.length > 0,
|
|
3120
3119
|
},
|
|
3121
3120
|
};
|
|
3122
3121
|
}
|
|
@@ -3232,13 +3231,16 @@
|
|
|
3232
3231
|
cakPublicKey: payload.cakPublicKey,
|
|
3233
3232
|
};
|
|
3234
3233
|
}
|
|
3235
|
-
async verifyCredential({ authToken, programId, redirectUrl,
|
|
3234
|
+
async verifyCredential({ authToken, programId, redirectUrl, fieldsToDisclose, offchain, }) {
|
|
3235
|
+
if (Array.isArray(fieldsToDisclose) && fieldsToDisclose.length === 0) {
|
|
3236
|
+
throw new AirServiceError("CLIENT_ERROR", "fieldsToDisclose array must contain at least one field");
|
|
3237
|
+
}
|
|
3236
3238
|
await __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureCredential).call(this);
|
|
3237
3239
|
const { payload } = await __classPrivateFieldGet(this, _AirService_credentialMessagingService, "f").sendVerifyCredentialRequest({
|
|
3238
3240
|
partnerToken: authToken,
|
|
3239
3241
|
programId,
|
|
3240
3242
|
redirectUrl,
|
|
3241
|
-
|
|
3243
|
+
fieldsToDisclose,
|
|
3242
3244
|
offchain,
|
|
3243
3245
|
});
|
|
3244
3246
|
if (payload.success === false) {
|
|
@@ -3256,7 +3258,7 @@
|
|
|
3256
3258
|
throw new AirServiceError("NOT_LOGGED_IN", "User not logged in");
|
|
3257
3259
|
}, _AirService_ensureCredential = async function _AirService_ensureCredential() {
|
|
3258
3260
|
__classPrivateFieldGet(this, _AirService_instances, "m", _AirService_assertInitialized).call(this);
|
|
3259
|
-
void __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureWallet).call(this);
|
|
3261
|
+
void __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureWallet).call(this, { skipWalletLogin: true });
|
|
3260
3262
|
try {
|
|
3261
3263
|
if (!__classPrivateFieldGet(this, _AirService_credentialsInitialization, "f"))
|
|
3262
3264
|
__classPrivateFieldSet(this, _AirService_credentialsInitialization, __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_initializeCredentials).call(this), "f");
|
|
@@ -3492,7 +3494,7 @@
|
|
|
3492
3494
|
id: payload.id,
|
|
3493
3495
|
abstractAccountAddress: payload.abstractAccountAddress,
|
|
3494
3496
|
token: payload.partnerAccessToken,
|
|
3495
|
-
isMFASetup: payload.
|
|
3497
|
+
isMFASetup: payload.activeMfaMethods.length > 0,
|
|
3496
3498
|
};
|
|
3497
3499
|
}, _AirService_createWalletInitializedResult = function _AirService_createWalletInitializedResult(payload) {
|
|
3498
3500
|
if ("isWalletLoggedIn" in payload && !payload.isWalletLoggedIn) {
|
|
@@ -3503,7 +3505,7 @@
|
|
|
3503
3505
|
}
|
|
3504
3506
|
return {
|
|
3505
3507
|
abstractAccountAddress: payload.addresses.aa,
|
|
3506
|
-
isMFASetup: payload.
|
|
3508
|
+
isMFASetup: payload.activeMfaMethods.length > 0,
|
|
3507
3509
|
};
|
|
3508
3510
|
}, _AirService_cleanUpAuth = async function _AirService_cleanUpAuth() {
|
|
3509
3511
|
// Logout auth session
|
|
@@ -97,11 +97,11 @@ declare class AirService {
|
|
|
97
97
|
}): Promise<{
|
|
98
98
|
cakPublicKey?: string;
|
|
99
99
|
}>;
|
|
100
|
-
verifyCredential({ authToken, programId, redirectUrl,
|
|
100
|
+
verifyCredential({ authToken, programId, redirectUrl, fieldsToDisclose, offchain, }: {
|
|
101
101
|
authToken: string;
|
|
102
102
|
programId: string;
|
|
103
103
|
redirectUrl?: string;
|
|
104
|
-
|
|
104
|
+
fieldsToDisclose?: "*" | string[];
|
|
105
105
|
offchain?: boolean;
|
|
106
106
|
}): Promise<CredentialVerificationResult>;
|
|
107
107
|
}
|
|
@@ -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
|
}>;
|
|
@@ -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",
|
|
@@ -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 {};
|
|
@@ -43,8 +43,10 @@ type EmailVerificationRequiredLoginResponse = {
|
|
|
43
43
|
type LoginRequiredLoginResponse = {
|
|
44
44
|
status: "login_required";
|
|
45
45
|
};
|
|
46
|
+
export type MfaMethod = "pin";
|
|
46
47
|
export type MFASetup = {
|
|
47
|
-
|
|
48
|
+
activeMfaMethods: MfaMethod[];
|
|
49
|
+
pinSalt?: string | null;
|
|
48
50
|
};
|
|
49
51
|
export type LoginResponse = LoggedInLoginResponse | PartnerLinkageRequiredLoginResponse | EmailRequiredLoginResponse | EmailVerificationRequiredLoginResponse | LoginRequiredLoginResponse;
|
|
50
52
|
export type CredentialConfigResponse = {
|
|
@@ -71,7 +71,7 @@ export type AirEventOnWalletInitialized = {
|
|
|
71
71
|
export type CredentialVerificationResult = AirVerifyCredentialSuccessResponsePayload["verificationResult"];
|
|
72
72
|
/**
|
|
73
73
|
* Re-export DisclosedCredentialData and CredentialProof for SDK consumers
|
|
74
|
-
* These types represent the decrypted credential data returned during full disclosure verification
|
|
74
|
+
* These types represent the decrypted credential data returned during full or selective disclosure verification
|
|
75
75
|
*/
|
|
76
76
|
export type { DisclosedCredentialData, CredentialProof };
|
|
77
77
|
export type AirEventData = AirEventOnInitialized | AirEventOnLoggedIn | AirEventOnWalletInitialized | AirEventOnLoggedOut;
|