@mocanetwork/airkit 1.8.0 → 1.9.0-beta.1

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.
@@ -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.8.0";
104
+ var version = "1.9.0-beta.1";
105
105
  var airkitPackage = {
106
106
  version: version};
107
107
 
@@ -129,6 +129,8 @@
129
129
  SETUP_WALLET_RESPONSE: "air_auth_setup_wallet_response",
130
130
  SETUP_RECOVERY_REQUEST: "air_auth_setup_recovery_request",
131
131
  SETUP_RECOVERY_RESPONSE: "air_auth_setup_recovery_response",
132
+ SETUP_CREDENTIAL_REQUEST: "air_auth_setup_credential_request",
133
+ SETUP_CREDENTIAL_RESPONSE: "air_auth_setup_credential_response",
132
134
  SIGN_SIWE_MESSAGE_REQUEST: "air_auth_sign_siwe_message_request",
133
135
  SIGN_SIWE_MESSAGE_RESPONSE: "air_auth_sign_siwe_message_response",
134
136
  CROSS_PARTNER_TOKEN_REQUEST: "air_auth_cross_partner_token_request",
@@ -141,6 +143,8 @@
141
143
  START_RECOVERY_RESPONSE: "air_start_recovery_response",
142
144
  RECOVERY_REQUEST: "air_auth_recovery_request",
143
145
  RECOVERY_RESPONSE: "air_auth_recovery_response",
146
+ ISSUE_ON_BEHALF_NEW_USER_CONFIRMATION_REQUEST: "air_auth_issue_on_behalf_new_user_confirmation_request",
147
+ ISSUE_ON_BEHALF_NEW_USER_CONFIRMATION_RESPONSE: "air_auth_issue_on_behalf_new_user_confirmation_response",
144
148
  EXPIRED_LOGOUT_REQUEST: "air_auth_expired_logout_request"
145
149
  };
146
150
 
@@ -153,12 +157,16 @@
153
157
  UPDATE_SESSION_CONFIG_RESPONSE: "air_credential_update_session_config_response",
154
158
  LOGOUT_REQUEST: "air_credential_logout_request",
155
159
  LOGOUT_RESPONSE: "air_credential_logout_response",
160
+ CLOSE_MODAL_REQUEST: "air_credential_close_modal_request",
161
+ CLOSE_MODAL_RESPONSE: "air_credential_close_modal_response",
156
162
  // New credential operation message types
157
163
  ISSUE_CREDENTIAL_REQUEST: "air_credential_issue_request",
158
164
  VERIFY_CREDENTIAL_REQUEST: "air_credential_verify_request",
159
165
  // Event messages for communication with parent
160
166
  ISSUE_CREDENTIAL_RESPONSE: "air_credential_issue_response",
161
- VERIFY_CREDENTIAL_RESPONSE: "air_credential_verify_response"
167
+ VERIFY_CREDENTIAL_RESPONSE: "air_credential_verify_response",
168
+ ISSUE_ON_BEHALF_NEW_USER_CONFIRMATION_REQUEST: "air_credential_issue_on_behalf_new_user_confirmation_request",
169
+ ISSUE_ON_BEHALF_NEW_USER_CONFIRMATION_RESPONSE: "air_credential_issue_on_behalf_new_user_confirmation_response"
162
170
  };
163
171
 
164
172
  const AirRecoveryMessageTypes = {
@@ -177,8 +185,8 @@
177
185
  SERVICE_STARTED: "air_service_started",
178
186
  INITIALIZATION_REQUEST: "air_initialization_request",
179
187
  INITIALIZATION_RESPONSE: "air_initialization_response",
180
- CLOSE_MODAL_REQUEST: "air_close_modal_request",
181
- CLOSE_MODAL_RESPONSE: "air_close_modal_response",
188
+ CLOSE_MODAL_REQUEST: "air_wallet_close_modal_request",
189
+ CLOSE_MODAL_RESPONSE: "air_wallet_close_modal_response",
182
190
  WALLET_INITIALIZED: "air_wallet_initialized",
183
191
  UPDATE_SESSION_CONFIG_REQUEST: "air_wallet_update_session_config_request",
184
192
  UPDATE_SESSION_CONFIG_RESPONSE: "air_wallet_update_session_config_response",
@@ -192,6 +200,10 @@
192
200
  SHOW_SWAP_UI_RESPONSE: "air_show_swap_ui_response",
193
201
  SHOW_ON_RAMP_UI_REQUEST: "air_show_on_ramp_ui_request",
194
202
  SHOW_ON_RAMP_UI_RESPONSE: "air_show_on_ramp_ui_response",
203
+ SHOW_TRANSFER_UI_REQUEST: "air_show_transfer_ui_request",
204
+ SHOW_TRANSFER_UI_RESPONSE: "air_show_transfer_ui_response",
205
+ SHOW_RECEIVE_UI_REQUEST: "air_show_receive_ui_request",
206
+ SHOW_RECEIVE_UI_RESPONSE: "air_show_receive_ui_response",
195
207
  DEPLOY_SMART_ACCOUNT_REQUEST: "air_deploy_smart_account_request",
196
208
  DEPLOY_SMART_ACCOUNT_RESPONSE: "air_deploy_smart_account_response",
197
209
  WALLET_IFRAME_VISIBILITY_REQUEST: "air_wallet_iframe_visibility_request",
@@ -200,7 +212,11 @@
200
212
  LOGOUT_REQUEST: "air_logout_request",
201
213
  LOGOUT_RESPONSE: "air_logout_response",
202
214
  INTERNAL_PROVIDER_REQUEST: "air_internal_provider_request",
203
- INTERNAL_PROVIDER_RESPONSE: "air_internal_provider_response"
215
+ INTERNAL_PROVIDER_RESPONSE: "air_internal_provider_response",
216
+ ADDITIONAL_SIGNER_SIGNATURE_REQUEST: "air_additional_signer_signature_request",
217
+ ADDITIONAL_SIGNER_SIGNATURE_RESPONSE: "air_additional_signer_signature_response",
218
+ REMOVE_SIGNER_SIGNATURE_REQUEST: "air_remove_signer_signature_request",
219
+ REMOVE_SIGNER_SIGNATURE_RESPONSE: "air_remove_signer_signature_response"
204
220
  };
