@privy-io/js-sdk-core
Version:
Vanilla JS client for the Privy Auth API
2 lines (1 loc) • 1.84 kB
JavaScript
import{Logout as t}from"@privy-io/routes";import e from"./CustomProviderApi.mjs";import r from"./EmailApi.mjs";import s from"./FarcasterApi.mjs";import i from"./FarcasterV2Api.mjs";import m from"./GuestApi.mjs";import o from"./OAuthApi.mjs";import a from"./PasskeyApi.mjs";import l from"./PhoneApi.mjs";import n from"./SiweApi.mjs";import p from"./SiwsApi.mjs";import h from"./SmartWalletApi.mjs";import"./maybeCreateWalletOnLogin.mjs";import"../../utils/getUserEmbeddedEthereumWallet.mjs";import"../../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../../utils/embedded-wallets.mjs";import"../../utils/getUserEmbeddedSolanaWallet.mjs";import"../../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../../utils/shouldCreateEmbeddedEthWallet.mjs";import"../../utils/shouldCreateEmbeddedSolWallet.mjs";import"../../Error.mjs";import"../../pkce.mjs";import"jose";class d{async logout(e){try{let e=await this._privyInternal.session.getRefreshToken()??void 0;await this._privyInternal.fetch(t,{body:{refresh_token:e}})}catch(t){console.warn("Error destroying session")}await Promise.all([this._privyInternal.session.destroyLocalState({reason:"logout"}),this._privyInternal.destroyClientAnalyticsId(),e?.userId&&this._mfa.clearMfa({userId:e.userId})]),this._privyInternal.callbacks?.setUser?.(null)}constructor(t,d,y,u,j){this._privyInternal=t,this._mfa=j,this.customProvider=new e(this._privyInternal,d),this.phone=new l(this._privyInternal,d),this.email=new r(this._privyInternal,d),this.oauth=new o(this._privyInternal,d,y,u),this.guest=new m(this._privyInternal,d),this.siwe=new n(this._privyInternal,d),this.siws=new p(this._privyInternal,d),this.smartWallet=new h(this._privyInternal),this.passkey=new a(this._privyInternal,d),this.farcaster=new s(this._privyInternal,d),this.farcasterV2=new i(this._privyInternal,d)}}export{d as default};