@privy-io/js-sdk-core
Version:
Vanilla JS client for the Privy Auth API
2 lines (1 loc) • 1.04 kB
JavaScript
Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@privy-io/public-api");exports.default=class{async link(n,t,i){await this._privyInternal.fetch(e.SiweLinkSmartWallet,{body:{message:n,signature:t,smart_wallet_type:i}});let s=await this._privyInternal.refreshSession();return{user:s.user,identity_token:s.identity_token}}async init(n){var t;let{nonce:i}=await this._privyInternal.fetch(e.SiweInit,{body:{address:n.address}});return{nonce:i,message:`${(t={chainId:n.chainId.toString().replace("eip155:",""),address:n.address,issuedAt:(new Date).toISOString(),statement:"By signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.",domain:"privy.io",uri:"https://auth.privy.io",nonce:i}).domain} wants you to sign in with your Ethereum account:\n${t.address}\n\n${t.statement}\n\nURI: ${t.uri}\nVersion: 1\nChain ID: ${t.chainId}\nNonce: ${t.nonce}\nIssued At: ${t.issuedAt}\nResources:\n- https://privy.io`}}constructor(e){this._privyInternal=e}};
;