@privy-io/js-sdk-core 0.26.6 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/EmailApi.js +1 -1
- package/dist/EmailApi.js.map +1 -1
- package/dist/Error.js.map +1 -1
- package/dist/FarcasterApi.js +1 -1
- package/dist/FarcasterApi.js.map +1 -1
- package/dist/OAuthApi.js +1 -1
- package/dist/OAuthApi.js.map +1 -1
- package/dist/PhoneApi.js +1 -1
- package/dist/PhoneApi.js.map +1 -1
- package/dist/PrivyInternal.js +1 -1
- package/dist/SiweApi.js +1 -1
- package/dist/SiweApi.js.map +1 -1
- package/dist/chains/polygon.js +1 -1
- package/dist/chains/polygon.js.map +1 -1
- package/dist/chains/polygonAmoy.js +1 -1
- package/dist/chains/polygonAmoy.js.map +1 -1
- package/dist/dts/EmailApi.d.ts +22 -1
- package/dist/dts/Error.d.ts +1 -1
- package/dist/dts/FarcasterApi.d.ts +22 -1
- package/dist/dts/OAuthApi.d.ts +24 -1
- package/dist/dts/PhoneApi.d.ts +22 -1
- package/dist/dts/SiweApi.d.ts +15 -1
- package/dist/dts/UserApi.d.ts +10 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/package.json +2 -2
package/dist/EmailApi.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{PasswordlessInit as e,PasswordlessAuthenticate as t,PasswordlessLink as r,PasswordlessUnlink as n}from"@privy-io/public-api";class i{_privyInternal;constructor(e){this._privyInternal=e}async sendCode(t,r){return this._privyInternal.fetch(e,{body:{email:t,token:r}})}async loginWithCode(e,r){const
|
|
1
|
+
import{PasswordlessInit as e,PasswordlessAuthenticate as t,PasswordlessLink as r,PasswordlessUnlink as n}from"@privy-io/public-api";class i{_privyInternal;constructor(e){this._privyInternal=e}async sendCode(t,r){return this._privyInternal.fetch(e,{body:{email:t,token:r}})}async loginWithCode(e,r,n){const i=await this._privyInternal.fetch(t,{body:{email:e,code:r,mode:n}});return await Promise.all([this._privyInternal.session.storeToken(i.token),this._privyInternal.session.storeRefreshToken(i.refresh_token),this._privyInternal.session.storeIdentityToken(i.identity_token)]),this._privyInternal.callbacks?.setUser?.(i.user),i}async linkWithCode(e,t){await this._privyInternal.fetch(r,{body:{email:e,code:t}});return(await this._privyInternal.refreshSession()).user}async unlink(e){await this._privyInternal.fetch(n,{body:{address:e}});return(await this._privyInternal.refreshSession()).user}}export{i as default};
|
|
2
2
|
//# sourceMappingURL=EmailApi.js.map
|
package/dist/EmailApi.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmailApi.js","sources":["../src/EmailApi.ts"],"sourcesContent":[null],"names":["EmailApi","_privyInternal","constructor","privyInternal","this","sendCode","email","token","fetch","PasswordlessInit","body","loginWithCode","code","res","PasswordlessAuthenticate","Promise","all","session","storeToken","storeRefreshToken","refresh_token","storeIdentityToken","identity_token","callbacks","setUser","user","linkWithCode","PasswordlessLink","refreshSession","unlink","PasswordlessUnlink","address"],"mappings":"oIASc,MAAOA,EAIFC,eAKjB,WAAAC,CAAmBC,GACjBC,KAAKH,eAAiBE,CACvB,CAQM,cAAME,CAASC,EAAeC,GACnC,OAAOH,KAAKH,eAAeO,MAAMC,EAAkB,CAACC,KAAM,CAACJ,QAAOC,UACnE,
|
|
1
|
+
{"version":3,"file":"EmailApi.js","sources":["../src/EmailApi.ts"],"sourcesContent":[null],"names":["EmailApi","_privyInternal","constructor","privyInternal","this","sendCode","email","token","fetch","PasswordlessInit","body","loginWithCode","code","mode","res","PasswordlessAuthenticate","Promise","all","session","storeToken","storeRefreshToken","refresh_token","storeIdentityToken","identity_token","callbacks","setUser","user","linkWithCode","PasswordlessLink","refreshSession","unlink","PasswordlessUnlink","address"],"mappings":"oIASc,MAAOA,EAIFC,eAKjB,WAAAC,CAAmBC,GACjBC,KAAKH,eAAiBE,CACvB,CAQM,cAAME,CAASC,EAAeC,GACnC,OAAOH,KAAKH,eAAeO,MAAMC,EAAkB,CAACC,KAAM,CAACJ,QAAOC,UACnE,CASM,mBAAMI,CAAcL,EAAeM,EAAcC,GACtD,MAAMC,QAAYV,KAAKH,eAAeO,MAAMO,EAA0B,CACpEL,KAAM,CAACJ,QAAOM,OAAMC,UAWtB,aARMG,QAAQC,IAAI,CAChBb,KAAKH,eAAeiB,QAAQC,WAAWL,EAAIP,OAC3CH,KAAKH,eAAeiB,QAAQE,kBAAkBN,EAAIO,eAClDjB,KAAKH,eAAeiB,QAAQI,mBAAmBR,EAAIS,kBAGrDnB,KAAKH,eAAeuB,WAAWC,UAAUX,EAAIY,MAEtCZ,CACR,CAQM,kBAAMa,CAAarB,EAAeM,SACjCR,KAAKH,eAAeO,MAAMoB,EAAkB,CAAClB,KAAM,CAACJ,QAAOM,UAMjE,aAJkBR,KAAKH,eAAe4B,kBAI3BH,IACZ,CAEM,YAAMI,CAAOxB,SACZF,KAAKH,eAAeO,MAAMuB,EAAoB,CAACrB,KAAM,CAACsB,QAAS1B,KAKrE,aAHkBF,KAAKH,eAAe4B,kBAG3BH,IACZ"}
|
package/dist/Error.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Error.js","sources":["../src/Error.ts"],"sourcesContent":[null],"names":["PrivyApiError","Error","error","code","constructor","super","this","PrivyClientError"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Error.js","sources":["../src/Error.ts"],"sourcesContent":[null],"names":["PrivyApiError","Error","error","code","constructor","super","this","PrivyClientError"],"mappings":"AAyCM,MAAOA,UAAsBC,MACjCC,MACAC,KAEA,WAAAC,EAAYF,MAACA,EAAKC,KAAEA,IAClBE,MAAMH,GACNI,KAAKJ,MAAQA,EACbI,KAAKH,KAAOA,CACb,EAGG,MAAOI,UAAyBN,MACpCC,MACAC,KAEA,WAAAC,EAAYF,MAACA,EAAKC,KAAEA,IAClBE,MAAMH,GACNI,KAAKH,KAAOA,EACZG,KAAKJ,MAAQA,CACd"}
|
package/dist/FarcasterApi.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{FarcasterInit as e,FarcasterStatus as t,FarcasterAuthenticate as n,FarcasterLink as r,FarcasterUnlink as i}from"@privy-io/public-api";class a{_privyInternal;constructor(e){this._privyInternal=e}async initializeAuth({relyingParty:t,redirectUrl:n,token:r}){return await this._privyInternal.fetch(e,{body:{relying_party:t,redirect_url:n,token:r}})}async getFarcasterStatus({channel_token:e}){return await this._privyInternal.fetch(t,{headers:{"farcaster-channel-token":e}})}async authenticate({channel_token:e,message:t,signature:r,fid:i}){const
|
|
1
|
+
import{FarcasterInit as e,FarcasterStatus as t,FarcasterAuthenticate as n,FarcasterLink as r,FarcasterUnlink as i}from"@privy-io/public-api";class a{_privyInternal;constructor(e){this._privyInternal=e}async initializeAuth({relyingParty:t,redirectUrl:n,token:r}){return await this._privyInternal.fetch(e,{body:{relying_party:t,redirect_url:n,token:r}})}async getFarcasterStatus({channel_token:e}){return await this._privyInternal.fetch(t,{headers:{"farcaster-channel-token":e}})}async authenticate({channel_token:e,message:t,signature:r,fid:i,mode:a}){const s=await this._privyInternal.fetch(n,{body:{channel_token:e,message:t,signature:r,fid:i,mode:a}});return await Promise.all([this._privyInternal.session.storeToken(s.token),this._privyInternal.session.storeRefreshToken(s.refresh_token),this._privyInternal.session.storeIdentityToken(s.identity_token)]),this._privyInternal.callbacks?.setUser?.(s.user),s}async link({channel_token:e,message:t,signature:n,fid:i}){await this._privyInternal.fetch(r,{body:{channel_token:e,message:t,signature:n,fid:i}});return(await this._privyInternal.refreshSession()).user}async unlink({fid:e}){await this._privyInternal.fetch(i,{body:{fid:e}});return(await this._privyInternal.refreshSession()).user}}export{a as default};
|
|
2
2
|
//# sourceMappingURL=FarcasterApi.js.map
|
package/dist/FarcasterApi.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FarcasterApi.js","sources":["../src/FarcasterApi.ts"],"sourcesContent":[null],"names":["FarcasterApi","_privyInternal","constructor","privyInternal","this","initializeAuth","relyingParty","redirectUrl","token","fetch","FarcasterInit","body","relying_party","redirect_url","getFarcasterStatus","channel_token","FarcasterStatus","headers","authenticate","message","signature","fid","res","FarcasterAuthenticate","Promise","all","session","storeToken","storeRefreshToken","refresh_token","storeIdentityToken","identity_token","callbacks","setUser","user","link","FarcasterLink","refreshSession","unlink","FarcasterUnlink"],"mappings":"6IAUc,MAAOA,EAIFC,eAKjB,WAAAC,CAAmBC,GACjBC,KAAKH,eAAiBE,CACvB,CAKM,oBAAME,EAAeC,aAC1BA,EAAYC,YACZA,EAAWC,MACXA,IAcA,aARkBJ,KAAKH,eAAeQ,MAAMC,EAAe,CACzDC,KAAM,CACJC,cAAeN,EACfO,aAAcN,EACdC,UAKL,CAKM,wBAAMM,EAAmBC,cAACA,IAO/B,aANkBX,KAAKH,eAAeQ,MAAMO,EAAiB,CAC3DC,QAAS,CACP,0BAA2BF,IAKhC,CAKM,kBAAMG,EAAaH,cACxBA,EAAaI,QACbA,EAAOC,UACPA,EAASC,IACTA,
|
|
1
|
+
{"version":3,"file":"FarcasterApi.js","sources":["../src/FarcasterApi.ts"],"sourcesContent":[null],"names":["FarcasterApi","_privyInternal","constructor","privyInternal","this","initializeAuth","relyingParty","redirectUrl","token","fetch","FarcasterInit","body","relying_party","redirect_url","getFarcasterStatus","channel_token","FarcasterStatus","headers","authenticate","message","signature","fid","mode","res","FarcasterAuthenticate","Promise","all","session","storeToken","storeRefreshToken","refresh_token","storeIdentityToken","identity_token","callbacks","setUser","user","link","FarcasterLink","refreshSession","unlink","FarcasterUnlink"],"mappings":"6IAUc,MAAOA,EAIFC,eAKjB,WAAAC,CAAmBC,GACjBC,KAAKH,eAAiBE,CACvB,CAKM,oBAAME,EAAeC,aAC1BA,EAAYC,YACZA,EAAWC,MACXA,IAcA,aARkBJ,KAAKH,eAAeQ,MAAMC,EAAe,CACzDC,KAAM,CACJC,cAAeN,EACfO,aAAcN,EACdC,UAKL,CAKM,wBAAMM,EAAmBC,cAACA,IAO/B,aANkBX,KAAKH,eAAeQ,MAAMO,EAAiB,CAC3DC,QAAS,CACP,0BAA2BF,IAKhC,CAKM,kBAAMG,EAAaH,cACxBA,EAAaI,QACbA,EAAOC,UACPA,EAASC,IACTA,EAAGC,KACHA,IAQA,MAAMC,QAAYnB,KAAKH,eAAeQ,MAAMe,EAAuB,CACjEb,KAAM,CACJI,gBACAI,UACAC,YACAC,MACAC,UAWJ,aAPMG,QAAQC,IAAI,CAChBtB,KAAKH,eAAe0B,QAAQC,WAAWL,EAAIf,OAC3CJ,KAAKH,eAAe0B,QAAQE,kBAAkBN,EAAIO,eAClD1B,KAAKH,eAAe0B,QAAQI,mBAAmBR,EAAIS,kBAErD5B,KAAKH,eAAegC,WAAWC,UAAUX,EAAIY,MAEtCZ,CACR,CAIM,UAAMa,EAAKrB,cAChBA,EAAaI,QACbA,EAAOC,UACPA,EAASC,IACTA,UAOMjB,KAAKH,eAAeQ,MAAM4B,EAAe,CAC7C1B,KAAM,CACJI,gBACAI,UACAC,YACAC,SASJ,aAJkBjB,KAAKH,eAAeqC,kBAI3BH,IACZ,CAKM,YAAMI,EAAOlB,IAACA,UACbjB,KAAKH,eAAeQ,MAAM+B,EAAiB,CAC/C7B,KAAM,CACJU,SAQJ,aAHkBjB,KAAKH,eAAeqC,kBAG3BH,IACZ"}
|
package/dist/OAuthApi.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{OAuthInit as t,OAuthAuthenticate as e,OAuthLink as r,OAuthUnlink as i}from"@privy-io/public-api";import{PrivyClientError as s}from"./Error.js";import{createCodeVerifier as o,createStateCode as a,deriveCodeChallengeFromCodeVerifier as n,CODE_VERIFIER_KEY as h,STATE_CODE_KEY as _}from"./pkce.js";import"jose";class c{_privyInternal;_storage;_crypto;constructor(t,e,r){this._privyInternal=t,this._storage=e,this._crypto=r}async generateURL(e,r){const i=o(),s=a(),c=await n({codeVerifier:i,digest:this._crypto?.digest});return await Promise.all([this._storage.put(h,i),this._storage.put(_,s)]),this._privyInternal.fetch(t,{body:{redirect_to:r,provider:e,code_challenge:c,state_code:s}})}async loginWithCode(t,r,i,o){const[
|
|
1
|
+
import{OAuthInit as t,OAuthAuthenticate as e,OAuthLink as r,OAuthUnlink as i}from"@privy-io/public-api";import{PrivyClientError as s}from"./Error.js";import{createCodeVerifier as o,createStateCode as a,deriveCodeChallengeFromCodeVerifier as n,CODE_VERIFIER_KEY as h,STATE_CODE_KEY as _}from"./pkce.js";import"jose";class c{_privyInternal;_storage;_crypto;constructor(t,e,r){this._privyInternal=t,this._storage=e,this._crypto=r}async generateURL(e,r){const i=o(),s=a(),c=await n({codeVerifier:i,digest:this._crypto?.digest});return await Promise.all([this._storage.put(h,i),this._storage.put(_,s)]),this._privyInternal.fetch(t,{body:{redirect_to:r,provider:e,code_challenge:c,state_code:s}})}async loginWithCode(t,r,i,o,a){const[n,c]=await Promise.all([this._storage.get(h),this._storage.get(_)]);if(c!==r)throw this._privyInternal.createAnalyticsEvent("possible_phishing_attempt",{flow:"oauth",provider:i,storedStateCode:c??"",returnedStateCode:r??""}),new s({code:"pkce_state_code_mismatch",error:"Unexpected auth flow. This may be a phishing attempt."});const l=await this._privyInternal.fetch(e,{body:{authorization_code:t,code_type:o,state_code:c,code_verifier:n,mode:a}});return await Promise.all([this._privyInternal.session.storeToken(l.token),this._privyInternal.session.storeRefreshToken(l.refresh_token),this._privyInternal.session.storeIdentityToken(l.identity_token)]),this._privyInternal.callbacks?.setUser?.(l.user),await Promise.all([this._storage.del(h),this._storage.del(_)]),l}async linkWithCode(t,e,i,o){const[a,n]=await Promise.all([this._storage.get(h),this._storage.get(_)]);if(n!==e)throw this._privyInternal.createAnalyticsEvent("possible_phishing_attempt",{flow:"oauth",provider:i,storedStateCode:n??"",returnedStateCode:e??""}),new s({code:"pkce_state_code_mismatch",error:"Unexpected auth flow. This may be a phishing attempt."});await this._privyInternal.fetch(r,{body:{authorization_code:t,code_type:o,state_code:n,code_verifier:a}});const c=await this._privyInternal.refreshSession();return await Promise.all([this._storage.del(h),this._storage.del(_)]),c.user}async unlink(t,e){await this._privyInternal.fetch(i,{body:{provider:t,subject:e}});return(await this._privyInternal.refreshSession()).user}}export{c as default};
|
|
2
2
|
//# sourceMappingURL=OAuthApi.js.map
|
package/dist/OAuthApi.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OAuthApi.js","sources":["../src/OAuthApi.ts"],"sourcesContent":[null],"names":["OAuthApi","_privyInternal","_storage","_crypto","constructor","privyInternal","storage","crypto","this","generateURL","provider","redirectURI","codeVerifier","createCodeVerifier","stateCode","createStateCode","codeChallenge","deriveCodeChallengeFromCodeVerifier","digest","Promise","all","put","CODE_VERIFIER_KEY","STATE_CODE_KEY","fetch","OAuthInit","body","redirect_to","code_challenge","state_code","loginWithCode","authorizationCode","returnedStateCode","codeType","storedStateCode","get","createAnalyticsEvent","flow","PrivyClientError","code","error","res","OAuthAuthenticate","authorization_code","code_type","code_verifier","session","storeToken","token","storeRefreshToken","refresh_token","storeIdentityToken","identity_token","callbacks","setUser","user","del","linkWithCode","OAuthLink","refreshSession","unlink","subject","OAuthUnlink"],"mappings":"2TAec,MAAOA,EAIFC,eAKAC,SAKAC,QAKjB,WAAAC,CACEC,EACAC,EACAC,GAEAC,KAAKP,eAAiBI,EACtBG,KAAKN,SAAWI,EAChBE,KAAKL,QAAUI,CAChB,CASM,iBAAME,CAAYC,EAA6BC,GACpD,MAAMC,EAAeC,IACfC,EAAYC,IACZC,QAAsBC,EAAoC,CAC9DL,eACAM,OAAQV,KAAKL,SAASe,SAQxB,aALMC,QAAQC,IAAI,CAChBZ,KAAKN,SAASmB,IAAIC,EAAmBV,GACrCJ,KAAKN,SAASmB,IAAIE,EAAgBT,KAG7BN,KAAKP,eAAeuB,MAAMC,EAAW,CAC1CC,KAAM,CACJC,YAAahB,EACbD,WACAkB,eAAgBZ,EAChBa,WAAYf,IAGjB,
|
|
1
|
+
{"version":3,"file":"OAuthApi.js","sources":["../src/OAuthApi.ts"],"sourcesContent":[null],"names":["OAuthApi","_privyInternal","_storage","_crypto","constructor","privyInternal","storage","crypto","this","generateURL","provider","redirectURI","codeVerifier","createCodeVerifier","stateCode","createStateCode","codeChallenge","deriveCodeChallengeFromCodeVerifier","digest","Promise","all","put","CODE_VERIFIER_KEY","STATE_CODE_KEY","fetch","OAuthInit","body","redirect_to","code_challenge","state_code","loginWithCode","authorizationCode","returnedStateCode","codeType","mode","storedStateCode","get","createAnalyticsEvent","flow","PrivyClientError","code","error","res","OAuthAuthenticate","authorization_code","code_type","code_verifier","session","storeToken","token","storeRefreshToken","refresh_token","storeIdentityToken","identity_token","callbacks","setUser","user","del","linkWithCode","OAuthLink","refreshSession","unlink","subject","OAuthUnlink"],"mappings":"2TAec,MAAOA,EAIFC,eAKAC,SAKAC,QAKjB,WAAAC,CACEC,EACAC,EACAC,GAEAC,KAAKP,eAAiBI,EACtBG,KAAKN,SAAWI,EAChBE,KAAKL,QAAUI,CAChB,CASM,iBAAME,CAAYC,EAA6BC,GACpD,MAAMC,EAAeC,IACfC,EAAYC,IACZC,QAAsBC,EAAoC,CAC9DL,eACAM,OAAQV,KAAKL,SAASe,SAQxB,aALMC,QAAQC,IAAI,CAChBZ,KAAKN,SAASmB,IAAIC,EAAmBV,GACrCJ,KAAKN,SAASmB,IAAIE,EAAgBT,KAG7BN,KAAKP,eAAeuB,MAAMC,EAAW,CAC1CC,KAAM,CACJC,YAAahB,EACbD,WACAkB,eAAgBZ,EAChBa,WAAYf,IAGjB,CAWM,mBAAMgB,CACXC,EACAC,EACAtB,EACAuB,EACAC,GAEA,MAAOtB,EAAcuB,SAAyBhB,QAAQC,IAAI,CACxDZ,KAAKN,SAASkC,IAAId,GAClBd,KAAKN,SAASkC,IAAIb,KAGpB,GAAIY,IAAoBH,EAStB,MAPKxB,KAAKP,eAAeoC,qBAAqB,4BAA6B,CACzEC,KAAM,QACN5B,SAAUA,EACVyB,gBAAiBA,GAAmB,GACpCH,kBAAmBA,GAAqB,KAGpC,IAAIO,EAAiB,CACzBC,KAAM,2BACNC,MAAO,0DAIX,MAAMC,QAAYlC,KAAKP,eAAeuB,MAAMmB,EAAmB,CAC7DjB,KAAM,CACJkB,mBAAoBb,EACpBc,UAAWZ,EACXJ,WAAYM,EACZW,cAAelC,EACfsB,UAcJ,aAVMf,QAAQC,IAAI,CAChBZ,KAAKP,eAAe8C,QAAQC,WAAWN,EAAIO,OAC3CzC,KAAKP,eAAe8C,QAAQG,kBAAkBR,EAAIS,eAClD3C,KAAKP,eAAe8C,QAAQK,mBAAmBV,EAAIW,kBAGrD7C,KAAKP,eAAeqD,WAAWC,UAAUb,EAAIc,YAEvCrC,QAAQC,IAAI,CAACZ,KAAKN,SAASuD,IAAInC,GAAoBd,KAAKN,SAASuD,IAAIlC,KAEpEmB,CACR,CAQM,kBAAMgB,CACX3B,EACAC,EACAtB,EACAuB,GAEA,MAAOrB,EAAcuB,SAAyBhB,QAAQC,IAAI,CACxDZ,KAAKN,SAASkC,IAAId,GAClBd,KAAKN,SAASkC,IAAIb,KAGpB,GAAIY,IAAoBH,EAStB,MAPKxB,KAAKP,eAAeoC,qBAAqB,4BAA6B,CACzEC,KAAM,QACN5B,SAAUA,EACVyB,gBAAiBA,GAAmB,GACpCH,kBAAmBA,GAAqB,KAGpC,IAAIO,EAAiB,CACzBC,KAAM,2BACNC,MAAO,gEAILjC,KAAKP,eAAeuB,MAAMmC,EAAW,CACzCjC,KAAM,CACJkB,mBAAoBb,EACpBc,UAAWZ,EACXJ,WAAYM,EACZW,cAAelC,KAKnB,MAAM8B,QAAYlC,KAAKP,eAAe2D,iBAKtC,aAHMzC,QAAQC,IAAI,CAACZ,KAAKN,SAASuD,IAAInC,GAAoBd,KAAKN,SAASuD,IAAIlC,KAGpEmB,EAAIc,IACZ,CAQM,YAAMK,CAAOnD,EAA6BoD,SACzCtD,KAAKP,eAAeuB,MAAMuC,EAAa,CAACrC,KAAM,CAAChB,WAAUoD,aAO/D,aAJkBtD,KAAKP,eAAe2D,kBAI3BJ,IACZ"}
|
package/dist/PhoneApi.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{PasswordlessSmsInit as e,PasswordlessSmsAuthenticate as n,PasswordlessSmsLink as r,PasswordlessSmsUnlink as t}from"@privy-io/public-api";class i{_privyInternal;constructor(e){this._privyInternal=e}async sendCode(n,r){return this._privyInternal.fetch(e,{body:{phoneNumber:n,token:r}})}async loginWithCode(e,r){const
|
|
1
|
+
import{PasswordlessSmsInit as e,PasswordlessSmsAuthenticate as n,PasswordlessSmsLink as r,PasswordlessSmsUnlink as t}from"@privy-io/public-api";class i{_privyInternal;constructor(e){this._privyInternal=e}async sendCode(n,r){return this._privyInternal.fetch(e,{body:{phoneNumber:n,token:r}})}async loginWithCode(e,r,t){const i=await this._privyInternal.fetch(n,{body:{phoneNumber:e,code:r,mode:t}});return await Promise.all([this._privyInternal.session.storeToken(i.token),this._privyInternal.session.storeRefreshToken(i.refresh_token),this._privyInternal.session.storeIdentityToken(i.identity_token)]),this._privyInternal.callbacks?.setUser?.(i.user),i}async linkWithCode(e,n){await this._privyInternal.fetch(r,{body:{phoneNumber:e,code:n}});return(await this._privyInternal.refreshSession()).user}async unlink(e){await this._privyInternal.fetch(t,{body:{phoneNumber:e}});return(await this._privyInternal.refreshSession()).user}}export{i as default};
|
|
2
2
|
//# sourceMappingURL=PhoneApi.js.map
|
package/dist/PhoneApi.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PhoneApi.js","sources":["../src/PhoneApi.ts"],"sourcesContent":[null],"names":["PhoneApi","_privyInternal","constructor","privyInternal","this","sendCode","phoneNumber","token","fetch","PasswordlessSmsInit","body","loginWithCode","code","res","PasswordlessSmsAuthenticate","Promise","all","session","storeToken","storeRefreshToken","refresh_token","storeIdentityToken","identity_token","callbacks","setUser","user","linkWithCode","PasswordlessSmsLink","refreshSession","unlink","PasswordlessSmsUnlink"],"mappings":"gJASc,MAAOA,EAIFC,eAKjB,WAAAC,CAAmBC,GACjBC,KAAKH,eAAiBE,CACvB,CAQM,cAAME,CAASC,EAAqBC,GACzC,OAAOH,KAAKH,eAAeO,MAAMC,EAAqB,CAACC,KAAM,CAACJ,cAAaC,UAC5E,
|
|
1
|
+
{"version":3,"file":"PhoneApi.js","sources":["../src/PhoneApi.ts"],"sourcesContent":[null],"names":["PhoneApi","_privyInternal","constructor","privyInternal","this","sendCode","phoneNumber","token","fetch","PasswordlessSmsInit","body","loginWithCode","code","mode","res","PasswordlessSmsAuthenticate","Promise","all","session","storeToken","storeRefreshToken","refresh_token","storeIdentityToken","identity_token","callbacks","setUser","user","linkWithCode","PasswordlessSmsLink","refreshSession","unlink","PasswordlessSmsUnlink"],"mappings":"gJASc,MAAOA,EAIFC,eAKjB,WAAAC,CAAmBC,GACjBC,KAAKH,eAAiBE,CACvB,CAQM,cAAME,CAASC,EAAqBC,GACzC,OAAOH,KAAKH,eAAeO,MAAMC,EAAqB,CAACC,KAAM,CAACJ,cAAaC,UAC5E,CASM,mBAAMI,CACXL,EACAM,EACAC,GAEA,MAAMC,QAAYV,KAAKH,eAAeO,MAAMO,EAA6B,CACvEL,KAAM,CAACJ,cAAaM,OAAMC,UAW5B,aARMG,QAAQC,IAAI,CAChBb,KAAKH,eAAeiB,QAAQC,WAAWL,EAAIP,OAC3CH,KAAKH,eAAeiB,QAAQE,kBAAkBN,EAAIO,eAClDjB,KAAKH,eAAeiB,QAAQI,mBAAmBR,EAAIS,kBAGrDnB,KAAKH,eAAeuB,WAAWC,UAAUX,EAAIY,MAEtCZ,CACR,CAQM,kBAAMa,CAAarB,EAAqBM,SACvCR,KAAKH,eAAeO,MAAMoB,EAAqB,CAAClB,KAAM,CAACJ,cAAaM,UAK1E,aAHkBR,KAAKH,eAAe4B,kBAG3BH,IACZ,CAEM,YAAMI,CAAOxB,SACZF,KAAKH,eAAeO,MAAMuB,EAAuB,CAACrB,KAAM,CAACJ,iBAK/D,aAHkBF,KAAKH,eAAe4B,kBAG3BH,IACZ"}
|
package/dist/PrivyInternal.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import t from"fetch-retry";import{v4 as e}from"uuid";import{PrivyErrorCode as s}from"@privy-io/api-base";import{getPathWithParams as i,AppConfig as n,AnalyticsEvent as a,RefreshSession as o}from"@privy-io/public-api";import{PrivyApiError as r}from"./Error.js";import{Session as h}from"./Session.js";import c from"./toAbortSignalTimeout.js";import"eventemitter3";import"js-cookie";import"./Token.js";import"jose";const l="privy:caid";class d{baseUrl;_config;appId;appClientId;_storage;_analyticsId;_sdkVersion="js-sdk-core:0.
|
|
1
|
+
import t from"fetch-retry";import{v4 as e}from"uuid";import{PrivyErrorCode as s}from"@privy-io/api-base";import{getPathWithParams as i,AppConfig as n,AnalyticsEvent as a,RefreshSession as o}from"@privy-io/public-api";import{PrivyApiError as r}from"./Error.js";import{Session as h}from"./Session.js";import c from"./toAbortSignalTimeout.js";import"eventemitter3";import"js-cookie";import"./Token.js";import"jose";const l="privy:caid";class d{baseUrl;_config;appId;appClientId;_storage;_analyticsId;_sdkVersion="js-sdk-core:0.27.0";_fetch;nativeAppIdentifier;callbacks;_cache=new Map;session;constructor(e){this._storage=e.storage,this._analyticsId=null,this._getOrGenerateClientAnalyticsId(),this.baseUrl=e.baseUrl??"https://auth.privy.io",this.appId=e.appId,this.appClientId=e.appClientId,this._sdkVersion=e.sdkVersion??this._sdkVersion,this.callbacks=e.callbacks,"undefined"==typeof document&&(this.nativeAppIdentifier=e.nativeAppIdentifier),this.session=new h({storage:this._storage,isUsingServerCookies:!1}),this._fetch=t(fetch,{retries:3,retryDelay:500})}get isReady(){return Boolean(this._config)}get config(){return this._config}get caid(){return this._analyticsId}async _initialize(){this.isReady||(this._config=await this.getAppConfig(),this._config?.custom_api_url&&(this.baseUrl=this._config.custom_api_url,this.session.isUsingServerCookies=!0),this.callbacks?.setIsReady?.(!0),this.createAnalyticsEvent("sdk_initialize",{}))}async fetch(t,{body:e,params:s,headers:n,options:a={onRequest:this._beforeRequest.bind(this)}}){const o=`${this.baseUrl}${i(t.path,s)}`,h=new Request(o,{method:t.method,body:JSON.stringify(e),headers:n}),c=await a.onRequest(h),l=await this._fetch(h,c),d=await l.json();if(l.status>299)throw new r(d);return d}async _beforeRequestWithoutInitialize(t){const e=await this.session.getToken(),s=new Headers(t.headers);s.set("privy-app-id",this.appId),this.appClientId&&s.set("privy-client-id",this.appClientId),s.set("privy-client",this._sdkVersion),s.set("Authorization",`Bearer ${e}`),s.set("Content-Type","application/json"),s.set("Accept","application/json");const i=await this._getOrGenerateClientAnalyticsId();return i&&s.set("privy-ca-id",i),this.nativeAppIdentifier&&s.set("x-native-app-identifier",this.nativeAppIdentifier),{signal:c(2e4),headers:s,credentials:"include"}}async beforeRequestWithoutRefresh(t){return await this._initialize(),this._beforeRequestWithoutInitialize(t)}async _beforeRequest(t){return await this._initialize(),await this.getAccessToken(),this.beforeRequestWithoutRefresh(t)}async getAppConfig(){return await this.fetch(n,{params:{app_id:this.appId},options:{onRequest:this._beforeRequestWithoutInitialize.bind(this)}})}async _getOrGenerateClientAnalyticsId(){if(this._analyticsId)return this._analyticsId;try{const t=await this._storage.get(l);if("string"==typeof t&&t.length>0)return this._analyticsId=t,t}catch(t){console.error("Unable to load clientId",t)}try{this._analyticsId=e()}catch(t){console.error("Unable to generate uuidv4",t)}if(!this._analyticsId)return null;try{await this._storage.put(l,this._analyticsId)}catch(t){console.error(`Unable to store clientId: ${this._analyticsId}`,t)}return this._analyticsId}async destroyClientAnalyticsId(){try{return await this._storage.del(l)}catch(t){console.error("Unable to delete clientId",t)}}async createAnalyticsEvent(t,e){try{await this.fetch(a,{body:{event_name:t,client_id:await this._getOrGenerateClientAnalyticsId(),payload:e},options:{onRequest:this.beforeRequestWithoutRefresh.bind(this)}})}catch(t){}}async refreshSession(){const t=await this.session.getRefreshToken()??void 0,e=t??"key",s=this._cache.get(e);if(s)return await s;const i=this._refreshSession(t);this._cache.set(e,i);try{return await i}catch(t){throw t}finally{this._cache.delete(e)}}async _refreshSession(t){const e=await this.session.getToken();if(!this.session.hasRefreshCredentials(e,t??null))throw await this._initialize(),new Error("missing_or_invalid_token");try{const{session_update_action:e,...s}=await this.fetch(o,{body:{refresh_token:t},options:{onRequest:this.beforeRequestWithoutRefresh.bind(this)}});return this.callbacks?.setUser?.(s.user),"set"===e&&await Promise.all([this.session.storeToken(s.token),this.session.storeRefreshToken(s.refresh_token),this.session.storeIdentityToken(s.identity_token)]),"clear"===e&&(await this.session.destroyLocalState(),this.callbacks?.setUser?.(null)),"ignore"===e&&s.token&&(await this.session.storeToken(s.token),s.identity_token&&await this.session.storeIdentityToken(s.identity_token)),s}catch(t){throw(t instanceof r&&t.code===s.MISSING_OR_INVALID_TOKEN||t instanceof Error&&"missing_or_invalid_token"===t.message)&&(await this.session.destroyLocalState(),this.callbacks?.setUser?.(null)),t}}async getAccessToken(){const[t,e]=await Promise.all([this.session.getToken(),this.session.getRefreshToken()]);if(!this.session.tokenIsActive(t)&&this.session.hasRefreshCredentials(t,e))try{return await this.refreshSession(),await this.session.getToken()}catch(t){return null}return t}async getIdentityToken(){return await this.session.getIdentityToken()}}export{d as PrivyInternal};
|
|
2
2
|
//# sourceMappingURL=PrivyInternal.js.map
|
package/dist/SiweApi.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{SiweUnlink as e,SiweLink as t,SiweAuthenticate as n,SiweInit as i}from"@privy-io/public-api";class r{_privyInternal;_wallet=void 0;_preparedMessage;constructor(e){this._privyInternal=e}async unlinkWallet(t){try{await this._privyInternal.fetch(e,{body:{address:t}});return(await this._privyInternal.refreshSession()).user}catch(e){throw e}}async linkWithSiwe(e,n,i){const r=n||this._wallet,s=i||this._preparedMessage;if(!r)throw new Error("A wallet must be provided in the init step or as an argument to linkWithSiwe");if(!s)throw new Error("A message must be generated and signed before being used to link a wallet to privy");try{await this._privyInternal.fetch(t,{body:{message:s,signature:e,chainId:r.chainId,walletClientType:r.walletClientType,connectorType:r.connectorType}});return(await this._privyInternal.refreshSession()).user}catch(e){throw e}}async loginWithSiwe(e,t,i,r){const s=t||this._wallet,a=i||this._preparedMessage;if(!s)throw new Error("A wallet must be provided in the init step or as an argument to loginWithSiwe");if(!a)throw new Error("A message must be generated and signed before being used to login to privy with a wallet");try{const t=await this._privyInternal.fetch(n,{body:{signature:e,message:a,chainId:s.chainId,walletClientType:s.walletClientType,connectorType:s.connectorType,mode:r}});return await Promise.all([this._privyInternal.session.storeToken(t.token),this._privyInternal.session.storeRefreshToken(t.refresh_token),this._privyInternal.session.storeIdentityToken(t.identity_token)]),this._privyInternal.callbacks?.setUser?.(t.user),t}catch(e){throw e}}async init(e,t,n){this._wallet=e;const r=await this._privyInternal.fetch(i,{body:{address:e.address}}),{nonce:s}=r,a=`${(o={chainId:e.chainId.toString().replace("eip155:",""),address:e.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:t,nonce:s,uri:n}).domain} wants you to sign in with your Ethereum account:\n${o.address}\n\n${o.statement}\n\nURI: ${o.uri}\nVersion: 1\nChain ID: ${o.chainId}\nNonce: ${o.nonce}\nIssued At: ${o.issuedAt}\nResources:\n- https://privy.io`;var o;return this._preparedMessage=a,{nonce:s,message:a}}}export{r as default};
|
|
2
2
|
//# sourceMappingURL=SiweApi.js.map
|
package/dist/SiweApi.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SiweApi.js","sources":["../src/SiweApi.ts"],"sourcesContent":[null],"names":["SiweApi","_privyInternal","_wallet","undefined","_preparedMessage","constructor","privyInternal","this","
|
|
1
|
+
{"version":3,"file":"SiweApi.js","sources":["../src/SiweApi.ts"],"sourcesContent":[null],"names":["SiweApi","_privyInternal","_wallet","undefined","_preparedMessage","constructor","privyInternal","this","unlinkWallet","address","fetch","SiweUnlink","body","refreshSession","user","error","linkWithSiwe","signature","walletOverride","messageOverride","wallet","message","Error","SiweLink","chainId","walletClientType","connectorType","loginWithSiwe","mode","res","SiweAuthenticate","Promise","all","session","storeToken","token","storeRefreshToken","refresh_token","storeIdentityToken","identity_token","callbacks","setUser","init","domain","uri","response","SiweInit","nonce","opts","toString","replace","issuedAt","Date","toISOString","statement"],"mappings":"oGAkBc,MAAOA,EAEFC,eAQTC,aAA2BC,EAQ3BC,iBAGR,WAAAC,CAAmBC,GACjBC,KAAKN,eAAiBK,CACvB,CAOD,kBAAME,CAIJC,GAEA,UACQF,KAAKN,eAAeS,MAAMC,EAAY,CAC1CC,KAAM,CAACH,aAKT,aAFkBF,KAAKN,eAAeY,kBAE3BC,IACZ,CAAC,MAAOC,GACP,MAAMA,CACP,CACF,CAOD,kBAAMC,CAIJC,EAIAC,EAIAC,GAEA,MAAMC,EAASF,GAAkBX,KAAKL,QAChCmB,EAAUF,GAAmBZ,KAAKH,iBAExC,IAAKgB,EACH,MAAM,IAAIE,MACR,gFAIJ,IAAKD,EACH,MAAM,IAAIC,MACR,sFAIJ,UACQf,KAAKN,eAAeS,MAAMa,EAAU,CACxCX,KAAM,CACJS,UACAJ,YACAO,QAASJ,EAAOI,QAChBC,iBAAkBL,EAAOK,iBACzBC,cAAeN,EAAOM,iBAQ1B,aAJkBnB,KAAKN,eAAeY,kBAI3BC,IACZ,CAAC,MAAOC,GACP,MAAMA,CACP,CACF,CAOD,mBAAMY,CAIJV,EAIAC,EAIAC,EAIAS,GAEA,MAAMR,EAASF,GAAkBX,KAAKL,QAChCmB,EAAUF,GAAmBZ,KAAKH,iBAExC,IAAKgB,EACH,MAAM,IAAIE,MACR,iFAIJ,IAAKD,EACH,MAAM,IAAIC,MACR,4FAIJ,IACE,MAAMO,QAAYtB,KAAKN,eAAeS,MAAMoB,EAAkB,CAC5DlB,KAAM,CACJK,YACAI,UACAG,QAASJ,EAAOI,QAChBC,iBAAkBL,EAAOK,iBACzBC,cAAeN,EAAOM,cACtBE,UAWJ,aAPMG,QAAQC,IAAI,CAChBzB,KAAKN,eAAegC,QAAQC,WAAWL,EAAIM,OAC3C5B,KAAKN,eAAegC,QAAQG,kBAAkBP,EAAIQ,eAClD9B,KAAKN,eAAegC,QAAQK,mBAAmBT,EAAIU,kBAGrDhC,KAAKN,eAAeuC,WAAWC,UAAUZ,EAAIf,MACtCe,CACR,CAAC,MAAOd,GACP,MAAMA,CACP,CACF,CAOD,UAAM2B,CAEJtB,EAEAuB,EAEAC,GAEArC,KAAKL,QAAUkB,EAEf,MAAMyB,QAAiBtC,KAAKN,eAAeS,MAAMoC,EAAU,CAAClC,KAAM,CAACH,QAASW,EAAOX,YAC7EsC,MAACA,GAASF,EAEVxB,EAwCD,IADkB2B,EAvCW,CAEhCxB,QAASJ,EAAOI,QAAQyB,WAAWC,QAAQ,UAAW,IACtDzC,QAASW,EAAOX,QAChB0C,UAAU,IAAIC,MAAOC,cACrBC,UAAW,yHACXX,SACAI,QACAH,QAgCWD,4DACfK,EAAKvC,cAELuC,EAAKM,qBAEAN,EAAKJ,8BAEAI,EAAKxB,mBACRwB,EAAKD,qBACDC,EAAKG,2CAVlB,IAA2BH,EA3BvB,OADAzC,KAAKH,iBAAmBiB,EACjB,CAAC0B,QAAO1B,UAChB"}
|
package/dist/chains/polygon.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const
|
|
1
|
+
const o={id:137,name:"Polygon Mainnet",network:"polygon",nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{privy:{http:["https://polygon-mainnet.rpc.privy.systems"]},alchemy:{http:["https://polygon-mainnet.g.alchemy.com/v2"],webSocket:["wss://polygon-mainnet.g.alchemy.com/v2"]},infura:{http:["https://polygon-mainnet.infura.io/v3"],webSocket:["wss://polygon-mainnet.infura.io/ws/v3"]},default:{http:["https://polygon-rpc.com"]},public:{http:["https://polygon-rpc.com"]}},blockExplorers:{etherscan:{name:"PolygonScan",url:"https://polygonscan.com"},default:{name:"PolygonScan",url:"https://polygonscan.com"}}};export{o as polygon};
|
|
2
2
|
//# sourceMappingURL=polygon.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"polygon.js","sources":["../../src/chains/polygon.ts"],"sourcesContent":[null],"names":["polygon","id","name","network","nativeCurrency","symbol","decimals","rpcUrls","privy","http","alchemy","webSocket","infura","default","public","blockExplorers","etherscan","url"],"mappings":"AAEa,MAAAA,EAAiB,CAC5BC,GAAI,IACJC,KAAM,kBACNC,QAAS,
|
|
1
|
+
{"version":3,"file":"polygon.js","sources":["../../src/chains/polygon.ts"],"sourcesContent":[null],"names":["polygon","id","name","network","nativeCurrency","symbol","decimals","rpcUrls","privy","http","alchemy","webSocket","infura","default","public","blockExplorers","etherscan","url"],"mappings":"AAEa,MAAAA,EAAiB,CAC5BC,GAAI,IACJC,KAAM,kBACNC,QAAS,UACTC,eAAgB,CAACF,KAAM,MAAOG,OAAQ,MAAOC,SAAU,IACvDC,QAAS,CACPC,MAAO,CACLC,KAAM,CAAC,8CAETC,QAAS,CACPD,KAAM,CAAC,4CACPE,UAAW,CAAC,2CAEdC,OAAQ,CACNH,KAAM,CAAC,wCACPE,UAAW,CAAC,0CAEdE,QAAS,CACPJ,KAAM,CAAC,4BAETK,OAAQ,CACNL,KAAM,CAAC,6BAGXM,eAAgB,CACdC,UAAW,CACTd,KAAM,cACNe,IAAK,2BAEPJ,QAAS,CACPX,KAAM,cACNe,IAAK"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const o={id:80002,name:"Polygon Amoy",nativeCurrency:{name:"
|
|
1
|
+
const o={id:80002,name:"Polygon Amoy",network:"polygon-amoy",nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{privy:{http:["https://polygon-amoy.rpc.privy.systems"]},infura:{http:["https://polygon-amoy.infura.io/v3"],webSocket:["wss://polygon-amoy.infura.io/ws/v3"]},default:{http:["https://rpc-amoy.polygon.technology"]}},blockExplorers:{default:{name:"OK LINK",url:"https://www.oklink.com/amoy"}},testnet:!0};export{o as polygonAmoy};
|
|
2
2
|
//# sourceMappingURL=polygonAmoy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"polygonAmoy.js","sources":["../../src/chains/polygonAmoy.ts"],"sourcesContent":[null],"names":["polygonAmoy","id","name","nativeCurrency","symbol","decimals","rpcUrls","privy","http","infura","webSocket","default","blockExplorers","url","testnet"],"mappings":"AAEa,MAAAA,EAAqB,CAChCC,GAAI,MACJC,KAAM,eACNC,eAAgB,
|
|
1
|
+
{"version":3,"file":"polygonAmoy.js","sources":["../../src/chains/polygonAmoy.ts"],"sourcesContent":[null],"names":["polygonAmoy","id","name","network","nativeCurrency","symbol","decimals","rpcUrls","privy","http","infura","webSocket","default","blockExplorers","url","testnet"],"mappings":"AAEa,MAAAA,EAAqB,CAChCC,GAAI,MACJC,KAAM,eACNC,QAAS,eACTC,eAAgB,CAACF,KAAM,MAAOG,OAAQ,MAAOC,SAAU,IACvDC,QAAS,CACPC,MAAO,CACLC,KAAM,CAAC,2CAETC,OAAQ,CACND,KAAM,CAAC,qCACPE,UAAW,CAAC,uCAEdC,QAAS,CACPH,KAAM,CAAC,yCAGXI,eAAgB,CACdD,QAAS,CACPV,KAAM,UACNY,IAAK,gCAGTC,SAAS"}
|
package/dist/dts/EmailApi.d.ts
CHANGED
|
@@ -11,8 +11,9 @@ export default class EmailApi {
|
|
|
11
11
|
*
|
|
12
12
|
* @param email The email address that the one time code was sent to
|
|
13
13
|
* @param code The one time code
|
|
14
|
+
* @param mode Optional Whether or not to block sign ups (only allow existing users to log in).
|
|
14
15
|
*/
|
|
15
|
-
loginWithCode(email: string, code: string): Promise<import("@privy-io/public-api").PrivyAuthenticatedUser>;
|
|
16
|
+
loginWithCode(email: string, code: string, mode?: 'login-or-sign-up' | 'no-signup'): Promise<import("@privy-io/public-api").PrivyAuthenticatedUser>;
|
|
16
17
|
/**
|
|
17
18
|
* Links an email adress to an existing user
|
|
18
19
|
*
|
|
@@ -54,6 +55,16 @@ export default class EmailApi {
|
|
|
54
55
|
chain_id?: string | undefined;
|
|
55
56
|
wallet_client_type?: string | undefined;
|
|
56
57
|
connector_type?: string | undefined;
|
|
58
|
+
} | {
|
|
59
|
+
type: "wallet";
|
|
60
|
+
address: string;
|
|
61
|
+
chain_type: "solana";
|
|
62
|
+
verified_at: number;
|
|
63
|
+
first_verified_at: number | null;
|
|
64
|
+
latest_verified_at: number | null;
|
|
65
|
+
wallet_client: "unknown";
|
|
66
|
+
wallet_client_type?: string | undefined;
|
|
67
|
+
connector_type?: string | undefined;
|
|
57
68
|
} | {
|
|
58
69
|
type: "farcaster";
|
|
59
70
|
fid: number;
|
|
@@ -251,6 +262,16 @@ export default class EmailApi {
|
|
|
251
262
|
chain_id?: string | undefined;
|
|
252
263
|
wallet_client_type?: string | undefined;
|
|
253
264
|
connector_type?: string | undefined;
|
|
265
|
+
} | {
|
|
266
|
+
type: "wallet";
|
|
267
|
+
address: string;
|
|
268
|
+
chain_type: "solana";
|
|
269
|
+
verified_at: number;
|
|
270
|
+
first_verified_at: number | null;
|
|
271
|
+
latest_verified_at: number | null;
|
|
272
|
+
wallet_client: "unknown";
|
|
273
|
+
wallet_client_type?: string | undefined;
|
|
274
|
+
connector_type?: string | undefined;
|
|
254
275
|
} | {
|
|
255
276
|
type: "farcaster";
|
|
256
277
|
fid: number;
|
package/dist/dts/Error.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PrivyErrorCode } from '@privy-io/api-base';
|
|
2
2
|
type AuthAction = 'login' | 'link';
|
|
3
3
|
type Method = 'email' | 'sms' | 'oauth' | 'siwe' | 'passkey' | 'farcaster';
|
|
4
|
-
export type ClientErrorCode = `failed_to_complete_${AuthAction}_with_oauth` | `${AuthAction}_with_oauth_returned_with_invalid_credentials` | `${AuthAction}_with_oauth_was_cancelled_by_user` | 'attempted_rpc_call_before_logged_in' | 'attempted_submit_otp_before_sending' | 'attempted_to_set_password_before_connected' | 'attempted_to_set_password_but_password_already_set' | `attempted_login_with_${Method}_while_already_logged_in` | `attempted_link_${Method}_before_logged_in` | 'embedded_wallet_needs_recovery' | 'embedded_wallet_creation_error' | 'embedded_wallet_recovery_error' | 'embedded_wallet_set_password_error' | 'embedded_wallet_set_recovery_error' | 'unknown_embedded_wallet_error' | 'embedded_wallet_does_not_exist' | 'embedded_wallet_already_exists' | 'embedded_wallet_webview_not_loaded' | 'embedded_wallet_request_error' | 'no_passkey_found_for_challenge' | 'pkce_state_code_mismatch' | 'failed_to_create_passkey' | 'failed_to_generate_farcaster_uri' | 'failed_to_generate_farcaster_channel_token' | 'farcaster_polling_timeout' | 'farcaster_polling_canceled' | 'unsupported_recovery_method' | 'third_party_auth_error';
|
|
4
|
+
export type ClientErrorCode = `failed_to_complete_${AuthAction}_with_oauth` | `${AuthAction}_with_oauth_returned_with_invalid_credentials` | `${AuthAction}_with_oauth_was_cancelled_by_user` | 'attempted_rpc_call_before_logged_in' | 'attempted_submit_otp_before_sending' | 'attempted_to_set_password_before_connected' | 'attempted_to_set_password_but_password_already_set' | `attempted_login_with_${Method}_while_already_logged_in` | `attempted_link_${Method}_before_logged_in` | `attempted_unlink_siwe_before_logged_in` | 'embedded_wallet_needs_recovery' | 'embedded_wallet_creation_error' | 'embedded_wallet_recovery_error' | 'embedded_wallet_set_password_error' | 'embedded_wallet_set_recovery_error' | 'unknown_embedded_wallet_error' | 'embedded_wallet_does_not_exist' | 'embedded_wallet_already_exists' | 'embedded_wallet_webview_not_loaded' | 'embedded_wallet_request_error' | 'no_passkey_found_for_challenge' | 'pkce_state_code_mismatch' | 'failed_to_create_passkey' | 'failed_to_generate_farcaster_uri' | 'failed_to_generate_farcaster_channel_token' | 'farcaster_polling_timeout' | 'farcaster_polling_canceled' | 'unsupported_recovery_method' | 'third_party_auth_error';
|
|
5
5
|
export type ErrorBody<T extends PrivyErrorCode | ClientErrorCode> = {
|
|
6
6
|
error: string;
|
|
7
7
|
code: T;
|
|
@@ -16,11 +16,12 @@ export default class FarcasterApi {
|
|
|
16
16
|
/**
|
|
17
17
|
* Authenticate with Privy via the Sign-In With Farcaster spec [FIP-11: Sign in with Farcaster](https://github.com/farcasterxyz/protocol/discussions/110).
|
|
18
18
|
*/
|
|
19
|
-
authenticate({ channel_token, message, signature, fid, }: {
|
|
19
|
+
authenticate({ channel_token, message, signature, fid, mode, }: {
|
|
20
20
|
channel_token: string;
|
|
21
21
|
message: string;
|
|
22
22
|
signature: string;
|
|
23
23
|
fid: number;
|
|
24
|
+
mode?: 'login-or-sign-up' | 'no-signup';
|
|
24
25
|
}): Promise<import("@privy-io/public-api").PrivyAuthenticatedUser>;
|
|
25
26
|
/**
|
|
26
27
|
* Link with Privy via the Sign-In With Farcaster spec [FIP-11: Sign in with Farcaster](https://github.com/farcasterxyz/protocol/discussions/110).
|
|
@@ -65,6 +66,16 @@ export default class FarcasterApi {
|
|
|
65
66
|
chain_id?: string | undefined;
|
|
66
67
|
wallet_client_type?: string | undefined;
|
|
67
68
|
connector_type?: string | undefined;
|
|
69
|
+
} | {
|
|
70
|
+
type: "wallet";
|
|
71
|
+
address: string;
|
|
72
|
+
chain_type: "solana";
|
|
73
|
+
verified_at: number;
|
|
74
|
+
first_verified_at: number | null;
|
|
75
|
+
latest_verified_at: number | null;
|
|
76
|
+
wallet_client: "unknown";
|
|
77
|
+
wallet_client_type?: string | undefined;
|
|
78
|
+
connector_type?: string | undefined;
|
|
68
79
|
} | {
|
|
69
80
|
type: "farcaster";
|
|
70
81
|
fid: number;
|
|
@@ -267,6 +278,16 @@ export default class FarcasterApi {
|
|
|
267
278
|
chain_id?: string | undefined;
|
|
268
279
|
wallet_client_type?: string | undefined;
|
|
269
280
|
connector_type?: string | undefined;
|
|
281
|
+
} | {
|
|
282
|
+
type: "wallet";
|
|
283
|
+
address: string;
|
|
284
|
+
chain_type: "solana";
|
|
285
|
+
verified_at: number;
|
|
286
|
+
first_verified_at: number | null;
|
|
287
|
+
latest_verified_at: number | null;
|
|
288
|
+
wallet_client: "unknown";
|
|
289
|
+
wallet_client_type?: string | undefined;
|
|
290
|
+
connector_type?: string | undefined;
|
|
270
291
|
} | {
|
|
271
292
|
type: "farcaster";
|
|
272
293
|
fid: number;
|
package/dist/dts/OAuthApi.d.ts
CHANGED
|
@@ -13,8 +13,11 @@ export default class OAuthApi {
|
|
|
13
13
|
*
|
|
14
14
|
* @param authorizationCode The code generated by the authorization server
|
|
15
15
|
* @param returnedStateCode The state value initially set in the request by Privy to the authorization server
|
|
16
|
+
* @param provider The OAuth provider (e.g. google, apple)
|
|
17
|
+
* @param codeType The string literal `raw` indicating this the authorizationCode is unhashed, from a native sign in flow.
|
|
18
|
+
* @param mode Optional Whether or not to block sign ups (only allow existing users to log in).
|
|
16
19
|
*/
|
|
17
|
-
loginWithCode(authorizationCode: string, returnedStateCode: string, provider?: OAuthProviderType, codeType?: 'raw'): Promise<import("@privy-io/public-api").PrivyAuthenticatedUser>;
|
|
20
|
+
loginWithCode(authorizationCode: string, returnedStateCode: string, provider?: OAuthProviderType, codeType?: 'raw', mode?: 'login-or-sign-up' | 'no-signup'): Promise<import("@privy-io/public-api").PrivyAuthenticatedUser>;
|
|
18
21
|
/**
|
|
19
22
|
* Links an OAuth account to an existing user
|
|
20
23
|
*
|
|
@@ -56,6 +59,16 @@ export default class OAuthApi {
|
|
|
56
59
|
chain_id?: string | undefined;
|
|
57
60
|
wallet_client_type?: string | undefined;
|
|
58
61
|
connector_type?: string | undefined;
|
|
62
|
+
} | {
|
|
63
|
+
type: "wallet";
|
|
64
|
+
address: string;
|
|
65
|
+
chain_type: "solana";
|
|
66
|
+
verified_at: number;
|
|
67
|
+
first_verified_at: number | null;
|
|
68
|
+
latest_verified_at: number | null;
|
|
69
|
+
wallet_client: "unknown";
|
|
70
|
+
wallet_client_type?: string | undefined;
|
|
71
|
+
connector_type?: string | undefined;
|
|
59
72
|
} | {
|
|
60
73
|
type: "farcaster";
|
|
61
74
|
fid: number;
|
|
@@ -259,6 +272,16 @@ export default class OAuthApi {
|
|
|
259
272
|
chain_id?: string | undefined;
|
|
260
273
|
wallet_client_type?: string | undefined;
|
|
261
274
|
connector_type?: string | undefined;
|
|
275
|
+
} | {
|
|
276
|
+
type: "wallet";
|
|
277
|
+
address: string;
|
|
278
|
+
chain_type: "solana";
|
|
279
|
+
verified_at: number;
|
|
280
|
+
first_verified_at: number | null;
|
|
281
|
+
latest_verified_at: number | null;
|
|
282
|
+
wallet_client: "unknown";
|
|
283
|
+
wallet_client_type?: string | undefined;
|
|
284
|
+
connector_type?: string | undefined;
|
|
262
285
|
} | {
|
|
263
286
|
type: "farcaster";
|
|
264
287
|
fid: number;
|
package/dist/dts/PhoneApi.d.ts
CHANGED
|
@@ -11,8 +11,9 @@ export default class PhoneApi {
|
|
|
11
11
|
*
|
|
12
12
|
* @param phoneNumber The phone number that the one time code was sent to
|
|
13
13
|
* @param code The one time code
|
|
14
|
+
* @param mode Optional Whether or not to block sign ups (only allow existing users to log in).
|
|
14
15
|
*/
|
|
15
|
-
loginWithCode(phoneNumber: string, code: string): Promise<import("@privy-io/public-api").PrivyAuthenticatedUser>;
|
|
16
|
+
loginWithCode(phoneNumber: string, code: string, mode?: 'login-or-sign-up' | 'no-signup'): Promise<import("@privy-io/public-api").PrivyAuthenticatedUser>;
|
|
16
17
|
/**
|
|
17
18
|
* Links a phone number to an existing user
|
|
18
19
|
*
|
|
@@ -54,6 +55,16 @@ export default class PhoneApi {
|
|
|
54
55
|
chain_id?: string | undefined;
|
|
55
56
|
wallet_client_type?: string | undefined;
|
|
56
57
|
connector_type?: string | undefined;
|
|
58
|
+
} | {
|
|
59
|
+
type: "wallet";
|
|
60
|
+
address: string;
|
|
61
|
+
chain_type: "solana";
|
|
62
|
+
verified_at: number;
|
|
63
|
+
first_verified_at: number | null;
|
|
64
|
+
latest_verified_at: number | null;
|
|
65
|
+
wallet_client: "unknown";
|
|
66
|
+
wallet_client_type?: string | undefined;
|
|
67
|
+
connector_type?: string | undefined;
|
|
57
68
|
} | {
|
|
58
69
|
type: "farcaster";
|
|
59
70
|
fid: number;
|
|
@@ -251,6 +262,16 @@ export default class PhoneApi {
|
|
|
251
262
|
chain_id?: string | undefined;
|
|
252
263
|
wallet_client_type?: string | undefined;
|
|
253
264
|
connector_type?: string | undefined;
|
|
265
|
+
} | {
|
|
266
|
+
type: "wallet";
|
|
267
|
+
address: string;
|
|
268
|
+
chain_type: "solana";
|
|
269
|
+
verified_at: number;
|
|
270
|
+
first_verified_at: number | null;
|
|
271
|
+
latest_verified_at: number | null;
|
|
272
|
+
wallet_client: "unknown";
|
|
273
|
+
wallet_client_type?: string | undefined;
|
|
274
|
+
connector_type?: string | undefined;
|
|
254
275
|
} | {
|
|
255
276
|
type: "farcaster";
|
|
256
277
|
fid: number;
|
package/dist/dts/SiweApi.d.ts
CHANGED
|
@@ -7,6 +7,16 @@ import type { ExternalWallet } from './types';
|
|
|
7
7
|
* This enables developers to use Privy for reading/writing user *without* hosting their own backend to handle authentication. A big win for reducing operational complexity!
|
|
8
8
|
*/
|
|
9
9
|
export default class SiweApi {
|
|
10
|
+
/**
|
|
11
|
+
* Unlink a wallet account from a user. Note that you can only unlink a wallet account if the user has at least one other account.
|
|
12
|
+
*
|
|
13
|
+
* @returns The user object.
|
|
14
|
+
*/
|
|
15
|
+
unlinkWallet(
|
|
16
|
+
/**
|
|
17
|
+
* The address of the wallet to be unlinked
|
|
18
|
+
*/
|
|
19
|
+
address: string): Promise<PrivyUser>;
|
|
10
20
|
/**
|
|
11
21
|
* Link a new wallet via the [Sign-In With Ethereum](https://eips.ethereum.org/EIPS/eip-4361) spec.
|
|
12
22
|
*
|
|
@@ -42,7 +52,11 @@ export default class SiweApi {
|
|
|
42
52
|
/**
|
|
43
53
|
* Optional [Sign-In With Ethereum](https://eips.ethereum.org/EIPS/eip-4361) message, only needed if the message differs from the one in memory that was cached in previous call to `generateMessage`
|
|
44
54
|
*/
|
|
45
|
-
messageOverride?: string
|
|
55
|
+
messageOverride?: string,
|
|
56
|
+
/**
|
|
57
|
+
* Optional Whether or not to block sign ups (only allow existing users to log in).
|
|
58
|
+
*/
|
|
59
|
+
mode?: 'login-or-sign-up' | 'no-signup'): Promise<PrivyAuthenticatedUser>;
|
|
46
60
|
/**
|
|
47
61
|
* Begin a login or link flow according to the [Sign-In With Ethereum](https://eips.ethereum.org/EIPS/eip-4361) spec.
|
|
48
62
|
*
|
package/dist/dts/UserApi.d.ts
CHANGED
|
@@ -38,6 +38,16 @@ export default class UserApi {
|
|
|
38
38
|
chain_id?: string | undefined;
|
|
39
39
|
wallet_client_type?: string | undefined;
|
|
40
40
|
connector_type?: string | undefined;
|
|
41
|
+
} | {
|
|
42
|
+
type: "wallet";
|
|
43
|
+
address: string;
|
|
44
|
+
chain_type: "solana";
|
|
45
|
+
verified_at: number;
|
|
46
|
+
first_verified_at: number | null;
|
|
47
|
+
latest_verified_at: number | null;
|
|
48
|
+
wallet_client: "unknown";
|
|
49
|
+
wallet_client_type?: string | undefined;
|
|
50
|
+
connector_type?: string | undefined;
|
|
41
51
|
} | {
|
|
42
52
|
type: "farcaster";
|
|
43
53
|
fid: number;
|