@privy-io/js-sdk-core 0.61.2 → 0.61.4-beta-20260507041913
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/cjs/client/Privy.js +1 -1
- package/dist/cjs/client/Privy.js.map +1 -1
- package/dist/cjs/client/PrivyInternal.js +1 -1
- package/dist/cjs/client/PrivyInternal.js.map +1 -1
- package/dist/cjs/client/auth/OAuthApi.js +1 -1
- package/dist/cjs/client/auth/OAuthApi.js.map +1 -1
- package/dist/cjs/client/recovery/RecoveryApi.js.map +1 -1
- package/dist/cjs/client/recovery/RecoveryOAuthApi.js +1 -1
- package/dist/cjs/client/recovery/RecoveryOAuthApi.js.map +1 -1
- package/dist/cjs/crypto/resolve.js +2 -0
- package/dist/cjs/crypto/resolve.js.map +1 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/pkce.js +1 -1
- package/dist/cjs/pkce.js.map +1 -1
- package/dist/cjs/solana/client.js +1 -1
- package/dist/cjs/solana/client.js.map +1 -1
- package/dist/dts/index.d.mts +8 -1
- package/dist/dts/index.d.ts +8 -1
- package/dist/esm/client/Privy.mjs +1 -1
- package/dist/esm/client/Privy.mjs.map +1 -1
- package/dist/esm/client/PrivyInternal.mjs +1 -1
- package/dist/esm/client/PrivyInternal.mjs.map +1 -1
- package/dist/esm/client/auth/OAuthApi.mjs +1 -1
- package/dist/esm/client/auth/OAuthApi.mjs.map +1 -1
- package/dist/esm/client/recovery/RecoveryApi.mjs.map +1 -1
- package/dist/esm/client/recovery/RecoveryOAuthApi.mjs +1 -1
- package/dist/esm/client/recovery/RecoveryOAuthApi.mjs.map +1 -1
- package/dist/esm/crypto/resolve.mjs +2 -0
- package/dist/esm/crypto/resolve.mjs.map +1 -0
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/pkce.mjs +1 -1
- package/dist/esm/pkce.mjs.map +1 -1
- package/dist/esm/solana/client.mjs +1 -1
- package/dist/esm/solana/client.mjs.map +1 -1
- package/dist/esm/toAbortSignalTimeout.mjs.map +1 -1
- package/package.json +4 -6
package/dist/cjs/client/Privy.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./AppApi.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../crypto/resolve.js"),r=require("./AppApi.js"),i=require("./CrossAppApi.js"),t=require("./DelegatedWalletsApi.js"),s=require("./EmbeddedWalletApi.js"),a=require("./MfaPromises.js"),u=require("./PrivyInternal.js"),l=require("./UserApi.js"),n=require("./auth/AuthApi.js"),d=require("./funding/FundingApi.js"),o=require("./mfa/MfaApi.js"),p=require("./recovery/RecoveryApi.js");require("@privy-io/routes"),require("../Token.js"),require("jose"),require("@privy-io/chains"),require("../Error.js"),require("../embedded/EmbeddedBitcoinWalletProvider.js"),require("../wallet-api/unified-wallet.js"),require("../embedded/errors.js"),require("../embedded/types.js"),require("../embedded/stack/walletCreate.js"),require("../wallet-api/create.js"),require("../embedded/utils/index.js"),require("viem"),require("../embedded/EmbeddedWalletProxy.js"),require("../utils/sleep.js"),require("../embedded/EventCallbackQueue.js"),require("../embedded/withMfa.js"),require("../embedded/EmbeddedWalletProvider.js"),require("eventemitter3"),require("@privy-io/ethereum"),require("../embedded/stack/walletRpc.js"),require("../utils/encodings.js"),require("../wallet-api/rpc.js"),require("../wallet-api/generate-authorization-signature.js"),require("canonicalize"),require("@privy-io/encoding"),require("../wallet-api/types.js"),require("../embedded/stack/wallet-api-eth-transaction.js"),require("../embedded/stack/wallet-api-eth-typed-data.js"),require("../embedded/EmbeddedSolanaWalletProvider.js"),require("../solana/getWalletPublicKeyFromTransaction.js"),require("../solana/isVersionedTransaction.js"),require("fetch-retry"),require("@privy-io/api-base"),require("../Session.js"),require("js-cookie"),require("../utils/allSettled.js"),require("../toAbortSignalTimeout.js"),require("../utils/toSearchParams.js"),require("./logger.js"),require("../utils/noop.js"),require("./auth/CustomProviderApi.js"),require("./auth/maybeCreateWalletOnLogin.js"),require("../utils/getUserEmbeddedEthereumWallet.js"),require("../utils/getAllUserEmbeddedEthereumWallets.js"),require("../utils/embedded-wallets.js"),require("../utils/getUserEmbeddedSolanaWallet.js"),require("../utils/getAllUserEmbeddedSolanaWallets.js"),require("../utils/shouldCreateEmbeddedEthWallet.js"),require("../utils/shouldCreateEmbeddedSolWallet.js"),require("./auth/EmailApi.js"),require("./auth/FarcasterApi.js"),require("./auth/FarcasterV2Api.js"),require("./auth/GuestApi.js"),require("./auth/OAuthApi.js"),require("../pkce.js"),require("./auth/PasskeyApi.js"),require("./auth/PhoneApi.js"),require("./auth/SiweApi.js"),require("./auth/SiwsApi.js"),require("./auth/SmartWalletApi.js"),require("./funding/CoinbaseOnRampApi.js"),require("./funding/MoonpayOnRampApi.js"),require("../funding/moonpay.js"),require("./mfa/MfaPasskeyApi.js"),require("./mfa/MfaSmsApi.js"),require("./recovery/RecoveryICloudApi.js"),require("./recovery/RecoveryOAuthApi.js");exports.default=class{async initialize(){await this._privyInternal._initialize()}setMessagePoster(e){this.embeddedWallet.setMessagePoster(e)}addOAuthTokensListener(e){return this._privyInternal.session.on("oauth_tokens_granted",e),{unsubscribe:()=>{this._privyInternal.session.removeListener("oauth_tokens_granted",e)}}}setCallbacks(e){this._privyInternal.setCallbacks(e)}getAccessToken(){return this._privyInternal.getAccessToken()}getIdentityToken(){return this._privyInternal.getIdentityToken()}getCompiledPath(e,r){return this._privyInternal.getPath(e,r)}async fetchPrivyRoute(e,r){return this._privyInternal.fetch(e,r)}get logger(){return this._privyInternal.logger}constructor({clientId:q,...h}){let j=e.resolveCryptoFns(h.crypto);this._privyInternal=new u.PrivyInternal({...h,appClientId:q,crypto:j}),this.mfa=new o.default(this._privyInternal),this.mfaPromises=new a.default,this.app=new r.default(this._privyInternal),this.embeddedWallet=new s.default(this._privyInternal,h.embeddedWalletMessagePoster,h.supportedChains,this.mfa,this.mfaPromises,this.app),this.user=new l.default(this._privyInternal),this.auth=new n.default(this._privyInternal,this.embeddedWallet,h.storage,j,this.mfa),this.recovery=new p.default(this._privyInternal,h.storage,j),this.funding=new d.default(this._privyInternal),this.delegated=new t.default(this._privyInternal),this.crossApp=new i.default(this._privyInternal,h.storage)}};
|
|
2
2
|
//# sourceMappingURL=Privy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Privy.js","sources":["../../../src/client/Privy.ts"],"names":["initialize","this","_privyInternal","_initialize","setMessagePoster","poster","embeddedWallet","addOAuthTokensListener","listener","session","on","unsubscribe","removeListener","setCallbacks","callbacks","getAccessToken","getIdentityToken","getCompiledPath","r","opts","getPath","fetchPrivyRoute","fetch","logger","constructor","clientId","o","PrivyInternal","appClientId","mfa","MfaApi","mfaPromises","MfaPromises","app","AppApi","EmbeddedWalletApi","embeddedWalletMessagePoster","supportedChains","user","UserApi","auth","AuthApi","storage","
|
|
1
|
+
{"version":3,"file":"Privy.js","sources":["../../../src/client/Privy.ts"],"names":["initialize","this","_privyInternal","_initialize","setMessagePoster","poster","embeddedWallet","addOAuthTokensListener","listener","session","on","unsubscribe","removeListener","setCallbacks","callbacks","getAccessToken","getIdentityToken","getCompiledPath","r","opts","getPath","fetchPrivyRoute","fetch","logger","constructor","clientId","o","crypto","resolveCryptoFns","PrivyInternal","appClientId","mfa","MfaApi","mfaPromises","MfaPromises","app","AppApi","EmbeddedWalletApi","embeddedWalletMessagePoster","supportedChains","user","UserApi","auth","AuthApi","storage","recovery","RecoveryApi","funding","FundingApi","delegated","DelegatedWalletsApi","crossApp","CrossAppApi"],"mappings":"g7FAiFe,MAqGb,gBAAaA,SACLC,KAAKC,eAAeC,aAC5B,CAEA,gBAAAC,CAAwBC,GACtBJ,KAAKK,eAAeF,iBAAiBC,EACvC,CAQA,sBAAAE,CAA8BC,GAE5B,OADAP,KAAKC,eAAeO,QAAQC,GAAG,uBAAwBF,GAChD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EAAAA,QAAYnD,KAAKC,eAAgBwB,EAAEkB,QACzD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("fetch-retry"),t=require("
|
|
1
|
+
"use strict";var e=require("fetch-retry"),t=require("@privy-io/api-base"),s=require("@privy-io/routes"),i=require("../Error.js"),r=require("../Session.js"),a=require("../toAbortSignalTimeout.js"),n=require("../utils/toSearchParams.js"),o=require("./logger.js");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("eventemitter3"),require("jose"),require("js-cookie"),require("../Token.js"),require("../utils/allSettled.js"),require("../utils/noop.js");var c=/*#__PURE__*/h(e);let l="privy:caid";exports.PrivyInternal=class{setCallbacks(e){this.callbacks={...this.callbacks,...e}}get isReady(){return!!this._config}get config(){return this._config}get caid(){return this._analyticsId}async _initialize(){if(this.isReady)this.callbacks?.setIsReady?.(!0);else{if(!await this.isStorageAccessible())throw new i.PrivyClientError({code:"storage_error",error:"Unable to access storage"});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._sdkVersion.startsWith("react-auth:")||this.createAnalyticsEvent("sdk_initialize",{})}}getPath(e,{params:t,query:i}){return`${this.baseUrl}${s.getPathWithParams(e.path,t)}${n.toSearchParams(i)}`}async fetch(e,{body:t,params:s,query:r,headers:a,onRequest:n=this._beforeRequest.bind(this)}){let o=new Request(this.getPath(e,{params:s,query:r}),{method:e.method,body:JSON.stringify(t),headers:a}),h=await n(o),c=await this._fetch(o,h),l=await c.json();if(c.status>299)throw new i.PrivyApiError({...l,status:c.status});return l}async _beforeRequestWithoutInitialize(e){let t=await this.session.getPrivyAccessToken()??await this.session.getCustomerAccessToken(),s=new Headers(e.headers);s.set("privy-app-id",this.appId),this.appClientId&&s.set("privy-client-id",this.appClientId),s.set("privy-client",this._sdkVersion),t&&s.set("Authorization",`Bearer ${t}`),s.set("Content-Type","application/json"),s.set("Accept","application/json");let i=await this._getOrGenerateClientAnalyticsId();return i&&s.set("privy-ca-id",i),this.nativeAppIdentifier&&s.set("x-native-app-identifier",this.nativeAppIdentifier),{signal:a.default(2e4),headers:s,credentials:"include"}}async beforeRequestWithoutRefresh(e){return await this._initialize(),this._beforeRequestWithoutInitialize(e)}async _beforeRequest(e){return await this._initialize(),await this.getAccessTokenInternal(),this.beforeRequestWithoutRefresh(e)}async getAppConfig(){return await this.fetch(s.AppConfig,{params:{app_id:this.appId},onRequest:this._beforeRequestWithoutInitialize.bind(this)})}async _getOrGenerateClientAnalyticsId(){if(this._analyticsId)return this._analyticsId;try{let e=await this._storage.get(l);if("string"==typeof e&&e.length>0)return this._analyticsId=e,e}catch(e){this.logger.error("Unable to load clientId",e)}try{this._analyticsId=this._crypto.randomUUID()}catch(e){this.logger.error("Unable to generate uuidv4",e)}if(this._analyticsId){try{await this._storage.put(l,this._analyticsId)}catch(e){this.logger.error(`Unable to store clientId: ${this._analyticsId}`,e)}return this._analyticsId}}async destroyClientAnalyticsId(){try{return await this._storage.del(l)}catch(e){this.logger.error("Unable to delete clientId",e)}}async createAnalyticsEvent(e,t){try{await this.fetch(s.AnalyticsEvent,{body:{event_name:e,client_id:await this._getOrGenerateClientAnalyticsId(),payload:t},onRequest:this.beforeRequestWithoutRefresh.bind(this)})}catch(e){}}async refreshSession(e=!1){if(!await this.isStorageAccessible())throw new i.PrivyClientError({code:"storage_error",error:"Unable to access storage"});let t=await this.session.getRefreshToken()??void 0,s=t??"key",r=this._cache.get(s);if(r)return this.logger.debug("[privy:refresh] found in-flight session refresh request, deduping"),await r;let a=this._refreshSession(t,e);this._cache.set(s,a);try{return await a}finally{this._cache.delete(s)}}async _refreshSession(e,r){let a=await this.session.getCustomerAccessToken();if(!this.session.hasRefreshCredentials(a,e??null))throw this.logger.debug("[privy:refresh] missing tokens, skipping request"),await this._initialize(),new i.PrivyApiError({code:t.PrivyErrorCode.MISSING_OR_INVALID_TOKEN,error:"No tokens found in storage",status:401});try{this.logger.debug(`[privy:refresh] fetching: ${s.RefreshSession.path}`);let t=await this.fetch(s.RefreshSession,{body:{refresh_token:e},onRequest:this.beforeRequestWithoutRefresh.bind(this)}),i=t.session_update_action;return this.logger.debug(`[privy:refresh] response: ${i}`),"set"===i&&(await this.session.updateWithTokensResponse(t),this.logger.debug("[privy:refresh] tokens stored")),"clear"===i&&(await this.session.destroyLocalState(),this.logger.debug("[privy:refresh] tokens cleared"),r||this.callbacks?.setUser?.(null)),"ignore"===i&&(t.token&&(await this.session.storeCustomerAccessToken(t.token),this.logger.debug("[privy:refresh] token stored (CAT)")),t.privy_access_token&&(await this.session.storePrivyAccessToken(t.privy_access_token),this.logger.debug("[privy:refresh] token stored (PAT)")),t.identity_token&&(this.logger.debug("[privy:refresh] token stored (IDT)"),await this.session.storeIdentityToken(t.identity_token))),this.logger.debug("[privy:refresh] returning response"),r||this.callbacks?.setUser?.(t.user),t}catch(e){throw this.logger.debug(`[privy:refresh] error: ${e.message??"unknown error"}`),e instanceof i.PrivyApiError&&e.code===t.PrivyErrorCode.MISSING_OR_INVALID_TOKEN&&(await this.session.destroyLocalState(),r||this.callbacks?.setUser?.(null)),e}}async getAccessToken(){let[e,t]=await Promise.all([this.session.getCustomerAccessToken(),this.session.getRefreshToken()]);if(e&&!this.session.tokenIsActive(e)&&this.session.hasRefreshCredentials(e,t)){let t=await this.refreshSession(),s=await this.session.getCustomerAccessToken();return t.token||this.logger.debug("[privy:getAccessToken] expected token received null"),t.token===e&&this.logger.debug("[privy:getAccessToken] expected new token in response received existing"),s===e&&this.logger.debug("[privy:getAccessToken] expected new token in storage received existing"),t.token??s}return e&&!this.session.tokenIsActive(e)?(this.logger.debug("[privy:getAccessToken] unable to refresh inactive token"),this.callbacks?.setUser?.(null),await this.session.destroyLocalState(),null):e}async getAccessTokenInternal(){let e=await this.getAccessToken();return await this.session.getPrivyAccessToken()??e}async getIdentityToken(){return await this.session.getIdentityToken()}async isStorageAccessible(){try{let e=`privy:__storage__test-${this._crypto.randomUUID()}`,t="blobby";await this._storage.put(e,t);let s=await this._storage.get(e);return await this._storage.del(e),s===t}catch(e){return this.logger.error(e),!1}}constructor(e){this._sdkVersion="js-sdk-core:0.61.4-beta-20260507041913",this._cache=new Map,this.logger=o.toLoggerWithLevel({level:e.logger?.level??e.logLevel??"ERROR",logger:e.logger??console}),this._storage=e.storage,this._crypto=e.crypto,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,this.nativeAppIdentifier=e.nativeAppIdentifier,this.session=new r.Session({storage:this._storage,isUsingServerCookies:!1,appId:e.appId}),this._fetch=c.default(globalThis.fetch,{retries:3,retryDelay:e=>3**e*500,retryOn:[408,409,425,500,502,503,504]}),this.session.on("error_storing_tokens",(e=>{this.createAnalyticsEvent("error_updating_tokens_in_storage",{reason:e})}))}};
|
|
2
2
|
//# sourceMappingURL=PrivyInternal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrivyInternal.js","sources":["../../../src/client/PrivyInternal.ts"],"names":["CLIENT_ANALYTICS_ID_KEY","setCallbacks","callbacks","this","isReady","_config","config","caid","_analyticsId","_initialize","setIsReady","isStorageAccessible","PrivyClientError","code","error","getAppConfig","custom_api_url","baseUrl","session","isUsingServerCookies","_sdkVersion","startsWith","createAnalyticsEvent","getPath","r","params","query","getPathWithParams","path","toSearchParams","fetch","body","headers","onRequest","_beforeRequest","bind","request","Request","method","JSON","stringify","requestInit","res","_fetch","json","status","PrivyApiError","_beforeRequestWithoutInitialize","token","getPrivyAccessToken","getCustomerAccessToken","Headers","set","appId","appClientId","_getOrGenerateClientAnalyticsId","nativeAppIdentifier","signal","toAbortSignalTimeout","credentials","beforeRequestWithoutRefresh","getAccessTokenInternal","AppConfig","app_id","clientAnalyticsId","_storage","get","length","e","logger","
|
|
1
|
+
{"version":3,"file":"PrivyInternal.js","sources":["../../../src/client/PrivyInternal.ts"],"names":["CLIENT_ANALYTICS_ID_KEY","setCallbacks","callbacks","this","isReady","_config","config","caid","_analyticsId","_initialize","setIsReady","isStorageAccessible","PrivyClientError","code","error","getAppConfig","custom_api_url","baseUrl","session","isUsingServerCookies","_sdkVersion","startsWith","createAnalyticsEvent","getPath","r","params","query","getPathWithParams","path","toSearchParams","fetch","body","headers","onRequest","_beforeRequest","bind","request","Request","method","JSON","stringify","requestInit","res","_fetch","json","status","PrivyApiError","_beforeRequestWithoutInitialize","token","getPrivyAccessToken","getCustomerAccessToken","Headers","set","appId","appClientId","_getOrGenerateClientAnalyticsId","nativeAppIdentifier","signal","toAbortSignalTimeout","credentials","beforeRequestWithoutRefresh","getAccessTokenInternal","AppConfig","app_id","clientAnalyticsId","_storage","get","length","e","logger","_crypto","randomUUID","put","destroyClientAnalyticsId","del","name","properties","AnalyticsEvent","event_name","client_id","payload","refreshSession","skipCallbacks","refreshToken","getRefreshToken","undefined","key","cached","_cache","debug","promise","_refreshSession","delete","hasRefreshCredentials","PrivyErrorCode","MISSING_OR_INVALID_TOKEN","RefreshSession","refresh_token","session_update_action","updateWithTokensResponse","destroyLocalState","setUser","storeCustomerAccessToken","privy_access_token","storePrivyAccessToken","identity_token","storeIdentityToken","user","message","s","getAccessToken","Promise","all","tokenIsActive","tokenFromStorage","cat","getIdentityToken","value","valueFromStorage","constructor","o","Map","toLoggerWithLevel","level","logLevel","console","storage","crypto","sdkVersion","Session","rfetch","globalThis","retries","retryDelay","attempt","retryOn","on","reason"],"mappings":"wfA8DA,IAAMA,EAA0B,mCAOzB,MAuHEC,YAAAA,CAAaC,GAClBC,KAAKD,UAAY,IAAIC,KAAKD,aAAcA,EAC1C,CAOA,WAAIE,GACF,QAAeD,KAAKE,OACtB,CAKA,UAAIC,GACF,OAAOH,KAAKE,OAAO,CAUrB,QAAIE,GACF,OAAOJ,KAAKK,YAAY,CAQ1B,iBAAaC,GAEX,GA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AsBgE,EAAEhE,oBAE7BrD,KAAKe,QAAU,IAAI+G,EAAAA,QAAQ,CACzBH,QAAS3H,KAAK8D,SACd9C,sBAAsB,EACtBkC,MAAOmE,EAAEnE,QAGXlD,KAAKwC,OAASuF,EAAAA,QAAOC,WAAWrG,MAAO,CACrCsG,QAAS,EAGTC,WAAYjE,GAAa,GAAKkE,EAAU,IAExCC,QAAS,CACP,IACA,IACA,IACA,IACA,IACA,IACA,OAKJpI,KAAKe,QAAQsH,GAAG,wBAAwBpE,IACjCjE,KAAKmB,qBAAqB,mCAAoC,CACjEmH,OAAAA,GACF,GAEJ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@privy-io/routes"),t=require("../../Error.js"),r=require("../../pkce.js"),i=require("./maybeCreateWalletOnLogin.js");require("jose"),require("../../utils/getUserEmbeddedEthereumWallet.js"),require("../../utils/getAllUserEmbeddedEthereumWallets.js"),require("../../utils/embedded-wallets.js"),require("../../utils/getUserEmbeddedSolanaWallet.js"),require("../../utils/getAllUserEmbeddedSolanaWallets.js"),require("../../utils/shouldCreateEmbeddedEthWallet.js"),require("../../utils/shouldCreateEmbeddedSolWallet.js");exports.default=class{async generateURL(t,i){let s=r.createCodeVerifier(),a=r.createStateCode(),o=await r.deriveCodeChallengeFromCodeVerifier({codeVerifier:s,digest:this._crypto
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@privy-io/routes"),t=require("../../Error.js"),r=require("../../pkce.js"),i=require("./maybeCreateWalletOnLogin.js");require("jose"),require("../../utils/getUserEmbeddedEthereumWallet.js"),require("../../utils/getAllUserEmbeddedEthereumWallets.js"),require("../../utils/embedded-wallets.js"),require("../../utils/getUserEmbeddedSolanaWallet.js"),require("../../utils/getAllUserEmbeddedSolanaWallets.js"),require("../../utils/shouldCreateEmbeddedEthWallet.js"),require("../../utils/shouldCreateEmbeddedSolWallet.js");exports.default=class{async generateURL(t,i){let s=r.createCodeVerifier(),a=r.createStateCode(),o=await r.deriveCodeChallengeFromCodeVerifier({codeVerifier:s,digest:this._crypto.digest});return await Promise.all([this._storage.put(r.CODE_VERIFIER_KEY,s),this._storage.put(r.STATE_CODE_KEY,a)]),this._privyInternal.fetch(e.OAuthInit,{body:{redirect_to:i,provider:t,code_challenge:o,state_code:a}})}async loginWithCode(s,a,o,l,d,n){let[_,h]=await Promise.all([this._storage.get(r.CODE_VERIFIER_KEY),this._storage.get(r.STATE_CODE_KEY)]);if(h!==a)throw this._privyInternal.createAnalyticsEvent("possible_phishing_attempt",{flow:"oauth",provider:o,storedStateCode:h??"",returnedStateCode:a??""}),new t.PrivyClientError({code:"pkce_state_code_mismatch",error:"Unexpected auth flow. This may be a phishing attempt."});let u=await this._privyInternal.fetch(e.OAuthAuthenticate,{body:{authorization_code:s,code_type:l,state_code:h,code_verifier:_,mode:d}});await this._privyInternal.session.updateWithTokensResponse(u);let c=await i.maybeCreateWalletOnLogin(this._embedded,u,n?.embedded);return await Promise.all([this._storage.del(r.CODE_VERIFIER_KEY),this._storage.del(r.STATE_CODE_KEY)]),this._privyInternal.callbacks?.setUser?.(c.user),c}async linkWithCode(i,s,a,o){let[l,d]=await Promise.all([this._storage.get(r.CODE_VERIFIER_KEY),this._storage.get(r.STATE_CODE_KEY)]);if(d!==s)throw this._privyInternal.createAnalyticsEvent("possible_phishing_attempt",{flow:"oauth",provider:a,storedStateCode:d??"",returnedStateCode:s??""}),new t.PrivyClientError({code:"pkce_state_code_mismatch",error:"Unexpected auth flow. This may be a phishing attempt."});let n=await this._privyInternal.fetch(e.OAuthLink,{body:{authorization_code:i,code_type:o,state_code:d,code_verifier:l}});await this._privyInternal.session.processOAuthTokens(n.oauth_tokens);let _=await this._privyInternal.refreshSession();return await Promise.all([this._storage.del(r.CODE_VERIFIER_KEY),this._storage.del(r.STATE_CODE_KEY)]),{user:_.user,identity_token:_.identity_token}}async unlink(t,r){await this._privyInternal.fetch(e.OAuthUnlink,{body:{provider:t,subject:r}});let i=await this._privyInternal.refreshSession();return{user:i.user,identity_token:i.identity_token}}constructor(e,t,r,i){this._privyInternal=e,this._embedded=t,this._storage=r,this._crypto=i}};
|
|
2
2
|
//# sourceMappingURL=OAuthApi.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OAuthApi.js","sources":["../../../../src/client/auth/OAuthApi.ts"],"names":["generateURL","provider","redirectURI","codeVerifier","createCodeVerifier","stateCode","createStateCode","codeChallenge","deriveCodeChallengeFromCodeVerifier","digest","this","_crypto","Promise","all","_storage","put","CODE_VERIFIER_KEY","STATE_CODE_KEY","_privyInternal","fetch","OAuthInit","body","redirect_to","code_challenge","state_code","loginWithCode","authorizationCode","returnedStateCode","codeType","mode","opts","storedStateCode","get","createAnalyticsEvent","flow","PrivyClientError","code","error","res","OAuthAuthenticate","authorization_code","code_type","code_verifier","session","updateWithTokensResponse","sessionWithWallets","maybeCreateWalletOnLogin","_embedded","embedded","del","callbacks","setUser","user","linkWithCode","linkResponse","OAuthLink","processOAuthTokens","oauth_tokens","refreshSession","identity_token","unlink","subject","OAuthUnlink","constructor","privyInternal","storage","crypto"],"mappings":"umBAkBe,MA2Cb,iBAAaA,CAAYC,EAA2BC,GAClD,IAAMC,EAAeC,uBACfC,EAAYC,EAAAA,kBACZC,QAAsBC,EAAAA,oCAAoC,CAC9DL,aAAAA,EACAM,OAAQC,KAAKC,
|
|
1
|
+
{"version":3,"file":"OAuthApi.js","sources":["../../../../src/client/auth/OAuthApi.ts"],"names":["generateURL","provider","redirectURI","codeVerifier","createCodeVerifier","stateCode","createStateCode","codeChallenge","deriveCodeChallengeFromCodeVerifier","digest","this","_crypto","Promise","all","_storage","put","CODE_VERIFIER_KEY","STATE_CODE_KEY","_privyInternal","fetch","OAuthInit","body","redirect_to","code_challenge","state_code","loginWithCode","authorizationCode","returnedStateCode","codeType","mode","opts","storedStateCode","get","createAnalyticsEvent","flow","PrivyClientError","code","error","res","OAuthAuthenticate","authorization_code","code_type","code_verifier","session","updateWithTokensResponse","sessionWithWallets","maybeCreateWalletOnLogin","_embedded","embedded","del","callbacks","setUser","user","linkWithCode","linkResponse","OAuthLink","processOAuthTokens","oauth_tokens","refreshSession","identity_token","unlink","subject","OAuthUnlink","constructor","privyInternal","storage","crypto"],"mappings":"umBAkBe,MA2Cb,iBAAaA,CAAYC,EAA2BC,GAClD,IAAMC,EAAeC,uBACfC,EAAYC,EAAAA,kBACZC,QAAsBC,EAAAA,oCAAoC,CAC9DL,aAAAA,EACAM,OAAQC,KAAKC,QAAQF,SAQvB,aALMG,QAAQC,IAAI,CAChBH,KAAKI,SAASC,IAAIC,EAAAA,kBAAmBb,GACrCO,KAAKI,SAASC,IAAIE,iBAAgBZ,KAG7BK,KAAKQ,eAAeC,MAAMC,YAAW,CAC1CC,KAAM,CACJC,YAAapB,EACbD,SAAAA,EACAsB,eAAgBhB,EAChBiB,WAAYnB,IAGlB,CAWA,mBAAaoB,CACXC,EACAC,EACA1B,EACA2B,EACAC,EACAC,GAEA,IAAO3B,EAAc4B,SAAyBnB,QAAQC,IAAI,CACxDH,KAAKI,SAASkB,IAAIhB,EAAAA,mBAClBN,KAAKI,SAASkB,IAAIf,EAAAA,kBAGpB,GAAIc,IAAoBJ,EAStB,MAPKjB,KAAKQ,eAAee,qBAAqB,4BAA6B,CACzEC,KAAM,QACNjC,SAAUA,EACV8B,gBAAiBA,GAAmB,GACpCJ,kBAAmBA,GAAqB,KAGpC,IAAIQ,EAAAA,iBAAiB,CACzBC,KAAM,2BACNC,MAAO,0DAIX,IAAMC,QAAY5B,KAAKQ,eAAeC,MAAMoB,EAAAA,kBAAmB,CAC7DlB,KAAM,CACJmB,mBAAoBd,EACpBe,UAAWb,EACXJ,WAAYO,EACZW,cAAevC,EACf0B,KAAAA,WAIEnB,KAAKQ,eAAeyB,QAAQC,yBAAyBN,GAE3D,IAAMO,QAA2BC,EAAAA,yBAAyBpC,KAAKqC,UAAWT,EAAKR,GAAMkB,U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YC,EACjBtC,KAAKI,SAAWmD,EAChBvD,KAAKC,QAAUuD,CACjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecoveryApi.js","sources":["../../../../src/client/recovery/RecoveryApi.ts"],"names":["getRecoveryKeyMaterial","address","chain_type","this","_privyInternal","fetch","RecoveryKeyMaterial","body","params","constructor","privyInternal","storage","crypto","auth","RecoveryOAuthApi","icloudAuth","RecoveryICloudApi"],"mappings":"
|
|
1
|
+
{"version":3,"file":"RecoveryApi.js","sources":["../../../../src/client/recovery/RecoveryApi.ts"],"names":["getRecoveryKeyMaterial","address","chain_type","this","_privyInternal","fetch","RecoveryKeyMaterial","body","params","constructor","privyInternal","storage","crypto","auth","RecoveryOAuthApi","icloudAuth","RecoveryICloudApi"],"mappings":"sQAsCE,4BAAaA,CAAuBC,EAAiBC,GACnD,OAAOC,KAAKC,eAAeC,MAAMC,EAAAA,oBAAqB,CACpDC,KAAM,CACJL,WAAAA,GAEFM,OAAQ,CACNP,QAAAA,IAGN,CAtBA,WAAAQ,CAAmBC,EAA8BC,EAAkBC,GACjET,KAAKC,eAAiBM,EAEtBP,KAAKU,KAAO,IAAIC,EAAAA,QAAiBX,KAAKC,eAAgBO,EAASC,GAC/DT,KAAKY,WAAa,IAAIC,EAAAA,QAAkBb,KAAKC,eAC/C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@privy-io/routes"),t=require("../../Error.js"),r=require("../../pkce.js");require("jose");exports.default=class{async generateURL(t){let i=r.createCodeVerifier(),a=r.createStateCode(),o=await r.deriveCodeChallengeFromCodeVerifier({codeVerifier:i,digest:this._crypto
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@privy-io/routes"),t=require("../../Error.js"),r=require("../../pkce.js");require("jose");exports.default=class{async generateURL(t){let i=r.createCodeVerifier(),a=r.createStateCode(),o=await r.deriveCodeChallengeFromCodeVerifier({codeVerifier:i,digest:this._crypto.digest});return await Promise.all([this._storage.put(r.CODE_VERIFIER_KEY,i),this._storage.put(r.STATE_CODE_KEY,a)]),this._privyInternal.fetch(e.RecoveryOAuthInit,{body:{redirect_to:t,code_challenge:o,state_code:a}})}async authorize(i,a){let[o,s]=await Promise.all([this._storage.get(r.CODE_VERIFIER_KEY),this._storage.get(r.STATE_CODE_KEY)]);if(s!==a)throw this._privyInternal.createAnalyticsEvent("possible_phishing_attempt",{flow:"recovery_oauth",storedStateCode:s??"",returnedStateCode:a??""}),new t.PrivyClientError({code:"pkce_state_code_mismatch",error:"Unexpected auth flow. This may be a phishing attempt."});let _=await this._privyInternal.fetch(e.RecoveryOAuthAuthenticate,{body:{authorization_code:i,state_code:s,code_verifier:o}});return await Promise.all([this._storage.del(r.CODE_VERIFIER_KEY),this._storage.del(r.STATE_CODE_KEY)]),_}constructor(e,t,r){this._privyInternal=e,this._storage=t,this._crypto=r}};
|
|
2
2
|
//# sourceMappingURL=RecoveryOAuthApi.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecoveryOAuthApi.js","sources":["../../../../src/client/recovery/RecoveryOAuthApi.ts"],"names":["generateURL","redirectURI","codeVerifier","createCodeVerifier","stateCode","createStateCode","codeChallenge","deriveCodeChallengeFromCodeVerifier","digest","this","_crypto","Promise","all","_storage","put","CODE_VERIFIER_KEY","STATE_CODE_KEY","_privyInternal","fetch","RecoveryOAuthInit","body","redirect_to","code_challenge","state_code","authorize","authorizationCode","returnedStateCode","storedStateCode","get","createAnalyticsEvent","flow","PrivyClientError","code","error","res","RecoveryOAuthAuthenticate","authorization_code","code_verifier","del","constructor","privyInternal","storage","crypto"],"mappings":"
|
|
1
|
+
{"version":3,"file":"RecoveryOAuthApi.js","sources":["../../../../src/client/recovery/RecoveryOAuthApi.ts"],"names":["generateURL","redirectURI","codeVerifier","createCodeVerifier","stateCode","createStateCode","codeChallenge","deriveCodeChallengeFromCodeVerifier","digest","this","_crypto","Promise","all","_storage","put","CODE_VERIFIER_KEY","STATE_CODE_KEY","_privyInternal","fetch","RecoveryOAuthInit","body","redirect_to","code_challenge","state_code","authorize","authorizationCode","returnedStateCode","storedStateCode","get","createAnalyticsEvent","flow","PrivyClientError","code","error","res","RecoveryOAuthAuthenticate","authorization_code","code_verifier","del","constructor","privyInternal","storage","crypto"],"mappings":"mMA6CE,iBAAaA,CAAYC,GACvB,IAAMC,EAAeC,EAAAA,qBACfC,EAAYC,EAAAA,kBACZC,QAAsBC,EAAAA,oCAAoC,CAC9DL,aAAAA,EACAM,OAAQC,KAAKC,QAAQF,SAQvB,aALMG,QAAQC,IAAI,CAChBH,KAAKI,SAASC,IAAIC,oBAAmBb,GACrCO,KAAKI,SAASC,IAAIE,EAAAA,eAAgBZ,KAG7BK,KAAKQ,eAAeC,MAAMC,oBAAmB,CAClDC,KAAM,CACJC,YAAapB,EACbqB,eAAgBhB,EAChBiB,WAAYnB,IAGlB,CAQA,eAAaoB,CAAUC,EAA2BC,GAChD,IAAOxB,EAAcyB,SAAyBhB,QAAQC,IAAI,CACxDH,KAAKI,SAASe,IAAIb,EAAAA,mBAClBN,KAAKI,SAASe,IAAIZ,EAAAA,kBAGpB,GAAIW,IAAoBD,EAQtB,MANKjB,KAAKQ,eAAeY,qBAAqB,4BAA6B,CACzEC,KAAM,iBACNH,gBAAiBA,GAAmB,GACpCD,kBAAmBA,GAAqB,KAGpC,IAAIK,EAAAA,iBAAiB,CACzBC,KAAM,2BACNC,MAAO,0DAIX,IAAMC,QAAYzB,KAAKQ,eAAeC,MAAMiB,EAAAA,0BAA2B,CACrEf,KAAM,CACJgB,mBAAoBX,EACpBF,WAAYI,EACZU,cAAenC,KAMnB,aAFMS,QAAQC,IAAI,CAACH,KAAKI,SAASyB,IAAIvB,EAAAA,mBAAoBN,KAAKI,SAASyB,IAAItB,EAAAA,kBAEpEkB,CACT,CAvEA,WAAAK,CAAmBC,EAA8BC,EAAkBC,GACjEjC,KAAKQ,eAAiBuB,EACtB/B,KAAKI,SAAW4B,EAChBhC,KAAKC,QAAUgC,CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.js","sources":["../../../src/crypto/resolve.ts"],"names":["overrides","digest","alg","data","globalThis","crypto","subtle","randomUUID"],"mappings":"sCAQO,SAA0BA,GAC/B,MAAO,CACLC,OAAQD,GAAWC,UAAYC,EAAKC,IAASC,WAAWC,OAAOC,OAAOL,OAAOC,EAAKC,IAClFI,WAAYP,GAAWO,YAAAA,KAAqBH,WAAWC,OAAOE,cAElE"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./client/Privy.js"),r=require("./storage/LocalStorage.js"),t=require("./storage/InMemoryStorage.js"),s=require("./Error.js"),i=require("./embedded/errors.js"),o=require("./utils/getUserEmbeddedEthereumWallet.js"),a=require("./utils/getAllUserEmbeddedEthereumWallets.js"),l=require("./utils/getAllUserEmbeddedSolanaWallets.js"),n=require("./utils/getAllUserEmbeddedBitcoinWallets.js"),d=require("./utils/embedded-wallets.js"),u=require("./utils/entropy.js"),p=require("./utils/getUserSmartWallet.js"),c=require("./embedded/utils/index.js"),m=require("./utils/phoneNumberUtils.js"),q=require("./utils/getUserEmbeddedSolanaWallet.js"),j=require("./utils/toObjectKeys.js"),g=require("./utils/getIsTokenUsdc.js"),A=require("./utils/generateWalletIdempotencyKey.js"),x=require("./funding/moonpay.js"),b=require("./funding/coinbase.js"),y=require("./solana/client.js"),E=require("./solana/createSiwsMessage.js"),h=require("./solana/getSolanaRpcEndpointForCluster.js"),C=require("./solana/getSolanaUsdcMintAddressForCluster.js"),S=require("./solana/getSolanaClusterDisplayName.js"),W=require("./types.js"),f=require("@privy-io/chains"),P=require("./utils/formatters.js"),v=require("./wallet-api/generate-authorization-signature.js"),M=require("./wallet-api/create.js"),I=require("./wallet-api/rpc.js"),U=require("./wallet-api/raw-sign.js"),w=require("./wallet-api/get-wallet.js"),T=require("./wallet-api/update-wallet.js"),R=require("./wallet-api/unified-wallet.js"),F=require("./embedded/stack/session-signers.js"),N=require("./solana/ConnectedStandardSolanaWallet.js"),O=require("./index-DzfqDJJ9.js"),k=require("./index-BDWdfIuK.js"),L=require("libphonenumber-js/min");require("./client/AppApi.js"),require("@privy-io/routes"),require("./client/CrossAppApi.js"),require("./Token.js"),require("jose"),require("./client/DelegatedWalletsApi.js"),require("./client/EmbeddedWalletApi.js"),require("./embedded/EmbeddedBitcoinWalletProvider.js"),require("./embedded/stack/walletCreate.js"),require("./embedded/EmbeddedWalletProxy.js"),require("./utils/sleep.js"),require("./embedded/EventCallbackQueue.js"),require("./embedded/withMfa.js"),require("./embedded/EmbeddedWalletProvider.js"),require("eventemitter3"),require("viem"),require("@privy-io/ethereum"),require("./embedded/stack/walletRpc.js"),require("./utils/encodings.js"),require("./embedded/stack/wallet-api-eth-transaction.js"),require("./embedded/stack/wallet-api-eth-typed-data.js"),require("./embedded/EmbeddedSolanaWalletProvider.js"),require("./solana/getWalletPublicKeyFromTransaction.js"),require("./solana/isVersionedTransaction.js"),require("./client/MfaPromises.js"),require("./client/PrivyInternal.js"),require("fetch-retry"),require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./client/Privy.js"),r=require("./storage/LocalStorage.js"),t=require("./storage/InMemoryStorage.js"),s=require("./Error.js"),i=require("./embedded/errors.js"),o=require("./utils/getUserEmbeddedEthereumWallet.js"),a=require("./utils/getAllUserEmbeddedEthereumWallets.js"),l=require("./utils/getAllUserEmbeddedSolanaWallets.js"),n=require("./utils/getAllUserEmbeddedBitcoinWallets.js"),d=require("./utils/embedded-wallets.js"),u=require("./utils/entropy.js"),p=require("./utils/getUserSmartWallet.js"),c=require("./embedded/utils/index.js"),m=require("./utils/phoneNumberUtils.js"),q=require("./utils/getUserEmbeddedSolanaWallet.js"),j=require("./utils/toObjectKeys.js"),g=require("./utils/getIsTokenUsdc.js"),A=require("./utils/generateWalletIdempotencyKey.js"),x=require("./funding/moonpay.js"),b=require("./funding/coinbase.js"),y=require("./solana/client.js"),E=require("./solana/createSiwsMessage.js"),h=require("./solana/getSolanaRpcEndpointForCluster.js"),C=require("./solana/getSolanaUsdcMintAddressForCluster.js"),S=require("./solana/getSolanaClusterDisplayName.js"),W=require("./types.js"),f=require("@privy-io/chains"),P=require("./utils/formatters.js"),v=require("./wallet-api/generate-authorization-signature.js"),M=require("./wallet-api/create.js"),I=require("./wallet-api/rpc.js"),U=require("./wallet-api/raw-sign.js"),w=require("./wallet-api/get-wallet.js"),T=require("./wallet-api/update-wallet.js"),R=require("./wallet-api/unified-wallet.js"),F=require("./embedded/stack/session-signers.js"),N=require("./solana/ConnectedStandardSolanaWallet.js"),O=require("./index-DzfqDJJ9.js"),k=require("./index-BDWdfIuK.js"),L=require("libphonenumber-js/min");require("./crypto/resolve.js"),require("./client/AppApi.js"),require("@privy-io/routes"),require("./client/CrossAppApi.js"),require("./Token.js"),require("jose"),require("./client/DelegatedWalletsApi.js"),require("./client/EmbeddedWalletApi.js"),require("./embedded/EmbeddedBitcoinWalletProvider.js"),require("./embedded/stack/walletCreate.js"),require("./embedded/EmbeddedWalletProxy.js"),require("./utils/sleep.js"),require("./embedded/EventCallbackQueue.js"),require("./embedded/withMfa.js"),require("./embedded/EmbeddedWalletProvider.js"),require("eventemitter3"),require("viem"),require("@privy-io/ethereum"),require("./embedded/stack/walletRpc.js"),require("./utils/encodings.js"),require("./embedded/stack/wallet-api-eth-transaction.js"),require("./embedded/stack/wallet-api-eth-typed-data.js"),require("./embedded/EmbeddedSolanaWalletProvider.js"),require("./solana/getWalletPublicKeyFromTransaction.js"),require("./solana/isVersionedTransaction.js"),require("./client/MfaPromises.js"),require("./client/PrivyInternal.js"),require("fetch-retry"),require("@privy-io/api-base"),require("./Session.js"),require("js-cookie"),require("./utils/allSettled.js"),require("./toAbortSignalTimeout.js"),require("./utils/toSearchParams.js"),require("./client/logger.js"),require("./utils/noop.js"),require("./client/UserApi.js"),require("./client/auth/AuthApi.js"),require("./client/auth/CustomProviderApi.js"),require("./client/auth/maybeCreateWalletOnLogin.js"),require("./utils/shouldCreateEmbeddedEthWallet.js"),require("./utils/shouldCreateEmbeddedSolWallet.js"),require("./client/auth/EmailApi.js"),require("./client/auth/FarcasterApi.js"),require("./client/auth/FarcasterV2Api.js"),require("./client/auth/GuestApi.js"),require("./client/auth/OAuthApi.js"),require("./pkce.js"),require("./client/auth/PasskeyApi.js"),require("./client/auth/PhoneApi.js"),require("./client/auth/SiweApi.js"),require("./client/auth/SiwsApi.js"),require("./client/auth/SmartWalletApi.js"),require("./client/funding/FundingApi.js"),require("./client/funding/CoinbaseOnRampApi.js"),require("./client/funding/MoonpayOnRampApi.js"),require("./client/mfa/MfaApi.js"),require("./client/mfa/MfaPasskeyApi.js"),require("./client/mfa/MfaSmsApi.js"),require("./client/recovery/RecoveryApi.js"),require("./client/recovery/RecoveryICloudApi.js"),require("./client/recovery/RecoveryOAuthApi.js"),require("./embedded/types.js"),require("libphonenumber-js/examples.mobile.json"),require("canonicalize"),require("@privy-io/encoding"),require("./wallet-api/types.js"),require("./action/delegatedActions/utils.js"),require("./action/crossApp/loginWithCrossAppAuth.js"),require("./action/crossApp/linkWithCrossAppAuth.js"),require("./index-CARkJvRM.js"),require("./action/crossApp/wallet/signMessage.js"),require("./action/crossApp/wallet/utils/isCrossAppWalletSmart.js"),require("./action/crossApp/wallet/utils/sendCrossAppRequest.js"),require("./action/crossApp/wallet/utils/getCrossAppAccountByWalletAddress.js"),require("./action/crossApp/wallet/utils/getProviderAccessTokenOrRelink.js"),require("./action/crossApp/wallet/utils/throwIfNotLoggedIn.js"),require("./action/crossApp/wallet/signTypedData.js"),require("./utils/typedData/generateDomainType.js"),require("./action/crossApp/wallet/sendTransaction.js"),require("./action/delegatedActions/delegateWallet.js"),require("./action/delegatedActions/revokeWallets.js");exports.default=e.default,exports.LocalStorage=r.LocalStorage,exports.InMemoryCache=t.InMemoryCache,exports.MoonpayApiError=s.MoonpayApiError,exports.PrivyApiError=s.PrivyApiError,exports.PrivyClientError=s.PrivyClientError,exports.createErrorFormatter=s.createErrorFormatter,exports.errorIndicatesMfaCanceled=s.errorIndicatesMfaCanceled,exports.EmbeddedProviderError=i.EmbeddedProviderError,exports.PrivyConnectorError=i.PrivyConnectorError,exports.PrivyEmbeddedWalletErrorCode=i.PrivyEmbeddedWalletErrorCode,exports.PrivyProviderRpcError=i.PrivyProviderRpcError,exports.ProviderErrors=i.ProviderErrors,exports.errorIndicatesMaxMfaRetries=i.errorIndicatesMaxMfaRetries,exports.errorIndicatesMfaRateLimit=i.errorIndicatesMfaRateLimit,exports.errorIndicatesMfaTimeout=i.errorIndicatesMfaTimeout,exports.errorIndicatesMfaVerificationFailed=i.errorIndicatesMfaVerificationFailed,exports.errorIndicatesRecoveryIsNeeded=i.errorIndicatesRecoveryIsNeeded,exports.getUserEmbeddedEthereumWallet=o.getUserEmbeddedEthereumWallet,exports.getUserEmbeddedWallet=o.getUserEmbeddedWallet,exports.getAllUserEmbeddedEthereumWallets=a.getAllUserEmbeddedEthereumWallets,exports.getAllUserEmbeddedSolanaWallets=l.getAllUserEmbeddedSolanaWallets,exports.getAllUserEmbeddedBitcoinWallets=n.getAllUserEmbeddedBitcoinWallets,exports.isEmbeddedWalletAccount=d.isEmbeddedWalletAccount,exports.getEntropyDetailsFromAccount=u.getEntropyDetailsFromAccount,exports.getEntropyDetailsFromUser=u.getEntropyDetailsFromUser,exports.getUserSmartWallet=p.getUserSmartWallet,exports.getJsonRpcEndpointFromChain=c.getJsonRpcEndpointFromChain,exports.throwIfInvalidRecoveryUpgradePath=c.throwIfInvalidRecoveryUpgradePath,exports.countryCodesAndNumbers=m.countryCodesAndNumbers,exports.formatPhoneNumber=m.formatPhoneNumber,exports.getPhoneCountryCodeAndNumber=m.getPhoneCountryCodeAndNumber,exports.getPlaceholderPhoneNumber=m.getPlaceholderPhoneNumber,exports.lastFourDigits=m.lastFourDigits,exports.phoneNumberTypingFormatter=m.phoneNumberTypingFormatter,exports.validatePhoneNumber=m.validatePhoneNumber,exports.getUserEmbeddedSolanaWallet=q.getUserEmbeddedSolanaWallet,exports.toObjectKeys=j.toObjectKeys,exports.SolanaUsdcAddressMap=g.SolanaUsdcAddressMap,exports.UsdcAddressMap=g.UsdcAddressMap,exports.getIsTokenUsdc=g.getIsTokenUsdc,exports.generateWalletIdempotencyKey=A.generateWalletIdempotencyKey,exports.chainToMoonpayCurrency=x.chainToMoonpayCurrency,exports.fundingMethodToMoonpayPaymentMethod=x.fundingMethodToMoonpayPaymentMethod,exports.isSupportedChainIdForMoonpay=x.isSupportedChainIdForMoonpay,exports.getCoinbaseOnRampUrl=b.getCoinbaseOnRampUrl,exports.isSupportedChainIdForCoinbaseOnramp=b.isSupportedChainIdForCoinbaseOnramp,exports.toCoinbaseAssetId=b.toCoinbaseAssetId,exports.toCoinbaseBlockchainFromChainId=b.toCoinbaseBlockchainFromChainId,exports.SolanaClient=y.SolanaClient,exports.createSiwsMessage=E.createSiwsMessage,exports.getSolanaRpcEndpointForCluster=h.getSolanaRpcEndpointForCluster,exports.getSolanaUsdcMintAddressForCluster=C.getSolanaUsdcMintAddressForCluster,exports.getSolanaClusterDisplayName=S.getSolanaClusterDisplayName,exports.ALL_WALLET_CLIENT_TYPES=W.ALL_WALLET_CLIENT_TYPES,exports.SUPPORTED_CONNECTOR_TYPES=W.SUPPORTED_CONNECTOR_TYPES,exports.formatLamportsAmount=P.formatLamportsAmount,exports.formatTokenAmount=P.formatTokenAmount,exports.formatWalletAddress=P.formatWalletAddress,exports.formatWeiAmount=P.formatWeiAmount,exports.generateAuthorizationSignature=v.generateAuthorizationSignature,exports.create=M.create,exports.rpc=I.rpc,exports.rawSign=U.rawSign,exports.getWallet=w.getWallet,exports.updateWallet=T.updateWallet,exports.isUnifiedWallet=R.isUnifiedWallet,exports.addSessionSigners=F.addSessionSigners,exports.removeSessionSigners=F.removeSessionSigners,exports.ConnectedStandardSolanaWallet=N.ConnectedStandardSolanaWallet,exports.crossApp=O.index,exports.delegatedActions=k.index,Object.defineProperty(exports,"getCountryCallingCode",{enumerable:!0,get:function(){return L.getCountryCallingCode}}),exports.BICONOMY="biconomy",exports.COINBASE_SMART_WALLET="coinbase_smart_wallet",exports.KERNEL="kernel",exports.LIGHT_ACCOUNT="light_account",exports.SAFE="safe",exports.THIRDWEB="thirdweb",Object.keys(f).forEach((function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return f[e]}})}));
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"names":[],"mappings":"49RAcwB,yCAEa,uCAEf,+BAEO,6BAET,wBAEI"}
|
package/dist/cjs/pkce.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("jose");async function r(e,r){let t=(new TextEncoder).encode(e);return new Uint8Array(await r("SHA-256",t))}function t(e){return crypto.getRandomValues(new Uint8Array(e))}function n(){return e.base64url.encode(t(36))}exports.CODE_VERIFIER_KEY="privy:code_verifier",exports.STATE_CODE_KEY="privy:state_code",exports.createCodeVerifier=n,exports.createHashBuffer=r,exports.createStateCode=function(){return n()},exports.deriveCodeChallengeFromCodeVerifier=async function({codeVerifier:t,method:n="S256",digest:o
|
|
1
|
+
"use strict";var e=require("jose");async function r(e,r){let t=(new TextEncoder).encode(e);return new Uint8Array(await r("SHA-256",t))}function t(e){return crypto.getRandomValues(new Uint8Array(e))}function n(){return e.base64url.encode(t(36))}exports.CODE_VERIFIER_KEY="privy:code_verifier",exports.STATE_CODE_KEY="privy:state_code",exports.createCodeVerifier=n,exports.createHashBuffer=r,exports.createStateCode=function(){return n()},exports.deriveCodeChallengeFromCodeVerifier=async function({codeVerifier:t,method:n="S256",digest:o}){if("S256"!=n)return t;{let n=await r(t,o);return e.base64url.encode(n)}},exports.randomBytes=t;
|
|
2
2
|
//# sourceMappingURL=pkce.js.map
|
package/dist/cjs/pkce.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pkce.js","sources":["../../src/pkce.ts"],"names":["async","createHashBuffer","message","digest","data","TextEncoder","encode","Uint8Array","randomBytes","size","crypto","getRandomValues","createCodeVerifier","base64url","codeVerifier","method","
|
|
1
|
+
{"version":3,"file":"pkce.js","sources":["../../src/pkce.ts"],"names":["async","createHashBuffer","message","digest","data","TextEncoder","encode","Uint8Array","randomBytes","size","crypto","getRandomValues","createCodeVerifier","base64url","codeVerifier","method","hashBuffer"],"mappings":"mCAYOA,eAAeC,EAAiBC,EAAiBC,GACtD,IAAMC,GAAO,IAAIC,aAAcC,OAAOJ,GAEtC,OAAO,IAAIK,iBADQJ,EAAO,UAAWC,GAEvC,CAEO,SAASI,EAAYC,GAC1B,OAAOC,OAAOC,gBAAgB,IAAIJ,WAAWE,GAC/C,CAOO,SAASG,IASd,OAAOC,EAAAA,UAAUP,OAAOE,EAAY,IACtC,2BA5BiC,6CADH,mGAwCvB,WAIL,OAAOI,GACT,8CAOOZ,gBACLc,aAAAA,EACAC,OAAAA,EAzDoC,OA0DpCZ,OAAAA,IAMA,GAAIY,QAAAA,EAQF,OAAOD,GANP,IAAME,QAAmBf,EAAiBa,EAAcX,GACxD,OAAOU,EAAAA,UAAUP,OAAOU,EAC1B,CAMF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var t=require("
|
|
1
|
+
"use strict";var t=require("../crypto/resolve.js");exports.SolanaClient=class{async invokeRpc({method:t,params:e}){let n=await fetch(this.cluster.rpcUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:this._crypto.randomUUID(),method:t,params:e})});return await n.json()}async getBalance(t){try{let e=await this.invokeRpc({method:"getBalance",params:[t]});return e.error?null:BigInt(e.result.value)}catch(t){return null}}async getTokenAccountsByOwner(t,e){try{let n=await this.invokeRpc({method:"getTokenAccountsByOwner",params:[t,{mint:e},{encoding:"jsonParsed"}]});if(n.error)return null;let r=n.result.value.at(0)?.account?.data?.parsed?.info?.tokenAmount;return r?{amount:BigInt(r.amount),decimals:r.decimals}:null}catch(t){return null}}async getAccountInfo(t){try{let e=await this.invokeRpc({method:"getAccountInfo",params:[t,{encoding:"jsonParsed"}]});if(e.error)return null;let n=e.result.value?.data?.parsed?.info;return n?{decimals:n.decimals}:null}catch(t){return null}}constructor(e,n){this.cluster=e,this._crypto=t.resolveCryptoFns(n)}};
|
|
2
2
|
//# sourceMappingURL=client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sources":["../../../src/solana/client.ts"],"names":["invokeRpc","method","params","response","fetch","this","cluster","rpcUrl","headers","body","JSON","stringify","jsonrpc","id","
|
|
1
|
+
{"version":3,"file":"client.js","sources":["../../../src/solana/client.ts"],"names":["invokeRpc","method","params","response","fetch","this","cluster","rpcUrl","headers","body","JSON","stringify","jsonrpc","id","_crypto","randomUUID","json","getBalance","address","error","BigInt","result","value","getTokenAccountsByOwner","mintAddress","mint","encoding","tokenAmount","at","account","data","parsed","info","amount","decimals","getAccountInfo","tokenInfo","constructor","crypto","resolveCryptoFns"],"mappings":"wEAuBO,MAUL,eAAcA,EAAcC,OAAAA,EAAQC,OAAAA,IAClC,IAAMC,QAAiBC,MAAMC,KAAKC,QAAQC,OAAQ,CAChDN,OAAQ,OACRO,QAAS,CAAC,eAAgB,oBAC1BC,KAAMC,KAAKC,UAAU,CAACC,QAAS,MAAOC,GAAIR,KAAKS,QAAQC,aAAcd,OAAAA,EAAQC,OAAAA,MAI/E,aADmBC,EAASa,MAE9B,CAEA,gBAAMC,CAAWC,GACf,IACE,IAAMf,QAAiBE,KAAKL,UAAkB,CAACC,OAAQ,aAAcC,OAAQ,CAACgB,KAE9E,OAAIf,EAASgB,MACJ,KAGFC,OAAOjB,EAASkB,OAAOC,MAChC,CAAE,MAAOH,GACP,OAAO,IACT,CACF,CAEA,6BAAMI,CAAwBL,EAAiBM,GAC7C,IACE,IAAMrB,QAAiBE,KAAKL,UAI1B,CACAC,OAAQ,0BACRC,OAAQ,CAACgB,EAAS,CAACO,KAAMD,GAAc,CAACE,SAAU,iBAGpD,GAAIvB,EAASgB,MACX,OAAO,KAGT,IAAMQ,EAAcxB,EAASkB,OAAOC,MAAMM,GAAG,IAAIC,SAASC,MAAMC,QAAQC,MAAML,YAC9E,OAAKA,EAIE,CACLM,OAAQb,OAAOO,EAAYM,QAC3BC,SAAUP,EAAYO,UALf,IAOX,CAAE,MAAOf,GACP,OAAO,IACT,CACF,CAEA,oBAAMgB,CAAejB,GACnB,IACE,IAAMf,QAAiBE,KAAKL,UAEzB,CACDC,OAAQ,iBACRC,OAAQ,CAACgB,EAAS,CAACQ,SAAU,iBAG/B,GAAIvB,EAASgB,MACX,OAAO,KAGT,IAAMiB,EAAYjC,EAASkB,OAAOC,OAAOQ,MAAMC,QAAQC,KACvD,OAAKI,EAIE,CACLF,SAAUE,EAAUF,UAJb,IAMX,CAAE,MAAOf,GACP,OAAO,IACT,CACF,CAnFAkB,WAAAA,CAAY/B,EAA2CgC,GACrDjC,KAAKC,QAAUA,EACfD,KAAKS,QAAUyB,mBAAiBD,EAClC"}
|
package/dist/dts/index.d.mts
CHANGED
|
@@ -2311,13 +2311,20 @@ declare const isSupportedChainIdForCoinbaseOnramp: (chainId: number, asset: "nat
|
|
|
2311
2311
|
declare function toCoinbaseBlockchainFromChainId(chainId: number): SupportedBlockchains | undefined;
|
|
2312
2312
|
declare function toCoinbaseAssetId(chainId: number, asset: 'USDC' | 'native-currency'): CoinbaseAssetId;
|
|
2313
2313
|
|
|
2314
|
+
/**
|
|
2315
|
+
* Optional overrides accepted at the public API boundary so callers can
|
|
2316
|
+
* supply partial implementations (e.g. only `randomUUID` on React Native).
|
|
2317
|
+
*/
|
|
2318
|
+
type CryptoOverrides = Partial<CryptoFns>;
|
|
2319
|
+
|
|
2314
2320
|
declare class SolanaClient {
|
|
2315
2321
|
cluster: SolanaCluster & {
|
|
2316
2322
|
rpcUrl: string;
|
|
2317
2323
|
};
|
|
2324
|
+
private readonly _crypto;
|
|
2318
2325
|
constructor(cluster: SolanaCluster & {
|
|
2319
2326
|
rpcUrl: string;
|
|
2320
|
-
});
|
|
2327
|
+
}, crypto?: CryptoOverrides);
|
|
2321
2328
|
private invokeRpc;
|
|
2322
2329
|
getBalance(address: string): Promise<bigint | null>;
|
|
2323
2330
|
getTokenAccountsByOwner(address: string, mintAddress: string): Promise<{
|
package/dist/dts/index.d.ts
CHANGED
|
@@ -2311,13 +2311,20 @@ declare const isSupportedChainIdForCoinbaseOnramp: (chainId: number, asset: "nat
|
|
|
2311
2311
|
declare function toCoinbaseBlockchainFromChainId(chainId: number): SupportedBlockchains | undefined;
|
|
2312
2312
|
declare function toCoinbaseAssetId(chainId: number, asset: 'USDC' | 'native-currency'): CoinbaseAssetId;
|
|
2313
2313
|
|
|
2314
|
+
/**
|
|
2315
|
+
* Optional overrides accepted at the public API boundary so callers can
|
|
2316
|
+
* supply partial implementations (e.g. only `randomUUID` on React Native).
|
|
2317
|
+
*/
|
|
2318
|
+
type CryptoOverrides = Partial<CryptoFns>;
|
|
2319
|
+
|
|
2314
2320
|
declare class SolanaClient {
|
|
2315
2321
|
cluster: SolanaCluster & {
|
|
2316
2322
|
rpcUrl: string;
|
|
2317
2323
|
};
|
|
2324
|
+
private readonly _crypto;
|
|
2318
2325
|
constructor(cluster: SolanaCluster & {
|
|
2319
2326
|
rpcUrl: string;
|
|
2320
|
-
});
|
|
2327
|
+
}, crypto?: CryptoOverrides);
|
|
2321
2328
|
private invokeRpc;
|
|
2322
2329
|
getBalance(address: string): Promise<bigint | null>;
|
|
2323
2330
|
getTokenAccountsByOwner(address: string, mintAddress: string): Promise<{
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"./AppApi.mjs";import
|
|
1
|
+
import{resolveCryptoFns as e}from"../crypto/resolve.mjs";import t from"./AppApi.mjs";import i from"./CrossAppApi.mjs";import r from"./DelegatedWalletsApi.mjs";import m from"./EmbeddedWalletApi.mjs";import s from"./MfaPromises.mjs";import{PrivyInternal as o}from"./PrivyInternal.mjs";import a from"./UserApi.mjs";import p from"./auth/AuthApi.mjs";import l from"./funding/FundingApi.mjs";import n from"./mfa/MfaApi.mjs";import d from"./recovery/RecoveryApi.mjs";import"@privy-io/routes";import"../Token.mjs";import"jose";import"@privy-io/chains";import"../Error.mjs";import"../embedded/EmbeddedBitcoinWalletProvider.mjs";import"../wallet-api/unified-wallet.mjs";import"../embedded/errors.mjs";import"../embedded/types.mjs";import"../embedded/stack/walletCreate.mjs";import"../wallet-api/create.mjs";import"../embedded/utils/index.mjs";import"viem";import"../embedded/EmbeddedWalletProxy.mjs";import"../utils/sleep.mjs";import"../embedded/EventCallbackQueue.mjs";import"../embedded/withMfa.mjs";import"../embedded/EmbeddedWalletProvider.mjs";import"eventemitter3";import"@privy-io/ethereum";import"../embedded/stack/walletRpc.mjs";import"../utils/encodings.mjs";import"../wallet-api/rpc.mjs";import"../wallet-api/generate-authorization-signature.mjs";import"canonicalize";import"@privy-io/encoding";import"../wallet-api/types.mjs";import"../embedded/stack/wallet-api-eth-transaction.mjs";import"../embedded/stack/wallet-api-eth-typed-data.mjs";import"../embedded/EmbeddedSolanaWalletProvider.mjs";import"../solana/getWalletPublicKeyFromTransaction.mjs";import"../solana/isVersionedTransaction.mjs";import"fetch-retry";import"@privy-io/api-base";import"../Session.mjs";import"js-cookie";import"../utils/allSettled.mjs";import"../toAbortSignalTimeout.mjs";import"../utils/toSearchParams.mjs";import"./logger.mjs";import"../utils/noop.mjs";import"./auth/CustomProviderApi.mjs";import"./auth/maybeCreateWalletOnLogin.mjs";import"../utils/getUserEmbeddedEthereumWallet.mjs";import"../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../utils/embedded-wallets.mjs";import"../utils/getUserEmbeddedSolanaWallet.mjs";import"../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../utils/shouldCreateEmbeddedEthWallet.mjs";import"../utils/shouldCreateEmbeddedSolWallet.mjs";import"./auth/EmailApi.mjs";import"./auth/FarcasterApi.mjs";import"./auth/FarcasterV2Api.mjs";import"./auth/GuestApi.mjs";import"./auth/OAuthApi.mjs";import"../pkce.mjs";import"./auth/PasskeyApi.mjs";import"./auth/PhoneApi.mjs";import"./auth/SiweApi.mjs";import"./auth/SiwsApi.mjs";import"./auth/SmartWalletApi.mjs";import"./funding/CoinbaseOnRampApi.mjs";import"./funding/MoonpayOnRampApi.mjs";import"../funding/moonpay.mjs";import"./mfa/MfaPasskeyApi.mjs";import"./mfa/MfaSmsApi.mjs";import"./recovery/RecoveryICloudApi.mjs";import"./recovery/RecoveryOAuthApi.mjs";class h{async initialize(){await this._privyInternal._initialize()}setMessagePoster(e){this.embeddedWallet.setMessagePoster(e)}addOAuthTokensListener(e){return this._privyInternal.session.on("oauth_tokens_granted",e),{unsubscribe:()=>{this._privyInternal.session.removeListener("oauth_tokens_granted",e)}}}setCallbacks(e){this._privyInternal.setCallbacks(e)}getAccessToken(){return this._privyInternal.getAccessToken()}getIdentityToken(){return this._privyInternal.getIdentityToken()}getCompiledPath(e,t){return this._privyInternal.getPath(e,t)}async fetchPrivyRoute(e,t){return this._privyInternal.fetch(e,t)}get logger(){return this._privyInternal.logger}constructor({clientId:h,...j}){let u=e(j.crypto);this._privyInternal=new o({...j,appClientId:h,crypto:u}),this.mfa=new n(this._privyInternal),this.mfaPromises=new s,this.app=new t(this._privyInternal),this.embeddedWallet=new m(this._privyInternal,j.embeddedWalletMessagePoster,j.supportedChains,this.mfa,this.mfaPromises,this.app),this.user=new a(this._privyInternal),this.auth=new p(this._privyInternal,this.embeddedWallet,j.storage,u,this.mfa),this.recovery=new d(this._privyInternal,j.storage,u),this.funding=new l(this._privyInternal),this.delegated=new r(this._privyInternal),this.crossApp=new i(this._privyInternal,j.storage)}}export{h as default};
|
|
2
2
|
//# sourceMappingURL=Privy.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Privy.mjs","sources":["../../../src/client/Privy.ts"],"names":["Privy","initialize","this","_privyInternal","_initialize","setMessagePoster","poster","embeddedWallet","addOAuthTokensListener","listener","session","on","unsubscribe","removeListener","setCallbacks","callbacks","getAccessToken","getIdentityToken","getCompiledPath","r","opts","getPath","fetchPrivyRoute","fetch","logger","constructor","clientId","o","PrivyInternal","appClientId","mfa","MfaApi","mfaPromises","MfaPromises","app","AppApi","EmbeddedWalletApi","embeddedWalletMessagePoster","supportedChains","user","UserApi","auth","AuthApi","storage","
|
|
1
|
+
{"version":3,"file":"Privy.mjs","sources":["../../../src/client/Privy.ts"],"names":["Privy","initialize","this","_privyInternal","_initialize","setMessagePoster","poster","embeddedWallet","addOAuthTokensListener","listener","session","on","unsubscribe","removeListener","setCallbacks","callbacks","getAccessToken","getIdentityToken","getCompiledPath","r","opts","getPath","fetchPrivyRoute","fetch","logger","constructor","clientId","o","crypto","resolveCryptoFns","PrivyInternal","appClientId","mfa","MfaApi","mfaPromises","MfaPromises","app","AppApi","EmbeddedWalletApi","embeddedWalletMessagePoster","supportedChains","user","UserApi","auth","AuthApi","storage","recovery","RecoveryApi","funding","FundingApi","delegated","DelegatedWalletsApi","crossApp","CrossAppApi"],"mappings":"8wFAiFe,MAAMA,EAqGnB,gBAAaC,SACLC,KAAKC,eAAeC,aAC5B,CAEA,gBAAAC,CAAwBC,GACtBJ,KAAKK,eAAeF,iBAAiBC,EACvC,CAQA,sBAAAE,CAA8BC,GAE5B,OADAP,KAAKC,eAAeO,QAAQC,GAAG,uBAAwBF,GAChD,CACLG,YAAa,KACXV,KAAKC,eAAeO,QAAQG,eAAe,uBAAwBJ,EAAAA,EAGzE,CAKA,YAAAK,CAAoBC,GAClBb,KAAKC,eAAeW,aAAaC,EACnC,CAEA,cAAAC,GACE,OAAOd,KAAKC,eAAea,gBAC7B,CAEOC,gBAAAA,GACL,OAAOf,KAAKC,eAAec,kBAC7B,CAEOC,eAAAA,CACLC,EACAC,GAMA,OAAOlB,KAAKC,eAAekB,QAAQF,EAAGC,EACxC,CAEA,qBAAaE,CACXH,EACAC,GAOA,OAAOlB,KAAKC,eAAeoB,MAAMJ,EAAGC,EACtC,CAKA,UAAWI,GACT,OAAOtB,KAAKC,eAAeqB,MAC7B,CA9GA,WAAAC,EAAoBC,SAAAA,KAAaC,IAG/B,IAAMC,EAASC,EAAiBF,EAAEC,QAGlC1B,KAAKC,eAAiB,IAAI2B,EAAc,IACnCH,EACHI,YAAaL,EACbE,OAAAA,IAIF1B,KAAK8B,IAAM,IAAIC,EAAO/B,KAAKC,gBAC3BD,KAAKgC,YAAc,IAAIC,EAGvBjC,KAAKkC,IAAM,IAAIC,EAAOnC,KAAKC,gBAG3BD,KAAKK,eAAiB,IAAI+B,EACxBpC,KAAKC,eACLwB,EAAEY,4BACFZ,EAAEa,gBACFtC,KAAK8B,IACL9B,KAAKgC,YACLhC,KAAKkC,KAIPlC,KAAKuC,KAAO,IAAIC,EAAQxC,KAAKC,gBAC7BD,KAAKyC,KAAO,IAAIC,EAAQ1C,KAAKC,eAAgBD,KAAKK,eAAgBoB,EAAEkB,QAASjB,EAAQ1B,KAAK8B,KAC1F9B,KAAK4C,SAAW,IAAIC,EAAY7C,KAAKC,eAAgBwB,EAAEkB,QAASjB,GAChE1B,KAAK8C,QAAU,IAAIC,EAAW/C,KAAKC,gBACnCD,KAAKgD,UAAY,IAAIC,EAAoBjD,KAAKC,gBAC9CD,KAAKkD,SAAW,IAAIC,EAAYnD,KAAKC,eAAgBwB,EAAEkB,QACzD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"fetch-retry";import{
|
|
1
|
+
import e from"fetch-retry";import{PrivyErrorCode as t}from"@privy-io/api-base";import{getPathWithParams as s,AppConfig as i,AnalyticsEvent as r,RefreshSession as a}from"@privy-io/routes";import{PrivyClientError as o,PrivyApiError as n}from"../Error.mjs";import{Session as h}from"../Session.mjs";import c from"../toAbortSignalTimeout.mjs";import{toSearchParams as l}from"../utils/toSearchParams.mjs";import{toLoggerWithLevel as g}from"./logger.mjs";import"eventemitter3";import"jose";import"js-cookie";import"../Token.mjs";import"../utils/allSettled.mjs";import"../utils/noop.mjs";let d="privy:caid";class p{setCallbacks(e){this.callbacks={...this.callbacks,...e}}get isReady(){return!!this._config}get config(){return this._config}get caid(){return this._analyticsId}async _initialize(){if(this.isReady)this.callbacks?.setIsReady?.(!0);else{if(!await this.isStorageAccessible())throw new o({code:"storage_error",error:"Unable to access storage"});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._sdkVersion.startsWith("react-auth:")||this.createAnalyticsEvent("sdk_initialize",{})}}getPath(e,{params:t,query:i}){return`${this.baseUrl}${s(e.path,t)}${l(i)}`}async fetch(e,{body:t,params:s,query:i,headers:r,onRequest:a=this._beforeRequest.bind(this)}){let o=new Request(this.getPath(e,{params:s,query:i}),{method:e.method,body:JSON.stringify(t),headers:r}),h=await a(o),c=await this._fetch(o,h),l=await c.json();if(c.status>299)throw new n({...l,status:c.status});return l}async _beforeRequestWithoutInitialize(e){let t=await this.session.getPrivyAccessToken()??await this.session.getCustomerAccessToken(),s=new Headers(e.headers);s.set("privy-app-id",this.appId),this.appClientId&&s.set("privy-client-id",this.appClientId),s.set("privy-client",this._sdkVersion),t&&s.set("Authorization",`Bearer ${t}`),s.set("Content-Type","application/json"),s.set("Accept","application/json");let 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(e){return await this._initialize(),this._beforeRequestWithoutInitialize(e)}async _beforeRequest(e){return await this._initialize(),await this.getAccessTokenInternal(),this.beforeRequestWithoutRefresh(e)}async getAppConfig(){return await this.fetch(i,{params:{app_id:this.appId},onRequest:this._beforeRequestWithoutInitialize.bind(this)})}async _getOrGenerateClientAnalyticsId(){if(this._analyticsId)return this._analyticsId;try{let e=await this._storage.get(d);if("string"==typeof e&&e.length>0)return this._analyticsId=e,e}catch(e){this.logger.error("Unable to load clientId",e)}try{this._analyticsId=this._crypto.randomUUID()}catch(e){this.logger.error("Unable to generate uuidv4",e)}if(this._analyticsId){try{await this._storage.put(d,this._analyticsId)}catch(e){this.logger.error(`Unable to store clientId: ${this._analyticsId}`,e)}return this._analyticsId}}async destroyClientAnalyticsId(){try{return await this._storage.del(d)}catch(e){this.logger.error("Unable to delete clientId",e)}}async createAnalyticsEvent(e,t){try{await this.fetch(r,{body:{event_name:e,client_id:await this._getOrGenerateClientAnalyticsId(),payload:t},onRequest:this.beforeRequestWithoutRefresh.bind(this)})}catch(e){}}async refreshSession(e=!1){if(!await this.isStorageAccessible())throw new o({code:"storage_error",error:"Unable to access storage"});let t=await this.session.getRefreshToken()??void 0,s=t??"key",i=this._cache.get(s);if(i)return this.logger.debug("[privy:refresh] found in-flight session refresh request, deduping"),await i;let r=this._refreshSession(t,e);this._cache.set(s,r);try{return await r}finally{this._cache.delete(s)}}async _refreshSession(e,s){let i=await this.session.getCustomerAccessToken();if(!this.session.hasRefreshCredentials(i,e??null))throw this.logger.debug("[privy:refresh] missing tokens, skipping request"),await this._initialize(),new n({code:t.MISSING_OR_INVALID_TOKEN,error:"No tokens found in storage",status:401});try{this.logger.debug(`[privy:refresh] fetching: ${a.path}`);let t=await this.fetch(a,{body:{refresh_token:e},onRequest:this.beforeRequestWithoutRefresh.bind(this)}),i=t.session_update_action;return this.logger.debug(`[privy:refresh] response: ${i}`),"set"===i&&(await this.session.updateWithTokensResponse(t),this.logger.debug("[privy:refresh] tokens stored")),"clear"===i&&(await this.session.destroyLocalState(),this.logger.debug("[privy:refresh] tokens cleared"),s||this.callbacks?.setUser?.(null)),"ignore"===i&&(t.token&&(await this.session.storeCustomerAccessToken(t.token),this.logger.debug("[privy:refresh] token stored (CAT)")),t.privy_access_token&&(await this.session.storePrivyAccessToken(t.privy_access_token),this.logger.debug("[privy:refresh] token stored (PAT)")),t.identity_token&&(this.logger.debug("[privy:refresh] token stored (IDT)"),await this.session.storeIdentityToken(t.identity_token))),this.logger.debug("[privy:refresh] returning response"),s||this.callbacks?.setUser?.(t.user),t}catch(e){throw this.logger.debug(`[privy:refresh] error: ${e.message??"unknown error"}`),e instanceof n&&e.code===t.MISSING_OR_INVALID_TOKEN&&(await this.session.destroyLocalState(),s||this.callbacks?.setUser?.(null)),e}}async getAccessToken(){let[e,t]=await Promise.all([this.session.getCustomerAccessToken(),this.session.getRefreshToken()]);if(e&&!this.session.tokenIsActive(e)&&this.session.hasRefreshCredentials(e,t)){let t=await this.refreshSession(),s=await this.session.getCustomerAccessToken();return t.token||this.logger.debug("[privy:getAccessToken] expected token received null"),t.token===e&&this.logger.debug("[privy:getAccessToken] expected new token in response received existing"),s===e&&this.logger.debug("[privy:getAccessToken] expected new token in storage received existing"),t.token??s}return e&&!this.session.tokenIsActive(e)?(this.logger.debug("[privy:getAccessToken] unable to refresh inactive token"),this.callbacks?.setUser?.(null),await this.session.destroyLocalState(),null):e}async getAccessTokenInternal(){let e=await this.getAccessToken();return await this.session.getPrivyAccessToken()??e}async getIdentityToken(){return await this.session.getIdentityToken()}async isStorageAccessible(){try{let e=`privy:__storage__test-${this._crypto.randomUUID()}`,t="blobby";await this._storage.put(e,t);let s=await this._storage.get(e);return await this._storage.del(e),s===t}catch(e){return this.logger.error(e),!1}}constructor(t){this._sdkVersion="js-sdk-core:0.61.4-beta-20260507041913",this._cache=new Map,this.logger=g({level:t.logger?.level??t.logLevel??"ERROR",logger:t.logger??console}),this._storage=t.storage,this._crypto=t.crypto,this._analyticsId=null,this._getOrGenerateClientAnalyticsId(),this.baseUrl=t.baseUrl??"https://auth.privy.io",this.appId=t.appId,this.appClientId=t.appClientId,this._sdkVersion=t.sdkVersion??this._sdkVersion,this.callbacks=t.callbacks,this.nativeAppIdentifier=t.nativeAppIdentifier,this.session=new h({storage:this._storage,isUsingServerCookies:!1,appId:t.appId}),this._fetch=e(globalThis.fetch,{retries:3,retryDelay:e=>3**e*500,retryOn:[408,409,425,500,502,503,504]}),this.session.on("error_storing_tokens",(e=>{this.createAnalyticsEvent("error_updating_tokens_in_storage",{reason:e})}))}}export{p as PrivyInternal};
|
|
2
2
|
//# sourceMappingURL=PrivyInternal.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrivyInternal.mjs","sources":["../../../src/client/PrivyInternal.ts"],"names":["CLIENT_ANALYTICS_ID_KEY","PrivyInternal","setCallbacks","callbacks","this","isReady","_config","config","caid","_analyticsId","_initialize","setIsReady","isStorageAccessible","PrivyClientError","code","error","getAppConfig","custom_api_url","baseUrl","session","isUsingServerCookies","_sdkVersion","startsWith","createAnalyticsEvent","getPath","r","params","query","getPathWithParams","path","toSearchParams","fetch","body","headers","onRequest","_beforeRequest","bind","request","Request","method","JSON","stringify","requestInit","res","_fetch","json","status","PrivyApiError","_beforeRequestWithoutInitialize","token","getPrivyAccessToken","getCustomerAccessToken","Headers","set","appId","appClientId","_getOrGenerateClientAnalyticsId","nativeAppIdentifier","signal","toAbortSignalTimeout","credentials","beforeRequestWithoutRefresh","getAccessTokenInternal","AppConfig","app_id","clientAnalyticsId","_storage","get","length","e","logger","
|
|
1
|
+
{"version":3,"file":"PrivyInternal.mjs","sources":["../../../src/client/PrivyInternal.ts"],"names":["CLIENT_ANALYTICS_ID_KEY","PrivyInternal","setCallbacks","callbacks","this","isReady","_config","config","caid","_analyticsId","_initialize","setIsReady","isStorageAccessible","PrivyClientError","code","error","getAppConfig","custom_api_url","baseUrl","session","isUsingServerCookies","_sdkVersion","startsWith","createAnalyticsEvent","getPath","r","params","query","getPathWithParams","path","toSearchParams","fetch","body","headers","onRequest","_beforeRequest","bind","request","Request","method","JSON","stringify","requestInit","res","_fetch","json","status","PrivyApiError","_beforeRequestWithoutInitialize","token","getPrivyAccessToken","getCustomerAccessToken","Headers","set","appId","appClientId","_getOrGenerateClientAnalyticsId","nativeAppIdentifier","signal","toAbortSignalTimeout","credentials","beforeRequestWithoutRefresh","getAccessTokenInternal","AppConfig","app_id","clientAnalyticsId","_storage","get","length","e","logger","_crypto","randomUUID","put","destroyClientAnalyticsId","del","name","properties","AnalyticsEvent","event_name","client_id","payload","refreshSession","skipCallbacks","refreshToken","getRefreshToken","undefined","key","cached","_cache","debug","promise","_refreshSession","delete","hasRefreshCredentials","PrivyErrorCode","MISSING_OR_INVALID_TOKEN","RefreshSession","refresh_token","session_update_action","updateWithTokensResponse","destroyLocalState","setUser","storeCustomerAccessToken","privy_access_token","storePrivyAccessToken","identity_token","storeIdentityToken","user","message","s","getAccessToken","Promise","all","tokenIsActive","tokenFromStorage","cat","getIdentityToken","value","valueFromStorage","constructor","o","Map","toLoggerWithLevel","level","logLevel","console","storage","crypto","sdkVersion","Session","rfetch","globalThis","retries","retryDelay","attempt","retryOn","on","reason"],"mappings":"okBA8DA,IAAMA,EAA0B,aAOzB,MAAMC,EAuHJC,YAAAA,CAAaC,GAClBC,KAAKD,UAAY,IAAIC,KAAKD,aAAcA,EAC1C,CAOA,WAAIE,GACF,QAAeD,KAAKE,OACtB,CAKA,UAAIC,GACF,OAAOH,KAAKE,OAAO,CAUrB,QAAIE,GACF,OAAOJ,KAAKK,YAAY,CAQ1B,iBAAaC,GAEX,GAAIN,KAAKC,QACPD,KAAKD,WAAWQ,cAAa,OAD/B,CAKA,UAAYP,KAAKQ,sBACf,MAAM,IAAIC,EAAiB,CACzBC,KAAM,gBACNC,MAAO,6BAIXX,KAAKE,cAAgBF,KAAKY,eAEtBZ,KAAKE,SAASW,iBAChBb,KAAKc,QAAUd,KAAKE,QAAQW,eAC5Bb,KAAKe,QAAQC,sBAAuB,GAGtChB,KAAKD,W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AA,GACF,GAEJ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{OAuthInit as e,OAuthAuthenticate as t,OAuthLink as i,OAuthUnlink as s}from"@privy-io/routes";import{PrivyClientError as r}from"../../Error.mjs";import{createCodeVerifier as a,createStateCode as o,deriveCodeChallengeFromCodeVerifier as l,CODE_VERIFIER_KEY as d,STATE_CODE_KEY as n}from"../../pkce.mjs";import{maybeCreateWalletOnLogin as h}from"./maybeCreateWalletOnLogin.mjs";import"jose";import"../../utils/getUserEmbeddedEthereumWallet.mjs";import"../../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../../utils/embedded-wallets.mjs";import"../../utils/getUserEmbeddedSolanaWallet.mjs";import"../../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../../utils/shouldCreateEmbeddedEthWallet.mjs";import"../../utils/shouldCreateEmbeddedSolWallet.mjs";class m{async generateURL(t,i){let s=a(),r=o(),h=await l({codeVerifier:s,digest:this._crypto
|
|
1
|
+
import{OAuthInit as e,OAuthAuthenticate as t,OAuthLink as i,OAuthUnlink as s}from"@privy-io/routes";import{PrivyClientError as r}from"../../Error.mjs";import{createCodeVerifier as a,createStateCode as o,deriveCodeChallengeFromCodeVerifier as l,CODE_VERIFIER_KEY as d,STATE_CODE_KEY as n}from"../../pkce.mjs";import{maybeCreateWalletOnLogin as h}from"./maybeCreateWalletOnLogin.mjs";import"jose";import"../../utils/getUserEmbeddedEthereumWallet.mjs";import"../../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../../utils/embedded-wallets.mjs";import"../../utils/getUserEmbeddedSolanaWallet.mjs";import"../../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../../utils/shouldCreateEmbeddedEthWallet.mjs";import"../../utils/shouldCreateEmbeddedSolWallet.mjs";class m{async generateURL(t,i){let s=a(),r=o(),h=await l({codeVerifier:s,digest:this._crypto.digest});return await Promise.all([this._storage.put(d,s),this._storage.put(n,r)]),this._privyInternal.fetch(e,{body:{redirect_to:i,provider:t,code_challenge:h,state_code:r}})}async loginWithCode(e,i,s,a,o,l){let[m,p]=await Promise.all([this._storage.get(d),this._storage.get(n)]);if(p!==i)throw this._privyInternal.createAnalyticsEvent("possible_phishing_attempt",{flow:"oauth",provider:s,storedStateCode:p??"",returnedStateCode:i??""}),new r({code:"pkce_state_code_mismatch",error:"Unexpected auth flow. This may be a phishing attempt."});let _=await this._privyInternal.fetch(t,{body:{authorization_code:e,code_type:a,state_code:p,code_verifier:m,mode:o}});await this._privyInternal.session.updateWithTokensResponse(_);let c=await h(this._embedded,_,l?.embedded);return await Promise.all([this._storage.del(d),this._storage.del(n)]),this._privyInternal.callbacks?.setUser?.(c.user),c}async linkWithCode(e,t,s,a){let[o,l]=await Promise.all([this._storage.get(d),this._storage.get(n)]);if(l!==t)throw this._privyInternal.createAnalyticsEvent("possible_phishing_attempt",{flow:"oauth",provider:s,storedStateCode:l??"",returnedStateCode:t??""}),new r({code:"pkce_state_code_mismatch",error:"Unexpected auth flow. This may be a phishing attempt."});let h=await this._privyInternal.fetch(i,{body:{authorization_code:e,code_type:a,state_code:l,code_verifier:o}});await this._privyInternal.session.processOAuthTokens(h.oauth_tokens);let m=await this._privyInternal.refreshSession();return await Promise.all([this._storage.del(d),this._storage.del(n)]),{user:m.user,identity_token:m.identity_token}}async unlink(e,t){await this._privyInternal.fetch(s,{body:{provider:e,subject:t}});let i=await this._privyInternal.refreshSession();return{user:i.user,identity_token:i.identity_token}}constructor(e,t,i,s){this._privyInternal=e,this._embedded=t,this._storage=i,this._crypto=s}}export{m as default};
|
|
2
2
|
//# sourceMappingURL=OAuthApi.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OAuthApi.mjs","sources":["../../../../src/client/auth/OAuthApi.ts"],"names":["OAuthApi","generateURL","provider","redirectURI","codeVerifier","createCodeVerifier","stateCode","createStateCode","codeChallenge","deriveCodeChallengeFromCodeVerifier","digest","this","_crypto","Promise","all","_storage","put","CODE_VERIFIER_KEY","STATE_CODE_KEY","_privyInternal","fetch","OAuthInit","body","redirect_to","code_challenge","state_code","loginWithCode","authorizationCode","returnedStateCode","codeType","mode","opts","storedStateCode","get","createAnalyticsEvent","flow","PrivyClientError","code","error","res","OAuthAuthenticate","authorization_code","code_type","code_verifier","session","updateWithTokensResponse","sessionWithWallets","maybeCreateWalletOnLogin","_embedded","embedded","del","callbacks","setUser","user","linkWithCode","linkResponse","OAuthLink","processOAuthTokens","oauth_tokens","refreshSession","identity_token","unlink","subject","OAuthUnlink","constructor","privyInternal","storage","crypto"],"mappings":"4vBAkBe,MAAMA,EA2CnB,iBAAaC,CAAYC,EAA2BC,GAClD,IAAMC,EAAeC,IACfC,EAAYC,IACZC,QAAsBC,EAAoC,CAC9DL,aAAAA,EACAM,OAAQC,KAAKC,
|
|
1
|
+
{"version":3,"file":"OAuthApi.mjs","sources":["../../../../src/client/auth/OAuthApi.ts"],"names":["OAuthApi","generateURL","provider","redirectURI","codeVerifier","createCodeVerifier","stateCode","createStateCode","codeChallenge","deriveCodeChallengeFromCodeVerifier","digest","this","_crypto","Promise","all","_storage","put","CODE_VERIFIER_KEY","STATE_CODE_KEY","_privyInternal","fetch","OAuthInit","body","redirect_to","code_challenge","state_code","loginWithCode","authorizationCode","returnedStateCode","codeType","mode","opts","storedStateCode","get","createAnalyticsEvent","flow","PrivyClientError","code","error","res","OAuthAuthenticate","authorization_code","code_type","code_verifier","session","updateWithTokensResponse","sessionWithWallets","maybeCreateWalletOnLogin","_embedded","embedded","del","callbacks","setUser","user","linkWithCode","linkResponse","OAuthLink","processOAuthTokens","oauth_tokens","refreshSession","identity_token","unlink","subject","OAuthUnlink","constructor","privyInternal","storage","crypto"],"mappings":"4vBAkBe,MAAMA,EA2CnB,iBAAaC,CAAYC,EAA2BC,GAClD,IAAMC,EAAeC,IACfC,EAAYC,IACZC,QAAsBC,EAAoC,CAC9DL,aAAAA,EACAM,OAAQC,KAAKC,QAAQF,SAQvB,aALMG,QAAQC,IAAI,CAChBH,KAAKI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,IAAIQ,EAAiB,CACzBC,KAAM,2BACNC,MAAO,0DAIX,IAAMiB,QAAqB5C,KAAKQ,eAAeC,MAAMoC,EAAW,CAC9DlC,KAAM,CACJmB,mBAAoBd,EACpBe,UAAWb,EACXJ,WAAYO,EACZW,cAAevC,WAIbO,KAAKQ,eAAeyB,QAAQa,mBAAmBF,EAAaG,cAGlE,IAAMnB,QAAY5B,KAAKQ,eAAewC,iBAGtC,aADM9C,QAAQC,IAAI,CAACH,KAAKI,SAASmC,IAAIjC,GAAoBN,KAAKI,SAASmC,IAAIhC,KACpE,CAACmC,KAAMd,EAAIc,KAAMO,eAAgBrB,EAAIqB,eAC9C,CAQA,YAAaC,CAAO3D,EAA2B4D,SACvCnD,KAAKQ,eAAeC,MAAM2C,EAAa,CAACzC,KAAM,CAACpB,SAAAA,EAAU4D,QAAAA,KAG/D,IAAMvB,QAAY5B,KAAKQ,eAAewC,iBAEtC,MAAO,CAACN,KAAMd,EAAIc,KAAMO,eAAgBrB,EAAIqB,eAC9C,CAnKA,WAAAI,CACEC,EACAhB,EACAiB,EACAC,GAEAxD,KAAKQ,eAAiB8C,EACtBtD,KAAKqC,UAAYC,EACjBtC,KAAKI,SAAWmD,EAChBvD,KAAKC,QAAUuD,CACjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecoveryApi.mjs","sources":["../../../../src/client/recovery/RecoveryApi.ts"],"names":["RecoveryApi","getRecoveryKeyMaterial","address","chain_type","this","_privyInternal","fetch","RecoveryKeyMaterial","body","params","constructor","privyInternal","storage","crypto","auth","RecoveryOAuthApi","icloudAuth","RecoveryICloudApi"],"mappings":"sMAQqBA,
|
|
1
|
+
{"version":3,"file":"RecoveryApi.mjs","sources":["../../../../src/client/recovery/RecoveryApi.ts"],"names":["RecoveryApi","getRecoveryKeyMaterial","address","chain_type","this","_privyInternal","fetch","RecoveryKeyMaterial","body","params","constructor","privyInternal","storage","crypto","auth","RecoveryOAuthApi","icloudAuth","RecoveryICloudApi"],"mappings":"sMAQqBA,EA8BnB,4BAAaC,CAAuBC,EAAiBC,GACnD,OAAOC,KAAKC,eAAeC,MAAMC,EAAqB,CACpDC,KAAM,CACJL,WAAAA,GAEFM,OAAQ,CACNP,QAAAA,IAGN,CAtBA,WAAAQ,CAAmBC,EAA8BC,EAAkBC,GACjET,KAAKC,eAAiBM,EAEtBP,KAAKU,KAAO,IAAIC,EAAiBX,KAAKC,eAAgBO,EAASC,GAC/DT,KAAKY,WAAa,IAAIC,EAAkBb,KAAKC,eAC/C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{RecoveryOAuthInit as t,RecoveryOAuthAuthenticate as e}from"@privy-io/routes";import{PrivyClientError as r}from"../../Error.mjs";import{createCodeVerifier as i,createStateCode as o,deriveCodeChallengeFromCodeVerifier as a,CODE_VERIFIER_KEY as s,STATE_CODE_KEY as h}from"../../pkce.mjs";import"jose";class c{async generateURL(e){let r=i(),c=o(),_=await a({codeVerifier:r,digest:this._crypto
|
|
1
|
+
import{RecoveryOAuthInit as t,RecoveryOAuthAuthenticate as e}from"@privy-io/routes";import{PrivyClientError as r}from"../../Error.mjs";import{createCodeVerifier as i,createStateCode as o,deriveCodeChallengeFromCodeVerifier as a,CODE_VERIFIER_KEY as s,STATE_CODE_KEY as h}from"../../pkce.mjs";import"jose";class c{async generateURL(e){let r=i(),c=o(),_=await a({codeVerifier:r,digest:this._crypto.digest});return await Promise.all([this._storage.put(s,r),this._storage.put(h,c)]),this._privyInternal.fetch(t,{body:{redirect_to:e,code_challenge:_,state_code:c}})}async authorize(t,i){let[o,a]=await Promise.all([this._storage.get(s),this._storage.get(h)]);if(a!==i)throw this._privyInternal.createAnalyticsEvent("possible_phishing_attempt",{flow:"recovery_oauth",storedStateCode:a??"",returnedStateCode:i??""}),new r({code:"pkce_state_code_mismatch",error:"Unexpected auth flow. This may be a phishing attempt."});let c=await this._privyInternal.fetch(e,{body:{authorization_code:t,state_code:a,code_verifier:o}});return await Promise.all([this._storage.del(s),this._storage.del(h)]),c}constructor(t,e,r){this._privyInternal=t,this._storage=e,this._crypto=r}}export{c as default};
|
|
2
2
|
//# sourceMappingURL=RecoveryOAuthApi.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecoveryOAuthApi.mjs","sources":["../../../../src/client/recovery/RecoveryOAuthApi.ts"],"names":["RecoveryOAuthApi","generateURL","redirectURI","codeVerifier","createCodeVerifier","stateCode","createStateCode","codeChallenge","deriveCodeChallengeFromCodeVerifier","digest","this","_crypto","Promise","all","_storage","put","CODE_VERIFIER_KEY","STATE_CODE_KEY","_privyInternal","fetch","RecoveryOAuthInit","body","redirect_to","code_challenge","state_code","authorize","authorizationCode","returnedStateCode","storedStateCode","get","createAnalyticsEvent","flow","PrivyClientError","code","error","res","RecoveryOAuthAuthenticate","authorization_code","code_verifier","del","constructor","privyInternal","storage","crypto"],"mappings":"uTAcqBA,
|
|
1
|
+
{"version":3,"file":"RecoveryOAuthApi.mjs","sources":["../../../../src/client/recovery/RecoveryOAuthApi.ts"],"names":["RecoveryOAuthApi","generateURL","redirectURI","codeVerifier","createCodeVerifier","stateCode","createStateCode","codeChallenge","deriveCodeChallengeFromCodeVerifier","digest","this","_crypto","Promise","all","_storage","put","CODE_VERIFIER_KEY","STATE_CODE_KEY","_privyInternal","fetch","RecoveryOAuthInit","body","redirect_to","code_challenge","state_code","authorize","authorizationCode","returnedStateCode","storedStateCode","get","createAnalyticsEvent","flow","PrivyClientError","code","error","res","RecoveryOAuthAuthenticate","authorization_code","code_verifier","del","constructor","privyInternal","storage","crypto"],"mappings":"uTAcqBA,EA+BnB,iBAAaC,CAAYC,GACvB,IAAMC,EAAeC,IACfC,EAAYC,IACZC,QAAsBC,EAAoC,CAC9DL,aAAAA,EACAM,OAAQC,KAAKC,QAAQF,SAQvB,aALMG,QAAQC,IAAI,CAChBH,KAAKI,SAASC,IAAIC,EAAmBb,GACrCO,KAAKI,SAASC,IAAIE,EAAgBZ,KAG7BK,KAAKQ,eAAeC,MAAMC,EAAmB,CAClDC,KAAM,CACJC,YAAapB,EACbqB,eAAgBhB,EAChBiB,WAAYnB,IAGlB,CAQA,eAAaoB,CAAUC,EAA2BC,GAChD,IAAOxB,EAAcyB,SAAyBhB,QAAQC,IAAI,CACxDH,KAAKI,SAASe,IAAIb,GAClBN,KAAKI,SAASe,IAAIZ,KAGpB,GAAIW,IAAoBD,EAQtB,MANKjB,KAAKQ,eAAeY,qBAAqB,4BAA6B,CACzEC,KAAM,iBACNH,gBAAiBA,GAAmB,GACpCD,kBAAmBA,GAAqB,KAGpC,IAAIK,EAAiB,CACzBC,KAAM,2BACNC,MAAO,0DAIX,IAAMC,QAAYzB,KAAKQ,eAAeC,MAAMiB,EAA2B,CACrEf,KAAM,CACJgB,mBAAoBX,EACpBF,WAAYI,EACZU,cAAenC,KAMnB,aAFMS,QAAQC,IAAI,CAACH,KAAKI,SAASyB,IAAIvB,GAAoBN,KAAKI,SAASyB,IAAItB,KAEpEkB,CACT,CAvEA,WAAAK,CAAmBC,EAA8BC,EAAkBC,GACjEjC,KAAKQ,eAAiBuB,EACtB/B,KAAKI,SAAW4B,EAChBhC,KAAKC,QAAUgC,CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.mjs","sources":["../../../src/crypto/resolve.ts"],"names":["resolveCryptoFns","overrides","digest","alg","data","globalThis","crypto","subtle","randomUUID"],"mappings":"AAQO,SAASA,EAAiBC,GAC/B,MAAO,CACLC,OAAQD,GAAWC,UAAYC,EAAKC,IAASC,WAAWC,OAAOC,OAAOL,OAAOC,EAAKC,IAClFI,WAAYP,GAAWO,YAAAA,KAAqBH,WAAWC,OAAOE,cAElE"}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"./client/Privy.mjs";export{LocalStorage}from"./storage/LocalStorage.mjs";export{InMemoryCache}from"./storage/InMemoryStorage.mjs";export{MoonpayApiError,PrivyApiError,PrivyClientError,createErrorFormatter,errorIndicatesMfaCanceled}from"./Error.mjs";export{EmbeddedProviderError,PrivyConnectorError,PrivyEmbeddedWalletErrorCode,PrivyProviderRpcError,ProviderErrors,errorIndicatesMaxMfaRetries,errorIndicatesMfaRateLimit,errorIndicatesMfaTimeout,errorIndicatesMfaVerificationFailed,errorIndicatesRecoveryIsNeeded}from"./embedded/errors.mjs";export{getUserEmbeddedEthereumWallet,getUserEmbeddedWallet}from"./utils/getUserEmbeddedEthereumWallet.mjs";export{getAllUserEmbeddedEthereumWallets}from"./utils/getAllUserEmbeddedEthereumWallets.mjs";export{getAllUserEmbeddedSolanaWallets}from"./utils/getAllUserEmbeddedSolanaWallets.mjs";export{getAllUserEmbeddedBitcoinWallets}from"./utils/getAllUserEmbeddedBitcoinWallets.mjs";export{isEmbeddedWalletAccount}from"./utils/embedded-wallets.mjs";export{getEntropyDetailsFromAccount,getEntropyDetailsFromUser}from"./utils/entropy.mjs";export{getUserSmartWallet}from"./utils/getUserSmartWallet.mjs";export{getJsonRpcEndpointFromChain,throwIfInvalidRecoveryUpgradePath}from"./embedded/utils/index.mjs";export{countryCodesAndNumbers,formatPhoneNumber,getPhoneCountryCodeAndNumber,getPlaceholderPhoneNumber,lastFourDigits,phoneNumberTypingFormatter,validatePhoneNumber}from"./utils/phoneNumberUtils.mjs";export{getUserEmbeddedSolanaWallet}from"./utils/getUserEmbeddedSolanaWallet.mjs";export{toObjectKeys}from"./utils/toObjectKeys.mjs";export{SolanaUsdcAddressMap,UsdcAddressMap,getIsTokenUsdc}from"./utils/getIsTokenUsdc.mjs";export{generateWalletIdempotencyKey}from"./utils/generateWalletIdempotencyKey.mjs";export{chainToMoonpayCurrency,fundingMethodToMoonpayPaymentMethod,isSupportedChainIdForMoonpay}from"./funding/moonpay.mjs";export{getCoinbaseOnRampUrl,isSupportedChainIdForCoinbaseOnramp,toCoinbaseAssetId,toCoinbaseBlockchainFromChainId}from"./funding/coinbase.mjs";export{SolanaClient}from"./solana/client.mjs";export{createSiwsMessage}from"./solana/createSiwsMessage.mjs";export{getSolanaRpcEndpointForCluster}from"./solana/getSolanaRpcEndpointForCluster.mjs";export{getSolanaUsdcMintAddressForCluster}from"./solana/getSolanaUsdcMintAddressForCluster.mjs";export{getSolanaClusterDisplayName}from"./solana/getSolanaClusterDisplayName.mjs";export{ALL_WALLET_CLIENT_TYPES,SUPPORTED_CONNECTOR_TYPES}from"./types.mjs";export*from"@privy-io/chains";export{formatLamportsAmount,formatTokenAmount,formatWalletAddress,formatWeiAmount}from"./utils/formatters.mjs";export{generateAuthorizationSignature}from"./wallet-api/generate-authorization-signature.mjs";export{create}from"./wallet-api/create.mjs";export{rpc}from"./wallet-api/rpc.mjs";export{rawSign}from"./wallet-api/raw-sign.mjs";export{getWallet}from"./wallet-api/get-wallet.mjs";export{updateWallet}from"./wallet-api/update-wallet.mjs";export{isUnifiedWallet}from"./wallet-api/unified-wallet.mjs";export{addSessionSigners,removeSessionSigners}from"./embedded/stack/session-signers.mjs";export{ConnectedStandardSolanaWallet}from"./solana/ConnectedStandardSolanaWallet.mjs";export{i as crossApp}from"./index-Bu3ySxLM.mjs";export{i as delegatedActions}from"./index-g0cxoRWQ.mjs";export{getCountryCallingCode}from"libphonenumber-js/min";import"./client/AppApi.mjs";import"@privy-io/routes";import"./client/CrossAppApi.mjs";import"./Token.mjs";import"jose";import"./client/DelegatedWalletsApi.mjs";import"./client/EmbeddedWalletApi.mjs";import"./embedded/EmbeddedBitcoinWalletProvider.mjs";import"./embedded/stack/walletCreate.mjs";import"./embedded/EmbeddedWalletProxy.mjs";import"./utils/sleep.mjs";import"./embedded/EventCallbackQueue.mjs";import"./embedded/withMfa.mjs";import"./embedded/EmbeddedWalletProvider.mjs";import"eventemitter3";import"viem";import"@privy-io/ethereum";import"./embedded/stack/walletRpc.mjs";import"./utils/encodings.mjs";import"./embedded/stack/wallet-api-eth-transaction.mjs";import"./embedded/stack/wallet-api-eth-typed-data.mjs";import"./embedded/EmbeddedSolanaWalletProvider.mjs";import"./solana/getWalletPublicKeyFromTransaction.mjs";import"./solana/isVersionedTransaction.mjs";import"./client/MfaPromises.mjs";import"./client/PrivyInternal.mjs";import"fetch-retry";import"
|
|
1
|
+
import e from"./client/Privy.mjs";export{LocalStorage}from"./storage/LocalStorage.mjs";export{InMemoryCache}from"./storage/InMemoryStorage.mjs";export{MoonpayApiError,PrivyApiError,PrivyClientError,createErrorFormatter,errorIndicatesMfaCanceled}from"./Error.mjs";export{EmbeddedProviderError,PrivyConnectorError,PrivyEmbeddedWalletErrorCode,PrivyProviderRpcError,ProviderErrors,errorIndicatesMaxMfaRetries,errorIndicatesMfaRateLimit,errorIndicatesMfaTimeout,errorIndicatesMfaVerificationFailed,errorIndicatesRecoveryIsNeeded}from"./embedded/errors.mjs";export{getUserEmbeddedEthereumWallet,getUserEmbeddedWallet}from"./utils/getUserEmbeddedEthereumWallet.mjs";export{getAllUserEmbeddedEthereumWallets}from"./utils/getAllUserEmbeddedEthereumWallets.mjs";export{getAllUserEmbeddedSolanaWallets}from"./utils/getAllUserEmbeddedSolanaWallets.mjs";export{getAllUserEmbeddedBitcoinWallets}from"./utils/getAllUserEmbeddedBitcoinWallets.mjs";export{isEmbeddedWalletAccount}from"./utils/embedded-wallets.mjs";export{getEntropyDetailsFromAccount,getEntropyDetailsFromUser}from"./utils/entropy.mjs";export{getUserSmartWallet}from"./utils/getUserSmartWallet.mjs";export{getJsonRpcEndpointFromChain,throwIfInvalidRecoveryUpgradePath}from"./embedded/utils/index.mjs";export{countryCodesAndNumbers,formatPhoneNumber,getPhoneCountryCodeAndNumber,getPlaceholderPhoneNumber,lastFourDigits,phoneNumberTypingFormatter,validatePhoneNumber}from"./utils/phoneNumberUtils.mjs";export{getUserEmbeddedSolanaWallet}from"./utils/getUserEmbeddedSolanaWallet.mjs";export{toObjectKeys}from"./utils/toObjectKeys.mjs";export{SolanaUsdcAddressMap,UsdcAddressMap,getIsTokenUsdc}from"./utils/getIsTokenUsdc.mjs";export{generateWalletIdempotencyKey}from"./utils/generateWalletIdempotencyKey.mjs";export{chainToMoonpayCurrency,fundingMethodToMoonpayPaymentMethod,isSupportedChainIdForMoonpay}from"./funding/moonpay.mjs";export{getCoinbaseOnRampUrl,isSupportedChainIdForCoinbaseOnramp,toCoinbaseAssetId,toCoinbaseBlockchainFromChainId}from"./funding/coinbase.mjs";export{SolanaClient}from"./solana/client.mjs";export{createSiwsMessage}from"./solana/createSiwsMessage.mjs";export{getSolanaRpcEndpointForCluster}from"./solana/getSolanaRpcEndpointForCluster.mjs";export{getSolanaUsdcMintAddressForCluster}from"./solana/getSolanaUsdcMintAddressForCluster.mjs";export{getSolanaClusterDisplayName}from"./solana/getSolanaClusterDisplayName.mjs";export{ALL_WALLET_CLIENT_TYPES,SUPPORTED_CONNECTOR_TYPES}from"./types.mjs";export*from"@privy-io/chains";export{formatLamportsAmount,formatTokenAmount,formatWalletAddress,formatWeiAmount}from"./utils/formatters.mjs";export{generateAuthorizationSignature}from"./wallet-api/generate-authorization-signature.mjs";export{create}from"./wallet-api/create.mjs";export{rpc}from"./wallet-api/rpc.mjs";export{rawSign}from"./wallet-api/raw-sign.mjs";export{getWallet}from"./wallet-api/get-wallet.mjs";export{updateWallet}from"./wallet-api/update-wallet.mjs";export{isUnifiedWallet}from"./wallet-api/unified-wallet.mjs";export{addSessionSigners,removeSessionSigners}from"./embedded/stack/session-signers.mjs";export{ConnectedStandardSolanaWallet}from"./solana/ConnectedStandardSolanaWallet.mjs";export{i as crossApp}from"./index-Bu3ySxLM.mjs";export{i as delegatedActions}from"./index-g0cxoRWQ.mjs";export{getCountryCallingCode}from"libphonenumber-js/min";import"./crypto/resolve.mjs";import"./client/AppApi.mjs";import"@privy-io/routes";import"./client/CrossAppApi.mjs";import"./Token.mjs";import"jose";import"./client/DelegatedWalletsApi.mjs";import"./client/EmbeddedWalletApi.mjs";import"./embedded/EmbeddedBitcoinWalletProvider.mjs";import"./embedded/stack/walletCreate.mjs";import"./embedded/EmbeddedWalletProxy.mjs";import"./utils/sleep.mjs";import"./embedded/EventCallbackQueue.mjs";import"./embedded/withMfa.mjs";import"./embedded/EmbeddedWalletProvider.mjs";import"eventemitter3";import"viem";import"@privy-io/ethereum";import"./embedded/stack/walletRpc.mjs";import"./utils/encodings.mjs";import"./embedded/stack/wallet-api-eth-transaction.mjs";import"./embedded/stack/wallet-api-eth-typed-data.mjs";import"./embedded/EmbeddedSolanaWalletProvider.mjs";import"./solana/getWalletPublicKeyFromTransaction.mjs";import"./solana/isVersionedTransaction.mjs";import"./client/MfaPromises.mjs";import"./client/PrivyInternal.mjs";import"fetch-retry";import"@privy-io/api-base";import"./Session.mjs";import"js-cookie";import"./utils/allSettled.mjs";import"./toAbortSignalTimeout.mjs";import"./utils/toSearchParams.mjs";import"./client/logger.mjs";import"./utils/noop.mjs";import"./client/UserApi.mjs";import"./client/auth/AuthApi.mjs";import"./client/auth/CustomProviderApi.mjs";import"./client/auth/maybeCreateWalletOnLogin.mjs";import"./utils/shouldCreateEmbeddedEthWallet.mjs";import"./utils/shouldCreateEmbeddedSolWallet.mjs";import"./client/auth/EmailApi.mjs";import"./client/auth/FarcasterApi.mjs";import"./client/auth/FarcasterV2Api.mjs";import"./client/auth/GuestApi.mjs";import"./client/auth/OAuthApi.mjs";import"./pkce.mjs";import"./client/auth/PasskeyApi.mjs";import"./client/auth/PhoneApi.mjs";import"./client/auth/SiweApi.mjs";import"./client/auth/SiwsApi.mjs";import"./client/auth/SmartWalletApi.mjs";import"./client/funding/FundingApi.mjs";import"./client/funding/CoinbaseOnRampApi.mjs";import"./client/funding/MoonpayOnRampApi.mjs";import"./client/mfa/MfaApi.mjs";import"./client/mfa/MfaPasskeyApi.mjs";import"./client/mfa/MfaSmsApi.mjs";import"./client/recovery/RecoveryApi.mjs";import"./client/recovery/RecoveryICloudApi.mjs";import"./client/recovery/RecoveryOAuthApi.mjs";import"./embedded/types.mjs";import"libphonenumber-js/examples.mobile.json";import"canonicalize";import"@privy-io/encoding";import"./wallet-api/types.mjs";import"./action/delegatedActions/utils.mjs";import"./action/crossApp/loginWithCrossAppAuth.mjs";import"./action/crossApp/linkWithCrossAppAuth.mjs";import"./index-DTAjYY8z.mjs";import"./action/crossApp/wallet/signMessage.mjs";import"./action/crossApp/wallet/utils/isCrossAppWalletSmart.mjs";import"./action/crossApp/wallet/utils/sendCrossAppRequest.mjs";import"./action/crossApp/wallet/utils/getCrossAppAccountByWalletAddress.mjs";import"./action/crossApp/wallet/utils/getProviderAccessTokenOrRelink.mjs";import"./action/crossApp/wallet/utils/throwIfNotLoggedIn.mjs";import"./action/crossApp/wallet/signTypedData.mjs";import"./utils/typedData/generateDomainType.mjs";import"./action/crossApp/wallet/sendTransaction.mjs";import"./action/delegatedActions/delegateWallet.mjs";import"./action/delegatedActions/revokeWallets.mjs";const t="biconomy",r="coinbase_smart_wallet",o="kernel",s="light_account",m="safe",a="thirdweb";export{t as BICONOMY,r as COINBASE_SMART_WALLET,o as KERNEL,s as LIGHT_ACCOUNT,m as SAFE,a as THIRDWEB,e as default};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/index.ts"],"names":["BICONOMY","COINBASE_SMART_WALLET","KERNEL","LIGHT_ACCOUNT","SAFE","THIRDWEB"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/index.ts"],"names":["BICONOMY","COINBASE_SMART_WALLET","KERNEL","LIGHT_ACCOUNT","SAFE","THIRDWEB"],"mappings":"y5MAcO,MAAMA,EAAW,WAEXC,EAAwB,wBAExBC,EAAS,SAETC,EAAgB,gBAEhBC,EAAO,OAEPC,EAAW"}
|
package/dist/esm/pkce.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{base64url as e}from"jose";const
|
|
1
|
+
import{base64url as e}from"jose";const n="privy:state_code",r="privy:code_verifier";async function t(e,n){let r=(new TextEncoder).encode(e);return new Uint8Array(await n("SHA-256",r))}function o(e){return crypto.getRandomValues(new Uint8Array(e))}function i(){return e.encode(o(36))}function c(){return i()}async function u({codeVerifier:n,method:r="S256",digest:o}){if("S256"!=r)return n;{let r=await t(n,o);return e.encode(r)}}export{r as CODE_VERIFIER_KEY,n as STATE_CODE_KEY,i as createCodeVerifier,t as createHashBuffer,c as createStateCode,u as deriveCodeChallengeFromCodeVerifier,o as randomBytes};
|
|
2
2
|
//# sourceMappingURL=pkce.mjs.map
|
package/dist/esm/pkce.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pkce.mjs","sources":["../../src/pkce.ts"],"names":["STATE_CODE_KEY","CODE_VERIFIER_KEY","async","createHashBuffer","message","digest","data","TextEncoder","encode","Uint8Array","randomBytes","size","crypto","getRandomValues","createCodeVerifier","base64url","createStateCode","deriveCodeChallengeFromCodeVerifier","codeVerifier","method","
|
|
1
|
+
{"version":3,"file":"pkce.mjs","sources":["../../src/pkce.ts"],"names":["STATE_CODE_KEY","CODE_VERIFIER_KEY","async","createHashBuffer","message","digest","data","TextEncoder","encode","Uint8Array","randomBytes","size","crypto","getRandomValues","createCodeVerifier","base64url","createStateCode","deriveCodeChallengeFromCodeVerifier","codeVerifier","method","hashBuffer"],"mappings":"iCAQO,MAAMA,EAAiB,mBACjBC,EAAoB,sBAG1BC,eAAeC,EAAiBC,EAAiBC,GACtD,IAAMC,GAAO,IAAIC,aAAcC,OAAOJ,GAEtC,OAAO,IAAIK,iBADQJ,EAAO,UAAWC,GAEvC,CAEO,SAASI,EAAYC,GAC1B,OAAOC,OAAOC,gBAAgB,IAAIJ,WAAWE,GAC/C,CAOO,SAASG,IASd,OAAOC,EAAUP,OAAOE,EAAY,IACtC,CAWO,SAASM,IAId,OAAOF,GACT,CAOOZ,eAAee,GACpBC,aAAAA,EACAC,OAAAA,EAzDoC,OA0DpCd,OAAAA,IAMA,GAAIc,QAAAA,EAQF,OAAOD,GANP,IAAME,QAAmBjB,EAAiBe,EAAcb,GACxD,OAAOU,EAAUP,OAAOY,EAC1B,CAMF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{resolveCryptoFns as t}from"../crypto/resolve.mjs";class e{async invokeRpc({method:t,params:e}){let n=await fetch(this.cluster.rpcUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:this._crypto.randomUUID(),method:t,params:e})});return await n.json()}async getBalance(t){try{let e=await this.invokeRpc({method:"getBalance",params:[t]});return e.error?null:BigInt(e.result.value)}catch(t){return null}}async getTokenAccountsByOwner(t,e){try{let n=await this.invokeRpc({method:"getTokenAccountsByOwner",params:[t,{mint:e},{encoding:"jsonParsed"}]});if(n.error)return null;let r=n.result.value.at(0)?.account?.data?.parsed?.info?.tokenAmount;return r?{amount:BigInt(r.amount),decimals:r.decimals}:null}catch(t){return null}}async getAccountInfo(t){try{let e=await this.invokeRpc({method:"getAccountInfo",params:[t,{encoding:"jsonParsed"}]});if(e.error)return null;let n=e.result.value?.data?.parsed?.info;return n?{decimals:n.decimals}:null}catch(t){return null}}constructor(e,n){this.cluster=e,this._crypto=t(n)}}export{e as SolanaClient};
|
|
2
2
|
//# sourceMappingURL=client.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.mjs","sources":["../../../src/solana/client.ts"],"names":["SolanaClient","invokeRpc","method","params","response","fetch","this","cluster","rpcUrl","headers","body","JSON","stringify","jsonrpc","id","
|
|
1
|
+
{"version":3,"file":"client.mjs","sources":["../../../src/solana/client.ts"],"names":["SolanaClient","invokeRpc","method","params","response","fetch","this","cluster","rpcUrl","headers","body","JSON","stringify","jsonrpc","id","_crypto","randomUUID","json","getBalance","address","error","BigInt","result","value","getTokenAccountsByOwner","mintAddress","mint","encoding","tokenAmount","at","account","data","parsed","info","amount","decimals","getAccountInfo","tokenInfo","constructor","crypto","resolveCryptoFns"],"mappings":"yDAuBO,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C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toAbortSignalTimeout.mjs","sources":["../../src/toAbortSignalTimeout.ts"],"names":["
|
|
1
|
+
{"version":3,"file":"toAbortSignalTimeout.mjs","sources":["../../src/toAbortSignalTimeout.ts"],"names":["c","t","controller","AbortController","setTimeout","abort","duration","signal"],"mappings":"AAUA,IAAAA,EAN6BC,IAC3B,IAAMC,EAAa,IAAIC,gBAEvB,OADAC,YAAW,IAAMF,EAAWG,SAASC,GAC9BJ,EAAWK,MACpB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@privy-io/js-sdk-core",
|
|
3
|
-
"version": "0.61.
|
|
3
|
+
"version": "0.61.4-beta-20260507041913",
|
|
4
4
|
"description": "Vanilla JS client for the Privy Auth API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"authentication",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"not op_mini all"
|
|
51
51
|
],
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@privy-io/api-types": "0.
|
|
53
|
+
"@privy-io/api-types": "0.11.0",
|
|
54
54
|
"canonicalize": "^2.0.0",
|
|
55
55
|
"eventemitter3": "^5.0.1",
|
|
56
56
|
"fetch-retry": "^6.0.0",
|
|
@@ -58,12 +58,11 @@
|
|
|
58
58
|
"js-cookie": "^3.0.5",
|
|
59
59
|
"libphonenumber-js": "^1.10.44",
|
|
60
60
|
"set-cookie-parser": "^2.6.0",
|
|
61
|
-
"uuid": ">=8 <10",
|
|
62
61
|
"@privy-io/api-base": "1.9.0",
|
|
62
|
+
"@privy-io/chains": "0.3.0-beta-20260507041913",
|
|
63
63
|
"@privy-io/encoding": "0.1.3",
|
|
64
64
|
"@privy-io/ethereum": "0.0.11",
|
|
65
|
-
"@privy-io/
|
|
66
|
-
"@privy-io/routes": "0.0.12"
|
|
65
|
+
"@privy-io/routes": "0.0.14-beta-20260507041913"
|
|
67
66
|
},
|
|
68
67
|
"devDependencies": {
|
|
69
68
|
"@metamask/eth-sig-util": "^8.2.0",
|
|
@@ -84,7 +83,6 @@
|
|
|
84
83
|
"@types/js-cookie": "^3.0.3",
|
|
85
84
|
"@types/set-cookie-parser": "^2.4.7",
|
|
86
85
|
"@types/text-encoding": "^0.0.37",
|
|
87
|
-
"@types/uuid": ">=8 <10",
|
|
88
86
|
"@wallet-standard/base": "*",
|
|
89
87
|
"@wallet-standard/core": "*",
|
|
90
88
|
"@wallet-standard/features": "*",
|