205
221
 
206
222
  const AirWindowMessageTypes = {
@@ -653,6 +669,34 @@
653
669
  },
654
670
  testnet: true
655
671
  };
672
+ const mocaMainnet = {
673
+ id: 2288,
674
+ name: "Moca Mainnet",
675
+ nativeCurrency: {
676
+ decimals: 18,
677
+ name: "Moca Network",
678
+ symbol: "MOCA"
679
+ },
680
+ rpcUrls: {
681
+ default: {
682
+ http: ["https://rpc.mocachain.org"],
683
+ webSocket: ["wss://rpc.mocachain.org/ws"]
684
+ }
685
+ },
686
+ blockExplorers: {
687
+ default: {
688
+ name: "Moca Mainnet",
689
+ url: "https://scan.mocachain.org"
690
+ } // TODO: need to confirm mainnet explorer
691
+ },
692
+ contracts: {
693
+ multicall3: {
694
+ address: "0xcA11bde05977b3631167028862bE2a173976CA11",
695
+ blockCreated: 3668598
696
+ }
697
+ },
698
+ testnet: false
699
+ };
656
700
 
657
701
  const BUILD_ENV = {
658
702
  PRODUCTION: "production",
@@ -1814,7 +1858,7 @@
1814
1858
  ...WindowErrorName
1815
1859
  };
1816
1860
 
1817
- const AirClientUserErrors = ["USER_CANCELLED", "CONFIG_ERROR", "CLIENT_ERROR", "UNKNOWN_ERROR", "PERMISSION_NOT_ENABLED", "SMART_ACCOUNT_NOT_DEPLOYED", "ACCOUNT_DELETION_PENDING"];
1861
+ const AirClientUserErrors = ["USER_CANCELLED", "CONFIG_ERROR", "CLIENT_ERROR", "UNKNOWN_ERROR", "PERMISSION_NOT_ENABLED", "SMART_ACCOUNT_NOT_DEPLOYED", "ACCOUNT_DELETION_PENDING", "SWAP_TO_ONRAMP", "USER_REJECTED"];
1818
1862
 
1819
1863
  class AirError extends BaseError {}
1820
1864
  new Set(AirClientUserErrors);
@@ -2082,6 +2126,7 @@
2082
2126
  AirAuthMessageTypes.LOGIN_RESPONSE,
2083
2127
  AirAuthMessageTypes.SETUP_WALLET_REQUEST,
2084
2128
  AirAuthMessageTypes.SETUP_RECOVERY_REQUEST,
2129
+ AirAuthMessageTypes.SETUP_CREDENTIAL_REQUEST,
2085
2130
  AirAuthMessageTypes.LOGOUT_RESPONSE,
2086
2131
  AirAuthMessageTypes.UPDATE_SESSION_CONFIG_RESPONSE,
2087
2132
  AirAuthMessageTypes.PARTNER_USER_INFO_RESPONSE,
@@ -2161,6 +2206,15 @@
2161
2206
  },
2162
2207
  });
2163
2208
  }
2209
+ async sendSetupCredentialSuccessResponse() {
2210
+ await this.sendMessage({
2211
+ type: AirAuthMessageTypes.SETUP_CREDENTIAL_RESPONSE,
2212
+ payload: { success: true },
2213
+ });
2214
+ }
2215
+ async sendSetupCredentialErrorResponse(error) {
2216
+ await this.sendMessage(this.createErrorResponseMessage(AirAuthMessageTypes.SETUP_CREDENTIAL_RESPONSE, error));
2217
+ }
2164
2218
  async sendCrossPartnerTokenRequest(targetPartnerUrl) {
2165
2219
  const response = firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirAuthMessageTypes.CROSS_PARTNER_TOKEN_RESPONSE)));
