UNPKG

@privy-io/js-sdk-core

Version:

Vanilla JS client for the Privy Auth API

2 lines (1 loc) 1.74 kB
import{Logout as t}from"@privy-io/public-api";import r from"./CustomProviderApi.mjs";import e from"./EmailApi.mjs";import i from"./FarcasterApi.mjs";import s from"./FarcasterV2Api.mjs";import o from"./GuestApi.mjs";import m 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/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(){try{let r=await this._privyInternal.session.getRefreshToken()??void 0;await this._privyInternal.fetch(t,{body:{refresh_token:r}})}catch(t){console.warn("Error destroying session")}await Promise.all([this._privyInternal.session.destroyLocalState({reason:"logout"}),this._privyInternal.destroyClientAnalyticsId()]),this._privyInternal.callbacks?.setUser?.(null)}constructor(t,d,y,u){this._privyInternal=t,this.customProvider=new r(this._privyInternal,d),this.phone=new l(this._privyInternal,d),this.email=new e(this._privyInternal,d),this.oauth=new m(this._privyInternal,d,y,u),this.guest=new o(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 i(this._privyInternal,d),this.farcasterV2=new s(this._privyInternal,d)}}export{d as default};