@magic-ext/passkey 0.0.1 → 1.0.0-canary.1085.25119171769.0
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/LICENSE +176 -0
- package/README.md +8 -0
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/es/index.js +2 -0
- package/dist/es/index.js.map +7 -0
- package/dist/es/index.mjs +2 -0
- package/dist/es/index.mjs.map +7 -0
- package/dist/extension.js +2 -0
- package/dist/types/index.cdn.d.ts +2 -0
- package/dist/types/index.d.ts +22 -0
- package/dist/types/index.native.d.ts +1 -0
- package/dist/types/types.d.ts +34 -0
- package/dist/types/utils/base64.d.ts +13 -0
- package/dist/types/utils/polyfills.d.ts +6 -0
- package/package.json +3 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
package/README.md
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var E=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var M=Object.prototype.hasOwnProperty;var O=(e,t)=>{for(var n in t)E(e,n,{get:t[n],enumerable:!0})},S=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of C(t))!M.call(e,i)&&i!==n&&E(e,i,{get:()=>t[i],enumerable:!(a=I(t,i))||a.enumerable});return e};var P=e=>S(E({},"__esModule",{value:!0}),e);var he={};O(he,{PasskeyExtension:()=>g});module.exports=P(he);var R=require("@magic-sdk/provider");var T=(e=>(e.MissingApiKey="MISSING_API_KEY",e.ModalNotReady="MODAL_NOT_READY",e.ConnectionLost="CONNECTION_WAS_LOST",e.MalformedResponse="MALFORMED_RESPONSE",e.InvalidArgument="INVALID_ARGUMENT",e.ExtensionNotInitialized="EXTENSION_NOT_INITIALIZED",e.IncompatibleExtensions="INCOMPATIBLE_EXTENSIONS",e))(T||{}),N=(e=>(e.SyncWeb3Method="SYNC_WEB3_METHOD",e.DuplicateIframe="DUPLICATE_IFRAME",e.ReactNativeEndpointConfiguration="REACT_NATIVE_ENDPOINT_CONFIGURATION",e.DeprecationNotice="DEPRECATION_NOTICE",e.ProductAnnouncement="ANNOUNCEMENT",e))(N||{}),L=(e=>(e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.MagicLinkFailedVerification=-1e4]="MagicLinkFailedVerification",e[e.MagicLinkExpired=-10001]="MagicLinkExpired",e[e.MagicLinkRateLimited=-10002]="MagicLinkRateLimited",e[e.UserAlreadyLoggedIn=-10003]="UserAlreadyLoggedIn",e[e.UpdateEmailFailed=-10004]="UpdateEmailFailed",e[e.UserRequestEditEmail=-10005]="UserRequestEditEmail",e[e.MagicLinkInvalidRedirectURL=-10006]="MagicLinkInvalidRedirectURL",e[e.InactiveRecipient=-10010]="InactiveRecipient",e[e.AccessDeniedToUser=-10011]="AccessDeniedToUser",e[e.UserRejectedAction=-10012]="UserRejectedAction",e[e.RequestCancelled=-10014]="RequestCancelled",e[e.RedirectLoginComplete=-10015]="RedirectLoginComplete",e[e.SessionTerminated=-10016]="SessionTerminated",e[e.PopupRequestOverriden=-10017]="PopupRequestOverriden",e[e.SanEmail=-10018]="SanEmail",e[e.DpopInvalidated=-10019]="DpopInvalidated",e[e.MaxAttemptsReached=-10031]="MaxAttemptsReached",e[e.UserRequiredMfa=-10033]="UserRequiredMfa",e))(L||{}),k=(e=>(e.PROVIDER="magic_3pw_provider",e.ADDRESS="magic_3pw_address",e.CHAIN_ID="magic_3pw_chainId",e))(k||{}),D=(e=>(e.WalletConnected="wallet_connected",e.WalletRejected="wallet_rejected",e.Web3ModalSelected="web3modal_selected",e))(D||{}),w=(e=>(e.LoginWithSms="magic_auth_login_with_sms",e.LoginWithEmailOTP="magic_auth_login_with_email_otp",e.LoginWithMagicLink="magic_auth_login_with_magic_link",e.LoginWithCredential="magic_auth_login_with_credential",e.SetAuthorizationToken="magic_auth_set_authorization_token",e.GetIdToken="magic_auth_get_id_token",e.GenerateIdToken="magic_auth_generate_id_token",e.GetMetadata="magic_auth_get_metadata",e.IsLoggedIn="magic_is_logged_in",e.Logout="magic_auth_logout",e.UpdateEmail="magic_auth_update_email",e.UserSettings="magic_auth_settings",e.UserSettingsTestMode="magic_auth_settings_testing_mode",e.LoginWithSmsTestMode="magic_auth_login_with_sms_testing_mode",e.LoginWithEmailOTPTestMode="magic_auth_login_with_email_otp_testing_mode",e.LoginWithMagicLinkTestMode="magic_login_with_magic_link_testing_mode",e.LoginWithCredentialTestMode="magic_auth_login_with_credential_testing_mode",e.GetIdTokenTestMode="magic_auth_get_id_token_testing_mode",e.GenerateIdTokenTestMode="magic_auth_generate_id_token_testing_mode",e.GetMetadataTestMode="magic_auth_get_metadata_testing_mode",e.IsLoggedInTestMode="magic_auth_is_logged_in_testing_mode",e.LogoutTestMode="magic_auth_logout_testing_mode",e.UpdateEmailTestMode="magic_auth_update_email_testing_mode",e.IntermediaryEvent="magic_intermediary_event",e.RequestAccounts="eth_requestAccounts",e.GetInfo="magic_get_info",e.ShowUI="magic_wallet",e.NFTPurchase="magic_nft_purchase",e.NFTCheckout="magic_nft_checkout",e.NFTTransfer="magic_nft_transfer",e.RequestUserInfoWithUI="mc_request_user_info",e.Disconnect="mc_disconnect",e.RecoverAccount="magic_auth_recover_account",e.RecoverAccountTestMode="magic_auth_recover_account_testing_mode",e.MagicBoxHeartBeat="magic_box_heart_beat",e.AutoConnect="mc_auto_connect",e.Login="mc_login",e.EncryptV1="magic_auth_encrypt_v1",e.DecryptV1="magic_auth_decrypt_v1",e.ShowNFTs="magic_show_nfts",e.ShowOnRamp="magic_show_fiat_onramp",e.ShowSendTokensUI="magic_show_send_tokens_ui",e.ShowAddress="magic_show_address",e.ShowBalances="magic_show_balances",e.RevealPK="magic_reveal_key",e.EnableMFA="magic_auth_enable_mfa_flow",e.DisableMFA="magic_auth_disable_mfa_flow",e.GetMultichainPublicAddress="magic_get_multichain_public_address",e.Sign7702Authorization="magic_wallet_sign_7702_authorization",e.Send7702Transaction="eth_send7702Transaction",e))(w||{});var U=(e=>(e.MAGIC_HANDLE_RESPONSE="MAGIC_HANDLE_RESPONSE",e.MAGIC_OVERLAY_READY="MAGIC_OVERLAY_READY",e.MAGIC_SHOW_OVERLAY="MAGIC_SHOW_OVERLAY",e.MAGIC_HIDE_OVERLAY="MAGIC_HIDE_OVERLAY",e.MAGIC_HANDLE_EVENT="MAGIC_HANDLE_EVENT",e.MAGIC_MG_BOX_SEND_RECEIPT="MAGIC_MG_BOX_SEND_RECEIPT",e.MAGIC_SEND_PRODUCT_ANNOUNCEMENT="MAGIC_SEND_PRODUCT_ANNOUNCEMENT",e.MAGIC_PONG="MAGIC_PONG",e.MAGIC_POPUP_RESPONSE="MAGIC_POPUP_RESPONSE",e.MAGIC_POPUP_OAUTH_VERIFY_RESPONSE="MAGIC_POPUP_OAUTH_VERIFY_RESPONSE",e.MAGIC_THIRD_PARTY_WALLET_REQUEST="MAGIC_THIRD_PARTY_WALLET_REQUEST",e.MAGIC_OPEN_MOBILE_URL="MAGIC_OPEN_MOBILE_URL",e))(U||{}),b=(e=>(e.MAGIC_HANDLE_REQUEST="MAGIC_HANDLE_REQUEST",e.MAGIC_THIRD_PARTY_WALLET_RESPONSE="MAGIC_THIRD_PARTY_WALLET_RESPONSE",e.MAGIC_THIRD_PARTY_WALLET_UPDATE="MAGIC_THIRD_PARTY_WALLET_EVENT",e.MAGIC_PING="MAGIC_PING",e))(b||{}),F=(e=>(e.UpdateEmail="update-email",e.MFA="mfa",e.Recovery="recovery",e))(F||{}),G=(e=>(e.Retry="retry",e))(G||{}),V=(e=>(e.EmailSent="email-sent",e.EmailNotDeliverable="email-not-deliverable",e))(V||{}),W=(e=>(e.VerifyEmailOtp="verify-email-otp",e.VerifyMFACode="verify-mfa-code",e.LostDevice="lost-device",e.VerifyRecoveryCode="verify-recovery-code",e.Cancel="cancel",e))(W||{}),H=(e=>(e.VerifySmsOtp="verify-sms-otp",e.VerifyMFACode="verify-mfa-code",e.LostDevice="lost-device",e.VerifyRecoveryCode="verify-recovery-code",e.Cancel="cancel",e.Retry="retry",e))(H||{}),x=(e=>(e.SmsOTPSent="sms-otp-sent",e.InvalidSmsOtp="invalid-sms-otp",e.ExpiredSmsOtp="expired-sms-otp",e.MfaSentHandle="mfa-sent-handle",e.InvalidMfaOtp="invalid-mfa-otp",e.LoginThrottled="login-throttled",e.RecoveryCodeSentHandle="recovery-code-sent-handle",e.InvalidRecoveryCode="invalid-recovery-code",e.RecoveryCodeSuccess="recovery-code-success",e))(x||{}),q=(e=>(e.EmailOTPSent="email-otp-sent",e.InvalidEmailOtp="invalid-email-otp",e.InvalidMfaOtp="invalid-mfa-otp",e.ExpiredEmailOtp="expired-email-otp",e.MfaSentHandle="mfa-sent-handle",e.RecoveryCodeSentHandle="recovery-code-sent-handle",e.InvalidRecoveryCode="invalid-recovery-code",e.RecoveryCodeSuccess="recovery-code-success",e.LoginThrottled="login-throttled",e.MaxAttemptsReached="max-attempts-reached",e))(q||{}),Y=(e=>(e.Retry="device-retry",e))(Y||{}),J=(e=>(e.DeviceApproved="device-approved",e.DeviceNeedsApproval="device-needs-approval",e.DeviceVerificationLinkExpired="device-verification-link-expired",e.DeviceVerificationEmailSent="device-verification-email-sent",e))(J||{}),B=(e=>(e.Retry="Recency/auth-factor-retry",e.Cancel="Recency/auth-factor-verification-cancel",e.VerifyEmailOtp="Recency/auth-factor-verify-email-otp",e.VerifyMFACode="Recency/verify-mfa-code",e))(B||{}),K=(e=>(e.PrimaryAuthFactorNeedsVerification="Recency/auth-factor-needs-verification",e.PrimaryAuthFactorVerified="Recency/auth-factor-verified",e.InvalidEmailOtp="Recency/auth-factor-invalid-email-otp",e.EmailExpired="Recency/auth-factor-verification-email-expired",e.EmailSent="Recency/auth-factor-verification-email-sent",e.EmailNotDeliverable="Recency/auth-factor-verification-email-not-deliverable",e))(K||{}),j=(e=>(e.RetryWithNewEmail="UpdateEmail/retry-with-new-email",e.Cancel="UpdateEmail/new-email-verification-cancel",e.VerifyEmailOtp="UpdateEmail/new-email-verify-otp",e))(j||{}),z=(e=>(e.NewAuthFactorNeedsVerification="UpdateEmail/new-email-needs-verification",e.EmailUpdated="UpdateEmail/email-updated",e.InvalidEmailOtp="UpdateEmail/new-email-invalid-email-otp",e.EmailExpired="UpdateEmail/new-email-verification-email-expired",e.EmailSent="UpdateEmail/new-email-verification-email-sent",e.EmailNotDeliverable="UpdateEmail/new-email-verification-email-not-deliverable",e.InvalidEmail="UpdateEmail/new-email-invalid",e.EmailAlreadyExists="UpdateEmail/new-email-already-exists",e))(z||{}),Q=(e=>(e.IDTokenCreated="Auth/id-token-created",e))(Q||{}),X=(e=>(e.Cancel="Farcaster/cancel",e))(X||{}),Z=(e=>(e.MFASecretGenerated="mfa-secret-generated",e.InvalidMFAOtp="invalid-mfa-otp",e.MFARecoveryCodes="mfa-recovery-codes",e))(Z||{}),$=(e=>(e.VerifyMFACode="verify-mfa-code",e.Cancel="cancel-mfa-setup",e))($||{}),ee=(e=>(e.MFACodeRequested="mfa-code-requested",e.InvalidMFAOtp="invalid-mfa-otp",e.InvalidRecoveryCode="invalid-recovery-code",e))(ee||{}),te=(e=>(e.VerifyMFACode="verify-mfa-code",e.LostDevice="lost-device",e.Cancel="cancel-mfa-disable",e))(te||{}),ae=(e=>(e.Harmony="HARMONY",e))(ae||{}),ie=(e=>(e.ClosedByUser="closed-by-user",e))(ie||{}),ne=(e=>(e.ClosedByUser="closed-by-user-on-received",e))(ne||{}),oe=(e=>(e.EnterNewPhoneNumber="enter-new-phone-number",e.EnterOtpCode="enter-otp-code",e.RecoveryFactorAlreadyExists="recovery-factor-already-exists",e.MalformedPhoneNumber="malformed-phone-number",e.InvalidOtpCode="invalid-otp-code",e.RecoveryFactorUpdated="recovery-factor-updated",e.RecoveryFactorDeleted="recovery-factor-deleted",e))(oe||{}),re=(e=>(e.SendNewPhoneNumber="send-new-phone-number",e.SendOtpCode="send-otp-code",e.Cancel="cancel",e.StartEditPhoneNumber="start-edit-phone-number",e))(re||{}),se=(e=>(e.PhoneNumber="phone_number",e))(se||{}),ce=(e=>(e.SmsOtpSent="sms-otp-sent",e.LoginThrottled="login-throttled",e.InvalidSmsOtp="invalid-sms-otp",e.SmsVerified="sms-verified",e.AccountRecovered="account-recovered",e.UpdateEmailRequired="update-email-required",e))(ce||{}),de=(e=>(e.Cancel="cancel",e.VerifyOtp="verify-otp-code",e.ResendSms="resend-sms-otp",e.UpdateEmail="update-email",e))(de||{}),le=(e=>(e.Success="nft-checkout-success",e.Failure="nft-checkout-failure",e.Initiated="nft-checkout-initiated",e.Disconnect="disconnect",e))(le||{}),_e=(e=>(e.WalletInfoFetched="Wallet/wallet-info-fetched",e))(_e||{}),me=(e=>(e.CloseMagicWindow="close-magic-window",e))(me||{}),ve=(e=>(e.Cancel="cancel",e.VerifyMFACode="verify-mfa-code",e.LostDevice="lost-device",e.VerifyRecoveryCode="verify-recovery-code",e))(ve||{}),ue=(e=>(e.MfaSentHandle="mfa-sent-handle",e.InvalidMfaOtp="invalid-mfa-otp",e.RecoveryCodeSentHandle="recovery-code-sent-handle",e.InvalidRecoveryCode="invalid-recovery-code",e.RecoveryCodeSuccess="recovery-code-success",e))(ue||{}),Ee=(e=>(e.PopupUrl="popup-url",e))(Ee||{}),pe=(e=>(e.PopupEvent="popup-event",e))(pe||{}),c=(e=>(e.Cancel="cancel",e.VerifyMFACode="verify-mfa-code",e.LostDevice="lost-device",e.VerifyRecoveryCode="verify-recovery-code",e))(c||{}),r=(e=>(e.MfaSentHandle="mfa-sent-handle",e.InvalidMfaOtp="invalid-mfa-otp",e.RecoveryCodeSentHandle="recovery-code-sent-handle",e.InvalidRecoveryCode="invalid-recovery-code",e.RecoveryCodeSuccess="recovery-code-success",e))(r||{});var d=class{static encode(t){return globalThis.btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}static decode(t){let n=t.replace(/-/g,"+").replace(/_/g,"/"),a=globalThis.atob(n),i=new Uint8Array(a.length);for(let s=0;s<a.length;s++)i[s]=a.charCodeAt(s);return i.buffer}};function ge(e){return!(typeof e!="object"||e?.authenticatorData===void 0||typeof e?.authenticatorData!="object")}function ye(e){return!(typeof e!="object"||e?.attestationObject===void 0||typeof e?.attestationObject!="object")}function p(e){if(typeof e.toJSON=="function")return e.toJSON();try{let t=e.id,n=d.encode(e.rawId),a=e.authenticatorAttachment,i={},s=e.type;if(ge(e.response))return{id:t,rawId:n,response:{authenticatorData:d.encode(e.response.authenticatorData),clientDataJSON:d.encode(e.response.clientDataJSON),signature:d.encode(e.response.signature),userHandle:e.response.userHandle?d.encode(e.response.userHandle):void 0},authenticatorAttachment:a,clientExtensionResults:i,type:s};if(ye(e.response))return{id:t,rawId:n,response:{clientDataJSON:d.encode(e.response.clientDataJSON),attestationObject:d.encode(e.response.attestationObject),transports:e.response?.getTransports()||[]},authenticatorAttachment:a,clientExtensionResults:i,type:s};throw new Error("Unexpected object.")}catch(t){throw console.error(t),t}}var g=class extends R.Extension.Internal{name="passkey";config={};createPasskeyNotSupportError(){this.createError("PASSKEY_NOT_SUPPORTED","Passkey is not supported in this device.",{})}createPasskeyCreateCredentialError(t){this.createError("PASSKEY_REGISTRATION_ERROR",`Error creating credential: ${t}`,{})}async registerNewUser(t){if(!window.PublicKeyCredential)throw this.createPasskeyNotSupportError();let{username:n,nickname:a="",skipDIDToken:i,lifespan:s}=t??{},{registrationOptions:_,registrationToken:o}=await this.request(this.utils.createJsonRpcRequestPayload("magic_auth_register_passkey_start",[{username:n}])),l;try{l=await navigator.credentials.create({publicKey:_})}catch(v){throw this.createPasskeyCreateCredentialError(v)}return this.request(this.utils.createJsonRpcRequestPayload("magic_auth_register_passkey_verify",[{registrationToken:o,registrationResponse:p(l),nickname:a,transport:l.response.getTransports(),userAgent:navigator.userAgent,skipDIDToken:i,lifespan:s}]))}login(t){let{username:n,showMfaModal:a,skipDIDToken:i,lifespan:s}=t??{},_,o=this.utils.createPromiEvent(async(l,v)=>{if(!window.PublicKeyCredential)return v(this.createPasskeyNotSupportError());let{authenticationToken:f,authenticationOptions:A}=await this.request(this.utils.createJsonRpcRequestPayload("magic_auth_login_with_passkey_start",[{username:n}])),y;try{y=await navigator.credentials.get({publicKey:A})}catch(u){return v(this.createPasskeyCreateCredentialError(u))}let h=this.utils.createJsonRpcRequestPayload("magic_auth_login_with_passkey_verify",[{authenticationToken:f,assertionResponse:p(y),showUI:a,skipDIDToken:i,lifespan:s}]);_=h.id;let m=this.request(h);a||(m.on(r.MfaSentHandle,()=>{o.emit(r.MfaSentHandle)}),m.on(r.InvalidMfaOtp,()=>{o.emit(r.InvalidMfaOtp)}),m.on(r.RecoveryCodeSentHandle,()=>{o.emit(r.RecoveryCodeSentHandle)}),m.on(r.InvalidRecoveryCode,()=>{o.emit(r.InvalidRecoveryCode)}),m.on(r.RecoveryCodeSuccess,()=>{o.emit(r.RecoveryCodeSuccess)}));try{let u=await m;l(u)}catch(u){v(u)}});return!a&&o&&(o.on(c.VerifyMFACode,l=>{this.createIntermediaryEvent(c.VerifyMFACode,_)(l)}),o.on(c.LostDevice,()=>{this.createIntermediaryEvent(c.LostDevice,_)()}),o.on(c.VerifyRecoveryCode,l=>{this.createIntermediaryEvent(c.VerifyRecoveryCode,_)(l)}),o.on(c.Cancel,()=>{this.createIntermediaryEvent(c.Cancel,_)()})),o}getMetadata(){let t=this.utils.createJsonRpcRequestPayload("magic_user_get_webauthn_credentials",[]);return this.request(t)}};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/index.ts", "../../../../@magic-sdk/types/src/core/exception-types.ts", "../../../../@magic-sdk/types/src/core/json-rpc-types.ts", "../../../../@magic-sdk/types/src/core/message-types.ts", "../../../../@magic-sdk/types/src/core/deep-link-pages.ts", "../../../../@magic-sdk/types/src/modules/auth-types.ts", "../../../../@magic-sdk/types/src/modules/rpc-provider-types.ts", "../../../../@magic-sdk/types/src/modules/user-types.ts", "../../../../@magic-sdk/types/src/modules/nft-types.ts", "../../../../@magic-sdk/types/src/modules/wallet-types.ts", "../../../../@magic-sdk/types/src/modules/common-types.ts", "../../../../@magic-sdk/types/src/modules/oauth-types.ts", "../../../../@magic-sdk/types/src/modules/webauthn-types.ts", "../../src/utils/base64.ts", "../../src/utils/polyfills.ts"],
|
|
4
|
+
"sourcesContent": ["import { Extension } from '@magic-sdk/provider';\nimport {\n RegisterNewUserConfiguration,\n MagicPasskeyPayloadMethod,\n PasskeySDKErrorCode,\n LoginWithPasskeyConfiguration,\n} from './types';\nimport { PasskeyResult, PasskeyEventHandlers, PasskeyMFAEventEmit, PasskeyMFAEventOnReceived } from '@magic-sdk/types';\nimport { toJSON } from './utils/polyfills';\n\nexport class PasskeyExtension extends Extension.Internal<'passkey', any> {\n name = 'passkey' as const;\n config: any = {};\n\n private createPasskeyNotSupportError() {\n this.createError(PasskeySDKErrorCode.PasskeyNotSupported, 'Passkey is not supported in this device.', {});\n }\n\n private createPasskeyCreateCredentialError(message: string) {\n this.createError(PasskeySDKErrorCode.PasskeyRegisterError, `Error creating credential: ${message}`, {});\n }\n\n public async registerNewUser(configuration?: RegisterNewUserConfiguration) {\n if (!window.PublicKeyCredential) {\n throw this.createPasskeyNotSupportError();\n }\n const { username, nickname = '', skipDIDToken, lifespan } = configuration ?? {};\n\n const { registrationOptions, registrationToken } = await this.request<any>(\n this.utils.createJsonRpcRequestPayload(MagicPasskeyPayloadMethod.RegisterPasskeyStart, [{ username }]),\n );\n\n let credential;\n try {\n credential = (await navigator.credentials.create({\n publicKey: registrationOptions,\n })) as any;\n } catch (err: any) {\n throw this.createPasskeyCreateCredentialError(err);\n }\n\n return this.request<string | null>(\n this.utils.createJsonRpcRequestPayload(MagicPasskeyPayloadMethod.RegisterPasskeyVerify, [\n {\n registrationToken,\n registrationResponse: toJSON(credential),\n nickname,\n transport: credential.response.getTransports(),\n userAgent: navigator.userAgent,\n skipDIDToken,\n lifespan,\n },\n ]),\n );\n }\n\n public login(configuration?: LoginWithPasskeyConfiguration) {\n const { username, showMfaModal, skipDIDToken, lifespan } = configuration ?? {};\n\n let verifyPayloadId: string;\n\n const promiEvent = this.utils.createPromiEvent<PasskeyResult, PasskeyEventHandlers>(async (resolve, reject) => {\n if (!window.PublicKeyCredential) {\n return reject(this.createPasskeyNotSupportError());\n }\n\n const { authenticationToken, authenticationOptions } = await this.request<any>(\n this.utils.createJsonRpcRequestPayload(MagicPasskeyPayloadMethod.LoginWithPasskeyStart, [{ username }]),\n );\n\n let assertion;\n try {\n assertion = (await navigator.credentials.get({\n publicKey: authenticationOptions,\n })) as any;\n } catch (err: any) {\n return reject(this.createPasskeyCreateCredentialError(err));\n }\n\n const requestPayload = this.utils.createJsonRpcRequestPayload(MagicPasskeyPayloadMethod.LoginWithPasskeyVerify, [\n {\n authenticationToken,\n assertionResponse: toJSON(assertion),\n showUI: showMfaModal,\n skipDIDToken,\n lifespan,\n },\n ]);\n\n verifyPayloadId = requestPayload.id as string;\n\n const loginRequest = this.request<PasskeyResult, PasskeyEventHandlers>(requestPayload);\n\n if (!showMfaModal) {\n loginRequest.on(PasskeyMFAEventOnReceived.MfaSentHandle, () => {\n promiEvent.emit(PasskeyMFAEventOnReceived.MfaSentHandle);\n });\n loginRequest.on(PasskeyMFAEventOnReceived.InvalidMfaOtp, () => {\n promiEvent.emit(PasskeyMFAEventOnReceived.InvalidMfaOtp);\n });\n loginRequest.on(PasskeyMFAEventOnReceived.RecoveryCodeSentHandle, () => {\n promiEvent.emit(PasskeyMFAEventOnReceived.RecoveryCodeSentHandle);\n });\n loginRequest.on(PasskeyMFAEventOnReceived.InvalidRecoveryCode, () => {\n promiEvent.emit(PasskeyMFAEventOnReceived.InvalidRecoveryCode);\n });\n loginRequest.on(PasskeyMFAEventOnReceived.RecoveryCodeSuccess, () => {\n promiEvent.emit(PasskeyMFAEventOnReceived.RecoveryCodeSuccess);\n });\n }\n\n try {\n const result = await loginRequest;\n resolve(result);\n } catch (error) {\n reject(error);\n }\n });\n\n if (!showMfaModal && promiEvent) {\n promiEvent.on(PasskeyMFAEventEmit.VerifyMFACode, (mfa: string) => {\n this.createIntermediaryEvent(PasskeyMFAEventEmit.VerifyMFACode, verifyPayloadId)(mfa);\n });\n promiEvent.on(PasskeyMFAEventEmit.LostDevice, () => {\n this.createIntermediaryEvent(PasskeyMFAEventEmit.LostDevice, verifyPayloadId)();\n });\n promiEvent.on(PasskeyMFAEventEmit.VerifyRecoveryCode, (recoveryCode: string) => {\n this.createIntermediaryEvent(PasskeyMFAEventEmit.VerifyRecoveryCode, verifyPayloadId)(recoveryCode);\n });\n promiEvent.on(PasskeyMFAEventEmit.Cancel, () => {\n this.createIntermediaryEvent(PasskeyMFAEventEmit.Cancel, verifyPayloadId)();\n });\n }\n\n return promiEvent;\n }\n\n public getMetadata() {\n const requestPayload = this.utils.createJsonRpcRequestPayload(MagicPasskeyPayloadMethod.GetPasskeyInfo, []);\n return this.request<any[]>(requestPayload);\n }\n}\n", "export enum SDKErrorCode {\n MissingApiKey = 'MISSING_API_KEY',\n ModalNotReady = 'MODAL_NOT_READY',\n ConnectionLost = 'CONNECTION_WAS_LOST',\n MalformedResponse = 'MALFORMED_RESPONSE',\n InvalidArgument = 'INVALID_ARGUMENT',\n ExtensionNotInitialized = 'EXTENSION_NOT_INITIALIZED',\n IncompatibleExtensions = 'INCOMPATIBLE_EXTENSIONS',\n}\n\nexport enum SDKWarningCode {\n SyncWeb3Method = 'SYNC_WEB3_METHOD',\n DuplicateIframe = 'DUPLICATE_IFRAME',\n ReactNativeEndpointConfiguration = 'REACT_NATIVE_ENDPOINT_CONFIGURATION',\n DeprecationNotice = 'DEPRECATION_NOTICE',\n ProductAnnouncement = 'ANNOUNCEMENT',\n}\n\nexport enum RPCErrorCode {\n // Standard JSON RPC 2.0 Error Codes\n ParseError = -32700,\n InvalidRequest = -32600,\n MethodNotFound = -32601,\n InvalidParams = -32602,\n InternalError = -32603,\n\n // Custom RPC Error Codes\n MagicLinkFailedVerification = -10000,\n MagicLinkExpired = -10001,\n MagicLinkRateLimited = -10002,\n UserAlreadyLoggedIn = -10003,\n UpdateEmailFailed = -10004,\n UserRequestEditEmail = -10005,\n MagicLinkInvalidRedirectURL = -10006,\n InactiveRecipient = -10010,\n AccessDeniedToUser = -10011,\n UserRejectedAction = -10012,\n RequestCancelled = -10014,\n RedirectLoginComplete = -10015,\n SessionTerminated = -10016,\n PopupRequestOverriden = -10017,\n SanEmail = -10018,\n DpopInvalidated = -10019,\n MaxAttemptsReached = -10031,\n UserRequiredMfa = -10033,\n}\n\nexport type ErrorCode = SDKErrorCode | RPCErrorCode;\nexport type WarningCode = SDKWarningCode;\n", "import { RPCErrorCode } from './exception-types';\n\n// --- Request interfaces\n\nexport interface JsonRpcRequestPayload<TParams = any> {\n jsonrpc: string;\n id: string | number | null;\n method: string;\n params?: TParams;\n}\n\nexport interface JsonRpcRequestCallback {\n /** Callback executed upon JSON RPC response. */\n (err: JsonRpcError | null, result?: JsonRpcResponsePayload | null): void;\n}\n\nexport interface JsonRpcBatchRequestCallback {\n /** Callback executed upon JSON RPC response. */\n (err: JsonRpcError | null, result?: (JsonRpcResponsePayload | null)[] | null): void;\n}\n\n// --- Response interfaces\n\nexport interface JsonRpcError {\n message: string;\n code: RPCErrorCode;\n data?: any;\n}\n\nexport interface JsonRpcResponsePayload<ResultType = any> {\n jsonrpc: string;\n id: string | number | null;\n result?: ResultType | null;\n error?: JsonRpcError | null;\n}\n\nexport interface UserInfo {\n email?: string;\n}\n\nexport type ShowUIPromiEvents = {\n disconnect: () => void;\n};\n\nexport interface RequestUserInfoScope {\n scope?: {\n email?: 'required' | 'optional';\n };\n}\n\nexport enum LocalStorageKeys {\n PROVIDER = 'magic_3pw_provider',\n ADDRESS = 'magic_3pw_address',\n CHAIN_ID = 'magic_3pw_chainId',\n}\n\nexport enum ThirdPartyWalletEvents {\n WalletConnected = 'wallet_connected',\n WalletRejected = 'wallet_rejected',\n Web3ModalSelected = 'web3modal_selected',\n}\n\nexport interface ConnectWithUIOptions {\n autoPromptThirdPartyWallets?: boolean;\n}\n\nexport type ConnectWithUiEvents = {\n 'id-token-created': (params: { idToken: string }) => void;\n} & { [key in ThirdPartyWalletEvents]: () => void };\n\n// --- Payload methods\n\n/**\n * Enum of JSON RPC methods for interacting with the Magic SDK authentication\n * relayer.\n */\nexport enum MagicPayloadMethod {\n LoginWithSms = 'magic_auth_login_with_sms',\n LoginWithEmailOTP = 'magic_auth_login_with_email_otp',\n LoginWithMagicLink = 'magic_auth_login_with_magic_link',\n LoginWithCredential = 'magic_auth_login_with_credential',\n SetAuthorizationToken = 'magic_auth_set_authorization_token',\n GetIdToken = 'magic_auth_get_id_token',\n GenerateIdToken = 'magic_auth_generate_id_token',\n GetMetadata = 'magic_auth_get_metadata',\n IsLoggedIn = 'magic_is_logged_in',\n Logout = 'magic_auth_logout',\n UpdateEmail = 'magic_auth_update_email',\n UserSettings = 'magic_auth_settings',\n UserSettingsTestMode = 'magic_auth_settings_testing_mode',\n LoginWithSmsTestMode = 'magic_auth_login_with_sms_testing_mode',\n LoginWithEmailOTPTestMode = 'magic_auth_login_with_email_otp_testing_mode',\n LoginWithMagicLinkTestMode = 'magic_login_with_magic_link_testing_mode',\n LoginWithCredentialTestMode = 'magic_auth_login_with_credential_testing_mode',\n GetIdTokenTestMode = 'magic_auth_get_id_token_testing_mode',\n GenerateIdTokenTestMode = 'magic_auth_generate_id_token_testing_mode',\n GetMetadataTestMode = 'magic_auth_get_metadata_testing_mode',\n IsLoggedInTestMode = 'magic_auth_is_logged_in_testing_mode',\n LogoutTestMode = 'magic_auth_logout_testing_mode',\n UpdateEmailTestMode = 'magic_auth_update_email_testing_mode',\n IntermediaryEvent = 'magic_intermediary_event',\n RequestAccounts = 'eth_requestAccounts',\n GetInfo = 'magic_get_info',\n ShowUI = 'magic_wallet',\n NFTPurchase = 'magic_nft_purchase',\n NFTCheckout = 'magic_nft_checkout',\n NFTTransfer = 'magic_nft_transfer',\n RequestUserInfoWithUI = 'mc_request_user_info',\n Disconnect = 'mc_disconnect',\n // UpdatePhoneNumber = 'magic_auth_update_phone_number',\n // UpdatePhoneNumberTestMode = 'magic_auth_update_phone_number_testing_mode',\n RecoverAccount = 'magic_auth_recover_account',\n RecoverAccountTestMode = 'magic_auth_recover_account_testing_mode',\n MagicBoxHeartBeat = 'magic_box_heart_beat',\n AutoConnect = 'mc_auto_connect',\n Login = 'mc_login',\n EncryptV1 = 'magic_auth_encrypt_v1',\n DecryptV1 = 'magic_auth_decrypt_v1',\n ShowNFTs = 'magic_show_nfts',\n ShowOnRamp = 'magic_show_fiat_onramp',\n ShowSendTokensUI = 'magic_show_send_tokens_ui',\n ShowAddress = 'magic_show_address',\n ShowBalances = 'magic_show_balances',\n RevealPK = 'magic_reveal_key',\n EnableMFA = 'magic_auth_enable_mfa_flow',\n DisableMFA = 'magic_auth_disable_mfa_flow',\n GetMultichainPublicAddress = 'magic_get_multichain_public_address',\n Sign7702Authorization = 'magic_wallet_sign_7702_authorization',\n Send7702Transaction = 'eth_send7702Transaction',\n}\n\n// Methods to not route if connected to third party wallet\nexport const routeToMagicMethods = [\n MagicPayloadMethod.IntermediaryEvent,\n MagicPayloadMethod.NFTCheckout,\n MagicPayloadMethod.Login,\n];\n", "import { JsonRpcResponsePayload, JsonRpcError, JsonRpcRequestPayload } from './json-rpc-types';\n\nexport enum MagicIncomingWindowMessage {\n MAGIC_HANDLE_RESPONSE = 'MAGIC_HANDLE_RESPONSE',\n MAGIC_OVERLAY_READY = 'MAGIC_OVERLAY_READY',\n MAGIC_SHOW_OVERLAY = 'MAGIC_SHOW_OVERLAY',\n MAGIC_HIDE_OVERLAY = 'MAGIC_HIDE_OVERLAY',\n MAGIC_HANDLE_EVENT = 'MAGIC_HANDLE_EVENT',\n MAGIC_MG_BOX_SEND_RECEIPT = 'MAGIC_MG_BOX_SEND_RECEIPT',\n MAGIC_SEND_PRODUCT_ANNOUNCEMENT = 'MAGIC_SEND_PRODUCT_ANNOUNCEMENT',\n MAGIC_PONG = 'MAGIC_PONG',\n MAGIC_POPUP_RESPONSE = 'MAGIC_POPUP_RESPONSE',\n MAGIC_POPUP_OAUTH_VERIFY_RESPONSE = 'MAGIC_POPUP_OAUTH_VERIFY_RESPONSE',\n MAGIC_THIRD_PARTY_WALLET_REQUEST = 'MAGIC_THIRD_PARTY_WALLET_REQUEST',\n MAGIC_OPEN_MOBILE_URL = 'MAGIC_OPEN_MOBILE_URL',\n}\n\nexport enum MagicOutgoingWindowMessage {\n MAGIC_HANDLE_REQUEST = 'MAGIC_HANDLE_REQUEST',\n MAGIC_THIRD_PARTY_WALLET_RESPONSE = 'MAGIC_THIRD_PARTY_WALLET_RESPONSE',\n MAGIC_THIRD_PARTY_WALLET_UPDATE = 'MAGIC_THIRD_PARTY_WALLET_EVENT',\n MAGIC_PING = 'MAGIC_PING',\n}\n\n/** The shape of responding window message data from the Magic iframe context. */\nexport interface MagicMessageRequest {\n msgType: string;\n payload: JsonRpcRequestPayload | JsonRpcRequestPayload[];\n rt?: string;\n jwt?: string;\n deviceShare?: string;\n}\n\n/** The shape of responding window message data from the Magic iframe context. */\nexport interface MagicMessageResponse<ResultType = any> {\n msgType: string;\n response: Partial<JsonRpcError> & Partial<JsonRpcResponsePayload<ResultType>>;\n rt?: string;\n deviceShare?: string;\n}\n\n/** The expected message event returned by the Magic iframe context. */\nexport interface MagicMessageEvent extends Partial<MessageEvent> {\n data: MagicMessageResponse;\n}\n\nexport interface MagicThirdPartyWalletRequest {\n msgType: MagicIncomingWindowMessage.MAGIC_THIRD_PARTY_WALLET_REQUEST;\n payload: JsonRpcRequestPayload;\n}\n\nexport interface MagicThirdPartyWalletResponse {\n msgType: `${MagicOutgoingWindowMessage.MAGIC_THIRD_PARTY_WALLET_RESPONSE}-${string}`;\n response: JsonRpcResponsePayload;\n}\n\nexport interface MagicThirdPartyWalletUpdate {\n msgType: `${MagicOutgoingWindowMessage.MAGIC_THIRD_PARTY_WALLET_UPDATE}-${string}`;\n details: {\n address: `0x${string}` | undefined;\n addresses: readonly `0x${string}`[] | undefined;\n chain: { id: number; name: string; [key: string]: unknown } | undefined;\n updatedField: 'chain' | 'address';\n };\n}\n\nexport type MagicThirdPartyWalletEventPayload = MagicThirdPartyWalletResponse | MagicThirdPartyWalletUpdate;\n", "export enum DeepLinkPage {\n UpdateEmail = 'update-email',\n MFA = 'mfa',\n Recovery = 'recovery',\n}\n", "import { WalletEventOnReceived } from './wallet-types';\n\nexport interface LoginWithMagicLinkConfiguration {\n /**\n * The email address of the user attempting to login.\n */\n email: string;\n\n /**\n * When `true`, a pre-built modal interface will show to the user, directing\n * them to check their email for the \"magic link\" to complete their\n * authentication.\n */\n showUI?: boolean;\n\n /**\n * You can optionally provide a redirect URI that will be followed at the end\n * of the magic link flow. Don't forget to invoke\n * `magic.auth.loginWithCredential()` to complete the login from the route you\n * configure here.\n */\n redirectURI?: string;\n\n /**\n * Enterprise users with a custom SMTP can create custom email templates\n * from their dashboard. The default Magic loginWithMagicLink email will be\n * overridden when a variation is passed here.\n */\n overrides?: {\n variation?: string;\n };\n\n /**\n * The number of seconds until the generated Decentralized ID token will expire.\n */\n lifespan?: number;\n}\n\nexport interface LoginWithSmsConfiguration {\n /**\n * Specify the phone number of the user attempting to login.\n */\n phoneNumber: string;\n\n /**\n * When `true`, a pre-built modal interface will show to the user, directing\n * them to check their SMS for the one time passcode (OTP) to complete their\n * authentication.\n *\n * When `false`, developers will be able to implement their own custom UI to\n * continue the SMS OTP flow.\n */\n showUI?: boolean;\n\n /*\n * The number of seconds until the generated Decentralized ID token will expire.\n */\n lifespan?: number;\n}\nexport interface LoginWithEmailOTPConfiguration {\n /**\n * Specify the email address of the user attempting to login.\n */\n email: string;\n\n /**\n * When `true`, a pre-built modal interface will show to the user, directing\n * them to check their email for the one time passcode (OTP) to complete their\n * authentication.\n *\n * When `false`, developers will be able to implement their own custom UI to\n * continue the email OTP flow.\n */\n showUI?: boolean;\n\n /**\n * Device Unrecognized UI will enforce showing up to secure user's login\n *\n * When set to true (default), an improved device recognition UI will be displayed to the user,\n * prompting them to verify their login by checking their email for device approval. This feature\n * enhances authentication security.\n *\n * This param will only be affected if showUI is false. When set to false,\n * developers have the flexibility to implement their own customized UI to\n * handle device check events, providing a more tailored user experience.\n */\n deviceCheckUI?: boolean;\n\n /**\n * Enterprise users with a custom SMTP can create custom email templates\n * from their dashboard. The default Magic loginWithOTP email will be\n * overridden when a variation is passed here.\n */\n overrides?: {\n variation?: string;\n appName?: string;\n assetUrl?: string;\n };\n\n /**\n * The number of seconds until the generated Decentralized ID token will expire.\n */\n lifespan?: number;\n}\n\nexport interface LoginWithCredentialConfiguration {\n /**\n * A credential token or a valid query string (prefixed with ? or #)\n */\n credentialOrQueryString?: string;\n\n /**\n * The number of seconds until the generated Decentralized ID token will expire.\n */\n lifespan?: number;\n}\n\nexport interface EnableMFAConfiguration {\n /**\n * When `true`, a pre-built modal interface will show to the user, directing\n * them to enable MFA using Google Authenticator app.\n *\n * When `false`, developers will be able to implement their own custom UI to\n * continue the enable MFA flow.\n */\n showUI?: boolean;\n}\n\nexport interface DisableMFAConfiguration {\n /**\n * When `true`, a pre-built modal interface will show to the user, directing\n * them to disable MFA.\n *\n * When `false`, developers will be able to implement their own custom UI to\n * continue the disable MFA flow.\n */\n showUI?: boolean;\n}\n\n/**\n * Auth Events Enum\n */\nexport enum LoginWithMagicLinkEventEmit {\n Retry = 'retry',\n}\n\nexport enum LoginWithMagicLinkEventOnReceived {\n EmailSent = 'email-sent',\n EmailNotDeliverable = 'email-not-deliverable',\n}\n\nexport enum LoginWithEmailOTPEventEmit {\n VerifyEmailOtp = 'verify-email-otp',\n VerifyMFACode = 'verify-mfa-code',\n LostDevice = 'lost-device',\n VerifyRecoveryCode = 'verify-recovery-code',\n Cancel = 'cancel',\n}\n\nexport enum LoginWithSmsOTPEventEmit {\n VerifySmsOtp = 'verify-sms-otp',\n VerifyMFACode = 'verify-mfa-code',\n LostDevice = 'lost-device',\n VerifyRecoveryCode = 'verify-recovery-code',\n Cancel = 'cancel',\n Retry = 'retry',\n}\n\nexport enum LoginWithSmsOTPEventOnReceived {\n SmsOTPSent = 'sms-otp-sent',\n InvalidSmsOtp = 'invalid-sms-otp',\n ExpiredSmsOtp = 'expired-sms-otp',\n MfaSentHandle = 'mfa-sent-handle',\n InvalidMfaOtp = 'invalid-mfa-otp',\n LoginThrottled = 'login-throttled',\n RecoveryCodeSentHandle = 'recovery-code-sent-handle',\n InvalidRecoveryCode = 'invalid-recovery-code',\n RecoveryCodeSuccess = 'recovery-code-success',\n}\n\nexport enum LoginWithEmailOTPEventOnReceived {\n EmailOTPSent = 'email-otp-sent',\n InvalidEmailOtp = 'invalid-email-otp',\n InvalidMfaOtp = 'invalid-mfa-otp',\n ExpiredEmailOtp = 'expired-email-otp',\n MfaSentHandle = 'mfa-sent-handle',\n RecoveryCodeSentHandle = 'recovery-code-sent-handle',\n InvalidRecoveryCode = 'invalid-recovery-code',\n RecoveryCodeSuccess = 'recovery-code-success',\n LoginThrottled = 'login-throttled',\n MaxAttemptsReached = 'max-attempts-reached',\n}\n\nexport enum DeviceVerificationEventEmit {\n Retry = 'device-retry',\n}\n\nexport enum DeviceVerificationEventOnReceived {\n DeviceApproved = 'device-approved',\n DeviceNeedsApproval = 'device-needs-approval',\n DeviceVerificationLinkExpired = 'device-verification-link-expired',\n DeviceVerificationEmailSent = 'device-verification-email-sent',\n}\n\nexport enum RecencyCheckEventEmit {\n Retry = 'Recency/auth-factor-retry',\n Cancel = 'Recency/auth-factor-verification-cancel',\n VerifyEmailOtp = 'Recency/auth-factor-verify-email-otp',\n VerifyMFACode = 'Recency/verify-mfa-code',\n}\n\nexport enum RecencyCheckEventOnReceived {\n PrimaryAuthFactorNeedsVerification = 'Recency/auth-factor-needs-verification',\n PrimaryAuthFactorVerified = 'Recency/auth-factor-verified',\n InvalidEmailOtp = 'Recency/auth-factor-invalid-email-otp',\n EmailExpired = 'Recency/auth-factor-verification-email-expired',\n EmailSent = 'Recency/auth-factor-verification-email-sent',\n EmailNotDeliverable = 'Recency/auth-factor-verification-email-not-deliverable',\n}\n\nexport enum UpdateEmailEventEmit {\n RetryWithNewEmail = 'UpdateEmail/retry-with-new-email',\n Cancel = 'UpdateEmail/new-email-verification-cancel',\n VerifyEmailOtp = 'UpdateEmail/new-email-verify-otp',\n}\n\nexport enum UpdateEmailEventOnReceived {\n NewAuthFactorNeedsVerification = 'UpdateEmail/new-email-needs-verification',\n EmailUpdated = 'UpdateEmail/email-updated',\n InvalidEmailOtp = 'UpdateEmail/new-email-invalid-email-otp',\n EmailExpired = 'UpdateEmail/new-email-verification-email-expired',\n EmailSent = 'UpdateEmail/new-email-verification-email-sent',\n EmailNotDeliverable = 'UpdateEmail/new-email-verification-email-not-deliverable',\n InvalidEmail = 'UpdateEmail/new-email-invalid',\n EmailAlreadyExists = 'UpdateEmail/new-email-already-exists',\n}\n\nexport enum AuthEventOnReceived {\n IDTokenCreated = 'Auth/id-token-created',\n}\n\nexport enum FarcasterLoginEventEmit {\n Cancel = 'Farcaster/cancel',\n}\n\nexport enum EnableMFAEventOnReceived {\n MFASecretGenerated = 'mfa-secret-generated',\n InvalidMFAOtp = 'invalid-mfa-otp',\n MFARecoveryCodes = 'mfa-recovery-codes',\n}\nexport enum EnableMFAEventEmit {\n VerifyMFACode = 'verify-mfa-code',\n Cancel = 'cancel-mfa-setup',\n}\n\nexport enum DisableMFAEventOnReceived {\n MFACodeRequested = 'mfa-code-requested',\n InvalidMFAOtp = 'invalid-mfa-otp',\n InvalidRecoveryCode = 'invalid-recovery-code',\n}\n\nexport enum DisableMFAEventEmit {\n VerifyMFACode = 'verify-mfa-code',\n LostDevice = 'lost-device',\n Cancel = 'cancel-mfa-disable',\n}\n\n/**\n * EventHandlers\n */\nexport type LoginWithMagicLinkEventHandlers = {\n // Event Received\n [LoginWithMagicLinkEventOnReceived.EmailSent]: () => void;\n [LoginWithMagicLinkEventOnReceived.EmailNotDeliverable]: () => void;\n\n // Event sent\n [LoginWithMagicLinkEventEmit.Retry]: () => void;\n} & DeviceVerificationEventHandlers;\n\nexport type LoginWithSmsOTPEventHandlers = {\n // Event sent\n [LoginWithSmsOTPEventEmit.VerifySmsOtp]: (otp: string) => void;\n [LoginWithSmsOTPEventEmit.VerifyMFACode]: (mfa: string) => void;\n [LoginWithSmsOTPEventEmit.LostDevice]: () => void;\n [LoginWithSmsOTPEventEmit.VerifyRecoveryCode]: (recoveryCode: string) => void;\n [LoginWithSmsOTPEventEmit.Cancel]: () => void;\n [LoginWithSmsOTPEventEmit.Retry]: () => void;\n\n // Event received\n [LoginWithSmsOTPEventOnReceived.SmsOTPSent]: () => void;\n [LoginWithSmsOTPEventOnReceived.InvalidSmsOtp]: () => void;\n [LoginWithSmsOTPEventOnReceived.ExpiredSmsOtp]: () => void;\n [LoginWithSmsOTPEventOnReceived.MfaSentHandle]: () => void;\n [LoginWithSmsOTPEventOnReceived.InvalidMfaOtp]: () => void;\n [LoginWithSmsOTPEventOnReceived.LoginThrottled]: () => void;\n [LoginWithSmsOTPEventOnReceived.RecoveryCodeSentHandle]: () => void;\n [LoginWithSmsOTPEventOnReceived.InvalidRecoveryCode]: () => void;\n [LoginWithSmsOTPEventOnReceived.RecoveryCodeSuccess]: () => void;\n} & DeviceVerificationEventHandlers;\n\nexport type LoginWithEmailOTPEventHandlers = {\n // Event Received\n [LoginWithEmailOTPEventOnReceived.EmailOTPSent]: () => void;\n [LoginWithEmailOTPEventOnReceived.LoginThrottled]: () => void;\n [LoginWithEmailOTPEventOnReceived.InvalidEmailOtp]: () => void;\n [LoginWithEmailOTPEventOnReceived.InvalidMfaOtp]: () => void;\n [LoginWithEmailOTPEventOnReceived.ExpiredEmailOtp]: () => void;\n [LoginWithEmailOTPEventOnReceived.MfaSentHandle]: () => void;\n [LoginWithEmailOTPEventOnReceived.RecoveryCodeSentHandle]: () => void;\n [LoginWithEmailOTPEventOnReceived.InvalidRecoveryCode]: () => void;\n [LoginWithEmailOTPEventOnReceived.RecoveryCodeSuccess]: () => void;\n [LoginWithEmailOTPEventOnReceived.MaxAttemptsReached]: () => void;\n [AuthEventOnReceived.IDTokenCreated]: (idToken: string) => void;\n [WalletEventOnReceived.WalletInfoFetched]: () => void;\n\n // Event sent\n [LoginWithEmailOTPEventEmit.VerifyEmailOtp]: (otp: string) => void;\n [LoginWithEmailOTPEventEmit.VerifyMFACode]: (mfa: string) => void;\n [LoginWithEmailOTPEventEmit.LostDevice]: () => void;\n [LoginWithEmailOTPEventEmit.VerifyRecoveryCode]: (recoveryCode: string) => void;\n [LoginWithEmailOTPEventEmit.Cancel]: () => void;\n} & DeviceVerificationEventHandlers;\n\ntype DeviceVerificationEventHandlers = {\n // Event Received\n [DeviceVerificationEventOnReceived.DeviceNeedsApproval]: () => void;\n [DeviceVerificationEventOnReceived.DeviceVerificationEmailSent]: () => void;\n [DeviceVerificationEventOnReceived.DeviceVerificationLinkExpired]: () => void;\n [DeviceVerificationEventOnReceived.DeviceApproved]: () => void;\n\n // Event sent\n [DeviceVerificationEventEmit.Retry]: () => void;\n};\n\n/**\n * Update Email\n */\n\nexport type RecencyCheckEventHandlers = {\n [RecencyCheckEventOnReceived.PrimaryAuthFactorNeedsVerification]: () => void;\n [RecencyCheckEventOnReceived.PrimaryAuthFactorVerified]: () => void;\n [RecencyCheckEventOnReceived.InvalidEmailOtp]: () => void;\n [RecencyCheckEventOnReceived.EmailNotDeliverable]: () => void;\n [RecencyCheckEventOnReceived.EmailExpired]: () => void;\n [RecencyCheckEventOnReceived.EmailSent]: () => void;\n\n [RecencyCheckEventEmit.Cancel]: () => void;\n [RecencyCheckEventEmit.Retry]: () => void;\n [RecencyCheckEventEmit.VerifyEmailOtp]: (otp: string) => void;\n [RecencyCheckEventEmit.VerifyMFACode]: (mfa: string) => void;\n};\n\nexport type UpdateEmailEventHandlers = {\n [UpdateEmailEventOnReceived.NewAuthFactorNeedsVerification]: () => void;\n [UpdateEmailEventOnReceived.EmailUpdated]: () => void;\n [UpdateEmailEventOnReceived.InvalidEmailOtp]: () => void;\n [UpdateEmailEventOnReceived.EmailNotDeliverable]: () => void;\n [UpdateEmailEventOnReceived.EmailExpired]: () => void;\n [UpdateEmailEventOnReceived.EmailSent]: () => void;\n [UpdateEmailEventOnReceived.InvalidEmail]: () => void;\n [UpdateEmailEventOnReceived.EmailAlreadyExists]: () => void;\n\n [UpdateEmailEventEmit.Cancel]: () => void;\n [UpdateEmailEventEmit.RetryWithNewEmail]: (email?: string) => void;\n [UpdateEmailEventEmit.VerifyEmailOtp]: (otp: string) => void;\n} & RecencyCheckEventHandlers;\n\n/**\n * Enable MFA\n */\n\nexport type EnableMFAEventHandlers = {\n // Event Received\n [EnableMFAEventOnReceived.MFASecretGenerated]: ({ QRCode, key }: { QRCode: string; key: string }) => void;\n [EnableMFAEventOnReceived.InvalidMFAOtp]: ({ errorCode }: { errorCode: string }) => void;\n [EnableMFAEventOnReceived.MFARecoveryCodes]: ({ recoveryCode }: { recoveryCode: string }) => void;\n\n // Event sent\n [EnableMFAEventEmit.VerifyMFACode]: (totp: string) => void;\n [EnableMFAEventEmit.Cancel]: () => void;\n};\n\n/**\n * Disable MFA\n */\n\nexport type DisableMFAEventHandlers = {\n // Event Received\n [DisableMFAEventOnReceived.MFACodeRequested]: () => void;\n [DisableMFAEventOnReceived.InvalidMFAOtp]: ({ errorCode }: { errorCode: string }) => void;\n [DisableMFAEventOnReceived.InvalidRecoveryCode]: () => void;\n\n // Event sent\n [DisableMFAEventEmit.VerifyMFACode]: (totp: string) => void;\n [DisableMFAEventEmit.LostDevice]: (recoveryCode: string) => void;\n [DisableMFAEventEmit.Cancel]: () => void;\n};\n", "export type EthNetworkName = 'mainnet' | 'goerli' | 'sepolia';\n\nexport enum EthChainType {\n Harmony = 'HARMONY',\n}\n\nexport interface CustomNodeConfiguration {\n rpcUrl: string;\n chainId?: number;\n chainType?: EthChainType;\n}\n\nexport type EthNetworkConfiguration = EthNetworkName | CustomNodeConfiguration;\n\nexport type ProviderEnableEvents = {\n 'id-token-created': (params: { idToken: string }) => void;\n};\n", "import { RecencyCheckEventHandlers } from './auth-types';\nimport { DeepLinkPage } from '../core/deep-link-pages';\n\nexport interface GetIdTokenConfiguration {\n /**\n * The number of seconds until the generated ID token will expire.\n */\n lifespan?: number;\n}\n\nexport interface GenerateIdTokenConfiguration extends GetIdTokenConfiguration {\n /**\n * An optional piece of data to sign with the token. Note, however, that the\n * unsigned data _will not_ be encoded in the token, only an encrypted\n * signature of the data.\n */\n attachment?: string;\n}\n\nexport enum UserEventsEmit {\n ClosedByUser = 'closed-by-user',\n}\n\nexport enum UserEventsOnReceived {\n ClosedByUser = 'closed-by-user-on-received',\n}\n\nexport interface ChainWalletInfo {\n publicAddress: string | null;\n subAccounts: Array<{ name: string; publicAddress: string }>;\n}\n\nexport interface MagicUserMetadata {\n issuer: string | null;\n email: string | null;\n phoneNumber: string | null;\n isMfaEnabled: boolean;\n recoveryFactors: [RecoveryFactor] | [];\n firstLoginAt: string | null;\n wallets: {\n ethereum?: ChainWalletInfo;\n algorand?: ChainWalletInfo;\n aptos?: ChainWalletInfo;\n avalancheX?: ChainWalletInfo;\n bitcoin?: ChainWalletInfo;\n conflux?: ChainWalletInfo;\n cosmos?: ChainWalletInfo;\n flow?: ChainWalletInfo;\n harmony?: ChainWalletInfo;\n hedera?: ChainWalletInfo;\n icon?: ChainWalletInfo;\n kadena?: ChainWalletInfo;\n near?: ChainWalletInfo;\n polkadot?: ChainWalletInfo;\n solana?: ChainWalletInfo;\n sui?: ChainWalletInfo;\n taquito?: ChainWalletInfo;\n terra?: ChainWalletInfo;\n tezos?: ChainWalletInfo;\n zilliqa?: ChainWalletInfo;\n [chain: string]: ChainWalletInfo | undefined;\n };\n}\n\nexport enum RecoveryFactorEventOnReceived {\n EnterNewPhoneNumber = 'enter-new-phone-number',\n EnterOtpCode = 'enter-otp-code',\n RecoveryFactorAlreadyExists = 'recovery-factor-already-exists',\n MalformedPhoneNumber = 'malformed-phone-number',\n InvalidOtpCode = 'invalid-otp-code',\n RecoveryFactorUpdated = 'recovery-factor-updated',\n RecoveryFactorDeleted = 'recovery-factor-deleted',\n}\n\nexport enum RecoveryFactorEventEmit {\n SendNewPhoneNumber = 'send-new-phone-number',\n SendOtpCode = 'send-otp-code',\n Cancel = 'cancel',\n StartEditPhoneNumber = 'start-edit-phone-number',\n}\n\ntype RecoveryFactor = {\n type: RecoveryMethodType;\n value: string;\n};\n\nexport type RecoveryFactorEventHandlers = {\n // Event Received\n [RecoveryFactorEventEmit.SendNewPhoneNumber]: (phone_number: string) => void;\n [RecoveryFactorEventEmit.SendOtpCode]: (otp: string) => void;\n [RecoveryFactorEventEmit.StartEditPhoneNumber]: () => void;\n [RecoveryFactorEventEmit.Cancel]: () => void;\n\n // Event sent\n [RecoveryFactorEventOnReceived.EnterNewPhoneNumber]: () => void;\n [RecoveryFactorEventOnReceived.EnterOtpCode]: () => void;\n [RecoveryFactorEventOnReceived.RecoveryFactorAlreadyExists]: () => void;\n [RecoveryFactorEventOnReceived.MalformedPhoneNumber]: () => void;\n [RecoveryFactorEventOnReceived.InvalidOtpCode]: () => void;\n [RecoveryFactorEventOnReceived.RecoveryFactorUpdated]: (updatedFactor: { type: string; value: string }) => void;\n [RecoveryFactorEventOnReceived.RecoveryFactorDeleted]: () => void;\n} & RecencyCheckEventHandlers;\n\nexport enum RecoveryMethodType {\n PhoneNumber = 'phone_number',\n}\n\nexport interface UpdateEmailConfiguration {\n /**\n * The new email address to update to\n */\n email: string;\n\n /**\n * When `true`, a pre-built pending modal interface will\n * guide the user to check their new, followed by old emails\n * for confirmation emails.\n */\n showUI?: boolean;\n}\n\nexport interface UpdateWebAuthnInfoConfiguration {\n /**\n * WebAuthn info id\n */\n id: string;\n\n /**\n * nickname that user attempts to update to the webauth device associate to the id.\n */\n nickname: string;\n}\n\nexport interface RecoverAccountConfiguration {\n /**\n * The email to recover\n */\n email: string;\n showUI: boolean;\n}\n\nexport interface ShowSettingsConfiguration {\n /**\n * deep linking destination\n */\n page: DeepLinkPage;\n showUI?: boolean;\n}\n\nexport enum RecoverAccountEventOnReceived {\n SmsOtpSent = 'sms-otp-sent',\n LoginThrottled = 'login-throttled',\n InvalidSmsOtp = 'invalid-sms-otp',\n SmsVerified = 'sms-verified',\n AccountRecovered = 'account-recovered',\n UpdateEmailRequired = 'update-email-required',\n}\n\nexport enum RecoverAccountEventEmit {\n Cancel = 'cancel',\n VerifyOtp = 'verify-otp-code',\n ResendSms = 'resend-sms-otp',\n UpdateEmail = 'update-email',\n}\n\nexport type RecoverAccountEventHandlers = {\n // Event Received\n [RecoverAccountEventEmit.Cancel]: () => void;\n [RecoverAccountEventEmit.VerifyOtp]: (otp: string) => void;\n [RecoverAccountEventEmit.ResendSms]: () => void;\n [RecoverAccountEventEmit.UpdateEmail]: (email: string) => void;\n\n // Event sent\n [RecoverAccountEventOnReceived.SmsOtpSent]: ({ phoneNumber }: { phoneNumber: string }) => void;\n [RecoverAccountEventOnReceived.LoginThrottled]: (error: string) => void;\n [RecoverAccountEventOnReceived.InvalidSmsOtp]: ({\n errorMessage,\n errorCode,\n }: {\n errorMessage: string;\n errorCode: string;\n }) => void;\n [RecoverAccountEventOnReceived.SmsVerified]: () => void;\n [RecoverAccountEventOnReceived.AccountRecovered]: () => void;\n [RecoverAccountEventOnReceived.UpdateEmailRequired]: () => void;\n};\n", "export type NFTResponseStatus = 'cancelled' | 'pending' | 'processed' | 'declined' | 'expired';\n\nexport type NFTResponse = {\n status: NFTResponseStatus;\n};\n\nexport interface NFTPurchaseRequest {\n nft: {\n name: string;\n imageUrl: string;\n blockchainNftId: string;\n contractAddress: string;\n network: string;\n platform: string;\n type: string;\n };\n identityPrefill: {\n firstName: string;\n lastName: string;\n dateOfBirth: string; // YYYY-MM-DD\n emailAddress: string;\n phone: string;\n address: {\n street1: string;\n street2: string;\n city: string;\n regionCode: string;\n postalCode: string;\n countryCode: string;\n };\n };\n}\n\nexport type NFTPurchaseResponse = NFTResponse & {\n errorMessage?: string;\n};\n\nexport interface NFTCheckoutRequest {\n // given by magic / found in the developer dashboard in future\n contractId: string;\n // in contract, if ERC1155\u2026 for ERC721, use token ID = 0\n tokenId: string;\n name: string;\n imageUrl: string;\n quantity?: number; // default is 1\n walletAddress?: string; // default is user's wallet address\n // If enabled, the user will be able to pay with crypto. the default is false\n isCryptoCheckoutEnabled?: boolean;\n walletProvider?: 'magic' | 'web3modal';\n}\n\nexport type NFTCheckoutResponse = NFTResponse;\n\nexport type NFTCheckoutEvents = {\n disconnect: () => void;\n 'nft-checkout-initiated': (rawTransaction: string) => void;\n};\n\nexport interface NFTTransferRequest {\n tokenId: string;\n contractAddress: string;\n quantity?: number;\n recipient?: string;\n}\n\nexport type NFTTransferResponse = NFTResponse;\n\nexport enum NftCheckoutIntermediaryEvents {\n Success = 'nft-checkout-success',\n Failure = 'nft-checkout-failure',\n Initiated = 'nft-checkout-initiated',\n Disconnect = 'disconnect',\n}\n\nexport type NftCheckoutEventHandler = {\n [NftCheckoutIntermediaryEvents.Initiated]: (rawTransaction: string) => void;\n [NftCheckoutIntermediaryEvents.Success]: (signedTransaction: string) => void;\n [NftCheckoutIntermediaryEvents.Failure]: () => void;\n};\n", "export type AccessListEntry = { address: string; storageKeys: Array<string> };\n\n/**\n * An ordered collection of [[AccessList]] entries.\n */\nexport type AccessList = Array<AccessListEntry>;\n\nexport enum WalletEventOnReceived {\n WalletInfoFetched = 'Wallet/wallet-info-fetched',\n}\n\n/**\n * Request parameters for EIP-7702 authorization signing\n */\nexport interface Sign7702AuthorizationRequest {\n /**\n * The smart contract implementation address the EOA delegates to\n */\n contractAddress: string;\n\n /**\n * The chain ID for the network (use 0 for universal cross-chain authorization)\n */\n chainId: number;\n\n /**\n * The nonce for the EOA account (transaction count)\n */\n nonce?: number;\n}\n\n/**\n * Response from EIP-7702 authorization signing\n */\nexport interface Sign7702AuthorizationResponse {\n /**\n * The contract address that was authorized\n */\n contractAddress: string;\n\n /**\n * The chain ID for the authorization\n */\n chainId: number;\n\n /**\n * The nonce used in the authorization\n */\n nonce: number;\n\n /**\n * The v component of the signature (recovery id)\n */\n v: number;\n\n /**\n * The r component of the signature\n */\n r: string;\n\n /**\n * The s component of the signature\n */\n s: string;\n\n /**\n * Optional: Full signature as hex string\n */\n signature?: string;\n}\n\n/**\n * Request parameters for sending an EIP-7702 transaction with authorization list\n */\nexport interface Send7702TransactionRequest {\n /**\n * The recipient address\n */\n to: string;\n\n /**\n * The value to send in wei (as hex string)\n */\n value?: string;\n\n /**\n * The transaction data (calldata)\n */\n data?: string;\n\n /**\n * Gas limit for the transaction (as hex string)\n */\n gas?: string;\n\n /**\n * Gas limit for the transaction (alias for gas)\n */\n gasLimit?: string;\n\n /**\n * Maximum fee per gas for EIP-1559 transactions (as hex string)\n */\n maxFeePerGas?: string;\n\n /**\n * Maximum priority fee per gas for EIP-1559 transactions (as hex string)\n */\n maxPriorityFeePerGas?: string;\n\n /**\n * Transaction nonce (if not provided, will be fetched from network)\n */\n nonce?: number;\n\n /**\n * The list of signed EIP-7702 authorizations to include in the transaction\n */\n authorizationList: Sign7702AuthorizationResponse[];\n}\n\n/**\n * Response from sending an EIP-7702 transaction\n */\nexport interface Send7702TransactionResponse {\n /**\n * The transaction hash\n */\n transactionHash: string;\n}", "export enum UiEventsEmit {\n CloseMagicWindow = 'close-magic-window',\n}\n", "// Shared MFA events reused by both popup and redirect flows\nexport enum OAuthMFAEventEmit {\n Cancel = 'cancel',\n VerifyMFACode = 'verify-mfa-code',\n LostDevice = 'lost-device',\n VerifyRecoveryCode = 'verify-recovery-code',\n}\n\nexport enum OAuthMFAEventOnReceived {\n MfaSentHandle = 'mfa-sent-handle',\n InvalidMfaOtp = 'invalid-mfa-otp',\n RecoveryCodeSentHandle = 'recovery-code-sent-handle',\n InvalidRecoveryCode = 'invalid-recovery-code',\n RecoveryCodeSuccess = 'recovery-code-success',\n}\n\ntype OAuthMFAEventHandlers = {\n // Event sent\n [OAuthMFAEventEmit.Cancel]: () => void;\n [OAuthMFAEventEmit.VerifyMFACode]: (mfa: string) => void;\n [OAuthMFAEventEmit.LostDevice]: () => void;\n [OAuthMFAEventEmit.VerifyRecoveryCode]: (recoveryCode: string) => void;\n // Event Received\n [OAuthMFAEventOnReceived.MfaSentHandle]: () => void;\n [OAuthMFAEventOnReceived.InvalidMfaOtp]: () => void;\n [OAuthMFAEventOnReceived.RecoveryCodeSentHandle]: () => void;\n [OAuthMFAEventOnReceived.InvalidRecoveryCode]: () => void;\n [OAuthMFAEventOnReceived.RecoveryCodeSuccess]: () => void;\n};\n\n// Popup-specific events\nexport enum OAuthPopupEventOnReceived {\n PopupUrl = 'popup-url',\n}\n\nexport enum OAuthPopupEventEmit {\n PopupEvent = 'popup-event',\n}\n\nexport type OAuthPopupEventHandlers = {\n [OAuthPopupEventEmit.PopupEvent]: (eventData: unknown) => void;\n [OAuthPopupEventOnReceived.PopupUrl]: (event: { popupUrl: string; provider: string }) => void;\n} & OAuthMFAEventHandlers;\n\n// Redirect-specific handler type\nexport type OAuthGetResultEventHandlers = OAuthMFAEventHandlers;\n", "export interface PasskeyResult {\n // null if skipDIDToken is true\n idToken: string | null;\n\n // Info of the device used to authenticate\n deviceInfo: {\n id: string;\n nickname: string;\n transport: string;\n userAgent: string;\n };\n}\n\nexport enum PasskeyMFAEventEmit {\n Cancel = 'cancel',\n VerifyMFACode = 'verify-mfa-code',\n LostDevice = 'lost-device',\n VerifyRecoveryCode = 'verify-recovery-code',\n}\nexport enum PasskeyMFAEventOnReceived {\n MfaSentHandle = 'mfa-sent-handle',\n InvalidMfaOtp = 'invalid-mfa-otp',\n RecoveryCodeSentHandle = 'recovery-code-sent-handle',\n InvalidRecoveryCode = 'invalid-recovery-code',\n RecoveryCodeSuccess = 'recovery-code-success',\n}\n\nexport type PasskeyEventHandlers = {\n // Event sent\n [PasskeyMFAEventEmit.Cancel]: () => void;\n [PasskeyMFAEventEmit.VerifyMFACode]: (mfa: string) => void;\n [PasskeyMFAEventEmit.LostDevice]: () => void;\n [PasskeyMFAEventEmit.VerifyRecoveryCode]: (recoveryCode: string) => void;\n // Event Received\n [PasskeyMFAEventOnReceived.MfaSentHandle]: () => void;\n [PasskeyMFAEventOnReceived.InvalidMfaOtp]: () => void;\n [PasskeyMFAEventOnReceived.RecoveryCodeSentHandle]: () => void;\n [PasskeyMFAEventOnReceived.InvalidRecoveryCode]: () => void;\n [PasskeyMFAEventOnReceived.RecoveryCodeSuccess]: () => void;\n};\n", "/**\n * Encode given buffer or decode given string with Base64URL.\n */\nexport class Base64URL {\n /**\n * Convert bytes into a base64url-encoded string\n */\n static encode(buffer: ArrayBuffer): string {\n const base64 = globalThis.btoa(String.fromCharCode(...new Uint8Array(buffer)));\n\n return base64.replace(/=/g, '').replace(/\\+/g, '-').replace(/\\//g, '_');\n }\n\n /**\n * Convert a base64url-encoded string into bytes\n */\n static decode(base64url: string): ArrayBuffer {\n const base64 = base64url.replace(/-/g, '+').replace(/_/g, '/');\n const binStr = globalThis.atob(base64);\n const bin = new Uint8Array(binStr.length);\n\n for (let i = 0; i < binStr.length; i++) {\n bin[i] = binStr.charCodeAt(i);\n }\n\n return bin.buffer;\n }\n}\n", "import { Base64URL } from './base64';\n\nfunction isAuthenticatorAssertionResponse(value: AuthenticatorResponse): value is AuthenticatorAssertionResponse {\n if (typeof value !== 'object') {\n return false;\n }\n if (\n (value as AuthenticatorAssertionResponse)?.authenticatorData === undefined ||\n typeof (value as AuthenticatorAssertionResponse)?.authenticatorData !== 'object'\n ) {\n return false;\n }\n return true;\n}\n\nfunction isAuthenticatorAttestationResponse(value: AuthenticatorResponse): value is AuthenticatorAttestationResponse {\n if (typeof value !== 'object') {\n return false;\n }\n if (\n (value as AuthenticatorAttestationResponse)?.attestationObject === undefined ||\n typeof (value as AuthenticatorAttestationResponse)?.attestationObject !== 'object'\n ) {\n return false;\n }\n return true;\n}\n\n/**\n * Polyfill `PublicKeyCredential.prototype.toJSON`\n *\n * See https://w3c.github.io/webauthn/#dom-publickeycredential-tojson\n */\nexport function toJSON(cred: PublicKeyCredential): PublicKeyCredentialJSON {\n // Prefer native implementation if available\n if (typeof cred.toJSON === 'function') {\n return cred.toJSON();\n }\n\n try {\n const id = cred.id;\n const rawId = Base64URL.encode(cred.rawId);\n const authenticatorAttachment = cred.authenticatorAttachment;\n const clientExtensionResults = {};\n const type = cred.type;\n\n // This is authentication.\n if (isAuthenticatorAssertionResponse(cred.response)) {\n return {\n id,\n rawId,\n response: {\n authenticatorData: Base64URL.encode(cred.response.authenticatorData),\n clientDataJSON: Base64URL.encode(cred.response.clientDataJSON),\n signature: Base64URL.encode(cred.response.signature),\n userHandle: cred.response.userHandle ? Base64URL.encode(cred.response.userHandle) : undefined,\n },\n authenticatorAttachment,\n clientExtensionResults,\n type,\n };\n }\n\n if (isAuthenticatorAttestationResponse(cred.response)) {\n // This is registration.\n return {\n id,\n rawId,\n response: {\n clientDataJSON: Base64URL.encode(cred.response.clientDataJSON),\n attestationObject: Base64URL.encode(cred.response.attestationObject),\n transports: cred.response?.getTransports() || [],\n },\n authenticatorAttachment,\n clientExtensionResults,\n type,\n };\n }\n\n throw new Error('Unexpected object.');\n } catch (error) {\n console.error(error);\n throw error;\n }\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,GAAA,GAAAC,EAAAD,GAAA,sBAAAE,IAAA,eAAAC,EAAAH,IAAA,IAAAI,EAA0B,+BCAnB,IAAKC,GAAAA,IACVA,EAAA,cAAgB,kBAChBA,EAAA,cAAgB,kBAChBA,EAAA,eAAiB,sBACjBA,EAAA,kBAAoB,qBACpBA,EAAA,gBAAkB,mBAClBA,EAAA,wBAA0B,4BAC1BA,EAAA,uBAAyB,0BAPfA,IAAAA,GAAA,CAAA,CAAA,EAUAC,GAAAA,IACVA,EAAA,eAAiB,mBACjBA,EAAA,gBAAkB,mBAClBA,EAAA,iCAAmC,sCACnCA,EAAA,kBAAoB,qBACpBA,EAAA,oBAAsB,eALZA,IAAAA,GAAA,CAAA,CAAA,EAQAC,GAAAA,IAEVA,EAAAA,EAAA,WAAa,MAAA,EAAb,aACAA,EAAAA,EAAA,eAAiB,MAAA,EAAjB,iBACAA,EAAAA,EAAA,eAAiB,MAAA,EAAjB,iBACAA,EAAAA,EAAA,cAAgB,MAAA,EAAhB,gBACAA,EAAAA,EAAA,cAAgB,MAAA,EAAhB,gBAGAA,EAAAA,EAAA,4BAA8B,IAAA,EAA9B,8BACAA,EAAAA,EAAA,iBAAmB,MAAA,EAAnB,mBACAA,EAAAA,EAAA,qBAAuB,MAAA,EAAvB,uBACAA,EAAAA,EAAA,oBAAsB,MAAA,EAAtB,sBACAA,EA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3C,CACF",
|
|
6
|
+
"names": ["index_exports", "__export", "PasskeyExtension", "__toCommonJS", "import_provider", "SDKErrorCode", "SDKWarningCode", "RPCErrorCode", "LocalStorageKeys", "ThirdPartyWalletEvents", "MagicPayloadMethod", "MagicIncomingWindowMessage", "MagicOutgoingWindowMessage", "DeepLinkPage", "LoginWithMagicLinkEventEmit", "LoginWithMagicLinkEventOnReceived", "LoginWithEmailOTPEventEmit", "LoginWithSmsOTPEventEmit", "LoginWithSmsOTPEventOnReceived", "LoginWithEmailOTPEventOnReceived", "DeviceVerificationEventEmit", "DeviceVerificationEventOnReceived", "RecencyCheckEventEmit", "RecencyCheckEventOnReceived", "UpdateEmailEventEmit", "UpdateEmailEventOnReceived", "AuthEventOnReceived", "FarcasterLoginEventEmit", "EnableMFAEventOnReceived", "EnableMFAEventEmit", "DisableMFAEventOnReceived", "DisableMFAEventEmit", "EthChainType", "UserEventsEmit", "UserEventsOnReceived", "RecoveryFactorEventOnReceived", "RecoveryFactorEventEmit", "RecoveryMethodType", "RecoverAccountEventOnReceived", "RecoverAccountEventEmit", "NftCheckoutIntermediaryEvents", "WalletEventOnReceived", "UiEventsEmit", "OAuthMFAEventEmit", "OAuthMFAEventOnReceived", "OAuthPopupEventOnReceived", "OAuthPopupEventEmit", "PasskeyMFAEventEmit", "PasskeyMFAEventOnReceived", "Base64URL", "buffer", "base64url", "base64", "binStr", "bin", "i", "isAuthenticatorAssertionResponse", "value", "isAuthenticatorAttestationResponse", "toJSON", "cred", "id", "rawId", "Base64URL", "authenticatorAttachment", "clientExtensionResults", "type", "error", "PasskeyExtension", "message", "configuration", "username", "nickname", "skipDIDToken", "lifespan", "registrationOptions", "registrationToken", "credential", "err", "toJSON", "showMfaModal", "verifyPayloadId", "promiEvent", "resolve", "reject", "authenticationToken", "authenticationOptions", "assertion", "requestPayload", "loginRequest", "ie", "result", "error", "te", "mfa", "recoveryCode"]
|
|
7
|
+
}
|
package/dist/es/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Extension as _e}from"@magic-sdk/provider";var f=(e=>(e.MissingApiKey="MISSING_API_KEY",e.ModalNotReady="MODAL_NOT_READY",e.ConnectionLost="CONNECTION_WAS_LOST",e.MalformedResponse="MALFORMED_RESPONSE",e.InvalidArgument="INVALID_ARGUMENT",e.ExtensionNotInitialized="EXTENSION_NOT_INITIALIZED",e.IncompatibleExtensions="INCOMPATIBLE_EXTENSIONS",e))(f||{}),A=(e=>(e.SyncWeb3Method="SYNC_WEB3_METHOD",e.DuplicateIframe="DUPLICATE_IFRAME",e.ReactNativeEndpointConfiguration="REACT_NATIVE_ENDPOINT_CONFIGURATION",e.DeprecationNotice="DEPRECATION_NOTICE",e.ProductAnnouncement="ANNOUNCEMENT",e))(A||{}),I=(e=>(e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.MagicLinkFailedVerification=-1e4]="MagicLinkFailedVerification",e[e.MagicLinkExpired=-10001]="MagicLinkExpired",e[e.MagicLinkRateLimited=-10002]="MagicLinkRateLimited",e[e.UserAlreadyLoggedIn=-10003]="UserAlreadyLoggedIn",e[e.UpdateEmailFailed=-10004]="UpdateEmailFailed",e[e.UserRequestEditEmail=-10005]="UserRequestEditEmail",e[e.MagicLinkInvalidRedirectURL=-10006]="MagicLinkInvalidRedirectURL",e[e.InactiveRecipient=-10010]="InactiveRecipient",e[e.AccessDeniedToUser=-10011]="AccessDeniedToUser",e[e.UserRejectedAction=-10012]="UserRejectedAction",e[e.RequestCancelled=-10014]="RequestCancelled",e[e.RedirectLoginComplete=-10015]="RedirectLoginComplete",e[e.SessionTerminated=-10016]="SessionTerminated",e[e.PopupRequestOverriden=-10017]="PopupRequestOverriden",e[e.SanEmail=-10018]="SanEmail",e[e.DpopInvalidated=-10019]="DpopInvalidated",e[e.MaxAttemptsReached=-10031]="MaxAttemptsReached",e[e.UserRequiredMfa=-10033]="UserRequiredMfa",e))(I||{}),C=(e=>(e.PROVIDER="magic_3pw_provider",e.ADDRESS="magic_3pw_address",e.CHAIN_ID="magic_3pw_chainId",e))(C||{}),M=(e=>(e.WalletConnected="wallet_connected",e.WalletRejected="wallet_rejected",e.Web3ModalSelected="web3modal_selected",e))(M||{}),O=(e=>(e.LoginWithSms="magic_auth_login_with_sms",e.LoginWithEmailOTP="magic_auth_login_with_email_otp",e.LoginWithMagicLink="magic_auth_login_with_magic_link",e.LoginWithCredential="magic_auth_login_with_credential",e.SetAuthorizationToken="magic_auth_set_authorization_token",e.GetIdToken="magic_auth_get_id_token",e.GenerateIdToken="magic_auth_generate_id_token",e.GetMetadata="magic_auth_get_metadata",e.IsLoggedIn="magic_is_logged_in",e.Logout="magic_auth_logout",e.UpdateEmail="magic_auth_update_email",e.UserSettings="magic_auth_settings",e.UserSettingsTestMode="magic_auth_settings_testing_mode",e.LoginWithSmsTestMode="magic_auth_login_with_sms_testing_mode",e.LoginWithEmailOTPTestMode="magic_auth_login_with_email_otp_testing_mode",e.LoginWithMagicLinkTestMode="magic_login_with_magic_link_testing_mode",e.LoginWithCredentialTestMode="magic_auth_login_with_credential_testing_mode",e.GetIdTokenTestMode="magic_auth_get_id_token_testing_mode",e.GenerateIdTokenTestMode="magic_auth_generate_id_token_testing_mode",e.GetMetadataTestMode="magic_auth_get_metadata_testing_mode",e.IsLoggedInTestMode="magic_auth_is_logged_in_testing_mode",e.LogoutTestMode="magic_auth_logout_testing_mode",e.UpdateEmailTestMode="magic_auth_update_email_testing_mode",e.IntermediaryEvent="magic_intermediary_event",e.RequestAccounts="eth_requestAccounts",e.GetInfo="magic_get_info",e.ShowUI="magic_wallet",e.NFTPurchase="magic_nft_purchase",e.NFTCheckout="magic_nft_checkout",e.NFTTransfer="magic_nft_transfer",e.RequestUserInfoWithUI="mc_request_user_info",e.Disconnect="mc_disconnect",e.RecoverAccount="magic_auth_recover_account",e.RecoverAccountTestMode="magic_auth_recover_account_testing_mode",e.MagicBoxHeartBeat="magic_box_heart_beat",e.AutoConnect="mc_auto_connect",e.Login="mc_login",e.EncryptV1="magic_auth_encrypt_v1",e.DecryptV1="magic_auth_decrypt_v1",e.ShowNFTs="magic_show_nfts",e.ShowOnRamp="magic_show_fiat_onramp",e.ShowSendTokensUI="magic_show_send_tokens_ui",e.ShowAddress="magic_show_address",e.ShowBalances="magic_show_balances",e.RevealPK="magic_reveal_key",e.EnableMFA="magic_auth_enable_mfa_flow",e.DisableMFA="magic_auth_disable_mfa_flow",e.GetMultichainPublicAddress="magic_get_multichain_public_address",e.Sign7702Authorization="magic_wallet_sign_7702_authorization",e.Send7702Transaction="eth_send7702Transaction",e))(O||{});var S=(e=>(e.MAGIC_HANDLE_RESPONSE="MAGIC_HANDLE_RESPONSE",e.MAGIC_OVERLAY_READY="MAGIC_OVERLAY_READY",e.MAGIC_SHOW_OVERLAY="MAGIC_SHOW_OVERLAY",e.MAGIC_HIDE_OVERLAY="MAGIC_HIDE_OVERLAY",e.MAGIC_HANDLE_EVENT="MAGIC_HANDLE_EVENT",e.MAGIC_MG_BOX_SEND_RECEIPT="MAGIC_MG_BOX_SEND_RECEIPT",e.MAGIC_SEND_PRODUCT_ANNOUNCEMENT="MAGIC_SEND_PRODUCT_ANNOUNCEMENT",e.MAGIC_PONG="MAGIC_PONG",e.MAGIC_POPUP_RESPONSE="MAGIC_POPUP_RESPONSE",e.MAGIC_POPUP_OAUTH_VERIFY_RESPONSE="MAGIC_POPUP_OAUTH_VERIFY_RESPONSE",e.MAGIC_THIRD_PARTY_WALLET_REQUEST="MAGIC_THIRD_PARTY_WALLET_REQUEST",e.MAGIC_OPEN_MOBILE_URL="MAGIC_OPEN_MOBILE_URL",e))(S||{}),P=(e=>(e.MAGIC_HANDLE_REQUEST="MAGIC_HANDLE_REQUEST",e.MAGIC_THIRD_PARTY_WALLET_RESPONSE="MAGIC_THIRD_PARTY_WALLET_RESPONSE",e.MAGIC_THIRD_PARTY_WALLET_UPDATE="MAGIC_THIRD_PARTY_WALLET_EVENT",e.MAGIC_PING="MAGIC_PING",e))(P||{}),T=(e=>(e.UpdateEmail="update-email",e.MFA="mfa",e.Recovery="recovery",e))(T||{}),N=(e=>(e.Retry="retry",e))(N||{}),L=(e=>(e.EmailSent="email-sent",e.EmailNotDeliverable="email-not-deliverable",e))(L||{}),k=(e=>(e.VerifyEmailOtp="verify-email-otp",e.VerifyMFACode="verify-mfa-code",e.LostDevice="lost-device",e.VerifyRecoveryCode="verify-recovery-code",e.Cancel="cancel",e))(k||{}),D=(e=>(e.VerifySmsOtp="verify-sms-otp",e.VerifyMFACode="verify-mfa-code",e.LostDevice="lost-device",e.VerifyRecoveryCode="verify-recovery-code",e.Cancel="cancel",e.Retry="retry",e))(D||{}),w=(e=>(e.SmsOTPSent="sms-otp-sent",e.InvalidSmsOtp="invalid-sms-otp",e.ExpiredSmsOtp="expired-sms-otp",e.MfaSentHandle="mfa-sent-handle",e.InvalidMfaOtp="invalid-mfa-otp",e.LoginThrottled="login-throttled",e.RecoveryCodeSentHandle="recovery-code-sent-handle",e.InvalidRecoveryCode="invalid-recovery-code",e.RecoveryCodeSuccess="recovery-code-success",e))(w||{}),U=(e=>(e.EmailOTPSent="email-otp-sent",e.InvalidEmailOtp="invalid-email-otp",e.InvalidMfaOtp="invalid-mfa-otp",e.ExpiredEmailOtp="expired-email-otp",e.MfaSentHandle="mfa-sent-handle",e.RecoveryCodeSentHandle="recovery-code-sent-handle",e.InvalidRecoveryCode="invalid-recovery-code",e.RecoveryCodeSuccess="recovery-code-success",e.LoginThrottled="login-throttled",e.MaxAttemptsReached="max-attempts-reached",e))(U||{}),b=(e=>(e.Retry="device-retry",e))(b||{}),F=(e=>(e.DeviceApproved="device-approved",e.DeviceNeedsApproval="device-needs-approval",e.DeviceVerificationLinkExpired="device-verification-link-expired",e.DeviceVerificationEmailSent="device-verification-email-sent",e))(F||{}),G=(e=>(e.Retry="Recency/auth-factor-retry",e.Cancel="Recency/auth-factor-verification-cancel",e.VerifyEmailOtp="Recency/auth-factor-verify-email-otp",e.VerifyMFACode="Recency/verify-mfa-code",e))(G||{}),V=(e=>(e.PrimaryAuthFactorNeedsVerification="Recency/auth-factor-needs-verification",e.PrimaryAuthFactorVerified="Recency/auth-factor-verified",e.InvalidEmailOtp="Recency/auth-factor-invalid-email-otp",e.EmailExpired="Recency/auth-factor-verification-email-expired",e.EmailSent="Recency/auth-factor-verification-email-sent",e.EmailNotDeliverable="Recency/auth-factor-verification-email-not-deliverable",e))(V||{}),W=(e=>(e.RetryWithNewEmail="UpdateEmail/retry-with-new-email",e.Cancel="UpdateEmail/new-email-verification-cancel",e.VerifyEmailOtp="UpdateEmail/new-email-verify-otp",e))(W||{}),H=(e=>(e.NewAuthFactorNeedsVerification="UpdateEmail/new-email-needs-verification",e.EmailUpdated="UpdateEmail/email-updated",e.InvalidEmailOtp="UpdateEmail/new-email-invalid-email-otp",e.EmailExpired="UpdateEmail/new-email-verification-email-expired",e.EmailSent="UpdateEmail/new-email-verification-email-sent",e.EmailNotDeliverable="UpdateEmail/new-email-verification-email-not-deliverable",e.InvalidEmail="UpdateEmail/new-email-invalid",e.EmailAlreadyExists="UpdateEmail/new-email-already-exists",e))(H||{}),x=(e=>(e.IDTokenCreated="Auth/id-token-created",e))(x||{}),q=(e=>(e.Cancel="Farcaster/cancel",e))(q||{}),Y=(e=>(e.MFASecretGenerated="mfa-secret-generated",e.InvalidMFAOtp="invalid-mfa-otp",e.MFARecoveryCodes="mfa-recovery-codes",e))(Y||{}),J=(e=>(e.VerifyMFACode="verify-mfa-code",e.Cancel="cancel-mfa-setup",e))(J||{}),B=(e=>(e.MFACodeRequested="mfa-code-requested",e.InvalidMFAOtp="invalid-mfa-otp",e.InvalidRecoveryCode="invalid-recovery-code",e))(B||{}),K=(e=>(e.VerifyMFACode="verify-mfa-code",e.LostDevice="lost-device",e.Cancel="cancel-mfa-disable",e))(K||{}),j=(e=>(e.Harmony="HARMONY",e))(j||{}),z=(e=>(e.ClosedByUser="closed-by-user",e))(z||{}),Q=(e=>(e.ClosedByUser="closed-by-user-on-received",e))(Q||{}),X=(e=>(e.EnterNewPhoneNumber="enter-new-phone-number",e.EnterOtpCode="enter-otp-code",e.RecoveryFactorAlreadyExists="recovery-factor-already-exists",e.MalformedPhoneNumber="malformed-phone-number",e.InvalidOtpCode="invalid-otp-code",e.RecoveryFactorUpdated="recovery-factor-updated",e.RecoveryFactorDeleted="recovery-factor-deleted",e))(X||{}),Z=(e=>(e.SendNewPhoneNumber="send-new-phone-number",e.SendOtpCode="send-otp-code",e.Cancel="cancel",e.StartEditPhoneNumber="start-edit-phone-number",e))(Z||{}),$=(e=>(e.PhoneNumber="phone_number",e))($||{}),ee=(e=>(e.SmsOtpSent="sms-otp-sent",e.LoginThrottled="login-throttled",e.InvalidSmsOtp="invalid-sms-otp",e.SmsVerified="sms-verified",e.AccountRecovered="account-recovered",e.UpdateEmailRequired="update-email-required",e))(ee||{}),te=(e=>(e.Cancel="cancel",e.VerifyOtp="verify-otp-code",e.ResendSms="resend-sms-otp",e.UpdateEmail="update-email",e))(te||{}),ae=(e=>(e.Success="nft-checkout-success",e.Failure="nft-checkout-failure",e.Initiated="nft-checkout-initiated",e.Disconnect="disconnect",e))(ae||{}),ie=(e=>(e.WalletInfoFetched="Wallet/wallet-info-fetched",e))(ie||{}),ne=(e=>(e.CloseMagicWindow="close-magic-window",e))(ne||{}),oe=(e=>(e.Cancel="cancel",e.VerifyMFACode="verify-mfa-code",e.LostDevice="lost-device",e.VerifyRecoveryCode="verify-recovery-code",e))(oe||{}),re=(e=>(e.MfaSentHandle="mfa-sent-handle",e.InvalidMfaOtp="invalid-mfa-otp",e.RecoveryCodeSentHandle="recovery-code-sent-handle",e.InvalidRecoveryCode="invalid-recovery-code",e.RecoveryCodeSuccess="recovery-code-success",e))(re||{}),se=(e=>(e.PopupUrl="popup-url",e))(se||{}),ce=(e=>(e.PopupEvent="popup-event",e))(ce||{}),r=(e=>(e.Cancel="cancel",e.VerifyMFACode="verify-mfa-code",e.LostDevice="lost-device",e.VerifyRecoveryCode="verify-recovery-code",e))(r||{}),n=(e=>(e.MfaSentHandle="mfa-sent-handle",e.InvalidMfaOtp="invalid-mfa-otp",e.RecoveryCodeSentHandle="recovery-code-sent-handle",e.InvalidRecoveryCode="invalid-recovery-code",e.RecoveryCodeSuccess="recovery-code-success",e))(n||{});var s=class{static encode(t){return globalThis.btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}static decode(t){let c=t.replace(/-/g,"+").replace(/_/g,"/"),i=globalThis.atob(c),d=new Uint8Array(i.length);for(let o=0;o<i.length;o++)d[o]=i.charCodeAt(o);return d.buffer}};function de(e){return!(typeof e!="object"||e?.authenticatorData===void 0||typeof e?.authenticatorData!="object")}function le(e){return!(typeof e!="object"||e?.attestationObject===void 0||typeof e?.attestationObject!="object")}function E(e){if(typeof e.toJSON=="function")return e.toJSON();try{let t=e.id,c=s.encode(e.rawId),i=e.authenticatorAttachment,d={},o=e.type;if(de(e.response))return{id:t,rawId:c,response:{authenticatorData:s.encode(e.response.authenticatorData),clientDataJSON:s.encode(e.response.clientDataJSON),signature:s.encode(e.response.signature),userHandle:e.response.userHandle?s.encode(e.response.userHandle):void 0},authenticatorAttachment:i,clientExtensionResults:d,type:o};if(le(e.response))return{id:t,rawId:c,response:{clientDataJSON:s.encode(e.response.clientDataJSON),attestationObject:s.encode(e.response.attestationObject),transports:e.response?.getTransports()||[]},authenticatorAttachment:i,clientExtensionResults:d,type:o};throw new Error("Unexpected object.")}catch(t){throw console.error(t),t}}var y=class extends _e.Internal{name="passkey";config={};createPasskeyNotSupportError(){this.createError("PASSKEY_NOT_SUPPORTED","Passkey is not supported in this device.",{})}createPasskeyCreateCredentialError(t){this.createError("PASSKEY_REGISTRATION_ERROR",`Error creating credential: ${t}`,{})}async registerNewUser(t){if(!window.PublicKeyCredential)throw this.createPasskeyNotSupportError();let{username:c,nickname:i="",skipDIDToken:d,lifespan:o}=t??{},{registrationOptions:_,registrationToken:a}=await this.request(this.utils.createJsonRpcRequestPayload("magic_auth_register_passkey_start",[{username:c}])),l;try{l=await navigator.credentials.create({publicKey:_})}catch(v){throw this.createPasskeyCreateCredentialError(v)}return this.request(this.utils.createJsonRpcRequestPayload("magic_auth_register_passkey_verify",[{registrationToken:a,registrationResponse:E(l),nickname:i,transport:l.response.getTransports(),userAgent:navigator.userAgent,skipDIDToken:d,lifespan:o}]))}login(t){let{username:c,showMfaModal:i,skipDIDToken:d,lifespan:o}=t??{},_,a=this.utils.createPromiEvent(async(l,v)=>{if(!window.PublicKeyCredential)return v(this.createPasskeyNotSupportError());let{authenticationToken:h,authenticationOptions:R}=await this.request(this.utils.createJsonRpcRequestPayload("magic_auth_login_with_passkey_start",[{username:c}])),p;try{p=await navigator.credentials.get({publicKey:R})}catch(u){return v(this.createPasskeyCreateCredentialError(u))}let g=this.utils.createJsonRpcRequestPayload("magic_auth_login_with_passkey_verify",[{authenticationToken:h,assertionResponse:E(p),showUI:i,skipDIDToken:d,lifespan:o}]);_=g.id;let m=this.request(g);i||(m.on(n.MfaSentHandle,()=>{a.emit(n.MfaSentHandle)}),m.on(n.InvalidMfaOtp,()=>{a.emit(n.InvalidMfaOtp)}),m.on(n.RecoveryCodeSentHandle,()=>{a.emit(n.RecoveryCodeSentHandle)}),m.on(n.InvalidRecoveryCode,()=>{a.emit(n.InvalidRecoveryCode)}),m.on(n.RecoveryCodeSuccess,()=>{a.emit(n.RecoveryCodeSuccess)}));try{let u=await m;l(u)}catch(u){v(u)}});return!i&&a&&(a.on(r.VerifyMFACode,l=>{this.createIntermediaryEvent(r.VerifyMFACode,_)(l)}),a.on(r.LostDevice,()=>{this.createIntermediaryEvent(r.LostDevice,_)()}),a.on(r.VerifyRecoveryCode,l=>{this.createIntermediaryEvent(r.VerifyRecoveryCode,_)(l)}),a.on(r.Cancel,()=>{this.createIntermediaryEvent(r.Cancel,_)()})),a}getMetadata(){let t=this.utils.createJsonRpcRequestPayload("magic_user_get_webauthn_credentials",[]);return this.request(t)}};export{y as PasskeyExtension};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/index.ts", "../../../../@magic-sdk/types/src/core/exception-types.ts", "../../../../@magic-sdk/types/src/core/json-rpc-types.ts", "../../../../@magic-sdk/types/src/core/message-types.ts", "../../../../@magic-sdk/types/src/core/deep-link-pages.ts", "../../../../@magic-sdk/types/src/modules/auth-types.ts", "../../../../@magic-sdk/types/src/modules/rpc-provider-types.ts", "../../../../@magic-sdk/types/src/modules/user-types.ts", "../../../../@magic-sdk/types/src/modules/nft-types.ts", "../../../../@magic-sdk/types/src/modules/wallet-types.ts", "../../../../@magic-sdk/types/src/modules/common-types.ts", "../../../../@magic-sdk/types/src/modules/oauth-types.ts", "../../../../@magic-sdk/types/src/modules/webauthn-types.ts", "../../src/utils/base64.ts", "../../src/utils/polyfills.ts"],
|
|
4
|
+
"sourcesContent": ["import { Extension } from '@magic-sdk/provider';\nimport {\n RegisterNewUserConfiguration,\n MagicPasskeyPayloadMethod,\n PasskeySDKErrorCode,\n LoginWithPasskeyConfiguration,\n} from './types';\nimport { PasskeyResult, PasskeyEventHandlers, PasskeyMFAEventEmit, PasskeyMFAEventOnReceived } from '@magic-sdk/types';\nimport { toJSON } from './utils/polyfills';\n\nexport class PasskeyExtension extends Extension.Internal<'passkey', any> {\n name = 'passkey' as const;\n config: any = {};\n\n private createPasskeyNotSupportError() {\n this.createError(PasskeySDKErrorCode.PasskeyNotSupported, 'Passkey is not supported in this device.', {});\n }\n\n private createPasskeyCreateCredentialError(message: string) {\n this.createError(PasskeySDKErrorCode.PasskeyRegisterError, `Error creating credential: ${message}`, {});\n }\n\n public async registerNewUser(configuration?: RegisterNewUserConfiguration) {\n if (!window.PublicKeyCredential) {\n throw this.createPasskeyNotSupportError();\n }\n const { username, nickname = '', skipDIDToken, lifespan } = configuration ?? {};\n\n const { registrationOptions, registrationToken } = await this.request<any>(\n this.utils.createJsonRpcRequestPayload(MagicPasskeyPayloadMethod.RegisterPasskeyStart, [{ username }]),\n );\n\n let credential;\n try {\n credential = (await navigator.credentials.create({\n publicKey: registrationOptions,\n })) as any;\n } catch (err: any) {\n throw this.createPasskeyCreateCredentialError(err);\n }\n\n return this.request<string | null>(\n this.utils.createJsonRpcRequestPayload(MagicPasskeyPayloadMethod.RegisterPasskeyVerify, [\n {\n registrationToken,\n registrationResponse: toJSON(credential),\n nickname,\n transport: credential.response.getTransports(),\n userAgent: navigator.userAgent,\n skipDIDToken,\n lifespan,\n },\n ]),\n );\n }\n\n public login(configuration?: LoginWithPasskeyConfiguration) {\n const { username, showMfaModal, skipDIDToken, lifespan } = configuration ?? {};\n\n let verifyPayloadId: string;\n\n const promiEvent = this.utils.createPromiEvent<PasskeyResult, PasskeyEventHandlers>(async (resolve, reject) => {\n if (!window.PublicKeyCredential) {\n return reject(this.createPasskeyNotSupportError());\n }\n\n const { authenticationToken, authenticationOptions } = await this.request<any>(\n this.utils.createJsonRpcRequestPayload(MagicPasskeyPayloadMethod.LoginWithPasskeyStart, [{ username }]),\n );\n\n let assertion;\n try {\n assertion = (await navigator.credentials.get({\n publicKey: authenticationOptions,\n })) as any;\n } catch (err: any) {\n return reject(this.createPasskeyCreateCredentialError(err));\n }\n\n const requestPayload = this.utils.createJsonRpcRequestPayload(MagicPasskeyPayloadMethod.LoginWithPasskeyVerify, [\n {\n authenticationToken,\n assertionResponse: toJSON(assertion),\n showUI: showMfaModal,\n skipDIDToken,\n lifespan,\n },\n ]);\n\n verifyPayloadId = requestPayload.id as string;\n\n const loginRequest = this.request<PasskeyResult, PasskeyEventHandlers>(requestPayload);\n\n if (!showMfaModal) {\n loginRequest.on(PasskeyMFAEventOnReceived.MfaSentHandle, () => {\n promiEvent.emit(PasskeyMFAEventOnReceived.MfaSentHandle);\n });\n loginRequest.on(PasskeyMFAEventOnReceived.InvalidMfaOtp, () => {\n promiEvent.emit(PasskeyMFAEventOnReceived.InvalidMfaOtp);\n });\n loginRequest.on(PasskeyMFAEventOnReceived.RecoveryCodeSentHandle, () => {\n promiEvent.emit(PasskeyMFAEventOnReceived.RecoveryCodeSentHandle);\n });\n loginRequest.on(PasskeyMFAEventOnReceived.InvalidRecoveryCode, () => {\n promiEvent.emit(PasskeyMFAEventOnReceived.InvalidRecoveryCode);\n });\n loginRequest.on(PasskeyMFAEventOnReceived.RecoveryCodeSuccess, () => {\n promiEvent.emit(PasskeyMFAEventOnReceived.RecoveryCodeSuccess);\n });\n }\n\n try {\n const result = await loginRequest;\n resolve(result);\n } catch (error) {\n reject(error);\n }\n });\n\n if (!showMfaModal && promiEvent) {\n promiEvent.on(PasskeyMFAEventEmit.VerifyMFACode, (mfa: string) => {\n this.createIntermediaryEvent(PasskeyMFAEventEmit.VerifyMFACode, verifyPayloadId)(mfa);\n });\n promiEvent.on(PasskeyMFAEventEmit.LostDevice, () => {\n this.createIntermediaryEvent(PasskeyMFAEventEmit.LostDevice, verifyPayloadId)();\n });\n promiEvent.on(PasskeyMFAEventEmit.VerifyRecoveryCode, (recoveryCode: string) => {\n this.createIntermediaryEvent(PasskeyMFAEventEmit.VerifyRecoveryCode, verifyPayloadId)(recoveryCode);\n });\n promiEvent.on(PasskeyMFAEventEmit.Cancel, () => {\n this.createIntermediaryEvent(PasskeyMFAEventEmit.Cancel, verifyPayloadId)();\n });\n }\n\n return promiEvent;\n }\n\n public getMetadata() {\n const requestPayload = this.utils.createJsonRpcRequestPayload(MagicPasskeyPayloadMethod.GetPasskeyInfo, []);\n return this.request<any[]>(requestPayload);\n }\n}\n", "export enum SDKErrorCode {\n MissingApiKey = 'MISSING_API_KEY',\n ModalNotReady = 'MODAL_NOT_READY',\n ConnectionLost = 'CONNECTION_WAS_LOST',\n MalformedResponse = 'MALFORMED_RESPONSE',\n InvalidArgument = 'INVALID_ARGUMENT',\n ExtensionNotInitialized = 'EXTENSION_NOT_INITIALIZED',\n IncompatibleExtensions = 'INCOMPATIBLE_EXTENSIONS',\n}\n\nexport enum SDKWarningCode {\n SyncWeb3Method = 'SYNC_WEB3_METHOD',\n DuplicateIframe = 'DUPLICATE_IFRAME',\n ReactNativeEndpointConfiguration = 'REACT_NATIVE_ENDPOINT_CONFIGURATION',\n DeprecationNotice = 'DEPRECATION_NOTICE',\n ProductAnnouncement = 'ANNOUNCEMENT',\n}\n\nexport enum RPCErrorCode {\n // Standard JSON RPC 2.0 Error Codes\n ParseError = -32700,\n InvalidRequest = -32600,\n MethodNotFound = -32601,\n InvalidParams = -32602,\n InternalError = -32603,\n\n // Custom RPC Error Codes\n MagicLinkFailedVerification = -10000,\n MagicLinkExpired = -10001,\n MagicLinkRateLimited = -10002,\n UserAlreadyLoggedIn = -10003,\n UpdateEmailFailed = -10004,\n UserRequestEditEmail = -10005,\n MagicLinkInvalidRedirectURL = -10006,\n InactiveRecipient = -10010,\n AccessDeniedToUser = -10011,\n UserRejectedAction = -10012,\n RequestCancelled = -10014,\n RedirectLoginComplete = -10015,\n SessionTerminated = -10016,\n PopupRequestOverriden = -10017,\n SanEmail = -10018,\n DpopInvalidated = -10019,\n MaxAttemptsReached = -10031,\n UserRequiredMfa = -10033,\n}\n\nexport type ErrorCode = SDKErrorCode | RPCErrorCode;\nexport type WarningCode = SDKWarningCode;\n", "import { RPCErrorCode } from './exception-types';\n\n// --- Request interfaces\n\nexport interface JsonRpcRequestPayload<TParams = any> {\n jsonrpc: string;\n id: string | number | null;\n method: string;\n params?: TParams;\n}\n\nexport interface JsonRpcRequestCallback {\n /** Callback executed upon JSON RPC response. */\n (err: JsonRpcError | null, result?: JsonRpcResponsePayload | null): void;\n}\n\nexport interface JsonRpcBatchRequestCallback {\n /** Callback executed upon JSON RPC response. */\n (err: JsonRpcError | null, result?: (JsonRpcResponsePayload | null)[] | null): void;\n}\n\n// --- Response interfaces\n\nexport interface JsonRpcError {\n message: string;\n code: RPCErrorCode;\n data?: any;\n}\n\nexport interface JsonRpcResponsePayload<ResultType = any> {\n jsonrpc: string;\n id: string | number | null;\n result?: ResultType | null;\n error?: JsonRpcError | null;\n}\n\nexport interface UserInfo {\n email?: string;\n}\n\nexport type ShowUIPromiEvents = {\n disconnect: () => void;\n};\n\nexport interface RequestUserInfoScope {\n scope?: {\n email?: 'required' | 'optional';\n };\n}\n\nexport enum LocalStorageKeys {\n PROVIDER = 'magic_3pw_provider',\n ADDRESS = 'magic_3pw_address',\n CHAIN_ID = 'magic_3pw_chainId',\n}\n\nexport enum ThirdPartyWalletEvents {\n WalletConnected = 'wallet_connected',\n WalletRejected = 'wallet_rejected',\n Web3ModalSelected = 'web3modal_selected',\n}\n\nexport interface ConnectWithUIOptions {\n autoPromptThirdPartyWallets?: boolean;\n}\n\nexport type ConnectWithUiEvents = {\n 'id-token-created': (params: { idToken: string }) => void;\n} & { [key in ThirdPartyWalletEvents]: () => void };\n\n// --- Payload methods\n\n/**\n * Enum of JSON RPC methods for interacting with the Magic SDK authentication\n * relayer.\n */\nexport enum MagicPayloadMethod {\n LoginWithSms = 'magic_auth_login_with_sms',\n LoginWithEmailOTP = 'magic_auth_login_with_email_otp',\n LoginWithMagicLink = 'magic_auth_login_with_magic_link',\n LoginWithCredential = 'magic_auth_login_with_credential',\n SetAuthorizationToken = 'magic_auth_set_authorization_token',\n GetIdToken = 'magic_auth_get_id_token',\n GenerateIdToken = 'magic_auth_generate_id_token',\n GetMetadata = 'magic_auth_get_metadata',\n IsLoggedIn = 'magic_is_logged_in',\n Logout = 'magic_auth_logout',\n UpdateEmail = 'magic_auth_update_email',\n UserSettings = 'magic_auth_settings',\n UserSettingsTestMode = 'magic_auth_settings_testing_mode',\n LoginWithSmsTestMode = 'magic_auth_login_with_sms_testing_mode',\n LoginWithEmailOTPTestMode = 'magic_auth_login_with_email_otp_testing_mode',\n LoginWithMagicLinkTestMode = 'magic_login_with_magic_link_testing_mode',\n LoginWithCredentialTestMode = 'magic_auth_login_with_credential_testing_mode',\n GetIdTokenTestMode = 'magic_auth_get_id_token_testing_mode',\n GenerateIdTokenTestMode = 'magic_auth_generate_id_token_testing_mode',\n GetMetadataTestMode = 'magic_auth_get_metadata_testing_mode',\n IsLoggedInTestMode = 'magic_auth_is_logged_in_testing_mode',\n LogoutTestMode = 'magic_auth_logout_testing_mode',\n UpdateEmailTestMode = 'magic_auth_update_email_testing_mode',\n IntermediaryEvent = 'magic_intermediary_event',\n RequestAccounts = 'eth_requestAccounts',\n GetInfo = 'magic_get_info',\n ShowUI = 'magic_wallet',\n NFTPurchase = 'magic_nft_purchase',\n NFTCheckout = 'magic_nft_checkout',\n NFTTransfer = 'magic_nft_transfer',\n RequestUserInfoWithUI = 'mc_request_user_info',\n Disconnect = 'mc_disconnect',\n // UpdatePhoneNumber = 'magic_auth_update_phone_number',\n // UpdatePhoneNumberTestMode = 'magic_auth_update_phone_number_testing_mode',\n RecoverAccount = 'magic_auth_recover_account',\n RecoverAccountTestMode = 'magic_auth_recover_account_testing_mode',\n MagicBoxHeartBeat = 'magic_box_heart_beat',\n AutoConnect = 'mc_auto_connect',\n Login = 'mc_login',\n EncryptV1 = 'magic_auth_encrypt_v1',\n DecryptV1 = 'magic_auth_decrypt_v1',\n ShowNFTs = 'magic_show_nfts',\n ShowOnRamp = 'magic_show_fiat_onramp',\n ShowSendTokensUI = 'magic_show_send_tokens_ui',\n ShowAddress = 'magic_show_address',\n ShowBalances = 'magic_show_balances',\n RevealPK = 'magic_reveal_key',\n EnableMFA = 'magic_auth_enable_mfa_flow',\n DisableMFA = 'magic_auth_disable_mfa_flow',\n GetMultichainPublicAddress = 'magic_get_multichain_public_address',\n Sign7702Authorization = 'magic_wallet_sign_7702_authorization',\n Send7702Transaction = 'eth_send7702Transaction',\n}\n\n// Methods to not route if connected to third party wallet\nexport const routeToMagicMethods = [\n MagicPayloadMethod.IntermediaryEvent,\n MagicPayloadMethod.NFTCheckout,\n MagicPayloadMethod.Login,\n];\n", "import { JsonRpcResponsePayload, JsonRpcError, JsonRpcRequestPayload } from './json-rpc-types';\n\nexport enum MagicIncomingWindowMessage {\n MAGIC_HANDLE_RESPONSE = 'MAGIC_HANDLE_RESPONSE',\n MAGIC_OVERLAY_READY = 'MAGIC_OVERLAY_READY',\n MAGIC_SHOW_OVERLAY = 'MAGIC_SHOW_OVERLAY',\n MAGIC_HIDE_OVERLAY = 'MAGIC_HIDE_OVERLAY',\n MAGIC_HANDLE_EVENT = 'MAGIC_HANDLE_EVENT',\n MAGIC_MG_BOX_SEND_RECEIPT = 'MAGIC_MG_BOX_SEND_RECEIPT',\n MAGIC_SEND_PRODUCT_ANNOUNCEMENT = 'MAGIC_SEND_PRODUCT_ANNOUNCEMENT',\n MAGIC_PONG = 'MAGIC_PONG',\n MAGIC_POPUP_RESPONSE = 'MAGIC_POPUP_RESPONSE',\n MAGIC_POPUP_OAUTH_VERIFY_RESPONSE = 'MAGIC_POPUP_OAUTH_VERIFY_RESPONSE',\n MAGIC_THIRD_PARTY_WALLET_REQUEST = 'MAGIC_THIRD_PARTY_WALLET_REQUEST',\n MAGIC_OPEN_MOBILE_URL = 'MAGIC_OPEN_MOBILE_URL',\n}\n\nexport enum MagicOutgoingWindowMessage {\n MAGIC_HANDLE_REQUEST = 'MAGIC_HANDLE_REQUEST',\n MAGIC_THIRD_PARTY_WALLET_RESPONSE = 'MAGIC_THIRD_PARTY_WALLET_RESPONSE',\n MAGIC_THIRD_PARTY_WALLET_UPDATE = 'MAGIC_THIRD_PARTY_WALLET_EVENT',\n MAGIC_PING = 'MAGIC_PING',\n}\n\n/** The shape of responding window message data from the Magic iframe context. */\nexport interface MagicMessageRequest {\n msgType: string;\n payload: JsonRpcRequestPayload | JsonRpcRequestPayload[];\n rt?: string;\n jwt?: string;\n deviceShare?: string;\n}\n\n/** The shape of responding window message data from the Magic iframe context. */\nexport interface MagicMessageResponse<ResultType = any> {\n msgType: string;\n response: Partial<JsonRpcError> & Partial<JsonRpcResponsePayload<ResultType>>;\n rt?: string;\n deviceShare?: string;\n}\n\n/** The expected message event returned by the Magic iframe context. */\nexport interface MagicMessageEvent extends Partial<MessageEvent> {\n data: MagicMessageResponse;\n}\n\nexport interface MagicThirdPartyWalletRequest {\n msgType: MagicIncomingWindowMessage.MAGIC_THIRD_PARTY_WALLET_REQUEST;\n payload: JsonRpcRequestPayload;\n}\n\nexport interface MagicThirdPartyWalletResponse {\n msgType: `${MagicOutgoingWindowMessage.MAGIC_THIRD_PARTY_WALLET_RESPONSE}-${string}`;\n response: JsonRpcResponsePayload;\n}\n\nexport interface MagicThirdPartyWalletUpdate {\n msgType: `${MagicOutgoingWindowMessage.MAGIC_THIRD_PARTY_WALLET_UPDATE}-${string}`;\n details: {\n address: `0x${string}` | undefined;\n addresses: readonly `0x${string}`[] | undefined;\n chain: { id: number; name: string; [key: string]: unknown } | undefined;\n updatedField: 'chain' | 'address';\n };\n}\n\nexport type MagicThirdPartyWalletEventPayload = MagicThirdPartyWalletResponse | MagicThirdPartyWalletUpdate;\n", "export enum DeepLinkPage {\n UpdateEmail = 'update-email',\n MFA = 'mfa',\n Recovery = 'recovery',\n}\n", "import { WalletEventOnReceived } from './wallet-types';\n\nexport interface LoginWithMagicLinkConfiguration {\n /**\n * The email address of the user attempting to login.\n */\n email: string;\n\n /**\n * When `true`, a pre-built modal interface will show to the user, directing\n * them to check their email for the \"magic link\" to complete their\n * authentication.\n */\n showUI?: boolean;\n\n /**\n * You can optionally provide a redirect URI that will be followed at the end\n * of the magic link flow. Don't forget to invoke\n * `magic.auth.loginWithCredential()` to complete the login from the route you\n * configure here.\n */\n redirectURI?: string;\n\n /**\n * Enterprise users with a custom SMTP can create custom email templates\n * from their dashboard. The default Magic loginWithMagicLink email will be\n * overridden when a variation is passed here.\n */\n overrides?: {\n variation?: string;\n };\n\n /**\n * The number of seconds until the generated Decentralized ID token will expire.\n */\n lifespan?: number;\n}\n\nexport interface LoginWithSmsConfiguration {\n /**\n * Specify the phone number of the user attempting to login.\n */\n phoneNumber: string;\n\n /**\n * When `true`, a pre-built modal interface will show to the user, directing\n * them to check their SMS for the one time passcode (OTP) to complete their\n * authentication.\n *\n * When `false`, developers will be able to implement their own custom UI to\n * continue the SMS OTP flow.\n */\n showUI?: boolean;\n\n /*\n * The number of seconds until the generated Decentralized ID token will expire.\n */\n lifespan?: number;\n}\nexport interface LoginWithEmailOTPConfiguration {\n /**\n * Specify the email address of the user attempting to login.\n */\n email: string;\n\n /**\n * When `true`, a pre-built modal interface will show to the user, directing\n * them to check their email for the one time passcode (OTP) to complete their\n * authentication.\n *\n * When `false`, developers will be able to implement their own custom UI to\n * continue the email OTP flow.\n */\n showUI?: boolean;\n\n /**\n * Device Unrecognized UI will enforce showing up to secure user's login\n *\n * When set to true (default), an improved device recognition UI will be displayed to the user,\n * prompting them to verify their login by checking their email for device approval. This feature\n * enhances authentication security.\n *\n * This param will only be affected if showUI is false. When set to false,\n * developers have the flexibility to implement their own customized UI to\n * handle device check events, providing a more tailored user experience.\n */\n deviceCheckUI?: boolean;\n\n /**\n * Enterprise users with a custom SMTP can create custom email templates\n * from their dashboard. The default Magic loginWithOTP email will be\n * overridden when a variation is passed here.\n */\n overrides?: {\n variation?: string;\n appName?: string;\n assetUrl?: string;\n };\n\n /**\n * The number of seconds until the generated Decentralized ID token will expire.\n */\n lifespan?: number;\n}\n\nexport interface LoginWithCredentialConfiguration {\n /**\n * A credential token or a valid query string (prefixed with ? or #)\n */\n credentialOrQueryString?: string;\n\n /**\n * The number of seconds until the generated Decentralized ID token will expire.\n */\n lifespan?: number;\n}\n\nexport interface EnableMFAConfiguration {\n /**\n * When `true`, a pre-built modal interface will show to the user, directing\n * them to enable MFA using Google Authenticator app.\n *\n * When `false`, developers will be able to implement their own custom UI to\n * continue the enable MFA flow.\n */\n showUI?: boolean;\n}\n\nexport interface DisableMFAConfiguration {\n /**\n * When `true`, a pre-built modal interface will show to the user, directing\n * them to disable MFA.\n *\n * When `false`, developers will be able to implement their own custom UI to\n * continue the disable MFA flow.\n */\n showUI?: boolean;\n}\n\n/**\n * Auth Events Enum\n */\nexport enum LoginWithMagicLinkEventEmit {\n Retry = 'retry',\n}\n\nexport enum LoginWithMagicLinkEventOnReceived {\n EmailSent = 'email-sent',\n EmailNotDeliverable = 'email-not-deliverable',\n}\n\nexport enum LoginWithEmailOTPEventEmit {\n VerifyEmailOtp = 'verify-email-otp',\n VerifyMFACode = 'verify-mfa-code',\n LostDevice = 'lost-device',\n VerifyRecoveryCode = 'verify-recovery-code',\n Cancel = 'cancel',\n}\n\nexport enum LoginWithSmsOTPEventEmit {\n VerifySmsOtp = 'verify-sms-otp',\n VerifyMFACode = 'verify-mfa-code',\n LostDevice = 'lost-device',\n VerifyRecoveryCode = 'verify-recovery-code',\n Cancel = 'cancel',\n Retry = 'retry',\n}\n\nexport enum LoginWithSmsOTPEventOnReceived {\n SmsOTPSent = 'sms-otp-sent',\n InvalidSmsOtp = 'invalid-sms-otp',\n ExpiredSmsOtp = 'expired-sms-otp',\n MfaSentHandle = 'mfa-sent-handle',\n InvalidMfaOtp = 'invalid-mfa-otp',\n LoginThrottled = 'login-throttled',\n RecoveryCodeSentHandle = 'recovery-code-sent-handle',\n InvalidRecoveryCode = 'invalid-recovery-code',\n RecoveryCodeSuccess = 'recovery-code-success',\n}\n\nexport enum LoginWithEmailOTPEventOnReceived {\n EmailOTPSent = 'email-otp-sent',\n InvalidEmailOtp = 'invalid-email-otp',\n InvalidMfaOtp = 'invalid-mfa-otp',\n ExpiredEmailOtp = 'expired-email-otp',\n MfaSentHandle = 'mfa-sent-handle',\n RecoveryCodeSentHandle = 'recovery-code-sent-handle',\n InvalidRecoveryCode = 'invalid-recovery-code',\n RecoveryCodeSuccess = 'recovery-code-success',\n LoginThrottled = 'login-throttled',\n MaxAttemptsReached = 'max-attempts-reached',\n}\n\nexport enum DeviceVerificationEventEmit {\n Retry = 'device-retry',\n}\n\nexport enum DeviceVerificationEventOnReceived {\n DeviceApproved = 'device-approved',\n DeviceNeedsApproval = 'device-needs-approval',\n DeviceVerificationLinkExpired = 'device-verification-link-expired',\n DeviceVerificationEmailSent = 'device-verification-email-sent',\n}\n\nexport enum RecencyCheckEventEmit {\n Retry = 'Recency/auth-factor-retry',\n Cancel = 'Recency/auth-factor-verification-cancel',\n VerifyEmailOtp = 'Recency/auth-factor-verify-email-otp',\n VerifyMFACode = 'Recency/verify-mfa-code',\n}\n\nexport enum RecencyCheckEventOnReceived {\n PrimaryAuthFactorNeedsVerification = 'Recency/auth-factor-needs-verification',\n PrimaryAuthFactorVerified = 'Recency/auth-factor-verified',\n InvalidEmailOtp = 'Recency/auth-factor-invalid-email-otp',\n EmailExpired = 'Recency/auth-factor-verification-email-expired',\n EmailSent = 'Recency/auth-factor-verification-email-sent',\n EmailNotDeliverable = 'Recency/auth-factor-verification-email-not-deliverable',\n}\n\nexport enum UpdateEmailEventEmit {\n RetryWithNewEmail = 'UpdateEmail/retry-with-new-email',\n Cancel = 'UpdateEmail/new-email-verification-cancel',\n VerifyEmailOtp = 'UpdateEmail/new-email-verify-otp',\n}\n\nexport enum UpdateEmailEventOnReceived {\n NewAuthFactorNeedsVerification = 'UpdateEmail/new-email-needs-verification',\n EmailUpdated = 'UpdateEmail/email-updated',\n InvalidEmailOtp = 'UpdateEmail/new-email-invalid-email-otp',\n EmailExpired = 'UpdateEmail/new-email-verification-email-expired',\n EmailSent = 'UpdateEmail/new-email-verification-email-sent',\n EmailNotDeliverable = 'UpdateEmail/new-email-verification-email-not-deliverable',\n InvalidEmail = 'UpdateEmail/new-email-invalid',\n EmailAlreadyExists = 'UpdateEmail/new-email-already-exists',\n}\n\nexport enum AuthEventOnReceived {\n IDTokenCreated = 'Auth/id-token-created',\n}\n\nexport enum FarcasterLoginEventEmit {\n Cancel = 'Farcaster/cancel',\n}\n\nexport enum EnableMFAEventOnReceived {\n MFASecretGenerated = 'mfa-secret-generated',\n InvalidMFAOtp = 'invalid-mfa-otp',\n MFARecoveryCodes = 'mfa-recovery-codes',\n}\nexport enum EnableMFAEventEmit {\n VerifyMFACode = 'verify-mfa-code',\n Cancel = 'cancel-mfa-setup',\n}\n\nexport enum DisableMFAEventOnReceived {\n MFACodeRequested = 'mfa-code-requested',\n InvalidMFAOtp = 'invalid-mfa-otp',\n InvalidRecoveryCode = 'invalid-recovery-code',\n}\n\nexport enum DisableMFAEventEmit {\n VerifyMFACode = 'verify-mfa-code',\n LostDevice = 'lost-device',\n Cancel = 'cancel-mfa-disable',\n}\n\n/**\n * EventHandlers\n */\nexport type LoginWithMagicLinkEventHandlers = {\n // Event Received\n [LoginWithMagicLinkEventOnReceived.EmailSent]: () => void;\n [LoginWithMagicLinkEventOnReceived.EmailNotDeliverable]: () => void;\n\n // Event sent\n [LoginWithMagicLinkEventEmit.Retry]: () => void;\n} & DeviceVerificationEventHandlers;\n\nexport type LoginWithSmsOTPEventHandlers = {\n // Event sent\n [LoginWithSmsOTPEventEmit.VerifySmsOtp]: (otp: string) => void;\n [LoginWithSmsOTPEventEmit.VerifyMFACode]: (mfa: string) => void;\n [LoginWithSmsOTPEventEmit.LostDevice]: () => void;\n [LoginWithSmsOTPEventEmit.VerifyRecoveryCode]: (recoveryCode: string) => void;\n [LoginWithSmsOTPEventEmit.Cancel]: () => void;\n [LoginWithSmsOTPEventEmit.Retry]: () => void;\n\n // Event received\n [LoginWithSmsOTPEventOnReceived.SmsOTPSent]: () => void;\n [LoginWithSmsOTPEventOnReceived.InvalidSmsOtp]: () => void;\n [LoginWithSmsOTPEventOnReceived.ExpiredSmsOtp]: () => void;\n [LoginWithSmsOTPEventOnReceived.MfaSentHandle]: () => void;\n [LoginWithSmsOTPEventOnReceived.InvalidMfaOtp]: () => void;\n [LoginWithSmsOTPEventOnReceived.LoginThrottled]: () => void;\n [LoginWithSmsOTPEventOnReceived.RecoveryCodeSentHandle]: () => void;\n [LoginWithSmsOTPEventOnReceived.InvalidRecoveryCode]: () => void;\n [LoginWithSmsOTPEventOnReceived.RecoveryCodeSuccess]: () => void;\n} & DeviceVerificationEventHandlers;\n\nexport type LoginWithEmailOTPEventHandlers = {\n // Event Received\n [LoginWithEmailOTPEventOnReceived.EmailOTPSent]: () => void;\n [LoginWithEmailOTPEventOnReceived.LoginThrottled]: () => void;\n [LoginWithEmailOTPEventOnReceived.InvalidEmailOtp]: () => void;\n [LoginWithEmailOTPEventOnReceived.InvalidMfaOtp]: () => void;\n [LoginWithEmailOTPEventOnReceived.ExpiredEmailOtp]: () => void;\n [LoginWithEmailOTPEventOnReceived.MfaSentHandle]: () => void;\n [LoginWithEmailOTPEventOnReceived.RecoveryCodeSentHandle]: () => void;\n [LoginWithEmailOTPEventOnReceived.InvalidRecoveryCode]: () => void;\n [LoginWithEmailOTPEventOnReceived.RecoveryCodeSuccess]: () => void;\n [LoginWithEmailOTPEventOnReceived.MaxAttemptsReached]: () => void;\n [AuthEventOnReceived.IDTokenCreated]: (idToken: string) => void;\n [WalletEventOnReceived.WalletInfoFetched]: () => void;\n\n // Event sent\n [LoginWithEmailOTPEventEmit.VerifyEmailOtp]: (otp: string) => void;\n [LoginWithEmailOTPEventEmit.VerifyMFACode]: (mfa: string) => void;\n [LoginWithEmailOTPEventEmit.LostDevice]: () => void;\n [LoginWithEmailOTPEventEmit.VerifyRecoveryCode]: (recoveryCode: string) => void;\n [LoginWithEmailOTPEventEmit.Cancel]: () => void;\n} & DeviceVerificationEventHandlers;\n\ntype DeviceVerificationEventHandlers = {\n // Event Received\n [DeviceVerificationEventOnReceived.DeviceNeedsApproval]: () => void;\n [DeviceVerificationEventOnReceived.DeviceVerificationEmailSent]: () => void;\n [DeviceVerificationEventOnReceived.DeviceVerificationLinkExpired]: () => void;\n [DeviceVerificationEventOnReceived.DeviceApproved]: () => void;\n\n // Event sent\n [DeviceVerificationEventEmit.Retry]: () => void;\n};\n\n/**\n * Update Email\n */\n\nexport type RecencyCheckEventHandlers = {\n [RecencyCheckEventOnReceived.PrimaryAuthFactorNeedsVerification]: () => void;\n [RecencyCheckEventOnReceived.PrimaryAuthFactorVerified]: () => void;\n [RecencyCheckEventOnReceived.InvalidEmailOtp]: () => void;\n [RecencyCheckEventOnReceived.EmailNotDeliverable]: () => void;\n [RecencyCheckEventOnReceived.EmailExpired]: () => void;\n [RecencyCheckEventOnReceived.EmailSent]: () => void;\n\n [RecencyCheckEventEmit.Cancel]: () => void;\n [RecencyCheckEventEmit.Retry]: () => void;\n [RecencyCheckEventEmit.VerifyEmailOtp]: (otp: string) => void;\n [RecencyCheckEventEmit.VerifyMFACode]: (mfa: string) => void;\n};\n\nexport type UpdateEmailEventHandlers = {\n [UpdateEmailEventOnReceived.NewAuthFactorNeedsVerification]: () => void;\n [UpdateEmailEventOnReceived.EmailUpdated]: () => void;\n [UpdateEmailEventOnReceived.InvalidEmailOtp]: () => void;\n [UpdateEmailEventOnReceived.EmailNotDeliverable]: () => void;\n [UpdateEmailEventOnReceived.EmailExpired]: () => void;\n [UpdateEmailEventOnReceived.EmailSent]: () => void;\n [UpdateEmailEventOnReceived.InvalidEmail]: () => void;\n [UpdateEmailEventOnReceived.EmailAlreadyExists]: () => void;\n\n [UpdateEmailEventEmit.Cancel]: () => void;\n [UpdateEmailEventEmit.RetryWithNewEmail]: (email?: string) => void;\n [UpdateEmailEventEmit.VerifyEmailOtp]: (otp: string) => void;\n} & RecencyCheckEventHandlers;\n\n/**\n * Enable MFA\n */\n\nexport type EnableMFAEventHandlers = {\n // Event Received\n [EnableMFAEventOnReceived.MFASecretGenerated]: ({ QRCode, key }: { QRCode: string; key: string }) => void;\n [EnableMFAEventOnReceived.InvalidMFAOtp]: ({ errorCode }: { errorCode: string }) => void;\n [EnableMFAEventOnReceived.MFARecoveryCodes]: ({ recoveryCode }: { recoveryCode: string }) => void;\n\n // Event sent\n [EnableMFAEventEmit.VerifyMFACode]: (totp: string) => void;\n [EnableMFAEventEmit.Cancel]: () => void;\n};\n\n/**\n * Disable MFA\n */\n\nexport type DisableMFAEventHandlers = {\n // Event Received\n [DisableMFAEventOnReceived.MFACodeRequested]: () => void;\n [DisableMFAEventOnReceived.InvalidMFAOtp]: ({ errorCode }: { errorCode: string }) => void;\n [DisableMFAEventOnReceived.InvalidRecoveryCode]: () => void;\n\n // Event sent\n [DisableMFAEventEmit.VerifyMFACode]: (totp: string) => void;\n [DisableMFAEventEmit.LostDevice]: (recoveryCode: string) => void;\n [DisableMFAEventEmit.Cancel]: () => void;\n};\n", "export type EthNetworkName = 'mainnet' | 'goerli' | 'sepolia';\n\nexport enum EthChainType {\n Harmony = 'HARMONY',\n}\n\nexport interface CustomNodeConfiguration {\n rpcUrl: string;\n chainId?: number;\n chainType?: EthChainType;\n}\n\nexport type EthNetworkConfiguration = EthNetworkName | CustomNodeConfiguration;\n\nexport type ProviderEnableEvents = {\n 'id-token-created': (params: { idToken: string }) => void;\n};\n", "import { RecencyCheckEventHandlers } from './auth-types';\nimport { DeepLinkPage } from '../core/deep-link-pages';\n\nexport interface GetIdTokenConfiguration {\n /**\n * The number of seconds until the generated ID token will expire.\n */\n lifespan?: number;\n}\n\nexport interface GenerateIdTokenConfiguration extends GetIdTokenConfiguration {\n /**\n * An optional piece of data to sign with the token. Note, however, that the\n * unsigned data _will not_ be encoded in the token, only an encrypted\n * signature of the data.\n */\n attachment?: string;\n}\n\nexport enum UserEventsEmit {\n ClosedByUser = 'closed-by-user',\n}\n\nexport enum UserEventsOnReceived {\n ClosedByUser = 'closed-by-user-on-received',\n}\n\nexport interface ChainWalletInfo {\n publicAddress: string | null;\n subAccounts: Array<{ name: string; publicAddress: string }>;\n}\n\nexport interface MagicUserMetadata {\n issuer: string | null;\n email: string | null;\n phoneNumber: string | null;\n isMfaEnabled: boolean;\n recoveryFactors: [RecoveryFactor] | [];\n firstLoginAt: string | null;\n wallets: {\n ethereum?: ChainWalletInfo;\n algorand?: ChainWalletInfo;\n aptos?: ChainWalletInfo;\n avalancheX?: ChainWalletInfo;\n bitcoin?: ChainWalletInfo;\n conflux?: ChainWalletInfo;\n cosmos?: ChainWalletInfo;\n flow?: ChainWalletInfo;\n harmony?: ChainWalletInfo;\n hedera?: ChainWalletInfo;\n icon?: ChainWalletInfo;\n kadena?: ChainWalletInfo;\n near?: ChainWalletInfo;\n polkadot?: ChainWalletInfo;\n solana?: ChainWalletInfo;\n sui?: ChainWalletInfo;\n taquito?: ChainWalletInfo;\n terra?: ChainWalletInfo;\n tezos?: ChainWalletInfo;\n zilliqa?: ChainWalletInfo;\n [chain: string]: ChainWalletInfo | undefined;\n };\n}\n\nexport enum RecoveryFactorEventOnReceived {\n EnterNewPhoneNumber = 'enter-new-phone-number',\n EnterOtpCode = 'enter-otp-code',\n RecoveryFactorAlreadyExists = 'recovery-factor-already-exists',\n MalformedPhoneNumber = 'malformed-phone-number',\n InvalidOtpCode = 'invalid-otp-code',\n RecoveryFactorUpdated = 'recovery-factor-updated',\n RecoveryFactorDeleted = 'recovery-factor-deleted',\n}\n\nexport enum RecoveryFactorEventEmit {\n SendNewPhoneNumber = 'send-new-phone-number',\n SendOtpCode = 'send-otp-code',\n Cancel = 'cancel',\n StartEditPhoneNumber = 'start-edit-phone-number',\n}\n\ntype RecoveryFactor = {\n type: RecoveryMethodType;\n value: string;\n};\n\nexport type RecoveryFactorEventHandlers = {\n // Event Received\n [RecoveryFactorEventEmit.SendNewPhoneNumber]: (phone_number: string) => void;\n [RecoveryFactorEventEmit.SendOtpCode]: (otp: string) => void;\n [RecoveryFactorEventEmit.StartEditPhoneNumber]: () => void;\n [RecoveryFactorEventEmit.Cancel]: () => void;\n\n // Event sent\n [RecoveryFactorEventOnReceived.EnterNewPhoneNumber]: () => void;\n [RecoveryFactorEventOnReceived.EnterOtpCode]: () => void;\n [RecoveryFactorEventOnReceived.RecoveryFactorAlreadyExists]: () => void;\n [RecoveryFactorEventOnReceived.MalformedPhoneNumber]: () => void;\n [RecoveryFactorEventOnReceived.InvalidOtpCode]: () => void;\n [RecoveryFactorEventOnReceived.RecoveryFactorUpdated]: (updatedFactor: { type: string; value: string }) => void;\n [RecoveryFactorEventOnReceived.RecoveryFactorDeleted]: () => void;\n} & RecencyCheckEventHandlers;\n\nexport enum RecoveryMethodType {\n PhoneNumber = 'phone_number',\n}\n\nexport interface UpdateEmailConfiguration {\n /**\n * The new email address to update to\n */\n email: string;\n\n /**\n * When `true`, a pre-built pending modal interface will\n * guide the user to check their new, followed by old emails\n * for confirmation emails.\n */\n showUI?: boolean;\n}\n\nexport interface UpdateWebAuthnInfoConfiguration {\n /**\n * WebAuthn info id\n */\n id: string;\n\n /**\n * nickname that user attempts to update to the webauth device associate to the id.\n */\n nickname: string;\n}\n\nexport interface RecoverAccountConfiguration {\n /**\n * The email to recover\n */\n email: string;\n showUI: boolean;\n}\n\nexport interface ShowSettingsConfiguration {\n /**\n * deep linking destination\n */\n page: DeepLinkPage;\n showUI?: boolean;\n}\n\nexport enum RecoverAccountEventOnReceived {\n SmsOtpSent = 'sms-otp-sent',\n LoginThrottled = 'login-throttled',\n InvalidSmsOtp = 'invalid-sms-otp',\n SmsVerified = 'sms-verified',\n AccountRecovered = 'account-recovered',\n UpdateEmailRequired = 'update-email-required',\n}\n\nexport enum RecoverAccountEventEmit {\n Cancel = 'cancel',\n VerifyOtp = 'verify-otp-code',\n ResendSms = 'resend-sms-otp',\n UpdateEmail = 'update-email',\n}\n\nexport type RecoverAccountEventHandlers = {\n // Event Received\n [RecoverAccountEventEmit.Cancel]: () => void;\n [RecoverAccountEventEmit.VerifyOtp]: (otp: string) => void;\n [RecoverAccountEventEmit.ResendSms]: () => void;\n [RecoverAccountEventEmit.UpdateEmail]: (email: string) => void;\n\n // Event sent\n [RecoverAccountEventOnReceived.SmsOtpSent]: ({ phoneNumber }: { phoneNumber: string }) => void;\n [RecoverAccountEventOnReceived.LoginThrottled]: (error: string) => void;\n [RecoverAccountEventOnReceived.InvalidSmsOtp]: ({\n errorMessage,\n errorCode,\n }: {\n errorMessage: string;\n errorCode: string;\n }) => void;\n [RecoverAccountEventOnReceived.SmsVerified]: () => void;\n [RecoverAccountEventOnReceived.AccountRecovered]: () => void;\n [RecoverAccountEventOnReceived.UpdateEmailRequired]: () => void;\n};\n", "export type NFTResponseStatus = 'cancelled' | 'pending' | 'processed' | 'declined' | 'expired';\n\nexport type NFTResponse = {\n status: NFTResponseStatus;\n};\n\nexport interface NFTPurchaseRequest {\n nft: {\n name: string;\n imageUrl: string;\n blockchainNftId: string;\n contractAddress: string;\n network: string;\n platform: string;\n type: string;\n };\n identityPrefill: {\n firstName: string;\n lastName: string;\n dateOfBirth: string; // YYYY-MM-DD\n emailAddress: string;\n phone: string;\n address: {\n street1: string;\n street2: string;\n city: string;\n regionCode: string;\n postalCode: string;\n countryCode: string;\n };\n };\n}\n\nexport type NFTPurchaseResponse = NFTResponse & {\n errorMessage?: string;\n};\n\nexport interface NFTCheckoutRequest {\n // given by magic / found in the developer dashboard in future\n contractId: string;\n // in contract, if ERC1155\u2026 for ERC721, use token ID = 0\n tokenId: string;\n name: string;\n imageUrl: string;\n quantity?: number; // default is 1\n walletAddress?: string; // default is user's wallet address\n // If enabled, the user will be able to pay with crypto. the default is false\n isCryptoCheckoutEnabled?: boolean;\n walletProvider?: 'magic' | 'web3modal';\n}\n\nexport type NFTCheckoutResponse = NFTResponse;\n\nexport type NFTCheckoutEvents = {\n disconnect: () => void;\n 'nft-checkout-initiated': (rawTransaction: string) => void;\n};\n\nexport interface NFTTransferRequest {\n tokenId: string;\n contractAddress: string;\n quantity?: number;\n recipient?: string;\n}\n\nexport type NFTTransferResponse = NFTResponse;\n\nexport enum NftCheckoutIntermediaryEvents {\n Success = 'nft-checkout-success',\n Failure = 'nft-checkout-failure',\n Initiated = 'nft-checkout-initiated',\n Disconnect = 'disconnect',\n}\n\nexport type NftCheckoutEventHandler = {\n [NftCheckoutIntermediaryEvents.Initiated]: (rawTransaction: string) => void;\n [NftCheckoutIntermediaryEvents.Success]: (signedTransaction: string) => void;\n [NftCheckoutIntermediaryEvents.Failure]: () => void;\n};\n", "export type AccessListEntry = { address: string; storageKeys: Array<string> };\n\n/**\n * An ordered collection of [[AccessList]] entries.\n */\nexport type AccessList = Array<AccessListEntry>;\n\nexport enum WalletEventOnReceived {\n WalletInfoFetched = 'Wallet/wallet-info-fetched',\n}\n\n/**\n * Request parameters for EIP-7702 authorization signing\n */\nexport interface Sign7702AuthorizationRequest {\n /**\n * The smart contract implementation address the EOA delegates to\n */\n contractAddress: string;\n\n /**\n * The chain ID for the network (use 0 for universal cross-chain authorization)\n */\n chainId: number;\n\n /**\n * The nonce for the EOA account (transaction count)\n */\n nonce?: number;\n}\n\n/**\n * Response from EIP-7702 authorization signing\n */\nexport interface Sign7702AuthorizationResponse {\n /**\n * The contract address that was authorized\n */\n contractAddress: string;\n\n /**\n * The chain ID for the authorization\n */\n chainId: number;\n\n /**\n * The nonce used in the authorization\n */\n nonce: number;\n\n /**\n * The v component of the signature (recovery id)\n */\n v: number;\n\n /**\n * The r component of the signature\n */\n r: string;\n\n /**\n * The s component of the signature\n */\n s: string;\n\n /**\n * Optional: Full signature as hex string\n */\n signature?: string;\n}\n\n/**\n * Request parameters for sending an EIP-7702 transaction with authorization list\n */\nexport interface Send7702TransactionRequest {\n /**\n * The recipient address\n */\n to: string;\n\n /**\n * The value to send in wei (as hex string)\n */\n value?: string;\n\n /**\n * The transaction data (calldata)\n */\n data?: string;\n\n /**\n * Gas limit for the transaction (as hex string)\n */\n gas?: string;\n\n /**\n * Gas limit for the transaction (alias for gas)\n */\n gasLimit?: string;\n\n /**\n * Maximum fee per gas for EIP-1559 transactions (as hex string)\n */\n maxFeePerGas?: string;\n\n /**\n * Maximum priority fee per gas for EIP-1559 transactions (as hex string)\n */\n maxPriorityFeePerGas?: string;\n\n /**\n * Transaction nonce (if not provided, will be fetched from network)\n */\n nonce?: number;\n\n /**\n * The list of signed EIP-7702 authorizations to include in the transaction\n */\n authorizationList: Sign7702AuthorizationResponse[];\n}\n\n/**\n * Response from sending an EIP-7702 transaction\n */\nexport interface Send7702TransactionResponse {\n /**\n * The transaction hash\n */\n transactionHash: string;\n}", "export enum UiEventsEmit {\n CloseMagicWindow = 'close-magic-window',\n}\n", "// Shared MFA events reused by both popup and redirect flows\nexport enum OAuthMFAEventEmit {\n Cancel = 'cancel',\n VerifyMFACode = 'verify-mfa-code',\n LostDevice = 'lost-device',\n VerifyRecoveryCode = 'verify-recovery-code',\n}\n\nexport enum OAuthMFAEventOnReceived {\n MfaSentHandle = 'mfa-sent-handle',\n InvalidMfaOtp = 'invalid-mfa-otp',\n RecoveryCodeSentHandle = 'recovery-code-sent-handle',\n InvalidRecoveryCode = 'invalid-recovery-code',\n RecoveryCodeSuccess = 'recovery-code-success',\n}\n\ntype OAuthMFAEventHandlers = {\n // Event sent\n [OAuthMFAEventEmit.Cancel]: () => void;\n [OAuthMFAEventEmit.VerifyMFACode]: (mfa: string) => void;\n [OAuthMFAEventEmit.LostDevice]: () => void;\n [OAuthMFAEventEmit.VerifyRecoveryCode]: (recoveryCode: string) => void;\n // Event Received\n [OAuthMFAEventOnReceived.MfaSentHandle]: () => void;\n [OAuthMFAEventOnReceived.InvalidMfaOtp]: () => void;\n [OAuthMFAEventOnReceived.RecoveryCodeSentHandle]: () => void;\n [OAuthMFAEventOnReceived.InvalidRecoveryCode]: () => void;\n [OAuthMFAEventOnReceived.RecoveryCodeSuccess]: () => void;\n};\n\n// Popup-specific events\nexport enum OAuthPopupEventOnReceived {\n PopupUrl = 'popup-url',\n}\n\nexport enum OAuthPopupEventEmit {\n PopupEvent = 'popup-event',\n}\n\nexport type OAuthPopupEventHandlers = {\n [OAuthPopupEventEmit.PopupEvent]: (eventData: unknown) => void;\n [OAuthPopupEventOnReceived.PopupUrl]: (event: { popupUrl: string; provider: string }) => void;\n} & OAuthMFAEventHandlers;\n\n// Redirect-specific handler type\nexport type OAuthGetResultEventHandlers = OAuthMFAEventHandlers;\n", "export interface PasskeyResult {\n // null if skipDIDToken is true\n idToken: string | null;\n\n // Info of the device used to authenticate\n deviceInfo: {\n id: string;\n nickname: string;\n transport: string;\n userAgent: string;\n };\n}\n\nexport enum PasskeyMFAEventEmit {\n Cancel = 'cancel',\n VerifyMFACode = 'verify-mfa-code',\n LostDevice = 'lost-device',\n VerifyRecoveryCode = 'verify-recovery-code',\n}\nexport enum PasskeyMFAEventOnReceived {\n MfaSentHandle = 'mfa-sent-handle',\n InvalidMfaOtp = 'invalid-mfa-otp',\n RecoveryCodeSentHandle = 'recovery-code-sent-handle',\n InvalidRecoveryCode = 'invalid-recovery-code',\n RecoveryCodeSuccess = 'recovery-code-success',\n}\n\nexport type PasskeyEventHandlers = {\n // Event sent\n [PasskeyMFAEventEmit.Cancel]: () => void;\n [PasskeyMFAEventEmit.VerifyMFACode]: (mfa: string) => void;\n [PasskeyMFAEventEmit.LostDevice]: () => void;\n [PasskeyMFAEventEmit.VerifyRecoveryCode]: (recoveryCode: string) => void;\n // Event Received\n [PasskeyMFAEventOnReceived.MfaSentHandle]: () => void;\n [PasskeyMFAEventOnReceived.InvalidMfaOtp]: () => void;\n [PasskeyMFAEventOnReceived.RecoveryCodeSentHandle]: () => void;\n [PasskeyMFAEventOnReceived.InvalidRecoveryCode]: () => void;\n [PasskeyMFAEventOnReceived.RecoveryCodeSuccess]: () => void;\n};\n", "/**\n * Encode given buffer or decode given string with Base64URL.\n */\nexport class Base64URL {\n /**\n * Convert bytes into a base64url-encoded string\n */\n static encode(buffer: ArrayBuffer): string {\n const base64 = globalThis.btoa(String.fromCharCode(...new Uint8Array(buffer)));\n\n return base64.replace(/=/g, '').replace(/\\+/g, '-').replace(/\\//g, '_');\n }\n\n /**\n * Convert a base64url-encoded string into bytes\n */\n static decode(base64url: string): ArrayBuffer {\n const base64 = base64url.replace(/-/g, '+').replace(/_/g, '/');\n const binStr = globalThis.atob(base64);\n const bin = new Uint8Array(binStr.length);\n\n for (let i = 0; i < binStr.length; i++) {\n bin[i] = binStr.charCodeAt(i);\n }\n\n return bin.buffer;\n }\n}\n", "import { Base64URL } from './base64';\n\nfunction isAuthenticatorAssertionResponse(value: AuthenticatorResponse): value is AuthenticatorAssertionResponse {\n if (typeof value !== 'object') {\n return false;\n }\n if (\n (value as AuthenticatorAssertionResponse)?.authenticatorData === undefined ||\n typeof (value as AuthenticatorAssertionResponse)?.authenticatorData !== 'object'\n ) {\n return false;\n }\n return true;\n}\n\nfunction isAuthenticatorAttestationResponse(value: AuthenticatorResponse): value is AuthenticatorAttestationResponse {\n if (typeof value !== 'object') {\n return false;\n }\n if (\n (value as AuthenticatorAttestationResponse)?.attestationObject === undefined ||\n typeof (value as AuthenticatorAttestationResponse)?.attestationObject !== 'object'\n ) {\n return false;\n }\n return true;\n}\n\n/**\n * Polyfill `PublicKeyCredential.prototype.toJSON`\n *\n * See https://w3c.github.io/webauthn/#dom-publickeycredential-tojson\n */\nexport function toJSON(cred: PublicKeyCredential): PublicKeyCredentialJSON {\n // Prefer native implementation if available\n if (typeof cred.toJSON === 'function') {\n return cred.toJSON();\n }\n\n try {\n const id = cred.id;\n const rawId = Base64URL.encode(cred.rawId);\n const authenticatorAttachment = cred.authenticatorAttachment;\n const clientExtensionResults = {};\n const type = cred.type;\n\n // This is authentication.\n if (isAuthenticatorAssertionResponse(cred.response)) {\n return {\n id,\n rawId,\n response: {\n authenticatorData: Base64URL.encode(cred.response.authenticatorData),\n clientDataJSON: Base64URL.encode(cred.response.clientDataJSON),\n signature: Base64URL.encode(cred.response.signature),\n userHandle: cred.response.userHandle ? Base64URL.encode(cred.response.userHandle) : undefined,\n },\n authenticatorAttachment,\n clientExtensionResults,\n type,\n };\n }\n\n if (isAuthenticatorAttestationResponse(cred.response)) {\n // This is registration.\n return {\n id,\n rawId,\n response: {\n clientDataJSON: Base64URL.encode(cred.response.clientDataJSON),\n attestationObject: Base64URL.encode(cred.response.attestationObject),\n transports: cred.response?.getTransports() || [],\n },\n authenticatorAttachment,\n clientExtensionResults,\n type,\n };\n }\n\n throw new Error('Unexpected object.');\n } catch (error) {\n console.error(error);\n throw error;\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,aAAAA,OAAiB,sBCAnB,IAAKC,GAAAA,IACVA,E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CACnER,EAAW,KAAKQ,EAA0B,mBAAmB,CAC/D,CAAC,GAGH,GAAI,CACF,IAAMC,EAAS,MAAMF,EACrBN,EAAQQ,CAAM,CAChB,OAASC,EAAO,CACdR,EAAOQ,CAAK,CACd,CACF,CAAC,EAED,MAAI,CAACZ,GAAgBE,IACnBA,EAAW,GAAGW,EAAoB,cAAgBC,GAAgB,CAChE,KAAK,wBAAwBD,EAAoB,cAAeZ,CAAe,EAAEa,CAAG,CACtF,CAAC,EACDZ,EAAW,GAAGW,EAAoB,WAAY,IAAM,CAClD,KAAK,wBAAwBA,EAAoB,WAAYZ,CAAe,EAAE,CAChF,CAAC,EACDC,EAAW,GAAGW,EAAoB,mBAAqBE,GAAyB,CAC9E,KAAK,wBAAwBF,EAAoB,mBAAoBZ,CAAe,EAAEc,CAAY,CACpG,CAAC,EACDb,EAAW,GAAGW,EAAoB,OAAQ,IAAM,CAC9C,KAAK,wBAAwBA,EAAoB,OAAQZ,CAAe,EAAE,CAC5E,CAAC,GAGIC,CACT,CAEO,aAAc,CACnB,IAAMM,EAAiB,KAAK,MAAM,kEAAsE,CAAC,CAAC,EAC1G,OAAO,KAAK,QAAeA,CAAc,CAC3C,CACF",
|
|
6
|
+
"names": ["Extension", "SDKErrorCode", "SDKWarningCode", "RPCErrorCode", "LocalStorageKeys", "ThirdPartyWalletEvents", "MagicPayloadMethod", "MagicIncomingWindowMessage", "MagicOutgoingWindowMessage", "DeepLinkPage", "LoginWithMagicLinkEventEmit", "LoginWithMagicLinkEventOnReceived", "LoginWithEmailOTPEventEmit", "LoginWithSmsOTPEventEmit", "LoginWithSmsOTPEventOnReceived", "LoginWithEmailOTPEventOnReceived", "DeviceVerificationEventEmit", "DeviceVerificationEventOnReceived", "RecencyCheckEventEmit", "RecencyCheckEventOnReceived", "UpdateEmailEventEmit", "UpdateEmailEventOnReceived", "AuthEventOnReceived", "FarcasterLoginEventEmit", "EnableMFAEventOnReceived", "EnableMFAEventEmit", "DisableMFAEventOnReceived", "DisableMFAEventEmit", "EthChainType", "UserEventsEmit", "UserEventsOnReceived", "RecoveryFactorEventOnReceived", "RecoveryFactorEventEmit", "RecoveryMethodType", "RecoverAccountEventOnReceived", "RecoverAccountEventEmit", "NftCheckoutIntermediaryEvents", "WalletEventOnReceived", "UiEventsEmit", "OAuthMFAEventEmit", "OAuthMFAEventOnReceived", "OAuthPopupEventOnReceived", "OAuthPopupEventEmit", "PasskeyMFAEventEmit", "PasskeyMFAEventOnReceived", "Base64URL", "buffer", "base64url", "base64", "binStr", "bin", "i", "isAuthenticatorAssertionResponse", "value", "isAuthenticatorAttestationResponse", "toJSON", "cred", "id", "rawId", "Base64URL", "authenticatorAttachment", "clientExtensionResults", "type", "error", "PasskeyExtension", "Extension", "message", "configuration", "username", "nickname", "skipDIDToken", "lifespan", "registrationOptions", "registrationToken", "credential", "err", "toJSON", "showMfaModal", "verifyPayloadId", "promiEvent", "resolve", "reject", "authenticationToken", "authenticationOptions", "assertion", "requestPayload", "loginRequest", "ie", "result", "error", "te", "mfa", "recoveryCode"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Extension as _e}from"@magic-sdk/provider";var f=(e=>(e.MissingApiKey="MISSING_API_KEY",e.ModalNotReady="MODAL_NOT_READY",e.ConnectionLost="CONNECTION_WAS_LOST",e.MalformedResponse="MALFORMED_RESPONSE",e.InvalidArgument="INVALID_ARGUMENT",e.ExtensionNotInitialized="EXTENSION_NOT_INITIALIZED",e.IncompatibleExtensions="INCOMPATIBLE_EXTENSIONS",e))(f||{}),A=(e=>(e.SyncWeb3Method="SYNC_WEB3_METHOD",e.DuplicateIframe="DUPLICATE_IFRAME",e.ReactNativeEndpointConfiguration="REACT_NATIVE_ENDPOINT_CONFIGURATION",e.DeprecationNotice="DEPRECATION_NOTICE",e.ProductAnnouncement="ANNOUNCEMENT",e))(A||{}),I=(e=>(e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.MagicLinkFailedVerification=-1e4]="MagicLinkFailedVerification",e[e.MagicLinkExpired=-10001]="MagicLinkExpired",e[e.MagicLinkRateLimited=-10002]="MagicLinkRateLimited",e[e.UserAlreadyLoggedIn=-10003]="UserAlreadyLoggedIn",e[e.UpdateEmailFailed=-10004]="UpdateEmailFailed",e[e.UserRequestEditEmail=-10005]="UserRequestEditEmail",e[e.MagicLinkInvalidRedirectURL=-10006]="MagicLinkInvalidRedirectURL",e[e.InactiveRecipient=-10010]="InactiveRecipient",e[e.AccessDeniedToUser=-10011]="AccessDeniedToUser",e[e.UserRejectedAction=-10012]="UserRejectedAction",e[e.RequestCancelled=-10014]="RequestCancelled",e[e.RedirectLoginComplete=-10015]="RedirectLoginComplete",e[e.SessionTerminated=-10016]="SessionTerminated",e[e.PopupRequestOverriden=-10017]="PopupRequestOverriden",e[e.SanEmail=-10018]="SanEmail",e[e.DpopInvalidated=-10019]="DpopInvalidated",e[e.MaxAttemptsReached=-10031]="MaxAttemptsReached",e[e.UserRequiredMfa=-10033]="UserRequiredMfa",e))(I||{}),C=(e=>(e.PROVIDER="magic_3pw_provider",e.ADDRESS="magic_3pw_address",e.CHAIN_ID="magic_3pw_chainId",e))(C||{}),M=(e=>(e.WalletConnected="wallet_connected",e.WalletRejected="wallet_rejected",e.Web3ModalSelected="web3modal_selected",e))(M||{}),O=(e=>(e.LoginWithSms="magic_auth_login_with_sms",e.LoginWithEmailOTP="magic_auth_login_with_email_otp",e.LoginWithMagicLink="magic_auth_login_with_magic_link",e.LoginWithCredential="magic_auth_login_with_credential",e.SetAuthorizationToken="magic_auth_set_authorization_token",e.GetIdToken="magic_auth_get_id_token",e.GenerateIdToken="magic_auth_generate_id_token",e.GetMetadata="magic_auth_get_metadata",e.IsLoggedIn="magic_is_logged_in",e.Logout="magic_auth_logout",e.UpdateEmail="magic_auth_update_email",e.UserSettings="magic_auth_settings",e.UserSettingsTestMode="magic_auth_settings_testing_mode",e.LoginWithSmsTestMode="magic_auth_login_with_sms_testing_mode",e.LoginWithEmailOTPTestMode="magic_auth_login_with_email_otp_testing_mode",e.LoginWithMagicLinkTestMode="magic_login_with_magic_link_testing_mode",e.LoginWithCredentialTestMode="magic_auth_login_with_credential_testing_mode",e.GetIdTokenTestMode="magic_auth_get_id_token_testing_mode",e.GenerateIdTokenTestMode="magic_auth_generate_id_token_testing_mode",e.GetMetadataTestMode="magic_auth_get_metadata_testing_mode",e.IsLoggedInTestMode="magic_auth_is_logged_in_testing_mode",e.LogoutTestMode="magic_auth_logout_testing_mode",e.UpdateEmailTestMode="magic_auth_update_email_testing_mode",e.IntermediaryEvent="magic_intermediary_event",e.RequestAccounts="eth_requestAccounts",e.GetInfo="magic_get_info",e.ShowUI="magic_wallet",e.NFTPurchase="magic_nft_purchase",e.NFTCheckout="magic_nft_checkout",e.NFTTransfer="magic_nft_transfer",e.RequestUserInfoWithUI="mc_request_user_info",e.Disconnect="mc_disconnect",e.RecoverAccount="magic_auth_recover_account",e.RecoverAccountTestMode="magic_auth_recover_account_testing_mode",e.MagicBoxHeartBeat="magic_box_heart_beat",e.AutoConnect="mc_auto_connect",e.Login="mc_login",e.EncryptV1="magic_auth_encrypt_v1",e.DecryptV1="magic_auth_decrypt_v1",e.ShowNFTs="magic_show_nfts",e.ShowOnRamp="magic_show_fiat_onramp",e.ShowSendTokensUI="magic_show_send_tokens_ui",e.ShowAddress="magic_show_address",e.ShowBalances="magic_show_balances",e.RevealPK="magic_reveal_key",e.EnableMFA="magic_auth_enable_mfa_flow",e.DisableMFA="magic_auth_disable_mfa_flow",e.GetMultichainPublicAddress="magic_get_multichain_public_address",e.Sign7702Authorization="magic_wallet_sign_7702_authorization",e.Send7702Transaction="eth_send7702Transaction",e))(O||{});var S=(e=>(e.MAGIC_HANDLE_RESPONSE="MAGIC_HANDLE_RESPONSE",e.MAGIC_OVERLAY_READY="MAGIC_OVERLAY_READY",e.MAGIC_SHOW_OVERLAY="MAGIC_SHOW_OVERLAY",e.MAGIC_HIDE_OVERLAY="MAGIC_HIDE_OVERLAY",e.MAGIC_HANDLE_EVENT="MAGIC_HANDLE_EVENT",e.MAGIC_MG_BOX_SEND_RECEIPT="MAGIC_MG_BOX_SEND_RECEIPT",e.MAGIC_SEND_PRODUCT_ANNOUNCEMENT="MAGIC_SEND_PRODUCT_ANNOUNCEMENT",e.MAGIC_PONG="MAGIC_PONG",e.MAGIC_POPUP_RESPONSE="MAGIC_POPUP_RESPONSE",e.MAGIC_POPUP_OAUTH_VERIFY_RESPONSE="MAGIC_POPUP_OAUTH_VERIFY_RESPONSE",e.MAGIC_THIRD_PARTY_WALLET_REQUEST="MAGIC_THIRD_PARTY_WALLET_REQUEST",e.MAGIC_OPEN_MOBILE_URL="MAGIC_OPEN_MOBILE_URL",e))(S||{}),P=(e=>(e.MAGIC_HANDLE_REQUEST="MAGIC_HANDLE_REQUEST",e.MAGIC_THIRD_PARTY_WALLET_RESPONSE="MAGIC_THIRD_PARTY_WALLET_RESPONSE",e.MAGIC_THIRD_PARTY_WALLET_UPDATE="MAGIC_THIRD_PARTY_WALLET_EVENT",e.MAGIC_PING="MAGIC_PING",e))(P||{}),T=(e=>(e.UpdateEmail="update-email",e.MFA="mfa",e.Recovery="recovery",e))(T||{}),N=(e=>(e.Retry="retry",e))(N||{}),L=(e=>(e.EmailSent="email-sent",e.EmailNotDeliverable="email-not-deliverable",e))(L||{}),k=(e=>(e.VerifyEmailOtp="verify-email-otp",e.VerifyMFACode="verify-mfa-code",e.LostDevice="lost-device",e.VerifyRecoveryCode="verify-recovery-code",e.Cancel="cancel",e))(k||{}),D=(e=>(e.VerifySmsOtp="verify-sms-otp",e.VerifyMFACode="verify-mfa-code",e.LostDevice="lost-device",e.VerifyRecoveryCode="verify-recovery-code",e.Cancel="cancel",e.Retry="retry",e))(D||{}),w=(e=>(e.SmsOTPSent="sms-otp-sent",e.InvalidSmsOtp="invalid-sms-otp",e.ExpiredSmsOtp="expired-sms-otp",e.MfaSentHandle="mfa-sent-handle",e.InvalidMfaOtp="invalid-mfa-otp",e.LoginThrottled="login-throttled",e.RecoveryCodeSentHandle="recovery-code-sent-handle",e.InvalidRecoveryCode="invalid-recovery-code",e.RecoveryCodeSuccess="recovery-code-success",e))(w||{}),U=(e=>(e.EmailOTPSent="email-otp-sent",e.InvalidEmailOtp="invalid-email-otp",e.InvalidMfaOtp="invalid-mfa-otp",e.ExpiredEmailOtp="expired-email-otp",e.MfaSentHandle="mfa-sent-handle",e.RecoveryCodeSentHandle="recovery-code-sent-handle",e.InvalidRecoveryCode="invalid-recovery-code",e.RecoveryCodeSuccess="recovery-code-success",e.LoginThrottled="login-throttled",e.MaxAttemptsReached="max-attempts-reached",e))(U||{}),b=(e=>(e.Retry="device-retry",e))(b||{}),F=(e=>(e.DeviceApproved="device-approved",e.DeviceNeedsApproval="device-needs-approval",e.DeviceVerificationLinkExpired="device-verification-link-expired",e.DeviceVerificationEmailSent="device-verification-email-sent",e))(F||{}),G=(e=>(e.Retry="Recency/auth-factor-retry",e.Cancel="Recency/auth-factor-verification-cancel",e.VerifyEmailOtp="Recency/auth-factor-verify-email-otp",e.VerifyMFACode="Recency/verify-mfa-code",e))(G||{}),V=(e=>(e.PrimaryAuthFactorNeedsVerification="Recency/auth-factor-needs-verification",e.PrimaryAuthFactorVerified="Recency/auth-factor-verified",e.InvalidEmailOtp="Recency/auth-factor-invalid-email-otp",e.EmailExpired="Recency/auth-factor-verification-email-expired",e.EmailSent="Recency/auth-factor-verification-email-sent",e.EmailNotDeliverable="Recency/auth-factor-verification-email-not-deliverable",e))(V||{}),W=(e=>(e.RetryWithNewEmail="UpdateEmail/retry-with-new-email",e.Cancel="UpdateEmail/new-email-verification-cancel",e.VerifyEmailOtp="UpdateEmail/new-email-verify-otp",e))(W||{}),H=(e=>(e.NewAuthFactorNeedsVerification="UpdateEmail/new-email-needs-verification",e.EmailUpdated="UpdateEmail/email-updated",e.InvalidEmailOtp="UpdateEmail/new-email-invalid-email-otp",e.EmailExpired="UpdateEmail/new-email-verification-email-expired",e.EmailSent="UpdateEmail/new-email-verification-email-sent",e.EmailNotDeliverable="UpdateEmail/new-email-verification-email-not-deliverable",e.InvalidEmail="UpdateEmail/new-email-invalid",e.EmailAlreadyExists="UpdateEmail/new-email-already-exists",e))(H||{}),x=(e=>(e.IDTokenCreated="Auth/id-token-created",e))(x||{}),q=(e=>(e.Cancel="Farcaster/cancel",e))(q||{}),Y=(e=>(e.MFASecretGenerated="mfa-secret-generated",e.InvalidMFAOtp="invalid-mfa-otp",e.MFARecoveryCodes="mfa-recovery-codes",e))(Y||{}),J=(e=>(e.VerifyMFACode="verify-mfa-code",e.Cancel="cancel-mfa-setup",e))(J||{}),B=(e=>(e.MFACodeRequested="mfa-code-requested",e.InvalidMFAOtp="invalid-mfa-otp",e.InvalidRecoveryCode="invalid-recovery-code",e))(B||{}),K=(e=>(e.VerifyMFACode="verify-mfa-code",e.LostDevice="lost-device",e.Cancel="cancel-mfa-disable",e))(K||{}),j=(e=>(e.Harmony="HARMONY",e))(j||{}),z=(e=>(e.ClosedByUser="closed-by-user",e))(z||{}),Q=(e=>(e.ClosedByUser="closed-by-user-on-received",e))(Q||{}),X=(e=>(e.EnterNewPhoneNumber="enter-new-phone-number",e.EnterOtpCode="enter-otp-code",e.RecoveryFactorAlreadyExists="recovery-factor-already-exists",e.MalformedPhoneNumber="malformed-phone-number",e.InvalidOtpCode="invalid-otp-code",e.RecoveryFactorUpdated="recovery-factor-updated",e.RecoveryFactorDeleted="recovery-factor-deleted",e))(X||{}),Z=(e=>(e.SendNewPhoneNumber="send-new-phone-number",e.SendOtpCode="send-otp-code",e.Cancel="cancel",e.StartEditPhoneNumber="start-edit-phone-number",e))(Z||{}),$=(e=>(e.PhoneNumber="phone_number",e))($||{}),ee=(e=>(e.SmsOtpSent="sms-otp-sent",e.LoginThrottled="login-throttled",e.InvalidSmsOtp="invalid-sms-otp",e.SmsVerified="sms-verified",e.AccountRecovered="account-recovered",e.UpdateEmailRequired="update-email-required",e))(ee||{}),te=(e=>(e.Cancel="cancel",e.VerifyOtp="verify-otp-code",e.ResendSms="resend-sms-otp",e.UpdateEmail="update-email",e))(te||{}),ae=(e=>(e.Success="nft-checkout-success",e.Failure="nft-checkout-failure",e.Initiated="nft-checkout-initiated",e.Disconnect="disconnect",e))(ae||{}),ie=(e=>(e.WalletInfoFetched="Wallet/wallet-info-fetched",e))(ie||{}),ne=(e=>(e.CloseMagicWindow="close-magic-window",e))(ne||{}),oe=(e=>(e.Cancel="cancel",e.VerifyMFACode="verify-mfa-code",e.LostDevice="lost-device",e.VerifyRecoveryCode="verify-recovery-code",e))(oe||{}),re=(e=>(e.MfaSentHandle="mfa-sent-handle",e.InvalidMfaOtp="invalid-mfa-otp",e.RecoveryCodeSentHandle="recovery-code-sent-handle",e.InvalidRecoveryCode="invalid-recovery-code",e.RecoveryCodeSuccess="recovery-code-success",e))(re||{}),se=(e=>(e.PopupUrl="popup-url",e))(se||{}),ce=(e=>(e.PopupEvent="popup-event",e))(ce||{}),r=(e=>(e.Cancel="cancel",e.VerifyMFACode="verify-mfa-code",e.LostDevice="lost-device",e.VerifyRecoveryCode="verify-recovery-code",e))(r||{}),n=(e=>(e.MfaSentHandle="mfa-sent-handle",e.InvalidMfaOtp="invalid-mfa-otp",e.RecoveryCodeSentHandle="recovery-code-sent-handle",e.InvalidRecoveryCode="invalid-recovery-code",e.RecoveryCodeSuccess="recovery-code-success",e))(n||{});var s=class{static encode(t){return globalThis.btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}static decode(t){let c=t.replace(/-/g,"+").replace(/_/g,"/"),i=globalThis.atob(c),d=new Uint8Array(i.length);for(let o=0;o<i.length;o++)d[o]=i.charCodeAt(o);return d.buffer}};function de(e){return!(typeof e!="object"||e?.authenticatorData===void 0||typeof e?.authenticatorData!="object")}function le(e){return!(typeof e!="object"||e?.attestationObject===void 0||typeof e?.attestationObject!="object")}function E(e){if(typeof e.toJSON=="function")return e.toJSON();try{let t=e.id,c=s.encode(e.rawId),i=e.authenticatorAttachment,d={},o=e.type;if(de(e.response))return{id:t,rawId:c,response:{authenticatorData:s.encode(e.response.authenticatorData),clientDataJSON:s.encode(e.response.clientDataJSON),signature:s.encode(e.response.signature),userHandle:e.response.userHandle?s.encode(e.response.userHandle):void 0},authenticatorAttachment:i,clientExtensionResults:d,type:o};if(le(e.response))return{id:t,rawId:c,response:{clientDataJSON:s.encode(e.response.clientDataJSON),attestationObject:s.encode(e.response.attestationObject),transports:e.response?.getTransports()||[]},authenticatorAttachment:i,clientExtensionResults:d,type:o};throw new Error("Unexpected object.")}catch(t){throw console.error(t),t}}var y=class extends _e.Internal{name="passkey";config={};createPasskeyNotSupportError(){this.createError("PASSKEY_NOT_SUPPORTED","Passkey is not supported in this device.",{})}createPasskeyCreateCredentialError(t){this.createError("PASSKEY_REGISTRATION_ERROR",`Error creating credential: ${t}`,{})}async registerNewUser(t){if(!window.PublicKeyCredential)throw this.createPasskeyNotSupportError();let{username:c,nickname:i="",skipDIDToken:d,lifespan:o}=t??{},{registrationOptions:_,registrationToken:a}=await this.request(this.utils.createJsonRpcRequestPayload("magic_auth_register_passkey_start",[{username:c}])),l;try{l=await navigator.credentials.create({publicKey:_})}catch(v){throw this.createPasskeyCreateCredentialError(v)}return this.request(this.utils.createJsonRpcRequestPayload("magic_auth_register_passkey_verify",[{registrationToken:a,registrationResponse:E(l),nickname:i,transport:l.response.getTransports(),userAgent:navigator.userAgent,skipDIDToken:d,lifespan:o}]))}login(t){let{username:c,showMfaModal:i,skipDIDToken:d,lifespan:o}=t??{},_,a=this.utils.createPromiEvent(async(l,v)=>{if(!window.PublicKeyCredential)return v(this.createPasskeyNotSupportError());let{authenticationToken:h,authenticationOptions:R}=await this.request(this.utils.createJsonRpcRequestPayload("magic_auth_login_with_passkey_start",[{username:c}])),p;try{p=await navigator.credentials.get({publicKey:R})}catch(u){return v(this.createPasskeyCreateCredentialError(u))}let g=this.utils.createJsonRpcRequestPayload("magic_auth_login_with_passkey_verify",[{authenticationToken:h,assertionResponse:E(p),showUI:i,skipDIDToken:d,lifespan:o}]);_=g.id;let m=this.request(g);i||(m.on(n.MfaSentHandle,()=>{a.emit(n.MfaSentHandle)}),m.on(n.InvalidMfaOtp,()=>{a.emit(n.InvalidMfaOtp)}),m.on(n.RecoveryCodeSentHandle,()=>{a.emit(n.RecoveryCodeSentHandle)}),m.on(n.InvalidRecoveryCode,()=>{a.emit(n.InvalidRecoveryCode)}),m.on(n.RecoveryCodeSuccess,()=>{a.emit(n.RecoveryCodeSuccess)}));try{let u=await m;l(u)}catch(u){v(u)}});return!i&&a&&(a.on(r.VerifyMFACode,l=>{this.createIntermediaryEvent(r.VerifyMFACode,_)(l)}),a.on(r.LostDevice,()=>{this.createIntermediaryEvent(r.LostDevice,_)()}),a.on(r.VerifyRecoveryCode,l=>{this.createIntermediaryEvent(r.VerifyRecoveryCode,_)(l)}),a.on(r.Cancel,()=>{this.createIntermediaryEvent(r.Cancel,_)()})),a}getMetadata(){let t=this.utils.createJsonRpcRequestPayload("magic_user_get_webauthn_credentials",[]);return this.request(t)}};export{y as PasskeyExtension};
|
|
2
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/index.ts", "../../../../@magic-sdk/types/src/core/exception-types.ts", "../../../../@magic-sdk/types/src/core/json-rpc-types.ts", "../../../../@magic-sdk/types/src/core/message-types.ts", "../../../../@magic-sdk/types/src/core/deep-link-pages.ts", "../../../../@magic-sdk/types/src/modules/auth-types.ts", "../../../../@magic-sdk/types/src/modules/rpc-provider-types.ts", "../../../../@magic-sdk/types/src/modules/user-types.ts", "../../../../@magic-sdk/types/src/modules/nft-types.ts", "../../../../@magic-sdk/types/src/modules/wallet-types.ts", "../../../../@magic-sdk/types/src/modules/common-types.ts", "../../../../@magic-sdk/types/src/modules/oauth-types.ts", "../../../../@magic-sdk/types/src/modules/webauthn-types.ts", "../../src/utils/base64.ts", "../../src/utils/polyfills.ts"],
|
|
4
|
+
"sourcesContent": ["import { Extension } from '@magic-sdk/provider';\nimport {\n RegisterNewUserConfiguration,\n MagicPasskeyPayloadMethod,\n PasskeySDKErrorCode,\n LoginWithPasskeyConfiguration,\n} from './types';\nimport { PasskeyResult, PasskeyEventHandlers, PasskeyMFAEventEmit, PasskeyMFAEventOnReceived } from '@magic-sdk/types';\nimport { toJSON } from './utils/polyfills';\n\nexport class PasskeyExtension extends Extension.Internal<'passkey', any> {\n name = 'passkey' as const;\n config: any = {};\n\n private createPasskeyNotSupportError() {\n this.createError(PasskeySDKErrorCode.PasskeyNotSupported, 'Passkey is not supported in this device.', {});\n }\n\n private createPasskeyCreateCredentialError(message: string) {\n this.createError(PasskeySDKErrorCode.PasskeyRegisterError, `Error creating credential: ${message}`, {});\n }\n\n public async registerNewUser(configuration?: RegisterNewUserConfiguration) {\n if (!window.PublicKeyCredential) {\n throw this.createPasskeyNotSupportError();\n }\n const { username, nickname = '', skipDIDToken, lifespan } = configuration ?? {};\n\n const { registrationOptions, registrationToken } = await this.request<any>(\n this.utils.createJsonRpcRequestPayload(MagicPasskeyPayloadMethod.RegisterPasskeyStart, [{ username }]),\n );\n\n let credential;\n try {\n credential = (await navigator.credentials.create({\n publicKey: registrationOptions,\n })) as any;\n } catch (err: any) {\n throw this.createPasskeyCreateCredentialError(err);\n }\n\n return this.request<string | null>(\n this.utils.createJsonRpcRequestPayload(MagicPasskeyPayloadMethod.RegisterPasskeyVerify, [\n {\n registrationToken,\n registrationResponse: toJSON(credential),\n nickname,\n transport: credential.response.getTransports(),\n userAgent: navigator.userAgent,\n skipDIDToken,\n lifespan,\n },\n ]),\n );\n }\n\n public login(configuration?: LoginWithPasskeyConfiguration) {\n const { username, showMfaModal, skipDIDToken, lifespan } = configuration ?? {};\n\n let verifyPayloadId: string;\n\n const promiEvent = this.utils.createPromiEvent<PasskeyResult, PasskeyEventHandlers>(async (resolve, reject) => {\n if (!window.PublicKeyCredential) {\n return reject(this.createPasskeyNotSupportError());\n }\n\n const { authenticationToken, authenticationOptions } = await this.request<any>(\n this.utils.createJsonRpcRequestPayload(MagicPasskeyPayloadMethod.LoginWithPasskeyStart, [{ username }]),\n );\n\n let assertion;\n try {\n assertion = (await navigator.credentials.get({\n publicKey: authenticationOptions,\n })) as any;\n } catch (err: any) {\n return reject(this.createPasskeyCreateCredentialError(err));\n }\n\n const requestPayload = this.utils.createJsonRpcRequestPayload(MagicPasskeyPayloadMethod.LoginWithPasskeyVerify, [\n {\n authenticationToken,\n assertionResponse: toJSON(assertion),\n showUI: showMfaModal,\n skipDIDToken,\n lifespan,\n },\n ]);\n\n verifyPayloadId = requestPayload.id as string;\n\n const loginRequest = this.request<PasskeyResult, PasskeyEventHandlers>(requestPayload);\n\n if (!showMfaModal) {\n loginRequest.on(PasskeyMFAEventOnReceived.MfaSentHandle, () => {\n promiEvent.emit(PasskeyMFAEventOnReceived.MfaSentHandle);\n });\n loginRequest.on(PasskeyMFAEventOnReceived.InvalidMfaOtp, () => {\n promiEvent.emit(PasskeyMFAEventOnReceived.InvalidMfaOtp);\n });\n loginRequest.on(PasskeyMFAEventOnReceived.RecoveryCodeSentHandle, () => {\n promiEvent.emit(PasskeyMFAEventOnReceived.RecoveryCodeSentHandle);\n });\n loginRequest.on(PasskeyMFAEventOnReceived.InvalidRecoveryCode, () => {\n promiEvent.emit(PasskeyMFAEventOnReceived.InvalidRecoveryCode);\n });\n loginRequest.on(PasskeyMFAEventOnReceived.RecoveryCodeSuccess, () => {\n promiEvent.emit(PasskeyMFAEventOnReceived.RecoveryCodeSuccess);\n });\n }\n\n try {\n const result = await loginRequest;\n resolve(result);\n } catch (error) {\n reject(error);\n }\n });\n\n if (!showMfaModal && promiEvent) {\n promiEvent.on(PasskeyMFAEventEmit.VerifyMFACode, (mfa: string) => {\n this.createIntermediaryEvent(PasskeyMFAEventEmit.VerifyMFACode, verifyPayloadId)(mfa);\n });\n promiEvent.on(PasskeyMFAEventEmit.LostDevice, () => {\n this.createIntermediaryEvent(PasskeyMFAEventEmit.LostDevice, verifyPayloadId)();\n });\n promiEvent.on(PasskeyMFAEventEmit.VerifyRecoveryCode, (recoveryCode: string) => {\n this.createIntermediaryEvent(PasskeyMFAEventEmit.VerifyRecoveryCode, verifyPayloadId)(recoveryCode);\n });\n promiEvent.on(PasskeyMFAEventEmit.Cancel, () => {\n this.createIntermediaryEvent(PasskeyMFAEventEmit.Cancel, verifyPayloadId)();\n });\n }\n\n return promiEvent;\n }\n\n public getMetadata() {\n const requestPayload = this.utils.createJsonRpcRequestPayload(MagicPasskeyPayloadMethod.GetPasskeyInfo, []);\n return this.request<any[]>(requestPayload);\n }\n}\n", "export enum SDKErrorCode {\n MissingApiKey = 'MISSING_API_KEY',\n ModalNotReady = 'MODAL_NOT_READY',\n ConnectionLost = 'CONNECTION_WAS_LOST',\n MalformedResponse = 'MALFORMED_RESPONSE',\n InvalidArgument = 'INVALID_ARGUMENT',\n ExtensionNotInitialized = 'EXTENSION_NOT_INITIALIZED',\n IncompatibleExtensions = 'INCOMPATIBLE_EXTENSIONS',\n}\n\nexport enum SDKWarningCode {\n SyncWeb3Method = 'SYNC_WEB3_METHOD',\n DuplicateIframe = 'DUPLICATE_IFRAME',\n ReactNativeEndpointConfiguration = 'REACT_NATIVE_ENDPOINT_CONFIGURATION',\n DeprecationNotice = 'DEPRECATION_NOTICE',\n ProductAnnouncement = 'ANNOUNCEMENT',\n}\n\nexport enum RPCErrorCode {\n // Standard JSON RPC 2.0 Error Codes\n ParseError = -32700,\n InvalidRequest = -32600,\n MethodNotFound = -32601,\n InvalidParams = -32602,\n InternalError = -32603,\n\n // Custom RPC Error Codes\n MagicLinkFailedVerification = -10000,\n MagicLinkExpired = -10001,\n MagicLinkRateLimited = -10002,\n UserAlreadyLoggedIn = -10003,\n UpdateEmailFailed = -10004,\n UserRequestEditEmail = -10005,\n MagicLinkInvalidRedirectURL = -10006,\n InactiveRecipient = -10010,\n AccessDeniedToUser = -10011,\n UserRejectedAction = -10012,\n RequestCancelled = -10014,\n RedirectLoginComplete = -10015,\n SessionTerminated = -10016,\n PopupRequestOverriden = -10017,\n SanEmail = -10018,\n DpopInvalidated = -10019,\n MaxAttemptsReached = -10031,\n UserRequiredMfa = -10033,\n}\n\nexport type ErrorCode = SDKErrorCode | RPCErrorCode;\nexport type WarningCode = SDKWarningCode;\n", "import { RPCErrorCode } from './exception-types';\n\n// --- Request interfaces\n\nexport interface JsonRpcRequestPayload<TParams = any> {\n jsonrpc: string;\n id: string | number | null;\n method: string;\n params?: TParams;\n}\n\nexport interface JsonRpcRequestCallback {\n /** Callback executed upon JSON RPC response. */\n (err: JsonRpcError | null, result?: JsonRpcResponsePayload | null): void;\n}\n\nexport interface JsonRpcBatchRequestCallback {\n /** Callback executed upon JSON RPC response. */\n (err: JsonRpcError | null, result?: (JsonRpcResponsePayload | null)[] | null): void;\n}\n\n// --- Response interfaces\n\nexport interface JsonRpcError {\n message: string;\n code: RPCErrorCode;\n data?: any;\n}\n\nexport interface JsonRpcResponsePayload<ResultType = any> {\n jsonrpc: string;\n id: string | number | null;\n result?: ResultType | null;\n error?: JsonRpcError | null;\n}\n\nexport interface UserInfo {\n email?: string;\n}\n\nexport type ShowUIPromiEvents = {\n disconnect: () => void;\n};\n\nexport interface RequestUserInfoScope {\n scope?: {\n email?: 'required' | 'optional';\n };\n}\n\nexport enum LocalStorageKeys {\n PROVIDER = 'magic_3pw_provider',\n ADDRESS = 'magic_3pw_address',\n CHAIN_ID = 'magic_3pw_chainId',\n}\n\nexport enum ThirdPartyWalletEvents {\n WalletConnected = 'wallet_connected',\n WalletRejected = 'wallet_rejected',\n Web3ModalSelected = 'web3modal_selected',\n}\n\nexport interface ConnectWithUIOptions {\n autoPromptThirdPartyWallets?: boolean;\n}\n\nexport type ConnectWithUiEvents = {\n 'id-token-created': (params: { idToken: string }) => void;\n} & { [key in ThirdPartyWalletEvents]: () => void };\n\n// --- Payload methods\n\n/**\n * Enum of JSON RPC methods for interacting with the Magic SDK authentication\n * relayer.\n */\nexport enum MagicPayloadMethod {\n LoginWithSms = 'magic_auth_login_with_sms',\n LoginWithEmailOTP = 'magic_auth_login_with_email_otp',\n LoginWithMagicLink = 'magic_auth_login_with_magic_link',\n LoginWithCredential = 'magic_auth_login_with_credential',\n SetAuthorizationToken = 'magic_auth_set_authorization_token',\n GetIdToken = 'magic_auth_get_id_token',\n GenerateIdToken = 'magic_auth_generate_id_token',\n GetMetadata = 'magic_auth_get_metadata',\n IsLoggedIn = 'magic_is_logged_in',\n Logout = 'magic_auth_logout',\n UpdateEmail = 'magic_auth_update_email',\n UserSettings = 'magic_auth_settings',\n UserSettingsTestMode = 'magic_auth_settings_testing_mode',\n LoginWithSmsTestMode = 'magic_auth_login_with_sms_testing_mode',\n LoginWithEmailOTPTestMode = 'magic_auth_login_with_email_otp_testing_mode',\n LoginWithMagicLinkTestMode = 'magic_login_with_magic_link_testing_mode',\n LoginWithCredentialTestMode = 'magic_auth_login_with_credential_testing_mode',\n GetIdTokenTestMode = 'magic_auth_get_id_token_testing_mode',\n GenerateIdTokenTestMode = 'magic_auth_generate_id_token_testing_mode',\n GetMetadataTestMode = 'magic_auth_get_metadata_testing_mode',\n IsLoggedInTestMode = 'magic_auth_is_logged_in_testing_mode',\n LogoutTestMode = 'magic_auth_logout_testing_mode',\n UpdateEmailTestMode = 'magic_auth_update_email_testing_mode',\n IntermediaryEvent = 'magic_intermediary_event',\n RequestAccounts = 'eth_requestAccounts',\n GetInfo = 'magic_get_info',\n ShowUI = 'magic_wallet',\n NFTPurchase = 'magic_nft_purchase',\n NFTCheckout = 'magic_nft_checkout',\n NFTTransfer = 'magic_nft_transfer',\n RequestUserInfoWithUI = 'mc_request_user_info',\n Disconnect = 'mc_disconnect',\n // UpdatePhoneNumber = 'magic_auth_update_phone_number',\n // UpdatePhoneNumberTestMode = 'magic_auth_update_phone_number_testing_mode',\n RecoverAccount = 'magic_auth_recover_account',\n RecoverAccountTestMode = 'magic_auth_recover_account_testing_mode',\n MagicBoxHeartBeat = 'magic_box_heart_beat',\n AutoConnect = 'mc_auto_connect',\n Login = 'mc_login',\n EncryptV1 = 'magic_auth_encrypt_v1',\n DecryptV1 = 'magic_auth_decrypt_v1',\n ShowNFTs = 'magic_show_nfts',\n ShowOnRamp = 'magic_show_fiat_onramp',\n ShowSendTokensUI = 'magic_show_send_tokens_ui',\n ShowAddress = 'magic_show_address',\n ShowBalances = 'magic_show_balances',\n RevealPK = 'magic_reveal_key',\n EnableMFA = 'magic_auth_enable_mfa_flow',\n DisableMFA = 'magic_auth_disable_mfa_flow',\n GetMultichainPublicAddress = 'magic_get_multichain_public_address',\n Sign7702Authorization = 'magic_wallet_sign_7702_authorization',\n Send7702Transaction = 'eth_send7702Transaction',\n}\n\n// Methods to not route if connected to third party wallet\nexport const routeToMagicMethods = [\n MagicPayloadMethod.IntermediaryEvent,\n MagicPayloadMethod.NFTCheckout,\n MagicPayloadMethod.Login,\n];\n", "import { JsonRpcResponsePayload, JsonRpcError, JsonRpcRequestPayload } from './json-rpc-types';\n\nexport enum MagicIncomingWindowMessage {\n MAGIC_HANDLE_RESPONSE = 'MAGIC_HANDLE_RESPONSE',\n MAGIC_OVERLAY_READY = 'MAGIC_OVERLAY_READY',\n MAGIC_SHOW_OVERLAY = 'MAGIC_SHOW_OVERLAY',\n MAGIC_HIDE_OVERLAY = 'MAGIC_HIDE_OVERLAY',\n MAGIC_HANDLE_EVENT = 'MAGIC_HANDLE_EVENT',\n MAGIC_MG_BOX_SEND_RECEIPT = 'MAGIC_MG_BOX_SEND_RECEIPT',\n MAGIC_SEND_PRODUCT_ANNOUNCEMENT = 'MAGIC_SEND_PRODUCT_ANNOUNCEMENT',\n MAGIC_PONG = 'MAGIC_PONG',\n MAGIC_POPUP_RESPONSE = 'MAGIC_POPUP_RESPONSE',\n MAGIC_POPUP_OAUTH_VERIFY_RESPONSE = 'MAGIC_POPUP_OAUTH_VERIFY_RESPONSE',\n MAGIC_THIRD_PARTY_WALLET_REQUEST = 'MAGIC_THIRD_PARTY_WALLET_REQUEST',\n MAGIC_OPEN_MOBILE_URL = 'MAGIC_OPEN_MOBILE_URL',\n}\n\nexport enum MagicOutgoingWindowMessage {\n MAGIC_HANDLE_REQUEST = 'MAGIC_HANDLE_REQUEST',\n MAGIC_THIRD_PARTY_WALLET_RESPONSE = 'MAGIC_THIRD_PARTY_WALLET_RESPONSE',\n MAGIC_THIRD_PARTY_WALLET_UPDATE = 'MAGIC_THIRD_PARTY_WALLET_EVENT',\n MAGIC_PING = 'MAGIC_PING',\n}\n\n/** The shape of responding window message data from the Magic iframe context. */\nexport interface MagicMessageRequest {\n msgType: string;\n payload: JsonRpcRequestPayload | JsonRpcRequestPayload[];\n rt?: string;\n jwt?: string;\n deviceShare?: string;\n}\n\n/** The shape of responding window message data from the Magic iframe context. */\nexport interface MagicMessageResponse<ResultType = any> {\n msgType: string;\n response: Partial<JsonRpcError> & Partial<JsonRpcResponsePayload<ResultType>>;\n rt?: string;\n deviceShare?: string;\n}\n\n/** The expected message event returned by the Magic iframe context. */\nexport interface MagicMessageEvent extends Partial<MessageEvent> {\n data: MagicMessageResponse;\n}\n\nexport interface MagicThirdPartyWalletRequest {\n msgType: MagicIncomingWindowMessage.MAGIC_THIRD_PARTY_WALLET_REQUEST;\n payload: JsonRpcRequestPayload;\n}\n\nexport interface MagicThirdPartyWalletResponse {\n msgType: `${MagicOutgoingWindowMessage.MAGIC_THIRD_PARTY_WALLET_RESPONSE}-${string}`;\n response: JsonRpcResponsePayload;\n}\n\nexport interface MagicThirdPartyWalletUpdate {\n msgType: `${MagicOutgoingWindowMessage.MAGIC_THIRD_PARTY_WALLET_UPDATE}-${string}`;\n details: {\n address: `0x${string}` | undefined;\n addresses: readonly `0x${string}`[] | undefined;\n chain: { id: number; name: string; [key: string]: unknown } | undefined;\n updatedField: 'chain' | 'address';\n };\n}\n\nexport type MagicThirdPartyWalletEventPayload = MagicThirdPartyWalletResponse | MagicThirdPartyWalletUpdate;\n", "export enum DeepLinkPage {\n UpdateEmail = 'update-email',\n MFA = 'mfa',\n Recovery = 'recovery',\n}\n", "import { WalletEventOnReceived } from './wallet-types';\n\nexport interface LoginWithMagicLinkConfiguration {\n /**\n * The email address of the user attempting to login.\n */\n email: string;\n\n /**\n * When `true`, a pre-built modal interface will show to the user, directing\n * them to check their email for the \"magic link\" to complete their\n * authentication.\n */\n showUI?: boolean;\n\n /**\n * You can optionally provide a redirect URI that will be followed at the end\n * of the magic link flow. Don't forget to invoke\n * `magic.auth.loginWithCredential()` to complete the login from the route you\n * configure here.\n */\n redirectURI?: string;\n\n /**\n * Enterprise users with a custom SMTP can create custom email templates\n * from their dashboard. The default Magic loginWithMagicLink email will be\n * overridden when a variation is passed here.\n */\n overrides?: {\n variation?: string;\n };\n\n /**\n * The number of seconds until the generated Decentralized ID token will expire.\n */\n lifespan?: number;\n}\n\nexport interface LoginWithSmsConfiguration {\n /**\n * Specify the phone number of the user attempting to login.\n */\n phoneNumber: string;\n\n /**\n * When `true`, a pre-built modal interface will show to the user, directing\n * them to check their SMS for the one time passcode (OTP) to complete their\n * authentication.\n *\n * When `false`, developers will be able to implement their own custom UI to\n * continue the SMS OTP flow.\n */\n showUI?: boolean;\n\n /*\n * The number of seconds until the generated Decentralized ID token will expire.\n */\n lifespan?: number;\n}\nexport interface LoginWithEmailOTPConfiguration {\n /**\n * Specify the email address of the user attempting to login.\n */\n email: string;\n\n /**\n * When `true`, a pre-built modal interface will show to the user, directing\n * them to check their email for the one time passcode (OTP) to complete their\n * authentication.\n *\n * When `false`, developers will be able to implement their own custom UI to\n * continue the email OTP flow.\n */\n showUI?: boolean;\n\n /**\n * Device Unrecognized UI will enforce showing up to secure user's login\n *\n * When set to true (default), an improved device recognition UI will be displayed to the user,\n * prompting them to verify their login by checking their email for device approval. This feature\n * enhances authentication security.\n *\n * This param will only be affected if showUI is false. When set to false,\n * developers have the flexibility to implement their own customized UI to\n * handle device check events, providing a more tailored user experience.\n */\n deviceCheckUI?: boolean;\n\n /**\n * Enterprise users with a custom SMTP can create custom email templates\n * from their dashboard. The default Magic loginWithOTP email will be\n * overridden when a variation is passed here.\n */\n overrides?: {\n variation?: string;\n appName?: string;\n assetUrl?: string;\n };\n\n /**\n * The number of seconds until the generated Decentralized ID token will expire.\n */\n lifespan?: number;\n}\n\nexport interface LoginWithCredentialConfiguration {\n /**\n * A credential token or a valid query string (prefixed with ? or #)\n */\n credentialOrQueryString?: string;\n\n /**\n * The number of seconds until the generated Decentralized ID token will expire.\n */\n lifespan?: number;\n}\n\nexport interface EnableMFAConfiguration {\n /**\n * When `true`, a pre-built modal interface will show to the user, directing\n * them to enable MFA using Google Authenticator app.\n *\n * When `false`, developers will be able to implement their own custom UI to\n * continue the enable MFA flow.\n */\n showUI?: boolean;\n}\n\nexport interface DisableMFAConfiguration {\n /**\n * When `true`, a pre-built modal interface will show to the user, directing\n * them to disable MFA.\n *\n * When `false`, developers will be able to implement their own custom UI to\n * continue the disable MFA flow.\n */\n showUI?: boolean;\n}\n\n/**\n * Auth Events Enum\n */\nexport enum LoginWithMagicLinkEventEmit {\n Retry = 'retry',\n}\n\nexport enum LoginWithMagicLinkEventOnReceived {\n EmailSent = 'email-sent',\n EmailNotDeliverable = 'email-not-deliverable',\n}\n\nexport enum LoginWithEmailOTPEventEmit {\n VerifyEmailOtp = 'verify-email-otp',\n VerifyMFACode = 'verify-mfa-code',\n LostDevice = 'lost-device',\n VerifyRecoveryCode = 'verify-recovery-code',\n Cancel = 'cancel',\n}\n\nexport enum LoginWithSmsOTPEventEmit {\n VerifySmsOtp = 'verify-sms-otp',\n VerifyMFACode = 'verify-mfa-code',\n LostDevice = 'lost-device',\n VerifyRecoveryCode = 'verify-recovery-code',\n Cancel = 'cancel',\n Retry = 'retry',\n}\n\nexport enum LoginWithSmsOTPEventOnReceived {\n SmsOTPSent = 'sms-otp-sent',\n InvalidSmsOtp = 'invalid-sms-otp',\n ExpiredSmsOtp = 'expired-sms-otp',\n MfaSentHandle = 'mfa-sent-handle',\n InvalidMfaOtp = 'invalid-mfa-otp',\n LoginThrottled = 'login-throttled',\n RecoveryCodeSentHandle = 'recovery-code-sent-handle',\n InvalidRecoveryCode = 'invalid-recovery-code',\n RecoveryCodeSuccess = 'recovery-code-success',\n}\n\nexport enum LoginWithEmailOTPEventOnReceived {\n EmailOTPSent = 'email-otp-sent',\n InvalidEmailOtp = 'invalid-email-otp',\n InvalidMfaOtp = 'invalid-mfa-otp',\n ExpiredEmailOtp = 'expired-email-otp',\n MfaSentHandle = 'mfa-sent-handle',\n RecoveryCodeSentHandle = 'recovery-code-sent-handle',\n InvalidRecoveryCode = 'invalid-recovery-code',\n RecoveryCodeSuccess = 'recovery-code-success',\n LoginThrottled = 'login-throttled',\n MaxAttemptsReached = 'max-attempts-reached',\n}\n\nexport enum DeviceVerificationEventEmit {\n Retry = 'device-retry',\n}\n\nexport enum DeviceVerificationEventOnReceived {\n DeviceApproved = 'device-approved',\n DeviceNeedsApproval = 'device-needs-approval',\n DeviceVerificationLinkExpired = 'device-verification-link-expired',\n DeviceVerificationEmailSent = 'device-verification-email-sent',\n}\n\nexport enum RecencyCheckEventEmit {\n Retry = 'Recency/auth-factor-retry',\n Cancel = 'Recency/auth-factor-verification-cancel',\n VerifyEmailOtp = 'Recency/auth-factor-verify-email-otp',\n VerifyMFACode = 'Recency/verify-mfa-code',\n}\n\nexport enum RecencyCheckEventOnReceived {\n PrimaryAuthFactorNeedsVerification = 'Recency/auth-factor-needs-verification',\n PrimaryAuthFactorVerified = 'Recency/auth-factor-verified',\n InvalidEmailOtp = 'Recency/auth-factor-invalid-email-otp',\n EmailExpired = 'Recency/auth-factor-verification-email-expired',\n EmailSent = 'Recency/auth-factor-verification-email-sent',\n EmailNotDeliverable = 'Recency/auth-factor-verification-email-not-deliverable',\n}\n\nexport enum UpdateEmailEventEmit {\n RetryWithNewEmail = 'UpdateEmail/retry-with-new-email',\n Cancel = 'UpdateEmail/new-email-verification-cancel',\n VerifyEmailOtp = 'UpdateEmail/new-email-verify-otp',\n}\n\nexport enum UpdateEmailEventOnReceived {\n NewAuthFactorNeedsVerification = 'UpdateEmail/new-email-needs-verification',\n EmailUpdated = 'UpdateEmail/email-updated',\n InvalidEmailOtp = 'UpdateEmail/new-email-invalid-email-otp',\n EmailExpired = 'UpdateEmail/new-email-verification-email-expired',\n EmailSent = 'UpdateEmail/new-email-verification-email-sent',\n EmailNotDeliverable = 'UpdateEmail/new-email-verification-email-not-deliverable',\n InvalidEmail = 'UpdateEmail/new-email-invalid',\n EmailAlreadyExists = 'UpdateEmail/new-email-already-exists',\n}\n\nexport enum AuthEventOnReceived {\n IDTokenCreated = 'Auth/id-token-created',\n}\n\nexport enum FarcasterLoginEventEmit {\n Cancel = 'Farcaster/cancel',\n}\n\nexport enum EnableMFAEventOnReceived {\n MFASecretGenerated = 'mfa-secret-generated',\n InvalidMFAOtp = 'invalid-mfa-otp',\n MFARecoveryCodes = 'mfa-recovery-codes',\n}\nexport enum EnableMFAEventEmit {\n VerifyMFACode = 'verify-mfa-code',\n Cancel = 'cancel-mfa-setup',\n}\n\nexport enum DisableMFAEventOnReceived {\n MFACodeRequested = 'mfa-code-requested',\n InvalidMFAOtp = 'invalid-mfa-otp',\n InvalidRecoveryCode = 'invalid-recovery-code',\n}\n\nexport enum DisableMFAEventEmit {\n VerifyMFACode = 'verify-mfa-code',\n LostDevice = 'lost-device',\n Cancel = 'cancel-mfa-disable',\n}\n\n/**\n * EventHandlers\n */\nexport type LoginWithMagicLinkEventHandlers = {\n // Event Received\n [LoginWithMagicLinkEventOnReceived.EmailSent]: () => void;\n [LoginWithMagicLinkEventOnReceived.EmailNotDeliverable]: () => void;\n\n // Event sent\n [LoginWithMagicLinkEventEmit.Retry]: () => void;\n} & DeviceVerificationEventHandlers;\n\nexport type LoginWithSmsOTPEventHandlers = {\n // Event sent\n [LoginWithSmsOTPEventEmit.VerifySmsOtp]: (otp: string) => void;\n [LoginWithSmsOTPEventEmit.VerifyMFACode]: (mfa: string) => void;\n [LoginWithSmsOTPEventEmit.LostDevice]: () => void;\n [LoginWithSmsOTPEventEmit.VerifyRecoveryCode]: (recoveryCode: string) => void;\n [LoginWithSmsOTPEventEmit.Cancel]: () => void;\n [LoginWithSmsOTPEventEmit.Retry]: () => void;\n\n // Event received\n [LoginWithSmsOTPEventOnReceived.SmsOTPSent]: () => void;\n [LoginWithSmsOTPEventOnReceived.InvalidSmsOtp]: () => void;\n [LoginWithSmsOTPEventOnReceived.ExpiredSmsOtp]: () => void;\n [LoginWithSmsOTPEventOnReceived.MfaSentHandle]: () => void;\n [LoginWithSmsOTPEventOnReceived.InvalidMfaOtp]: () => void;\n [LoginWithSmsOTPEventOnReceived.LoginThrottled]: () => void;\n [LoginWithSmsOTPEventOnReceived.RecoveryCodeSentHandle]: () => void;\n [LoginWithSmsOTPEventOnReceived.InvalidRecoveryCode]: () => void;\n [LoginWithSmsOTPEventOnReceived.RecoveryCodeSuccess]: () => void;\n} & DeviceVerificationEventHandlers;\n\nexport type LoginWithEmailOTPEventHandlers = {\n // Event Received\n [LoginWithEmailOTPEventOnReceived.EmailOTPSent]: () => void;\n [LoginWithEmailOTPEventOnReceived.LoginThrottled]: () => void;\n [LoginWithEmailOTPEventOnReceived.InvalidEmailOtp]: () => void;\n [LoginWithEmailOTPEventOnReceived.InvalidMfaOtp]: () => void;\n [LoginWithEmailOTPEventOnReceived.ExpiredEmailOtp]: () => void;\n [LoginWithEmailOTPEventOnReceived.MfaSentHandle]: () => void;\n [LoginWithEmailOTPEventOnReceived.RecoveryCodeSentHandle]: () => void;\n [LoginWithEmailOTPEventOnReceived.InvalidRecoveryCode]: () => void;\n [LoginWithEmailOTPEventOnReceived.RecoveryCodeSuccess]: () => void;\n [LoginWithEmailOTPEventOnReceived.MaxAttemptsReached]: () => void;\n [AuthEventOnReceived.IDTokenCreated]: (idToken: string) => void;\n [WalletEventOnReceived.WalletInfoFetched]: () => void;\n\n // Event sent\n [LoginWithEmailOTPEventEmit.VerifyEmailOtp]: (otp: string) => void;\n [LoginWithEmailOTPEventEmit.VerifyMFACode]: (mfa: string) => void;\n [LoginWithEmailOTPEventEmit.LostDevice]: () => void;\n [LoginWithEmailOTPEventEmit.VerifyRecoveryCode]: (recoveryCode: string) => void;\n [LoginWithEmailOTPEventEmit.Cancel]: () => void;\n} & DeviceVerificationEventHandlers;\n\ntype DeviceVerificationEventHandlers = {\n // Event Received\n [DeviceVerificationEventOnReceived.DeviceNeedsApproval]: () => void;\n [DeviceVerificationEventOnReceived.DeviceVerificationEmailSent]: () => void;\n [DeviceVerificationEventOnReceived.DeviceVerificationLinkExpired]: () => void;\n [DeviceVerificationEventOnReceived.DeviceApproved]: () => void;\n\n // Event sent\n [DeviceVerificationEventEmit.Retry]: () => void;\n};\n\n/**\n * Update Email\n */\n\nexport type RecencyCheckEventHandlers = {\n [RecencyCheckEventOnReceived.PrimaryAuthFactorNeedsVerification]: () => void;\n [RecencyCheckEventOnReceived.PrimaryAuthFactorVerified]: () => void;\n [RecencyCheckEventOnReceived.InvalidEmailOtp]: () => void;\n [RecencyCheckEventOnReceived.EmailNotDeliverable]: () => void;\n [RecencyCheckEventOnReceived.EmailExpired]: () => void;\n [RecencyCheckEventOnReceived.EmailSent]: () => void;\n\n [RecencyCheckEventEmit.Cancel]: () => void;\n [RecencyCheckEventEmit.Retry]: () => void;\n [RecencyCheckEventEmit.VerifyEmailOtp]: (otp: string) => void;\n [RecencyCheckEventEmit.VerifyMFACode]: (mfa: string) => void;\n};\n\nexport type UpdateEmailEventHandlers = {\n [UpdateEmailEventOnReceived.NewAuthFactorNeedsVerification]: () => void;\n [UpdateEmailEventOnReceived.EmailUpdated]: () => void;\n [UpdateEmailEventOnReceived.InvalidEmailOtp]: () => void;\n [UpdateEmailEventOnReceived.EmailNotDeliverable]: () => void;\n [UpdateEmailEventOnReceived.EmailExpired]: () => void;\n [UpdateEmailEventOnReceived.EmailSent]: () => void;\n [UpdateEmailEventOnReceived.InvalidEmail]: () => void;\n [UpdateEmailEventOnReceived.EmailAlreadyExists]: () => void;\n\n [UpdateEmailEventEmit.Cancel]: () => void;\n [UpdateEmailEventEmit.RetryWithNewEmail]: (email?: string) => void;\n [UpdateEmailEventEmit.VerifyEmailOtp]: (otp: string) => void;\n} & RecencyCheckEventHandlers;\n\n/**\n * Enable MFA\n */\n\nexport type EnableMFAEventHandlers = {\n // Event Received\n [EnableMFAEventOnReceived.MFASecretGenerated]: ({ QRCode, key }: { QRCode: string; key: string }) => void;\n [EnableMFAEventOnReceived.InvalidMFAOtp]: ({ errorCode }: { errorCode: string }) => void;\n [EnableMFAEventOnReceived.MFARecoveryCodes]: ({ recoveryCode }: { recoveryCode: string }) => void;\n\n // Event sent\n [EnableMFAEventEmit.VerifyMFACode]: (totp: string) => void;\n [EnableMFAEventEmit.Cancel]: () => void;\n};\n\n/**\n * Disable MFA\n */\n\nexport type DisableMFAEventHandlers = {\n // Event Received\n [DisableMFAEventOnReceived.MFACodeRequested]: () => void;\n [DisableMFAEventOnReceived.InvalidMFAOtp]: ({ errorCode }: { errorCode: string }) => void;\n [DisableMFAEventOnReceived.InvalidRecoveryCode]: () => void;\n\n // Event sent\n [DisableMFAEventEmit.VerifyMFACode]: (totp: string) => void;\n [DisableMFAEventEmit.LostDevice]: (recoveryCode: string) => void;\n [DisableMFAEventEmit.Cancel]: () => void;\n};\n", "export type EthNetworkName = 'mainnet' | 'goerli' | 'sepolia';\n\nexport enum EthChainType {\n Harmony = 'HARMONY',\n}\n\nexport interface CustomNodeConfiguration {\n rpcUrl: string;\n chainId?: number;\n chainType?: EthChainType;\n}\n\nexport type EthNetworkConfiguration = EthNetworkName | CustomNodeConfiguration;\n\nexport type ProviderEnableEvents = {\n 'id-token-created': (params: { idToken: string }) => void;\n};\n", "import { RecencyCheckEventHandlers } from './auth-types';\nimport { DeepLinkPage } from '../core/deep-link-pages';\n\nexport interface GetIdTokenConfiguration {\n /**\n * The number of seconds until the generated ID token will expire.\n */\n lifespan?: number;\n}\n\nexport interface GenerateIdTokenConfiguration extends GetIdTokenConfiguration {\n /**\n * An optional piece of data to sign with the token. Note, however, that the\n * unsigned data _will not_ be encoded in the token, only an encrypted\n * signature of the data.\n */\n attachment?: string;\n}\n\nexport enum UserEventsEmit {\n ClosedByUser = 'closed-by-user',\n}\n\nexport enum UserEventsOnReceived {\n ClosedByUser = 'closed-by-user-on-received',\n}\n\nexport interface ChainWalletInfo {\n publicAddress: string | null;\n subAccounts: Array<{ name: string; publicAddress: string }>;\n}\n\nexport interface MagicUserMetadata {\n issuer: string | null;\n email: string | null;\n phoneNumber: string | null;\n isMfaEnabled: boolean;\n recoveryFactors: [RecoveryFactor] | [];\n firstLoginAt: string | null;\n wallets: {\n ethereum?: ChainWalletInfo;\n algorand?: ChainWalletInfo;\n aptos?: ChainWalletInfo;\n avalancheX?: ChainWalletInfo;\n bitcoin?: ChainWalletInfo;\n conflux?: ChainWalletInfo;\n cosmos?: ChainWalletInfo;\n flow?: ChainWalletInfo;\n harmony?: ChainWalletInfo;\n hedera?: ChainWalletInfo;\n icon?: ChainWalletInfo;\n kadena?: ChainWalletInfo;\n near?: ChainWalletInfo;\n polkadot?: ChainWalletInfo;\n solana?: ChainWalletInfo;\n sui?: ChainWalletInfo;\n taquito?: ChainWalletInfo;\n terra?: ChainWalletInfo;\n tezos?: ChainWalletInfo;\n zilliqa?: ChainWalletInfo;\n [chain: string]: ChainWalletInfo | undefined;\n };\n}\n\nexport enum RecoveryFactorEventOnReceived {\n EnterNewPhoneNumber = 'enter-new-phone-number',\n EnterOtpCode = 'enter-otp-code',\n RecoveryFactorAlreadyExists = 'recovery-factor-already-exists',\n MalformedPhoneNumber = 'malformed-phone-number',\n InvalidOtpCode = 'invalid-otp-code',\n RecoveryFactorUpdated = 'recovery-factor-updated',\n RecoveryFactorDeleted = 'recovery-factor-deleted',\n}\n\nexport enum RecoveryFactorEventEmit {\n SendNewPhoneNumber = 'send-new-phone-number',\n SendOtpCode = 'send-otp-code',\n Cancel = 'cancel',\n StartEditPhoneNumber = 'start-edit-phone-number',\n}\n\ntype RecoveryFactor = {\n type: RecoveryMethodType;\n value: string;\n};\n\nexport type RecoveryFactorEventHandlers = {\n // Event Received\n [RecoveryFactorEventEmit.SendNewPhoneNumber]: (phone_number: string) => void;\n [RecoveryFactorEventEmit.SendOtpCode]: (otp: string) => void;\n [RecoveryFactorEventEmit.StartEditPhoneNumber]: () => void;\n [RecoveryFactorEventEmit.Cancel]: () => void;\n\n // Event sent\n [RecoveryFactorEventOnReceived.EnterNewPhoneNumber]: () => void;\n [RecoveryFactorEventOnReceived.EnterOtpCode]: () => void;\n [RecoveryFactorEventOnReceived.RecoveryFactorAlreadyExists]: () => void;\n [RecoveryFactorEventOnReceived.MalformedPhoneNumber]: () => void;\n [RecoveryFactorEventOnReceived.InvalidOtpCode]: () => void;\n [RecoveryFactorEventOnReceived.RecoveryFactorUpdated]: (updatedFactor: { type: string; value: string }) => void;\n [RecoveryFactorEventOnReceived.RecoveryFactorDeleted]: () => void;\n} & RecencyCheckEventHandlers;\n\nexport enum RecoveryMethodType {\n PhoneNumber = 'phone_number',\n}\n\nexport interface UpdateEmailConfiguration {\n /**\n * The new email address to update to\n */\n email: string;\n\n /**\n * When `true`, a pre-built pending modal interface will\n * guide the user to check their new, followed by old emails\n * for confirmation emails.\n */\n showUI?: boolean;\n}\n\nexport interface UpdateWebAuthnInfoConfiguration {\n /**\n * WebAuthn info id\n */\n id: string;\n\n /**\n * nickname that user attempts to update to the webauth device associate to the id.\n */\n nickname: string;\n}\n\nexport interface RecoverAccountConfiguration {\n /**\n * The email to recover\n */\n email: string;\n showUI: boolean;\n}\n\nexport interface ShowSettingsConfiguration {\n /**\n * deep linking destination\n */\n page: DeepLinkPage;\n showUI?: boolean;\n}\n\nexport enum RecoverAccountEventOnReceived {\n SmsOtpSent = 'sms-otp-sent',\n LoginThrottled = 'login-throttled',\n InvalidSmsOtp = 'invalid-sms-otp',\n SmsVerified = 'sms-verified',\n AccountRecovered = 'account-recovered',\n UpdateEmailRequired = 'update-email-required',\n}\n\nexport enum RecoverAccountEventEmit {\n Cancel = 'cancel',\n VerifyOtp = 'verify-otp-code',\n ResendSms = 'resend-sms-otp',\n UpdateEmail = 'update-email',\n}\n\nexport type RecoverAccountEventHandlers = {\n // Event Received\n [RecoverAccountEventEmit.Cancel]: () => void;\n [RecoverAccountEventEmit.VerifyOtp]: (otp: string) => void;\n [RecoverAccountEventEmit.ResendSms]: () => void;\n [RecoverAccountEventEmit.UpdateEmail]: (email: string) => void;\n\n // Event sent\n [RecoverAccountEventOnReceived.SmsOtpSent]: ({ phoneNumber }: { phoneNumber: string }) => void;\n [RecoverAccountEventOnReceived.LoginThrottled]: (error: string) => void;\n [RecoverAccountEventOnReceived.InvalidSmsOtp]: ({\n errorMessage,\n errorCode,\n }: {\n errorMessage: string;\n errorCode: string;\n }) => void;\n [RecoverAccountEventOnReceived.SmsVerified]: () => void;\n [RecoverAccountEventOnReceived.AccountRecovered]: () => void;\n [RecoverAccountEventOnReceived.UpdateEmailRequired]: () => void;\n};\n", "export type NFTResponseStatus = 'cancelled' | 'pending' | 'processed' | 'declined' | 'expired';\n\nexport type NFTResponse = {\n status: NFTResponseStatus;\n};\n\nexport interface NFTPurchaseRequest {\n nft: {\n name: string;\n imageUrl: string;\n blockchainNftId: string;\n contractAddress: string;\n network: string;\n platform: string;\n type: string;\n };\n identityPrefill: {\n firstName: string;\n lastName: string;\n dateOfBirth: string; // YYYY-MM-DD\n emailAddress: string;\n phone: string;\n address: {\n street1: string;\n street2: string;\n city: string;\n regionCode: string;\n postalCode: string;\n countryCode: string;\n };\n };\n}\n\nexport type NFTPurchaseResponse = NFTResponse & {\n errorMessage?: string;\n};\n\nexport interface NFTCheckoutRequest {\n // given by magic / found in the developer dashboard in future\n contractId: string;\n // in contract, if ERC1155\u2026 for ERC721, use token ID = 0\n tokenId: string;\n name: string;\n imageUrl: string;\n quantity?: number; // default is 1\n walletAddress?: string; // default is user's wallet address\n // If enabled, the user will be able to pay with crypto. the default is false\n isCryptoCheckoutEnabled?: boolean;\n walletProvider?: 'magic' | 'web3modal';\n}\n\nexport type NFTCheckoutResponse = NFTResponse;\n\nexport type NFTCheckoutEvents = {\n disconnect: () => void;\n 'nft-checkout-initiated': (rawTransaction: string) => void;\n};\n\nexport interface NFTTransferRequest {\n tokenId: string;\n contractAddress: string;\n quantity?: number;\n recipient?: string;\n}\n\nexport type NFTTransferResponse = NFTResponse;\n\nexport enum NftCheckoutIntermediaryEvents {\n Success = 'nft-checkout-success',\n Failure = 'nft-checkout-failure',\n Initiated = 'nft-checkout-initiated',\n Disconnect = 'disconnect',\n}\n\nexport type NftCheckoutEventHandler = {\n [NftCheckoutIntermediaryEvents.Initiated]: (rawTransaction: string) => void;\n [NftCheckoutIntermediaryEvents.Success]: (signedTransaction: string) => void;\n [NftCheckoutIntermediaryEvents.Failure]: () => void;\n};\n", "export type AccessListEntry = { address: string; storageKeys: Array<string> };\n\n/**\n * An ordered collection of [[AccessList]] entries.\n */\nexport type AccessList = Array<AccessListEntry>;\n\nexport enum WalletEventOnReceived {\n WalletInfoFetched = 'Wallet/wallet-info-fetched',\n}\n\n/**\n * Request parameters for EIP-7702 authorization signing\n */\nexport interface Sign7702AuthorizationRequest {\n /**\n * The smart contract implementation address the EOA delegates to\n */\n contractAddress: string;\n\n /**\n * The chain ID for the network (use 0 for universal cross-chain authorization)\n */\n chainId: number;\n\n /**\n * The nonce for the EOA account (transaction count)\n */\n nonce?: number;\n}\n\n/**\n * Response from EIP-7702 authorization signing\n */\nexport interface Sign7702AuthorizationResponse {\n /**\n * The contract address that was authorized\n */\n contractAddress: string;\n\n /**\n * The chain ID for the authorization\n */\n chainId: number;\n\n /**\n * The nonce used in the authorization\n */\n nonce: number;\n\n /**\n * The v component of the signature (recovery id)\n */\n v: number;\n\n /**\n * The r component of the signature\n */\n r: string;\n\n /**\n * The s component of the signature\n */\n s: string;\n\n /**\n * Optional: Full signature as hex string\n */\n signature?: string;\n}\n\n/**\n * Request parameters for sending an EIP-7702 transaction with authorization list\n */\nexport interface Send7702TransactionRequest {\n /**\n * The recipient address\n */\n to: string;\n\n /**\n * The value to send in wei (as hex string)\n */\n value?: string;\n\n /**\n * The transaction data (calldata)\n */\n data?: string;\n\n /**\n * Gas limit for the transaction (as hex string)\n */\n gas?: string;\n\n /**\n * Gas limit for the transaction (alias for gas)\n */\n gasLimit?: string;\n\n /**\n * Maximum fee per gas for EIP-1559 transactions (as hex string)\n */\n maxFeePerGas?: string;\n\n /**\n * Maximum priority fee per gas for EIP-1559 transactions (as hex string)\n */\n maxPriorityFeePerGas?: string;\n\n /**\n * Transaction nonce (if not provided, will be fetched from network)\n */\n nonce?: number;\n\n /**\n * The list of signed EIP-7702 authorizations to include in the transaction\n */\n authorizationList: Sign7702AuthorizationResponse[];\n}\n\n/**\n * Response from sending an EIP-7702 transaction\n */\nexport interface Send7702TransactionResponse {\n /**\n * The transaction hash\n */\n transactionHash: string;\n}", "export enum UiEventsEmit {\n CloseMagicWindow = 'close-magic-window',\n}\n", "// Shared MFA events reused by both popup and redirect flows\nexport enum OAuthMFAEventEmit {\n Cancel = 'cancel',\n VerifyMFACode = 'verify-mfa-code',\n LostDevice = 'lost-device',\n VerifyRecoveryCode = 'verify-recovery-code',\n}\n\nexport enum OAuthMFAEventOnReceived {\n MfaSentHandle = 'mfa-sent-handle',\n InvalidMfaOtp = 'invalid-mfa-otp',\n RecoveryCodeSentHandle = 'recovery-code-sent-handle',\n InvalidRecoveryCode = 'invalid-recovery-code',\n RecoveryCodeSuccess = 'recovery-code-success',\n}\n\ntype OAuthMFAEventHandlers = {\n // Event sent\n [OAuthMFAEventEmit.Cancel]: () => void;\n [OAuthMFAEventEmit.VerifyMFACode]: (mfa: string) => void;\n [OAuthMFAEventEmit.LostDevice]: () => void;\n [OAuthMFAEventEmit.VerifyRecoveryCode]: (recoveryCode: string) => void;\n // Event Received\n [OAuthMFAEventOnReceived.MfaSentHandle]: () => void;\n [OAuthMFAEventOnReceived.InvalidMfaOtp]: () => void;\n [OAuthMFAEventOnReceived.RecoveryCodeSentHandle]: () => void;\n [OAuthMFAEventOnReceived.InvalidRecoveryCode]: () => void;\n [OAuthMFAEventOnReceived.RecoveryCodeSuccess]: () => void;\n};\n\n// Popup-specific events\nexport enum OAuthPopupEventOnReceived {\n PopupUrl = 'popup-url',\n}\n\nexport enum OAuthPopupEventEmit {\n PopupEvent = 'popup-event',\n}\n\nexport type OAuthPopupEventHandlers = {\n [OAuthPopupEventEmit.PopupEvent]: (eventData: unknown) => void;\n [OAuthPopupEventOnReceived.PopupUrl]: (event: { popupUrl: string; provider: string }) => void;\n} & OAuthMFAEventHandlers;\n\n// Redirect-specific handler type\nexport type OAuthGetResultEventHandlers = OAuthMFAEventHandlers;\n", "export interface PasskeyResult {\n // null if skipDIDToken is true\n idToken: string | null;\n\n // Info of the device used to authenticate\n deviceInfo: {\n id: string;\n nickname: string;\n transport: string;\n userAgent: string;\n };\n}\n\nexport enum PasskeyMFAEventEmit {\n Cancel = 'cancel',\n VerifyMFACode = 'verify-mfa-code',\n LostDevice = 'lost-device',\n VerifyRecoveryCode = 'verify-recovery-code',\n}\nexport enum PasskeyMFAEventOnReceived {\n MfaSentHandle = 'mfa-sent-handle',\n InvalidMfaOtp = 'invalid-mfa-otp',\n RecoveryCodeSentHandle = 'recovery-code-sent-handle',\n InvalidRecoveryCode = 'invalid-recovery-code',\n RecoveryCodeSuccess = 'recovery-code-success',\n}\n\nexport type PasskeyEventHandlers = {\n // Event sent\n [PasskeyMFAEventEmit.Cancel]: () => void;\n [PasskeyMFAEventEmit.VerifyMFACode]: (mfa: string) => void;\n [PasskeyMFAEventEmit.LostDevice]: () => void;\n [PasskeyMFAEventEmit.VerifyRecoveryCode]: (recoveryCode: string) => void;\n // Event Received\n [PasskeyMFAEventOnReceived.MfaSentHandle]: () => void;\n [PasskeyMFAEventOnReceived.InvalidMfaOtp]: () => void;\n [PasskeyMFAEventOnReceived.RecoveryCodeSentHandle]: () => void;\n [PasskeyMFAEventOnReceived.InvalidRecoveryCode]: () => void;\n [PasskeyMFAEventOnReceived.RecoveryCodeSuccess]: () => void;\n};\n", "/**\n * Encode given buffer or decode given string with Base64URL.\n */\nexport class Base64URL {\n /**\n * Convert bytes into a base64url-encoded string\n */\n static encode(buffer: ArrayBuffer): string {\n const base64 = globalThis.btoa(String.fromCharCode(...new Uint8Array(buffer)));\n\n return base64.replace(/=/g, '').replace(/\\+/g, '-').replace(/\\//g, '_');\n }\n\n /**\n * Convert a base64url-encoded string into bytes\n */\n static decode(base64url: string): ArrayBuffer {\n const base64 = base64url.replace(/-/g, '+').replace(/_/g, '/');\n const binStr = globalThis.atob(base64);\n const bin = new Uint8Array(binStr.length);\n\n for (let i = 0; i < binStr.length; i++) {\n bin[i] = binStr.charCodeAt(i);\n }\n\n return bin.buffer;\n }\n}\n", "import { Base64URL } from './base64';\n\nfunction isAuthenticatorAssertionResponse(value: AuthenticatorResponse): value is AuthenticatorAssertionResponse {\n if (typeof value !== 'object') {\n return false;\n }\n if (\n (value as AuthenticatorAssertionResponse)?.authenticatorData === undefined ||\n typeof (value as AuthenticatorAssertionResponse)?.authenticatorData !== 'object'\n ) {\n return false;\n }\n return true;\n}\n\nfunction isAuthenticatorAttestationResponse(value: AuthenticatorResponse): value is AuthenticatorAttestationResponse {\n if (typeof value !== 'object') {\n return false;\n }\n if (\n (value as AuthenticatorAttestationResponse)?.attestationObject === undefined ||\n typeof (value as AuthenticatorAttestationResponse)?.attestationObject !== 'object'\n ) {\n return false;\n }\n return true;\n}\n\n/**\n * Polyfill `PublicKeyCredential.prototype.toJSON`\n *\n * See https://w3c.github.io/webauthn/#dom-publickeycredential-tojson\n */\nexport function toJSON(cred: PublicKeyCredential): PublicKeyCredentialJSON {\n // Prefer native implementation if available\n if (typeof cred.toJSON === 'function') {\n return cred.toJSON();\n }\n\n try {\n const id = cred.id;\n const rawId = Base64URL.encode(cred.rawId);\n const authenticatorAttachment = cred.authenticatorAttachment;\n const clientExtensionResults = {};\n const type = cred.type;\n\n // This is authentication.\n if (isAuthenticatorAssertionResponse(cred.response)) {\n return {\n id,\n rawId,\n response: {\n authenticatorData: Base64URL.encode(cred.response.authenticatorData),\n clientDataJSON: Base64URL.encode(cred.response.clientDataJSON),\n signature: Base64URL.encode(cred.response.signature),\n userHandle: cred.response.userHandle ? Base64URL.encode(cred.response.userHandle) : undefined,\n },\n authenticatorAttachment,\n clientExtensionResults,\n type,\n };\n }\n\n if (isAuthenticatorAttestationResponse(cred.response)) {\n // This is registration.\n return {\n id,\n rawId,\n response: {\n clientDataJSON: Base64URL.encode(cred.response.clientDataJSON),\n attestationObject: Base64URL.encode(cred.response.attestationObject),\n transports: cred.response?.getTransports() || [],\n },\n authenticatorAttachment,\n clientExtensionResults,\n type,\n };\n }\n\n throw new Error('Unexpected object.');\n } catch (error) {\n console.error(error);\n throw error;\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,aAAAA,OAAiB,sBCAnB,IAAKC,GAAAA,IACVA,EAAA,cAAgB,kBAChBA,EAAA,cAAgB,kBAChBA,EAAA,eAAiB,sBACjBA,EAAA,kBAAoB,qBACpBA,EAAA,gBAAkB,mBAClBA,EAAA,wBAA0B,4BAC1BA,EAAA,uBAAyB,0BAPfA,IAAAA,GAAA,CAAA,CAAA,EAUAC,GAAAA,IACVA,EAAA,eAAiB,mBACjBA,EAAA,gBAAkB,mBAClBA,EAAA,iCAAmC,sCACnCA,EAAA,kBAAoB,qBACpBA,EAAA,oBAAsB,eALZA,IAAAA,GAAA,CAAA,CAAA,EAQAC,GAAAA,IAEVA,EAAAA,EAAA,WAAa,MAAA,EAAb,aACAA,EAAAA,EAAA,eAAiB,MAAA,EAAjB,iBACAA,EAAAA,EAAA,eAAiB,MAAA,EAAjB,iBACAA,EAAAA,EAAA,cAAgB,MAAA,EAAhB,gBACAA,EAAAA,EAAA,cAAgB,MAAA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AAQ,IAAM,CAC9C,KAAK,wBAAwBA,EAAoB,OAAQZ,CAAe,EAAE,CAC5E,CAAC,GAGIC,CACT,CAEO,aAAc,CACnB,IAAMM,EAAiB,KAAK,MAAM,kEAAsE,CAAC,CAAC,EAC1G,OAAO,KAAK,QAAeA,CAAc,CAC3C,CACF",
|
|
6
|
+
"names": ["Extension", "SDKErrorCode", "SDKWarningCode", "RPCErrorCode", "LocalStorageKeys", "ThirdPartyWalletEvents", "MagicPayloadMethod", "MagicIncomingWindowMessage", "MagicOutgoingWindowMessage", "DeepLinkPage", "LoginWithMagicLinkEventEmit", "LoginWithMagicLinkEventOnReceived", "LoginWithEmailOTPEventEmit", "LoginWithSmsOTPEventEmit", "LoginWithSmsOTPEventOnReceived", "LoginWithEmailOTPEventOnReceived", "DeviceVerificationEventEmit", "DeviceVerificationEventOnReceived", "RecencyCheckEventEmit", "RecencyCheckEventOnReceived", "UpdateEmailEventEmit", "UpdateEmailEventOnReceived", "AuthEventOnReceived", "FarcasterLoginEventEmit", "EnableMFAEventOnReceived", "EnableMFAEventEmit", "DisableMFAEventOnReceived", "DisableMFAEventEmit", "EthChainType", "UserEventsEmit", "UserEventsOnReceived", "RecoveryFactorEventOnReceived", "RecoveryFactorEventEmit", "RecoveryMethodType", "RecoverAccountEventOnReceived", "RecoverAccountEventEmit", "NftCheckoutIntermediaryEvents", "WalletEventOnReceived", "UiEventsEmit", "OAuthMFAEventEmit", "OAuthMFAEventOnReceived", "OAuthPopupEventOnReceived", "OAuthPopupEventEmit", "PasskeyMFAEventEmit", "PasskeyMFAEventOnReceived", "Base64URL", "buffer", "base64url", "base64", "binStr", "bin", "i", "isAuthenticatorAssertionResponse", "value", "isAuthenticatorAttestationResponse", "toJSON", "cred", "id", "rawId", "Base64URL", "authenticatorAttachment", "clientExtensionResults", "type", "error", "PasskeyExtension", "Extension", "message", "configuration", "username", "nickname", "skipDIDToken", "lifespan", "registrationOptions", "registrationToken", "credential", "err", "toJSON", "showMfaModal", "verifyPayloadId", "promiEvent", "resolve", "reject", "authenticationToken", "authenticationOptions", "assertion", "requestPayload", "loginRequest", "ie", "result", "error", "te", "mfa", "recoveryCode"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var MagicPasskeyExtension=(()=>{var O=Object.create;var E=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var T=Object.getPrototypeOf,N=Object.prototype.hasOwnProperty;var L=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),k=(e,t)=>{for(var a in t)E(e,a,{get:t[a],enumerable:!0})},f=(e,t,a,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of P(t))!N.call(e,n)&&n!==a&&E(e,n,{get:()=>t[n],enumerable:!(i=S(t,n))||i.enumerable});return e};var D=(e,t,a)=>(a=e!=null?O(T(e)):{},f(t||!e||!e.__esModule?E(a,"default",{value:e,enumerable:!0}):a,e)),w=e=>f(E({},"__esModule",{value:!0}),e);var A=L((Pe,R)=>{"use strict";R.exports=Magic});var Oe={};k(Oe,{default:()=>Me});var I=D(A());var U=(e=>(e.MissingApiKey="MISSING_API_KEY",e.ModalNotReady="MODAL_NOT_READY",e.ConnectionLost="CONNECTION_WAS_LOST",e.MalformedResponse="MALFORMED_RESPONSE",e.InvalidArgument="INVALID_ARGUMENT",e.ExtensionNotInitialized="EXTENSION_NOT_INITIALIZED",e.IncompatibleExtensions="INCOMPATIBLE_EXTENSIONS",e))(U||{}),b=(e=>(e.SyncWeb3Method="SYNC_WEB3_METHOD",e.DuplicateIframe="DUPLICATE_IFRAME",e.ReactNativeEndpointConfiguration="REACT_NATIVE_ENDPOINT_CONFIGURATION",e.DeprecationNotice="DEPRECATION_NOTICE",e.ProductAnnouncement="ANNOUNCEMENT",e))(b||{}),F=(e=>(e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.MagicLinkFailedVerification=-1e4]="MagicLinkFailedVerification",e[e.MagicLinkExpired=-10001]="MagicLinkExpired",e[e.MagicLinkRateLimited=-10002]="MagicLinkRateLimited",e[e.UserAlreadyLoggedIn=-10003]="UserAlreadyLoggedIn",e[e.UpdateEmailFailed=-10004]="UpdateEmailFailed",e[e.UserRequestEditEmail=-10005]="UserRequestEditEmail",e[e.MagicLinkInvalidRedirectURL=-10006]="MagicLinkInvalidRedirectURL",e[e.InactiveRecipient=-10010]="InactiveRecipient",e[e.AccessDeniedToUser=-10011]="AccessDeniedToUser",e[e.UserRejectedAction=-10012]="UserRejectedAction",e[e.RequestCancelled=-10014]="RequestCancelled",e[e.RedirectLoginComplete=-10015]="RedirectLoginComplete",e[e.SessionTerminated=-10016]="SessionTerminated",e[e.PopupRequestOverriden=-10017]="PopupRequestOverriden",e[e.SanEmail=-10018]="SanEmail",e[e.DpopInvalidated=-10019]="DpopInvalidated",e[e.MaxAttemptsReached=-10031]="MaxAttemptsReached",e[e.UserRequiredMfa=-10033]="UserRequiredMfa",e))(F||{}),G=(e=>(e.PROVIDER="magic_3pw_provider",e.ADDRESS="magic_3pw_address",e.CHAIN_ID="magic_3pw_chainId",e))(G||{}),V=(e=>(e.WalletConnected="wallet_connected",e.WalletRejected="wallet_rejected",e.Web3ModalSelected="web3modal_selected",e))(V||{}),W=(e=>(e.LoginWithSms="magic_auth_login_with_sms",e.LoginWithEmailOTP="magic_auth_login_with_email_otp",e.LoginWithMagicLink="magic_auth_login_with_magic_link",e.LoginWithCredential="magic_auth_login_with_credential",e.SetAuthorizationToken="magic_auth_set_authorization_token",e.GetIdToken="magic_auth_get_id_token",e.GenerateIdToken="magic_auth_generate_id_token",e.GetMetadata="magic_auth_get_metadata",e.IsLoggedIn="magic_is_logged_in",e.Logout="magic_auth_logout",e.UpdateEmail="magic_auth_update_email",e.UserSettings="magic_auth_settings",e.UserSettingsTestMode="magic_auth_settings_testing_mode",e.LoginWithSmsTestMode="magic_auth_login_with_sms_testing_mode",e.LoginWithEmailOTPTestMode="magic_auth_login_with_email_otp_testing_mode",e.LoginWithMagicLinkTestMode="magic_login_with_magic_link_testing_mode",e.LoginWithCredentialTestMode="magic_auth_login_with_credential_testing_mode",e.GetIdTokenTestMode="magic_auth_get_id_token_testing_mode",e.GenerateIdTokenTestMode="magic_auth_generate_id_token_testing_mode",e.GetMetadataTestMode="magic_auth_get_metadata_testing_mode",e.IsLoggedInTestMode="magic_auth_is_logged_in_testing_mode",e.LogoutTestMode="magic_auth_logout_testing_mode",e.UpdateEmailTestMode="magic_auth_update_email_testing_mode",e.IntermediaryEvent="magic_intermediary_event",e.RequestAccounts="eth_requestAccounts",e.GetInfo="magic_get_info",e.ShowUI="magic_wallet",e.NFTPurchase="magic_nft_purchase",e.NFTCheckout="magic_nft_checkout",e.NFTTransfer="magic_nft_transfer",e.RequestUserInfoWithUI="mc_request_user_info",e.Disconnect="mc_disconnect",e.RecoverAccount="magic_auth_recover_account",e.RecoverAccountTestMode="magic_auth_recover_account_testing_mode",e.MagicBoxHeartBeat="magic_box_heart_beat",e.AutoConnect="mc_auto_connect",e.Login="mc_login",e.EncryptV1="magic_auth_encrypt_v1",e.DecryptV1="magic_auth_decrypt_v1",e.ShowNFTs="magic_show_nfts",e.ShowOnRamp="magic_show_fiat_onramp",e.ShowSendTokensUI="magic_show_send_tokens_ui",e.ShowAddress="magic_show_address",e.ShowBalances="magic_show_balances",e.RevealPK="magic_reveal_key",e.EnableMFA="magic_auth_enable_mfa_flow",e.DisableMFA="magic_auth_disable_mfa_flow",e.GetMultichainPublicAddress="magic_get_multichain_public_address",e.Sign7702Authorization="magic_wallet_sign_7702_authorization",e.Send7702Transaction="eth_send7702Transaction",e))(W||{});var H=(e=>(e.MAGIC_HANDLE_RESPONSE="MAGIC_HANDLE_RESPONSE",e.MAGIC_OVERLAY_READY="MAGIC_OVERLAY_READY",e.MAGIC_SHOW_OVERLAY="MAGIC_SHOW_OVERLAY",e.MAGIC_HIDE_OVERLAY="MAGIC_HIDE_OVERLAY",e.MAGIC_HANDLE_EVENT="MAGIC_HANDLE_EVENT",e.MAGIC_MG_BOX_SEND_RECEIPT="MAGIC_MG_BOX_SEND_RECEIPT",e.MAGIC_SEND_PRODUCT_ANNOUNCEMENT="MAGIC_SEND_PRODUCT_ANNOUNCEMENT",e.MAGIC_PONG="MAGIC_PONG",e.MAGIC_POPUP_RESPONSE="MAGIC_POPUP_RESPONSE",e.MAGIC_POPUP_OAUTH_VERIFY_RESPONSE="MAGIC_POPUP_OAUTH_VERIFY_RESPONSE",e.MAGIC_THIRD_PARTY_WALLET_REQUEST="MAGIC_THIRD_PARTY_WALLET_REQUEST",e.MAGIC_OPEN_MOBILE_URL="MAGIC_OPEN_MOBILE_URL",e))(H||{}),x=(e=>(e.MAGIC_HANDLE_REQUEST="MAGIC_HANDLE_REQUEST",e.MAGIC_THIRD_PARTY_WALLET_RESPONSE="MAGIC_THIRD_PARTY_WALLET_RESPONSE",e.MAGIC_THIRD_PARTY_WALLET_UPDATE="MAGIC_THIRD_PARTY_WALLET_EVENT",e.MAGIC_PING="MAGIC_PING",e))(x||{}),q=(e=>(e.UpdateEmail="update-email",e.MFA="mfa",e.Recovery="recovery",e))(q||{}),Y=(e=>(e.Retry="retry",e))(Y||{}),J=(e=>(e.EmailSent="email-sent",e.EmailNotDeliverable="email-not-deliverable",e))(J||{}),B=(e=>(e.VerifyEmailOtp="verify-email-otp",e.VerifyMFACode="verify-mfa-code",e.LostDevice="lost-device",e.VerifyRecoveryCode="verify-recovery-code",e.Cancel="cancel",e))(B||{}),K=(e=>(e.VerifySmsOtp="verify-sms-otp",e.VerifyMFACode="verify-mfa-code",e.LostDevice="lost-device",e.VerifyRecoveryCode="verify-recovery-code",e.Cancel="cancel",e.Retry="retry",e))(K||{}),j=(e=>(e.SmsOTPSent="sms-otp-sent",e.InvalidSmsOtp="invalid-sms-otp",e.ExpiredSmsOtp="expired-sms-otp",e.MfaSentHandle="mfa-sent-handle",e.InvalidMfaOtp="invalid-mfa-otp",e.LoginThrottled="login-throttled",e.RecoveryCodeSentHandle="recovery-code-sent-handle",e.InvalidRecoveryCode="invalid-recovery-code",e.RecoveryCodeSuccess="recovery-code-success",e))(j||{}),z=(e=>(e.EmailOTPSent="email-otp-sent",e.InvalidEmailOtp="invalid-email-otp",e.InvalidMfaOtp="invalid-mfa-otp",e.ExpiredEmailOtp="expired-email-otp",e.MfaSentHandle="mfa-sent-handle",e.RecoveryCodeSentHandle="recovery-code-sent-handle",e.InvalidRecoveryCode="invalid-recovery-code",e.RecoveryCodeSuccess="recovery-code-success",e.LoginThrottled="login-throttled",e.MaxAttemptsReached="max-attempts-reached",e))(z||{}),Q=(e=>(e.Retry="device-retry",e))(Q||{}),X=(e=>(e.DeviceApproved="device-approved",e.DeviceNeedsApproval="device-needs-approval",e.DeviceVerificationLinkExpired="device-verification-link-expired",e.DeviceVerificationEmailSent="device-verification-email-sent",e))(X||{}),Z=(e=>(e.Retry="Recency/auth-factor-retry",e.Cancel="Recency/auth-factor-verification-cancel",e.VerifyEmailOtp="Recency/auth-factor-verify-email-otp",e.VerifyMFACode="Recency/verify-mfa-code",e))(Z||{}),$=(e=>(e.PrimaryAuthFactorNeedsVerification="Recency/auth-factor-needs-verification",e.PrimaryAuthFactorVerified="Recency/auth-factor-verified",e.InvalidEmailOtp="Recency/auth-factor-invalid-email-otp",e.EmailExpired="Recency/auth-factor-verification-email-expired",e.EmailSent="Recency/auth-factor-verification-email-sent",e.EmailNotDeliverable="Recency/auth-factor-verification-email-not-deliverable",e))($||{}),ee=(e=>(e.RetryWithNewEmail="UpdateEmail/retry-with-new-email",e.Cancel="UpdateEmail/new-email-verification-cancel",e.VerifyEmailOtp="UpdateEmail/new-email-verify-otp",e))(ee||{}),te=(e=>(e.NewAuthFactorNeedsVerification="UpdateEmail/new-email-needs-verification",e.EmailUpdated="UpdateEmail/email-updated",e.InvalidEmailOtp="UpdateEmail/new-email-invalid-email-otp",e.EmailExpired="UpdateEmail/new-email-verification-email-expired",e.EmailSent="UpdateEmail/new-email-verification-email-sent",e.EmailNotDeliverable="UpdateEmail/new-email-verification-email-not-deliverable",e.InvalidEmail="UpdateEmail/new-email-invalid",e.EmailAlreadyExists="UpdateEmail/new-email-already-exists",e))(te||{}),ae=(e=>(e.IDTokenCreated="Auth/id-token-created",e))(ae||{}),ie=(e=>(e.Cancel="Farcaster/cancel",e))(ie||{}),ne=(e=>(e.MFASecretGenerated="mfa-secret-generated",e.InvalidMFAOtp="invalid-mfa-otp",e.MFARecoveryCodes="mfa-recovery-codes",e))(ne||{}),oe=(e=>(e.VerifyMFACode="verify-mfa-code",e.Cancel="cancel-mfa-setup",e))(oe||{}),re=(e=>(e.MFACodeRequested="mfa-code-requested",e.InvalidMFAOtp="invalid-mfa-otp",e.InvalidRecoveryCode="invalid-recovery-code",e))(re||{}),se=(e=>(e.VerifyMFACode="verify-mfa-code",e.LostDevice="lost-device",e.Cancel="cancel-mfa-disable",e))(se||{}),ce=(e=>(e.Harmony="HARMONY",e))(ce||{}),de=(e=>(e.ClosedByUser="closed-by-user",e))(de||{}),le=(e=>(e.ClosedByUser="closed-by-user-on-received",e))(le||{}),_e=(e=>(e.EnterNewPhoneNumber="enter-new-phone-number",e.EnterOtpCode="enter-otp-code",e.RecoveryFactorAlreadyExists="recovery-factor-already-exists",e.MalformedPhoneNumber="malformed-phone-number",e.InvalidOtpCode="invalid-otp-code",e.RecoveryFactorUpdated="recovery-factor-updated",e.RecoveryFactorDeleted="recovery-factor-deleted",e))(_e||{}),me=(e=>(e.SendNewPhoneNumber="send-new-phone-number",e.SendOtpCode="send-otp-code",e.Cancel="cancel",e.StartEditPhoneNumber="start-edit-phone-number",e))(me||{}),ve=(e=>(e.PhoneNumber="phone_number",e))(ve||{}),ue=(e=>(e.SmsOtpSent="sms-otp-sent",e.LoginThrottled="login-throttled",e.InvalidSmsOtp="invalid-sms-otp",e.SmsVerified="sms-verified",e.AccountRecovered="account-recovered",e.UpdateEmailRequired="update-email-required",e))(ue||{}),Ee=(e=>(e.Cancel="cancel",e.VerifyOtp="verify-otp-code",e.ResendSms="resend-sms-otp",e.UpdateEmail="update-email",e))(Ee||{}),pe=(e=>(e.Success="nft-checkout-success",e.Failure="nft-checkout-failure",e.Initiated="nft-checkout-initiated",e.Disconnect="disconnect",e))(pe||{}),ge=(e=>(e.WalletInfoFetched="Wallet/wallet-info-fetched",e))(ge||{}),ye=(e=>(e.CloseMagicWindow="close-magic-window",e))(ye||{}),he=(e=>(e.Cancel="cancel",e.VerifyMFACode="verify-mfa-code",e.LostDevice="lost-device",e.VerifyRecoveryCode="verify-recovery-code",e))(he||{}),fe=(e=>(e.MfaSentHandle="mfa-sent-handle",e.InvalidMfaOtp="invalid-mfa-otp",e.RecoveryCodeSentHandle="recovery-code-sent-handle",e.InvalidRecoveryCode="invalid-recovery-code",e.RecoveryCodeSuccess="recovery-code-success",e))(fe||{}),Re=(e=>(e.PopupUrl="popup-url",e))(Re||{}),Ae=(e=>(e.PopupEvent="popup-event",e))(Ae||{}),c=(e=>(e.Cancel="cancel",e.VerifyMFACode="verify-mfa-code",e.LostDevice="lost-device",e.VerifyRecoveryCode="verify-recovery-code",e))(c||{}),r=(e=>(e.MfaSentHandle="mfa-sent-handle",e.InvalidMfaOtp="invalid-mfa-otp",e.RecoveryCodeSentHandle="recovery-code-sent-handle",e.InvalidRecoveryCode="invalid-recovery-code",e.RecoveryCodeSuccess="recovery-code-success",e))(r||{});var d=class{static encode(t){return globalThis.btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}static decode(t){let a=t.replace(/-/g,"+").replace(/_/g,"/"),i=globalThis.atob(a),n=new Uint8Array(i.length);for(let s=0;s<i.length;s++)n[s]=i.charCodeAt(s);return n.buffer}};function Ie(e){return!(typeof e!="object"||e?.authenticatorData===void 0||typeof e?.authenticatorData!="object")}function Ce(e){return!(typeof e!="object"||e?.attestationObject===void 0||typeof e?.attestationObject!="object")}function g(e){if(typeof e.toJSON=="function")return e.toJSON();try{let t=e.id,a=d.encode(e.rawId),i=e.authenticatorAttachment,n={},s=e.type;if(Ie(e.response))return{id:t,rawId:a,response:{authenticatorData:d.encode(e.response.authenticatorData),clientDataJSON:d.encode(e.response.clientDataJSON),signature:d.encode(e.response.signature),userHandle:e.response.userHandle?d.encode(e.response.userHandle):void 0},authenticatorAttachment:i,clientExtensionResults:n,type:s};if(Ce(e.response))return{id:t,rawId:a,response:{clientDataJSON:d.encode(e.response.clientDataJSON),attestationObject:d.encode(e.response.attestationObject),transports:e.response?.getTransports()||[]},authenticatorAttachment:i,clientExtensionResults:n,type:s};throw new Error("Unexpected object.")}catch(t){throw console.error(t),t}}var p=class extends I.Extension.Internal{name="passkey";config={};createPasskeyNotSupportError(){this.createError("PASSKEY_NOT_SUPPORTED","Passkey is not supported in this device.",{})}createPasskeyCreateCredentialError(t){this.createError("PASSKEY_REGISTRATION_ERROR",`Error creating credential: ${t}`,{})}async registerNewUser(t){if(!window.PublicKeyCredential)throw this.createPasskeyNotSupportError();let{username:a,nickname:i="",skipDIDToken:n,lifespan:s}=t??{},{registrationOptions:_,registrationToken:o}=await this.request(this.utils.createJsonRpcRequestPayload("magic_auth_register_passkey_start",[{username:a}])),l;try{l=await navigator.credentials.create({publicKey:_})}catch(v){throw this.createPasskeyCreateCredentialError(v)}return this.request(this.utils.createJsonRpcRequestPayload("magic_auth_register_passkey_verify",[{registrationToken:o,registrationResponse:g(l),nickname:i,transport:l.response.getTransports(),userAgent:navigator.userAgent,skipDIDToken:n,lifespan:s}]))}login(t){let{username:a,showMfaModal:i,skipDIDToken:n,lifespan:s}=t??{},_,o=this.utils.createPromiEvent(async(l,v)=>{if(!window.PublicKeyCredential)return v(this.createPasskeyNotSupportError());let{authenticationToken:C,authenticationOptions:M}=await this.request(this.utils.createJsonRpcRequestPayload("magic_auth_login_with_passkey_start",[{username:a}])),y;try{y=await navigator.credentials.get({publicKey:M})}catch(u){return v(this.createPasskeyCreateCredentialError(u))}let h=this.utils.createJsonRpcRequestPayload("magic_auth_login_with_passkey_verify",[{authenticationToken:C,assertionResponse:g(y),showUI:i,skipDIDToken:n,lifespan:s}]);_=h.id;let m=this.request(h);i||(m.on(r.MfaSentHandle,()=>{o.emit(r.MfaSentHandle)}),m.on(r.InvalidMfaOtp,()=>{o.emit(r.InvalidMfaOtp)}),m.on(r.RecoveryCodeSentHandle,()=>{o.emit(r.RecoveryCodeSentHandle)}),m.on(r.InvalidRecoveryCode,()=>{o.emit(r.InvalidRecoveryCode)}),m.on(r.RecoveryCodeSuccess,()=>{o.emit(r.RecoveryCodeSuccess)}));try{let u=await m;l(u)}catch(u){v(u)}});return!i&&o&&(o.on(c.VerifyMFACode,l=>{this.createIntermediaryEvent(c.VerifyMFACode,_)(l)}),o.on(c.LostDevice,()=>{this.createIntermediaryEvent(c.LostDevice,_)()}),o.on(c.VerifyRecoveryCode,l=>{this.createIntermediaryEvent(c.VerifyRecoveryCode,_)(l)}),o.on(c.Cancel,()=>{this.createIntermediaryEvent(c.Cancel,_)()})),o}getMetadata(){let t=this.utils.createJsonRpcRequestPayload("magic_user_get_webauthn_credentials",[]);return this.request(t)}};var Me=p;return w(Oe);})();
|
|
2
|
+
if (MagicPasskeyExtension && MagicPasskeyExtension.default != null) { MagicPasskeyExtension = Object.assign(MagicPasskeyExtension.default, MagicPasskeyExtension); delete MagicPasskeyExtension.default; }
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Extension } from '@magic-sdk/provider';
|
|
2
|
+
import { RegisterNewUserConfiguration, LoginWithPasskeyConfiguration } from './types';
|
|
3
|
+
import { PasskeyResult, PasskeyEventHandlers } from '@magic-sdk/types';
|
|
4
|
+
export declare class PasskeyExtension extends Extension.Internal<'passkey', any> {
|
|
5
|
+
name: "passkey";
|
|
6
|
+
config: any;
|
|
7
|
+
private createPasskeyNotSupportError;
|
|
8
|
+
private createPasskeyCreateCredentialError;
|
|
9
|
+
registerNewUser(configuration?: RegisterNewUserConfiguration): Promise<string | null>;
|
|
10
|
+
login(configuration?: LoginWithPasskeyConfiguration): import("@magic-sdk/provider").PromiEvent<PasskeyResult, PasskeyEventHandlers & {
|
|
11
|
+
done: (result: PasskeyResult) => void;
|
|
12
|
+
error: (reason: any) => void;
|
|
13
|
+
settled: () => void;
|
|
14
|
+
"closed-by-user": () => void;
|
|
15
|
+
}>;
|
|
16
|
+
getMetadata(): import("@magic-sdk/provider").PromiEvent<any[], {
|
|
17
|
+
done: (result: any[]) => void;
|
|
18
|
+
error: (reason: any) => void;
|
|
19
|
+
settled: () => void;
|
|
20
|
+
"closed-by-user": () => void;
|
|
21
|
+
}>;
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './index';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export interface RegisterNewUserConfiguration {
|
|
2
|
+
/**
|
|
3
|
+
* The username of the user attempting to register.
|
|
4
|
+
* Optional parameter used as display name for the passkey
|
|
5
|
+
*/
|
|
6
|
+
username?: string;
|
|
7
|
+
/**
|
|
8
|
+
* The nickname that the user attempts to set to this passkey.
|
|
9
|
+
*/
|
|
10
|
+
nickname?: string;
|
|
11
|
+
skipDIDToken?: boolean;
|
|
12
|
+
lifespan?: number;
|
|
13
|
+
}
|
|
14
|
+
export interface LoginWithPasskeyConfiguration {
|
|
15
|
+
/**
|
|
16
|
+
* The username of the user attempting to login.
|
|
17
|
+
* Optional parameter used for legacy users
|
|
18
|
+
*/
|
|
19
|
+
username?: string;
|
|
20
|
+
showMfaModal?: boolean;
|
|
21
|
+
skipDIDToken?: boolean;
|
|
22
|
+
lifespan?: number;
|
|
23
|
+
}
|
|
24
|
+
export declare enum MagicPasskeyPayloadMethod {
|
|
25
|
+
RegisterPasskeyStart = "magic_auth_register_passkey_start",
|
|
26
|
+
RegisterPasskeyVerify = "magic_auth_register_passkey_verify",
|
|
27
|
+
LoginWithPasskeyStart = "magic_auth_login_with_passkey_start",
|
|
28
|
+
LoginWithPasskeyVerify = "magic_auth_login_with_passkey_verify",
|
|
29
|
+
GetPasskeyInfo = "magic_user_get_webauthn_credentials"
|
|
30
|
+
}
|
|
31
|
+
export declare enum PasskeySDKErrorCode {
|
|
32
|
+
PasskeyNotSupported = "PASSKEY_NOT_SUPPORTED",
|
|
33
|
+
PasskeyRegisterError = "PASSKEY_REGISTRATION_ERROR"
|
|
34
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Encode given buffer or decode given string with Base64URL.
|
|
3
|
+
*/
|
|
4
|
+
export declare class Base64URL {
|
|
5
|
+
/**
|
|
6
|
+
* Convert bytes into a base64url-encoded string
|
|
7
|
+
*/
|
|
8
|
+
static encode(buffer: ArrayBuffer): string;
|
|
9
|
+
/**
|
|
10
|
+
* Convert a base64url-encoded string into bytes
|
|
11
|
+
*/
|
|
12
|
+
static decode(base64url: string): ArrayBuffer;
|
|
13
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@magic-ext/passkey",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "1.0.0-canary.1085.25119171769.0",
|
|
4
4
|
"description": "Magic SDK Passkey Extension",
|
|
5
5
|
"author": "Magic <team@magic.link> (https://magic.link/)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -29,5 +29,6 @@
|
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@magic-sdk/provider": "^33.7.0"
|
|
32
|
-
}
|
|
32
|
+
},
|
|
33
|
+
"gitHead": "3ad3b03e9349afe80a0fea303563af5693f3d28d"
|
|
33
34
|
}
|