2166
2220
  await this.sendMessage({
@@ -2284,6 +2338,8 @@
2284
2338
  "publickey-credentials-create *",
2285
2339
  "ch-ua-model",
2286
2340
  "ch-ua-platform-version",
2341
+ "clipboard-write",
2342
+ "web-share"
2287
2343
  ].join("; ");
2288
2344
  iframe.src = this.iframeUrl;
2289
2345
  iframe.style.position = "fixed";
@@ -2394,6 +2450,8 @@
2394
2450
  AirWalletMessageTypes.SETUP_OR_UPDATE_MFA_RESPONSE,
2395
2451
  AirWalletMessageTypes.SHOW_SWAP_UI_RESPONSE,
2396
2452
  AirWalletMessageTypes.SHOW_ON_RAMP_UI_RESPONSE,
2453
+ AirWalletMessageTypes.SHOW_TRANSFER_UI_RESPONSE,
2454
+ AirWalletMessageTypes.SHOW_RECEIVE_UI_RESPONSE,
2397
2455
  AirWalletMessageTypes.CLAIM_ID_RESPONSE,
2398
2456
  AirWalletMessageTypes.IS_SMART_ACCOUNT_DEPLOYED_RESPONSE,
2399
2457
  AirWalletMessageTypes.DEPLOY_SMART_ACCOUNT_RESPONSE,
@@ -2518,6 +2576,26 @@
2518
2576
  });
2519
2577
  return response;
2520
2578
  }
2579
+ async sendShowTransferUIRequest(payload) {
2580
+ const response = firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirWalletMessageTypes.SHOW_TRANSFER_UI_RESPONSE)));
2581
+ await this.sendMessage({
2582
+ type: AirWalletMessageTypes.SHOW_TRANSFER_UI_REQUEST,
2583
+ payload: {
2584
+ tokenSymbol: payload?.tokenSymbol,
2585
+ chainId: payload?.chainId,
2586
+ recipientAddress: payload?.recipientAddress,
2587
+ amount: payload?.amount,
2588
+ },
2589
+ });
2590
+ return response;
2591
+ }
2592
+ async sendShowReceiveUIRequest() {
2593
+ const response = firstValueFrom(this.messages$.pipe(filter((msg) => msg.type === AirWalletMessageTypes.SHOW_RECEIVE_UI_RESPONSE)));
2594
+ await this.sendMessage({
2595
+ type: AirWalletMessageTypes.SHOW_RECEIVE_UI_REQUEST,
2596
+ });
2597
+ return response;
2598
+ }
2521
2599
  }
2522
2600
  _a = WalletMessageService;
2523
2601
  _WalletMessageService_instance = { value: void 0 };
@@ -2784,7 +2862,7 @@
2784
2862
  return localStorage.getItem("automation") === "true" && __classPrivateFieldGet(this, _AirService_buildEnv, "f") !== BUILD_ENV.PRODUCTION;
2785
2863
  }
2786
2864
  async init(config) {
2787
- const { buildEnv = BUILD_ENV.PRODUCTION, enableLogging = false, skipRehydration = false, sessionConfig = undefined, preloadWallet = false, preloadCredential = false, credentialNetwork = "testnet", } = config;
2865
+ const { buildEnv = BUILD_ENV.PRODUCTION, enableLogging = false, skipRehydration = false, sessionConfig = undefined, preloadWallet = false, preloadCredential = false, credentialNetwork = "devnet", } = config;
2788
2866
  if (!__classPrivateFieldGet(this, _AirService_partnerId, "f"))
2789
2867
  throw new AirServiceError("CLIENT_ERROR", "Partner ID is required to initialize the service");
2790
2868
  if (__classPrivateFieldGet(this, _AirService_isAuthInitialized, "f"))
@@ -2839,6 +2917,18 @@
2839
2917
  }
2840
2918
  break;
2841
2919
  }
2920
+ case AirAuthMessageTypes.SETUP_CREDENTIAL_REQUEST: {
2921
+ try {
2922
+ await __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureWallet).call(this, { skipWalletLogin: true });
2923
+ await __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureCredential).call(this);
2924
+ await __classPrivateFieldGet(this, _AirService_authMessagingService, "f").sendSetupCredentialSuccessResponse();
2925
+ }
2926
+ catch (err) {
2927
+ const error = ensureError(err);
2928
+ await __classPrivateFieldGet(this, _AirService_authMessagingService, "f").sendSetupCredentialErrorResponse(error);
2929
+ }
2930
+ break;
2931
+ }
2842
2932
  case AirAuthMessageTypes.EXPIRED_LOGOUT_REQUEST: {
2843
2933
  await this.logout();
2844
2934
  break;
@@ -2900,6 +2990,10 @@
2900
2990
  });
2901
2991
  if (payload.success === true) {
2902
2992
  __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
+ }
2903
2997
  __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_triggerAirAuthLoggedIn).call(this);
2904
2998
  return __classPrivateFieldGet(this, _AirService_loginResult, "f");
2905
2999
  }
@@ -2977,6 +3071,37 @@
2977
3071
  throw new AirServiceError(result.payload.errorName, result.payload.errorMessage);
2978
3072
  }
2979
3073
  }
