UNPKG

@privy-io/react-auth

Version:

React client for the Privy Auth API

2 lines (1 loc) 461 B
import{useMemo as t}from"react";import{u as e}from"./internal-context-Z-fyxadS.mjs";const r=()=>{let{walletProxy:r,client:a}=e();return t((()=>({signWithUserSigner:async({message:t,targetAppId:e})=>{if(!r)throw Error("Wallet proxy not initialized");let i=await a.getAccessToken();if(!i)throw Error("User must be authenticated");let{signature:s}=await r.signWithUserSigner({accessToken:i,message:t,targetAppId:e});return{signature:s}}})),[r,a])};export{r as u};