@privy-io/server-auth
Version:
Server-side client for the Privy API
2 lines (1 loc) • 794 B
JavaScript
import t from"redaxios";import{VERSION as s}from"./constants.mjs";import{wrapApiError as r}from"./errors.mjs";import{d as a,e}from"./utils-DDjlFg8J.mjs";import"node-fetch-native";import"ts-case-convert";class i{async get(t,s){try{return await this.instance.get(t,s)}catch(t){throw r(t)}}async post(t,s,a){try{return await this.instance.post(t,s,a)}catch(t){throw r(t)}}async patch(t,s,a){try{return await this.instance.patch(t,s,a)}catch(t){throw r(t)}}async delete(t,s,a){try{return await this.instance.delete(t,{...a,data:s})}catch(t){throw r(t)}}constructor(r,i,{baseURL:c,timeout:n}){this.sdkVersion=s,this.instance=t.create({baseURL:c,fetch:a(n),auth:`Basic ${e(`${r}:${i}`)}`,headers:{"privy-app-id":r,"privy-client":`server-auth:${this.sdkVersion}`}}),this.baseURL=c}}export{i as Http};