3074
+ /**
3075
+ * @experimental This feature has not been officially released and might change in the future.
3076
+ */
3077
+ async showTransferUI(options) {
3078
+ await __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureWallet).call(this);
3079
+ const result = await __classPrivateFieldGet(this, _AirService_walletMessagingService, "f").sendShowTransferUIRequest(options);
3080
+ if (result.payload.success === false) {
3081
+ throw new AirServiceError(result.payload.errorName, result.payload.errorMessage);
3082
+ }
3083
+ return {
3084
+ txHash: result.payload.txHash,
3085
+ symbol: result.payload.symbol,
3086
+ chainId: result.payload.chainId,
3087
+ decimals: result.payload.decimals,
3088
+ address: result.payload.address,
3089
+ recipientAddress: result.payload.recipientAddress,
3090
+ amount: result.payload.amount
3091
+ };
3092
+ }
3093
+ /**
3094
+ * @experimental This feature has not been officially released and might change in the future.
3095
+ */
3096
+ async showReceiveUI() {
3097
+ await __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureWallet).call(this);
3098
+ const result = await __classPrivateFieldGet(this, _AirService_walletMessagingService, "f").sendShowReceiveUIRequest();
3099
+ if (result.payload.success === false) {
3100
+ if (result.payload.errorName === "USER_CANCELLED")
3101
+ return;
3102
+ throw new AirServiceError(result.payload.errorName, result.payload.errorMessage);
3103
+ }
3104
+ }
2980
3105
  async getUserInfo() {
2981
3106
  __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_assertLoggedIn).call(this);
2982
3107
  const info = await __classPrivateFieldGet(this, _AirService_authMessagingService, "f").sendPartnerUserInfoRequest();
@@ -3086,7 +3211,7 @@
3086
3211
  async preloadCredential() {
3087
3212
  await __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureCredential).call(this);
3088
3213
  }
3089
- async issueCredential({ authToken, issuerDid, credentialId, credentialSubject, curve, }) {
3214
+ async issueCredential({ authToken, issuerDid, credentialId, credentialSubject, curve, offchain, }) {
3090
3215
  await __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureCredential).call(this);
3091
3216
  const response = await __classPrivateFieldGet(this, _AirService_credentialMessagingService, "f").sendIssueCredentialRequest({
3092
3217
  partnerToken: authToken,
@@ -3094,6 +3219,7 @@
3094
3219
  credentialId,
3095
3220
  credentialSubject,
3096
3221
  curve,
3222
+ offchain,
3097
3223
  });
3098
3224
  const { payload } = response;
3099
3225
  if (payload.closeDApp) {
@@ -3106,12 +3232,14 @@
3106
3232
  cakPublicKey: payload.cakPublicKey,
3107
3233
  };
3108
3234
  }
