UNPKG

@privy-io/js-sdk-core

Version:

Vanilla JS client for the Privy Auth API

2 lines (1 loc) 577 B
"use strict";var e=require("canonicalize"),a=require("@privy-io/public-api");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=/*#__PURE__*/t(e);exports.rpc=async function(e,t,{wallet_id:i,...l}){let p={version:1,url:e.getCompiledPath(a.WalletRpc,{params:{wallet_id:i}}),method:a.WalletRpc.method,headers:{"privy-app-id":e.app.appId},body:{...l}},o=Buffer.from(r.default(p)).toString("base64"),{signature:u}=await t({message:o});return await e.fetchPrivyRoute(a.WalletRpc,{body:l,params:{wallet_id:i},headers:{"privy-authorization-signature":u}})};