3109
- async verifyCredential({ authToken, programId, redirectUrl, }) {
3235
+ async verifyCredential({ authToken, programId, redirectUrl, requestDisclosure, offchain, }) {
3110
3236
  await __classPrivateFieldGet(this, _AirService_instances, "m", _AirService_ensureCredential).call(this);
3111
3237
  const { payload } = await __classPrivateFieldGet(this, _AirService_credentialMessagingService, "f").sendVerifyCredentialRequest({
3112
3238
  partnerToken: authToken,
3113
3239
  programId,
3114
3240
  redirectUrl,
3241
+ requestDisclosure,
3242
+ offchain,
3115
3243
  });
3116
3244
  if (payload.success === false) {
3117
3245
  throw new AirServiceError(payload.errorName, payload.errorMessage);
@@ -3253,6 +3381,7 @@
3253
3381
  const { payload } = await __classPrivateFieldGet(this, _AirService_walletMessagingService, "f").sendInitializationRequest({
3254
3382
  sessionId: __classPrivateFieldGet(this, _AirService_sessionId, "f"),
3255
3383
  partnerId: __classPrivateFieldGet(this, _AirService_partnerId, "f"),
3384
+ partnerDAppUrl: window.location.href,
3256
3385
  enableLogging: __classPrivateFieldGet(this, _AirService_enableLogging, "f"),
3257
3386
  sdkVersion: airKitVersion,
3258
3387
  enableAutomation: this.shouldEnableAutomation(),
@@ -3430,6 +3559,7 @@
3430
3559
  const { payload } = await __classPrivateFieldGet(this, _AirService_recoveryMessagingService, "f").sendInitializationRequest({
3431
3560
  sessionId: __classPrivateFieldGet(this, _AirService_sessionId, "f"),
3432
3561
  partnerId: __classPrivateFieldGet(this, _AirService_partnerId, "f"),
3562
+ partnerDAppUrl: window.location.href,
3433
3563
  enableLogging: __classPrivateFieldGet(this, _AirService_enableLogging, "f"),
3434
3564
  sdkVersion: airKitVersion,
3435
3565
  enableAutomation: this.shouldEnableAutomation(),
@@ -3503,6 +3633,7 @@
3503
3633
  exports.UserRejectedRequestError = UserRejectedRequestError;
3504
3634
  exports.ensureProviderRpcError = ensureProviderRpcError;
3505
3635
  exports.mocaDevnet = mocaDevnet;
3636
+ exports.mocaMainnet = mocaMainnet;
3506
3637
  exports.mocaTestnet = mocaTestnet;
3507
3638
 
3508
3639
  }));
@@ -1,6 +1,6 @@
1
1
  import { AirAuthStartRecoveryRequestPayload } from "@mocanetwork/common/src/air/messaging/auth";
2
- import { AirEventListener, AirLoginResult, AirSessionConfig, AirUserDetails, BUILD_ENV, BUILD_ENV_TYPE, ClaimAirIdOptions, ClaimAirIdResult, CredentialNetwork, CredentialVerificationResult, EIP1193Provider, ShowSwapUIOptions } from "./interfaces";
3
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";
4
4
  declare class AirService {
5
5
  #private;
6
6
  constructor({ partnerId }: {
@@ -65,6 +65,14 @@ declare class AirService {
65
65
  displayCurrencyCode: string;
66
66
  targetCurrencyCode?: string;
67
67
  }): Promise<void>;
68
+ /**
69
+ * @experimental This feature has not been officially released and might change in the future.
70
+ */
71
+ showTransferUI(options?: ShowTransferUIOptions): Promise<ShowTransferUIResult>;
72
+ /**
73
+ * @experimental This feature has not been officially released and might change in the future.
74
+ */
75
+ showReceiveUI(): Promise<void>;
68
76
  getUserInfo(): Promise<AirUserDetails>;
69
77
  updateSessionConfig(config: Partial<AirSessionConfig>): Promise<AirSessionConfig>;
70
78
  goToPartner(partnerUrl: string): Promise<{
@@ -79,19 +87,22 @@ declare class AirService {
79
87
  on(listener: AirEventListener): void;
80
88
  off(listener: AirEventListener): void;
81
89
  preloadCredential(): Promise<void>;
82
- issueCredential({ authToken, issuerDid, credentialId, credentialSubject, curve, }: {
90
+ issueCredential({ authToken, issuerDid, credentialId, credentialSubject, curve, offchain, }: {
83
91
  authToken: string;
84
92
  issuerDid: string;
85
93
  credentialId: string;
86
94
  credentialSubject: Record<string, unknown>;
87
95
  curve?: "secp256r1" | "secp256k1";
96
+ offchain?: boolean;
88
97
  }): Promise<{
89
98
  cakPublicKey?: string;
90
99
  }>;
91
- verifyCredential({ authToken, programId, redirectUrl, }: {
100
+ verifyCredential({ authToken, programId, redirectUrl, requestDisclosure, offchain, }: {
92
101
  authToken: string;
93
102
  programId: string;
94
103
  redirectUrl?: string;
104
+ requestDisclosure?: boolean;
105
+ offchain?: boolean;
95
106
  }): Promise<CredentialVerificationResult>;
96
107
  }
97
108
  export default AirService;
@@ -14,6 +14,8 @@ export declare class AuthMessageService extends MessageServiceBase<AirAuthMessag
14
14
  sendSetupWalletErrorResponse(error: Error): Promise<void>;
15
15
  sendSetupRecoverySuccessResponse(): Promise<void>;
16
16
  sendSetupRecoveryErrorResponse(error: Error): Promise<void>;
17
+ sendSetupCredentialSuccessResponse(): Promise<void>;
18
+ sendSetupCredentialErrorResponse(error: Error): Promise<void>;
17
19
  sendCrossPartnerTokenRequest(targetPartnerUrl: string): Promise<import("./common/air/messaging/auth").AirAuthCrossPartnerTokenResponseMessage>;
18
20
  sendPartnerAccessTokenRequest(): Promise<import("./common/air/messaging/auth").AirAuthPartnerAccessTokenResponseMessage>;
19
21
  sendAccountRecoveryRequest(payload: AirAuthStartRecoveryRequestPayload): Promise<import("./common/air/messaging/auth").AirStartRecoveryResponseMessage>;
@@ -1,3 +1,3 @@
1
1
  import { Codes } from "./codes";
2
- export declare const AirClientUserErrors: readonly ["USER_CANCELLED", "CONFIG_ERROR", "CLIENT_ERROR", "UNKNOWN_ERROR", "PERMISSION_NOT_ENABLED", "SMART_ACCOUNT_NOT_DEPLOYED", "ACCOUNT_DELETION_PENDING"];
2
+ export declare const AirClientUserErrors: readonly ["USER_CANCELLED", "CONFIG_ERROR", "CLIENT_ERROR", "UNKNOWN_ERROR", "PERMISSION_NOT_ENABLED", "SMART_ACCOUNT_NOT_DEPLOYED", "ACCOUNT_DELETION_PENDING", "SWAP_TO_ONRAMP", "USER_REJECTED"];
3
3
  export type AirErrorName = (typeof AirClientUserErrors)[number] | (typeof Codes)[keyof typeof Codes];
@@ -25,6 +25,8 @@ export declare const AirAuthMessageTypes: {
25
25
  readonly SETUP_WALLET_RESPONSE: "air_auth_setup_wallet_response";
26
26
  readonly SETUP_RECOVERY_REQUEST: "air_auth_setup_recovery_request";
27
27
  readonly SETUP_RECOVERY_RESPONSE: "air_auth_setup_recovery_response";
28
+ readonly SETUP_CREDENTIAL_REQUEST: "air_auth_setup_credential_request";
29
+ readonly SETUP_CREDENTIAL_RESPONSE: "air_auth_setup_credential_response";
28
30
  readonly SIGN_SIWE_MESSAGE_REQUEST: "air_auth_sign_siwe_message_request";
29
31
  readonly SIGN_SIWE_MESSAGE_RESPONSE: "air_auth_sign_siwe_message_response";
30
32
  readonly CROSS_PARTNER_TOKEN_REQUEST: "air_auth_cross_partner_token_request";
@@ -37,6 +39,8 @@ export declare const AirAuthMessageTypes: {
37
39
  readonly START_RECOVERY_RESPONSE: "air_start_recovery_response";
38
40
  readonly RECOVERY_REQUEST: "air_auth_recovery_request";
39
41
  readonly RECOVERY_RESPONSE: "air_auth_recovery_response";
42
+ readonly ISSUE_ON_BEHALF_NEW_USER_CONFIRMATION_REQUEST: "air_auth_issue_on_behalf_new_user_confirmation_request";
43
+ readonly ISSUE_ON_BEHALF_NEW_USER_CONFIRMATION_RESPONSE: "air_auth_issue_on_behalf_new_user_confirmation_response";
40
44
  readonly EXPIRED_LOGOUT_REQUEST: "air_auth_expired_logout_request";
41
45
  };
42
46
  export type AirAuthMessageType = (typeof AirAuthMessageTypes)[keyof typeof AirAuthMessageTypes];
@@ -60,10 +64,14 @@ export type AirAuthPartnerUserDetailsSuccess = AirMessageSuccessPayload & {
60
64
  airId?: AirIdDetails;
61
65
  user: GlobalId & {
62
66
  email?: string;
67
+ credentialSignerAvailable: boolean;
68
+ issueOnBehalfApproved?: boolean;
63
69
  } & MFASetup & CredentialConfigResponse;
64
70
  };
65
71
  export type AirAuthSuccessWithAirIdAndTokens = AirAuthPartnerUserDetailsSuccess & AirMessageSuccessPayloadTokens;
66
- type AirAuthLoginResponseToEmbedPayload = AirAuthLoginSuccess | AirMessageErrorPayload;
72
+ type AirAuthLoginResponseToEmbedPayload = AirAuthLoginSuccess & {
73
+ needsWalletRestart?: boolean;
74
+ } | AirMessageErrorPayload;
67
75
  type AirAuthLoginResponseToAirServicePayload = AirAuthSuccessWithAirIdAndTokens | AirMessageErrorPayload;
68
76
  export type AirAuthLoginServiceStatusResponsePayload = ({
69
77
  isUserLoggedIn: false;
@@ -167,6 +175,9 @@ export type AirAuthStartRecoveryRequestPayload = {
167
175
  };
168
176
  export type AirStartRecoveryRequestMessage = AirAuthMessageBase<"air_start_recovery_request", AirAuthStartRecoveryRequestPayload>;
169
177
  export type AirStartRecoveryResponseMessage = AirAuthMessageBase<"air_start_recovery_response", AirMessageSuccessPayload | AirMessageErrorPayload>;
178
+ export type AirAuthSetupCredentialResponsePayload = AirMessageSuccessPayload | AirMessageErrorPayload;
179
+ export type AirAuthSetupCredentialRequestMessage = AirAuthMessageBaseWithoutPayload<"air_auth_setup_credential_request">;
180
+ export type AirAuthSetupCredentialResponseMessage = AirAuthMessageBase<"air_auth_setup_credential_response", AirAuthSetupCredentialResponsePayload>;
170
181
  export type UpdateEmailCompletePayloadParam = {
171
182
  privyAccessToken?: string;
172
183
  intentId?: string;
@@ -199,5 +210,9 @@ export type AirAuthRecoverySuccessPayload = AirMessageSuccessPayload & {
199
210
  };
200
211
  export type AirAuthRecoveryResponseMessage = AirAuthMessageBase<"air_auth_recovery_response", AirAuthRecoverySuccessPayload | AirMessageErrorPayload>;
201
212
  export type AirAuthExpiredLogoutRequestMessage = AirAuthMessageBaseWithoutPayload<"air_auth_expired_logout_request">;
202
- 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;
213
+ export type AirAuthIssueOnBehalfNewUserConfirmationRequestMessage = AirAuthMessageBaseWithoutPayload<"air_auth_issue_on_behalf_new_user_confirmation_request">;
214
+ export type AirAuthIssueOnBehalfNewUserConfirmationResponseMessage = AirAuthMessageBase<"air_auth_issue_on_behalf_new_user_confirmation_response", AirMessageSuccessPayload & {
215
+ needsWalletRestart: boolean;
216
+ } | AirMessageErrorPayload>;
217
+ 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;
203
218
  export {};
@@ -8,10 +8,14 @@ export declare const AirCredentialMessageTypes: {
8
8
  readonly UPDATE_SESSION_CONFIG_RESPONSE: "air_credential_update_session_config_response";
9
9
  readonly LOGOUT_REQUEST: "air_credential_logout_request";
10
10
  readonly LOGOUT_RESPONSE: "air_credential_logout_response";
11
+ readonly CLOSE_MODAL_REQUEST: "air_credential_close_modal_request";
12
+ readonly CLOSE_MODAL_RESPONSE: "air_credential_close_modal_response";
11
13
  readonly ISSUE_CREDENTIAL_REQUEST: "air_credential_issue_request";
12
14
  readonly VERIFY_CREDENTIAL_REQUEST: "air_credential_verify_request";
13
15
  readonly ISSUE_CREDENTIAL_RESPONSE: "air_credential_issue_response";
14
16
  readonly VERIFY_CREDENTIAL_RESPONSE: "air_credential_verify_response";
17
+ readonly ISSUE_ON_BEHALF_NEW_USER_CONFIRMATION_REQUEST: "air_credential_issue_on_behalf_new_user_confirmation_request";
18
+ readonly ISSUE_ON_BEHALF_NEW_USER_CONFIRMATION_RESPONSE: "air_credential_issue_on_behalf_new_user_confirmation_response";
15
19
  };
16
20
  export type AirCredentialMessageType = (typeof AirCredentialMessageTypes)[keyof typeof AirCredentialMessageTypes];
17
21
  export type AirCredentialMessageBase<TType extends AirCredentialMessageType, TPayload extends object> = AirMessageBase<TType, TPayload>;
@@ -38,17 +42,29 @@ export type AirCredentialUpdateSessionConfigRequestMessage = AirCredentialMessag
38
42
  export type AirCredentialUpdateSessionConfigResponseMessage = AirCredentialMessageBase<"air_credential_update_session_config_response", (AirMessageSuccessPayload & SessionConfig) | AirMessageErrorPayload>;
39
43
  export type AirLogoutRequestMessage = AirCredentialMessageBaseWithoutPayload<"air_credential_logout_request">;
40
44
  export type AirLogoutResponseMessage = AirCredentialMessageBase<"air_credential_logout_response", AirMessageSuccessPayload | AirMessageErrorPayload>;
45
+ export type AirCloseModalRequestMessage = AirCredentialMessageBaseWithoutPayload<"air_credential_close_modal_request">;
46
+ export type AirCloseModalResponseMessage = AirCredentialMessageBase<"air_credential_close_modal_response", AirMessageSuccessPayload | AirMessageErrorPayload>;
41
47
  export type AirIssueCredentialRequestMessage = AirCredentialMessageBase<"air_credential_issue_request", {
42
48
  partnerToken: string;
43
49
  issuerDid: string;
44
50
  credentialId: string;
45
51
  credentialSubject: Record<string, unknown>;
46
52
  curve?: "secp256r1" | "secp256k1";
53
+ /** When true, credential is stored offchain only (OSS, no blockchain). Status = STORED. */
54
+ offchain?: boolean;
47
55
  }>;
48
56
  export type AirVerifyCredentialRequestMessage = AirCredentialMessageBase<"air_credential_verify_request", {
49
57
  partnerToken: string;
50
58
  programId: string;
51
59
  redirectUrl?: string;
60
+ /**
61
+ * When true, the verifier requests full disclosure of credential data.
62
+ * The user will be prompted to consent and sign a message authorizing disclosure.
63
+ * If the user consents, the disclosed data will be included in the verification response.
64
+ */
65
+ requestDisclosure?: boolean;
66
+ /** When true, verification skips ZKP and on-chain proof, using offchain flow instead. Works with both ONCHAIN and STORED credentials. */
67
+ offchain?: boolean;
52
68
  }>;
53
69
  export type AirIssueCredentialResponseMessage = AirCredentialMessageBase<"air_credential_issue_response", ((AirMessageSuccessPayload & {
54
70
  result: Record<string, unknown>;
@@ -56,6 +72,58 @@ export type AirIssueCredentialResponseMessage = AirCredentialMessageBase<"air_cr
56
72
  }) | AirMessageErrorPayload) & {
57
73
  closeDApp?: boolean;
58
74
  }>;
75
+ /**
76
+ * Credential proof data containing the issuer's signature.
77
+ * This allows verifiers to validate that the credential data has not been tampered with.
78
+ */
79
+ export type CredentialProof = {
80
+ /** The type of proof (e.g., "BJJSignature2021", "Iden3SparseMerkleTreeProof") */
81
+ type: string;
82
+ /** The core claim in hex format - can be used to verify the credential on-chain */
83
+ coreClaim?: string;
84
+ /** Issuer data including state and authentication information */
85
+ issuerData?: {
86
+ id: string;
87
+ state?: {
88
+ claimsTreeRoot?: string;
89
+ revocationTreeRoot?: string;
90
+ rootOfRoots?: string;
91
+ value?: string;
92
+ };
93
+ authCoreClaim?: string;
94
+ credentialStatus?: {
95
+ id: string;
96
+ type: string;
97
+ revocationNonce?: number;
98
+ };
99
+ };
100
+ /** The signature value (format depends on proof type) */
101
+ signature?: string;
102
+ /** Merkle tree proof data if applicable */
103
+ mtp?: Record<string, unknown>;
104
+ };
105
+ /**
106
+ * Disclosed credential data returned during verification.
107
+ * This is the decrypted credential subject data that the user has consented to share.
108
+ * Includes proof data for verifiers to validate the credential's authenticity.
109
+ */
110
+ export type DisclosedCredentialData = {
111
+ /** The credential subject data (e.g., KYC data, age verification, etc.) */
112
+ credentialSubject: Record<string, unknown>;
113
+ /** The schema/type of the credential */
114
+ credentialType: string;
115
+ /** The issuer DID that issued this credential */
116
+ issuerDid: string;
117
+ /** When the credential was issued */
118
+ issuanceDate: string;
119
+ /** When the credential expires */
120
+ expirationDate: string;
121
+ /**
122
+ * The credential proof containing the issuer's signature.
123
+ * Verifiers can use this to validate that the credential data has not been modified.
124
+ */
125
+ proof?: CredentialProof[];
126
+ };
59
127
  export type AirVerifyCredentialSuccessResponsePayload = {
60
128
  verificationResult: {
61
129
  status: "Non-Compliant" | "Pending" | "Revoking" | "Revoked" | "Expired" | "NotFound";
@@ -64,8 +132,10 @@ export type AirVerifyCredentialSuccessResponsePayload = {
64
132
  zkProofs: Record<string, string>;
65
133
  transactionHash: string;
66
134
  cakPrivateKey?: string;
135
+ /** Disclosed credential data - only present when full disclosure is enabled */
136
+ disclosedData?: DisclosedCredentialData;
67
137
  };
68
138
  } & AirMessageSuccessPayload;
69
139
  export type AirVerifyCredentialResponseMessage = AirCredentialMessageBase<"air_credential_verify_response", AirVerifyCredentialSuccessResponsePayload | AirMessageErrorPayload>;
70
- export type AirCredentialMessage = AirInitializationRequestMessage | AirInitializationResponseMessage | AirCredentialIframeVisibilityRequestMessage | AirCredentialUpdateSessionConfigRequestMessage | AirCredentialUpdateSessionConfigResponseMessage | AirLogoutRequestMessage | AirLogoutResponseMessage | AirIssueCredentialRequestMessage | AirVerifyCredentialRequestMessage | AirIssueCredentialResponseMessage | AirVerifyCredentialResponseMessage;
140
+ export type AirCredentialMessage = AirInitializationRequestMessage | AirInitializationResponseMessage | AirCredentialIframeVisibilityRequestMessage | AirCredentialUpdateSessionConfigRequestMessage | AirCredentialUpdateSessionConfigResponseMessage | AirLogoutRequestMessage | AirLogoutResponseMessage | AirCloseModalRequestMessage | AirCloseModalResponseMessage | AirIssueCredentialRequestMessage | AirVerifyCredentialRequestMessage | AirIssueCredentialResponseMessage | AirVerifyCredentialResponseMessage;
71
141
  export {};
@@ -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: "USER_CANCELLED" | "CONFIG_ERROR" | "CLIENT_ERROR" | "UNKNOWN_ERROR" | "PERMISSION_NOT_ENABLED" | "SMART_ACCOUNT_NOT_DEPLOYED" | "ACCOUNT_DELETION_PENDING" | import("../error/codes").AuthErrorName | import("../error/codes").PartnerAccessTokenErrorName | import("../error/codes").RealmIDErrorName | import("../error/codes").ParameterErrorName | import("../error/codes").ServerErrorName | import("../error/codes").PasskeyErrorName | import("../error/codes").PasswordlessErrorName | import("../error/codes").AuthWalletErrorName | import("../error/codes").WalletLinkErrorName | import("../error/codes").IntentErrorName | import("../error/codes").PrivyErrorName | import("../error/codes").AirIDErrorName | import("../error/codes").WindowErrorName;
30
+ errorName: import("../error/codes").AuthErrorName | import("../error/codes").PartnerAccessTokenErrorName | import("../error/codes").RealmIDErrorName | import("../error/codes").ParameterErrorName | import("../error/codes").ServerErrorName | import("../error/codes").PasskeyErrorName | import("../error/codes").PasswordlessErrorName | import("../error/codes").AuthWalletErrorName | import("../error/codes").WalletLinkErrorName | import("../error/codes").IntentErrorName | import("../error/codes").PrivyErrorName | import("../error/codes").AirIDErrorName | import("../error/codes").WindowErrorName | "USER_CANCELLED" | "CONFIG_ERROR" | "CLIENT_ERROR" | "UNKNOWN_ERROR" | "PERMISSION_NOT_ENABLED" | "SMART_ACCOUNT_NOT_DEPLOYED" | "ACCOUNT_DELETION_PENDING" | "SWAP_TO_ONRAMP" | "USER_REJECTED";
31
31
  errorMessage: string;
32
32
  };
33
33
  };
@@ -17,6 +17,7 @@ export type AirInitializationResponsePayload = AirMessageSuccessPayload | AirMes
17
17
  export type AirInitializationRequestMessage = AirRecoveryMessageBase<"air_recovery_initialization_request", {
18
18
  sessionId: string;
19
19
  partnerId: string;
20
+ partnerDAppUrl?: string;
20
21
  enableLogging: boolean;
21
22
  sdkVersion: string;
22
23
  enableAutomation: boolean;