@privy-io/js-sdk-core 0.67.3 → 0.68.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/dist/cjs/Session.js +1 -1
  2. package/dist/cjs/Session.js.map +1 -1
  3. package/dist/cjs/client/Privy.js +1 -1
  4. package/dist/cjs/client/Privy.js.map +1 -1
  5. package/dist/cjs/client/PrivyInternal.js +1 -1
  6. package/dist/cjs/client/PrivyInternal.js.map +1 -1
  7. package/dist/cjs/client/UserApi.js +1 -1
  8. package/dist/cjs/client/UserApi.js.map +1 -1
  9. package/dist/cjs/client/auth/CustomProviderApi.js +1 -1
  10. package/dist/cjs/client/auth/CustomProviderApi.js.map +1 -1
  11. package/dist/cjs/client/auth/EmailApi.js +1 -1
  12. package/dist/cjs/client/auth/EmailApi.js.map +1 -1
  13. package/dist/cjs/client/auth/FarcasterApi.js +1 -1
  14. package/dist/cjs/client/auth/FarcasterApi.js.map +1 -1
  15. package/dist/cjs/client/auth/FarcasterV2Api.js +1 -1
  16. package/dist/cjs/client/auth/FarcasterV2Api.js.map +1 -1
  17. package/dist/cjs/client/auth/GuestApi.js.map +1 -1
  18. package/dist/cjs/client/auth/OAuthApi.js +1 -1
  19. package/dist/cjs/client/auth/OAuthApi.js.map +1 -1
  20. package/dist/cjs/client/auth/PasskeyApi.js +1 -1
  21. package/dist/cjs/client/auth/PasskeyApi.js.map +1 -1
  22. package/dist/cjs/client/auth/PhoneApi.js +1 -1
  23. package/dist/cjs/client/auth/PhoneApi.js.map +1 -1
  24. package/dist/cjs/client/auth/SiweApi.js +1 -1
  25. package/dist/cjs/client/auth/SiweApi.js.map +1 -1
  26. package/dist/cjs/client/auth/SiwsApi.js +1 -1
  27. package/dist/cjs/client/auth/SiwsApi.js.map +1 -1
  28. package/dist/cjs/embedded/stack/wallet-api-eth-transaction.js +1 -1
  29. package/dist/cjs/embedded/stack/wallet-api-eth-transaction.js.map +1 -1
  30. package/dist/cjs/index.js +1 -1
  31. package/dist/cjs/index.js.map +1 -1
  32. package/dist/cjs/session/keys.js +2 -0
  33. package/dist/cjs/session/keys.js.map +1 -0
  34. package/dist/dts/index.d.mts +36 -1
  35. package/dist/dts/index.d.ts +36 -1
  36. package/dist/esm/Session.mjs +1 -1
  37. package/dist/esm/Session.mjs.map +1 -1
  38. package/dist/esm/client/Privy.mjs +1 -1
  39. package/dist/esm/client/Privy.mjs.map +1 -1
  40. package/dist/esm/client/PrivyInternal.mjs +1 -1
  41. package/dist/esm/client/PrivyInternal.mjs.map +1 -1
  42. package/dist/esm/client/UserApi.mjs +1 -1
  43. package/dist/esm/client/UserApi.mjs.map +1 -1
  44. package/dist/esm/client/auth/CustomProviderApi.mjs +1 -1
  45. package/dist/esm/client/auth/CustomProviderApi.mjs.map +1 -1
  46. package/dist/esm/client/auth/EmailApi.mjs +1 -1
  47. package/dist/esm/client/auth/EmailApi.mjs.map +1 -1
  48. package/dist/esm/client/auth/FarcasterApi.mjs +1 -1
  49. package/dist/esm/client/auth/FarcasterApi.mjs.map +1 -1
  50. package/dist/esm/client/auth/FarcasterV2Api.mjs +1 -1
  51. package/dist/esm/client/auth/FarcasterV2Api.mjs.map +1 -1
  52. package/dist/esm/client/auth/GuestApi.mjs.map +1 -1
  53. package/dist/esm/client/auth/OAuthApi.mjs +1 -1
  54. package/dist/esm/client/auth/OAuthApi.mjs.map +1 -1
  55. package/dist/esm/client/auth/PasskeyApi.mjs +1 -1
  56. package/dist/esm/client/auth/PasskeyApi.mjs.map +1 -1
  57. package/dist/esm/client/auth/PhoneApi.mjs +1 -1
  58. package/dist/esm/client/auth/PhoneApi.mjs.map +1 -1
  59. package/dist/esm/client/auth/SiweApi.mjs +1 -1
  60. package/dist/esm/client/auth/SiweApi.mjs.map +1 -1
  61. package/dist/esm/client/auth/SiwsApi.mjs +1 -1
  62. package/dist/esm/client/auth/SiwsApi.mjs.map +1 -1
  63. package/dist/esm/embedded/stack/wallet-api-eth-transaction.mjs +1 -1
  64. package/dist/esm/embedded/stack/wallet-api-eth-transaction.mjs.map +1 -1
  65. package/dist/esm/index.mjs +1 -1
  66. package/dist/esm/index.mjs.map +1 -1
  67. package/dist/esm/session/keys.mjs +2 -0
  68. package/dist/esm/session/keys.mjs.map +1 -0
  69. package/package.json +7 -7
@@ -1 +1 @@
1
- {"version":3,"file":"SiwsApi.js","sources":["../../../../src/client/auth/SiwsApi.ts"],"names":["unlink","address","this","_privyInternal","fetch","SiwsUnlink","body","res","refreshSession","user","identity_token","link","message","signature","walletClientType","connectorType","SiwsLink","login","mode","opts","SiwsAuthenticate","session","updateWithTokensResponse","sessionWithWallets","maybeCreateWalletOnLogin","_embedded","embedded","callbacks","setUser","fetchNonce","nonce","SiwsInit","constructor","privyInternal"],"mappings":"giBAQe,MAwBb,YAAMA,EACJC,QAAAA,UAOMC,KAAKC,eAAeC,MAAMC,EAAAA,WAAY,CAC1CC,KAAM,CAACL,QAAAA,KAGT,IAAMM,QAAYL,KAAKC,eAAeK,iBAEtC,MAAO,CAACC,KAAMF,EAAIE,KAAMC,eAAgBH,EAAIG,eAC9C,CAOA,UAAMC,EACJC,QAAAA,EACAC,UAAAA,EACAC,iBAAAA,EACAC,cAAAA,UAmBMb,KAAKC,eAAeC,MAAMY,EAAAA,SAAU,CACxCV,KAAM,CACJM,QAAAA,EACAC,UAAAA,EACAC,iBAAkBA,GAAoB,KACtCC,cAAeA,GAAiB,QAKpC,IAAMR,QAAYL,KAAKC,eAAeK,iBAEtC,MAAO,CAACC,KAAMF,EAAIE,KAAMC,eAAgBH,EAAIG,eAC9C,CAOA,WAAMO,EACJC,KAAAA,EACAN,QAAAA,EACAC,UAAAA,EACAC,iBAAAA,EACAC,cAAAA,EACAI,KAAAA,IAwBA,IAAMZ,QAAYL,KAAKC,eAAeC,MAAMgB,EAAAA,iBAAkB,CAC5Dd,KAAM,CACJO,UAAAA,EACAD,QAAAA,EACAE,iBAAkBA,GAAoB,KACtCC,cAAeA,GAAiB,KAChCG,KAAAA,WAIEhB,KAAKC,eAAekB,QAAQC,yBAAyBf,GAE3D,IAAMgB,QAA2BC,EAAAA,yBAAyBtB,KAAKuB,UAAWlB,EAAKY,GAAMO,UAIrF,OAFAxB,KAAKC,eAAewB,WAAWC,UAAUL,EAAmBd,MAErDc,CACT,CAOA,gBAAMM,EACJ5B,QAAAA,IAKA,IAAO6B,MAAAA,SAAe5B,KAAKC,eAAeC,MAAM2B,WAAU,CAACzB,KAAM,CAACL,QAAAA,KAElE,MAAO,CAAC6B,MAAAA,EACV,CA1IA,WAAAE,CAAmBC,EAA8BP,GAC/CxB,KAAKC,eAAiB8B,EACtB/B,KAAKuB,UAAYC,CACnB"}
1
+ {"version":3,"file":"SiwsApi.js","sources":["../../../../src/client/auth/SiwsApi.ts"],"names":["unlink","address","this","_privyInternal","fetch","SiwsUnlink","body","res","refreshSession","user","identity_token","link","message","signature","walletClientType","connectorType","SiwsLink","login","mode","opts","fetchForLogin","SiwsAuthenticate","session","updateWithTokensResponse","sessionWithWallets","maybeCreateWalletOnLogin","_embedded","embedded","callbacks","setUser","fetchNonce","nonce","SiwsInit","constructor","privyInternal"],"mappings":"giBAQe,MAwBb,YAAMA,EACJC,QAAAA,UAOMC,KAAKC,eAAeC,MAAMC,EAAAA,WAAY,CAC1CC,KAAM,CAACL,QAAAA,KAGT,IAAMM,QAAYL,KAAKC,eAAeK,iBAEtC,MAAO,CAACC,KAAMF,EAAIE,KAAMC,eAAgBH,EAAIG,eAC9C,CAOA,UAAMC,EACJC,QAAAA,EACAC,UAAAA,EACAC,iBAAAA,EACAC,cAAAA,UAmBMb,KAAKC,eAAeC,MAAMY,EAAAA,SAAU,CACxCV,KAAM,CACJM,QAAAA,EACAC,UAAAA,EACAC,iBAAkBA,GAAoB,KACtCC,cAAeA,GAAiB,QAKpC,IAAMR,QAAYL,KAAKC,eAAeK,iBAEtC,MAAO,CAACC,KAAMF,EAAIE,KAAMC,eAAgBH,EAAIG,eAC9C,CAOA,WAAMO,EACJC,KAAAA,EACAN,QAAAA,EACAC,UAAAA,EACAC,iBAAAA,EACAC,cAAAA,EACAI,KAAAA,IAwBA,IAAMZ,QAAYL,KAAKC,eAAeiB,cAAcC,EAAAA,iBAAkB,CACpEf,KAAM,CACJO,UAAAA,EACAD,QAAAA,EACAE,iBAAkBA,GAAoB,KACtCC,cAAeA,GAAiB,KAChCG,KAAAA,WAIEhB,KAAKC,eAAemB,QAAQC,yBAAyBhB,GAE3D,IAAMiB,QAA2BC,EAAAA,yBAAyBvB,KAAKwB,UAAWnB,EAAKY,GAAMQ,UAIrF,OAFAzB,KAAKC,eAAeyB,WAAWC,UAAUL,EAAmBf,MAErDe,CACT,CAOA,gBAAMM,EACJ7B,QAAAA,IAKA,IAAO8B,MAAAA,SAAe7B,KAAKC,eAAeC,MAAM4B,WAAU,CAAC1B,KAAM,CAACL,QAAAA,KAElE,MAAO,CAAC8B,MAAAA,EACV,CA1IA,WAAAE,CAAmBC,EAA8BP,GAC/CzB,KAAKC,eAAiB+B,EACtBhC,KAAKwB,UAAYC,CACnB"}
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("@privy-io/ethereum"),r=require("../../utils/encodings.js");function t(e){if("number"==typeof e||"bigint"==typeof e){return`0x${BigInt(e).toString(16)}`}if("string"==typeof e){if(r.isHexEncoded(e))return e;if(!/^\d+$/.test(e))throw Error(`Invalid quantity string: must be hex (0x…) or decimal: ${e}`);return r.bytesToHex(r.utf8ToBytes(e))}}exports.toWalletApiUnsignedEthTransaction=function(i){return e.isTempoTransactionRequest(i)?{type:e.TEMPO_TXN_TYPE_NUMBER,from:i.from,chain_id:t(i.chainId),nonce:t(i.nonce),nonce_key:t(i.nonceKey),gas_limit:t(i.gasLimit),max_fee_per_gas:t(i.maxFeePerGas),max_priority_fee_per_gas:t(i.maxPriorityFeePerGas),fee_token:i.feeToken,valid_after:t(i.validAfter),valid_before:t(i.validBefore),fee_payer_signature:function(e){if(!e)return;let r=void 0!==e.yParity?e.yParity:void 0!==e.v?Number(e.v)-27:void 0;if(0!==r&&1!==r)throw Error("Tempo fee payer signatures require a valid yParity value");return{r:e.r,s:e.s,y_parity:r}}(i.feePayerSignature),access_list:function(e){if(e)return Array.isArray(e)?e.map((e=>"address"in e?{address:e.address,storage_keys:[...e.storageKeys]}:{address:e[0],storage_keys:[...e[1]]})):Object.entries(e).map((([e,r])=>({address:e,storage_keys:[...r]})))}(i.accessList),calls:i.calls.map((e=>({to:e.to,data:e.data,value:t(e.value)})))}:{from:i.from,to:i.to??void 0,nonce:t(i.nonce),chain_id:t(i.chainId),data:function(e){if(void 0!==e)return"string"==typeof e?r.isHexEncoded(e)?e:r.bytesToHex(r.utf8ToBytes(e)):r.bytesToHex(Buffer.from(Uint8Array.from(e)))}(i.data),value:t(i.value),type:i.type,gas_limit:t(i.gasLimit),gas_price:t(i.gasPrice),max_fee_per_gas:t(i.maxFeePerGas),max_priority_fee_per_gas:t(i.maxPriorityFeePerGas)}};
1
+ "use strict";var e=require("@privy-io/ethereum"),r=require("../../utils/encodings.js");function i(e){if("number"==typeof e||"bigint"==typeof e){return`0x${BigInt(e).toString(16)}`}if("string"==typeof e){if(r.isHexEncoded(e))return e;throw Error(`Invalid quantity string: expected a hex-prefixed value (0x…), got "${e}". Use a number, bigint, or hex string instead.`)}}exports.toWalletApiUnsignedEthTransaction=function(a){return e.isTempoTransactionRequest(a)?{type:e.TEMPO_TXN_TYPE_NUMBER,from:a.from,chain_id:i(a.chainId),nonce:i(a.nonce),nonce_key:i(a.nonceKey),gas_limit:i(a.gasLimit),max_fee_per_gas:i(a.maxFeePerGas),max_priority_fee_per_gas:i(a.maxPriorityFeePerGas),fee_token:a.feeToken,valid_after:i(a.validAfter),valid_before:i(a.validBefore),fee_payer_signature:function(e){if(!e)return;let r=void 0!==e.yParity?e.yParity:void 0!==e.v?Number(e.v)-27:void 0;if(0!==r&&1!==r)throw Error("Tempo fee payer signatures require a valid yParity value");return{r:e.r,s:e.s,y_parity:r}}(a.feePayerSignature),access_list:function(e){if(e)return Array.isArray(e)?e.map((e=>"address"in e?{address:e.address,storage_keys:[...e.storageKeys]}:{address:e[0],storage_keys:[...e[1]]})):Object.entries(e).map((([e,r])=>({address:e,storage_keys:[...r]})))}(a.accessList),calls:a.calls.map((e=>({to:e.to,data:e.data,value:i(e.value)})))}:{from:a.from,to:a.to??void 0,nonce:i(a.nonce),chain_id:i(a.chainId),data:function(e){if(void 0!==e)return"string"==typeof e?r.isHexEncoded(e)?e:r.bytesToHex(r.utf8ToBytes(e)):r.bytesToHex(Buffer.from(Uint8Array.from(e)))}(a.data),value:i(a.value),type:a.type,gas_limit:i(a.gasLimit),gas_price:i(a.gasPrice),max_fee_per_gas:i(a.maxFeePerGas),max_priority_fee_per_gas:i(a.maxPriorityFeePerGas)}};
2
2
  //# sourceMappingURL=wallet-api-eth-transaction.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"wallet-api-eth-transaction.js","sources":["../../../../src/embedded/stack/wallet-api-eth-transaction.ts"],"names":["quantityToHex","val","BigInt","toString","isHexEncoded","test","Error","bytesToHex","utf8ToBytes","transaction","e","type","TEMPO_TXN_TYPE_NUMBER","from","chain_id","chainId","nonce","nonce_key","nonceKey","gas_limit","gasLimit","max_fee_per_gas","maxFeePerGas","max_priority_fee_per_gas","maxPriorityFeePerGas","fee_token","feeToken","valid_after","validAfter","valid_before","validBefore","fee_payer_signature","signature","yParity","v","Number","r","s","y_parity","feePayerSignature","access_list","toWalletApiAccessList","accessList","Array","isArray","map","entry","address","storage_keys","storageKeys","Object","entries","calls","call","to","data","value","undefined","encodeTransactionData","Buffer","Uint8Array","gas_price","gasPrice"],"mappings":"uFAqIA,SAASA,EAAcC,GACrB,GAAmB,iBAARA,GAAoB,iBAAOA,EAAkB,CAEtD,MAAO,KADOC,OAAOD,GACHE,SAAS,KAAK,CAGlC,GAAI,iBAAOF,EAAkB,CAC3B,GAAIG,EAAAA,aAAaH,GAAM,OAAOA,EAK9B,IAAK,QAAQI,KAAKJ,GAChB,MAA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CvB,CACL3C,KAAMJ,EAAYI,KAClByC,GAR4C7C,EAQ5B6C,SAAMG,EACtBzC,MAAOhB,EAAcS,EAAYO,OACjCF,SAAUd,EAAcS,EAAYM,SACpCwC,KAAMG,SAiFqBH,GAC7B,QAAoB,IAATA,EAAAA,MAIX,iBAAWA,EAEFnD,EAAAA,aAAamD,GAAQA,EAAOhD,EAAAA,WAAWC,EAAAA,YAAY+C,IAIrDhD,EAAAA,WAAWoD,OAAO9C,KAAK+C,WAAW/C,KAAK0C,IAChD,CA7FUG,CAXsCjD,EAWJ8C,MACxCC,MAAOxD,EAZqCS,EAYX+C,OACjC7C,KAAMF,EAAYE,KAClBQ,UAAWnB,EAdiCS,EAcPW,UACrCyC,UAAW7D,EAfiCS,EAePqD,UACrCzC,gBAAiBrB,EAhB2BS,EAgBDa,cAC3CC,yBAA0BvB,EAjBkBS,EAiBQe,sBAhBxD"}
1
+ {"version":3,"file":"wallet-api-eth-transaction.js","sources":["../../../../src/embedded/stack/wallet-api-eth-transaction.ts"],"names":["quantityToHex","val","BigInt","toString","isHexEncoded","Error","transaction","e","type","TEMPO_TXN_TYPE_NUMBER","from","chain_id","chainId","nonce","nonce_key","nonceKey","gas_limit","gasLimit","max_fee_per_gas","maxFeePerGas","max_priority_fee_per_gas","maxPriorityFeePerGas","fee_token","feeToken","valid_after","validAfter","valid_before","validBefore","fee_payer_signature","signature","yParity","v","Number","r","s","y_parity","feePayerSignature","access_list","toWalletApiAccessList","accessList","Array","isArray","map","entry","address","storage_keys","storageKeys","Object","entries","calls","call","to","data","value","undefined","encodeTransactionData","bytesToHex","utf8ToBytes","Buffer","Uint8Array","gas_price","gasPrice"],"mappings":"uFAqIA,SAASA,EAAcC,GACrB,GAAmB,iBAARA,GAAoB,iBAAOA,EAAkB,CAEtD,MAAO,KADOC,OAAOD,GACHE,SAAS,KAAK,CAGlC,GAAI,iBAAOF,EAAkB,CAC3B,GAAIG,eAAaH,GAAM,OAAOA,EAC9B,MAAUI,MACR,sEA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AMG,EACtBzC,MAAOb,EAAcM,EAAYO,OACjCF,SAAUX,EAAcM,EAAYM,SACpCwC,KAAMG,SAiFqBH,GAC7B,QAAoB,IAATA,EAAAA,MAIX,iBAAWA,EAEFhD,EAAAA,aAAagD,GAAQA,EAAOI,EAAAA,WAAWC,EAAAA,YAAYL,IAIrDI,EAAAA,WAAWE,OAAOhD,KAAKiD,WAAWjD,KAAK0C,IAChD,CA7FUG,CAAsBjD,EAAY8C,MACxCC,MAAOrD,EAAcM,EAAY+C,OACjC7C,KAAMF,EAAYE,KAClBQ,UAAWhB,EAdiCM,EAcPW,UACrC2C,UAAW5D,EAfiCM,EAePuD,UACrC3C,gBAAiBlB,EAAcM,EAAYa,cAC3CC,yBAA0BpB,EAAcM,EAAYe,sBAhBxD"}
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("./embedded/stack/wallet-api-eth-transaction.js"),q=require("./utils/phoneNumberUtils.js"),j=require("./utils/getUserEmbeddedSolanaWallet.js"),g=require("./utils/toObjectKeys.js"),A=require("./utils/getIsTokenUsdc.js"),x=require("./utils/generateWalletIdempotencyKey.js"),b=require("./funding/moonpay.js"),y=require("./funding/coinbase.js"),h=require("./solana/client.js"),E=require("./solana/createSiwsMessage.js"),C=require("./solana/getSolanaRpcEndpointForCluster.js"),S=require("./solana/getSolanaUsdcMintAddressForCluster.js"),f=require("./solana/getSolanaClusterDisplayName.js"),W=require("./solana/offchain-message.js"),P=require("./types.js"),v=require("@privy-io/chains"),M=require("./utils/formatters.js"),U=require("./wallet-api/generate-authorization-signature.js"),I=require("./wallet-api/create.js"),T=require("./wallet-api/rpc.js"),w=require("./wallet-api/raw-sign.js"),O=require("./wallet-api/get-wallet.js"),R=require("./wallet-api/update-wallet.js"),F=require("./wallet-api/unified-wallet.js"),N=require("./embedded/stack/session-signers.js"),k=require("./solana/ConnectedStandardSolanaWallet.js"),L=require("./utils/poll.js"),D=require("./index-DzfqDJJ9.js"),_=require("./index-BDWdfIuK.js"),B=require("./index--nYkyGeH.js"),K=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-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("viem/chains"),require("libphonenumber-js/examples.mobile.json"),require("@privy-io/encoding"),require("canonicalize"),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"),require("./action/depositAddress/generate.js"),require("./action/depositAddress/resolve-refund-address.js"),require("./action/depositAddress/polling.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.toWalletApiUnsignedEthTransaction=m.toWalletApiUnsignedEthTransaction,exports.countryCodesAndNumbers=q.countryCodesAndNumbers,exports.formatPhoneNumber=q.formatPhoneNumber,exports.getPhoneCountryCodeAndNumber=q.getPhoneCountryCodeAndNumber,exports.getPlaceholderPhoneNumber=q.getPlaceholderPhoneNumber,exports.lastFourDigits=q.lastFourDigits,exports.phoneNumberTypingFormatter=q.phoneNumberTypingFormatter,exports.validatePhoneNumber=q.validatePhoneNumber,exports.getUserEmbeddedSolanaWallet=j.getUserEmbeddedSolanaWallet,exports.toObjectKeys=g.toObjectKeys,exports.SolanaUsdcAddressMap=A.SolanaUsdcAddressMap,exports.UsdcAddressMap=A.UsdcAddressMap,exports.getIsTokenUsdc=A.getIsTokenUsdc,exports.generateWalletIdempotencyKey=x.generateWalletIdempotencyKey,exports.chainToMoonpayCurrency=b.chainToMoonpayCurrency,exports.fundingMethodToMoonpayPaymentMethod=b.fundingMethodToMoonpayPaymentMethod,exports.isSupportedChainIdForMoonpay=b.isSupportedChainIdForMoonpay,exports.getCoinbaseOnRampUrl=y.getCoinbaseOnRampUrl,exports.isSupportedChainIdForCoinbaseOnramp=y.isSupportedChainIdForCoinbaseOnramp,exports.toCoinbaseAssetId=y.toCoinbaseAssetId,exports.toCoinbaseBlockchainFromChainId=y.toCoinbaseBlockchainFromChainId,exports.SolanaClient=h.SolanaClient,exports.createSiwsMessage=E.createSiwsMessage,exports.getSolanaRpcEndpointForCluster=C.getSolanaRpcEndpointForCluster,exports.getSolanaUsdcMintAddressForCluster=S.getSolanaUsdcMintAddressForCluster,exports.getSolanaClusterDisplayName=f.getSolanaClusterDisplayName,exports.buildSolanaOffchainMessage=W.buildSolanaOffchainMessage,exports.deriveSolanaApplicationDomain=W.deriveSolanaApplicationDomain,exports.parseSolanaOffchainMessage=W.parseSolanaOffchainMessage,exports.ALL_WALLET_CLIENT_TYPES=P.ALL_WALLET_CLIENT_TYPES,exports.SUPPORTED_CONNECTOR_TYPES=P.SUPPORTED_CONNECTOR_TYPES,exports.formatLamportsAmount=M.formatLamportsAmount,exports.formatTokenAmount=M.formatTokenAmount,exports.formatWalletAddress=M.formatWalletAddress,exports.formatWeiAmount=M.formatWeiAmount,exports.generateAuthorizationSignature=U.generateAuthorizationSignature,exports.create=I.create,exports.rpc=T.rpc,exports.rawSign=w.rawSign,exports.getWallet=O.getWallet,exports.updateWallet=R.updateWallet,exports.isUnifiedWallet=F.isUnifiedWallet,exports.addSessionSigners=N.addSessionSigners,exports.removeSessionSigners=N.removeSessionSigners,exports.ConnectedStandardSolanaWallet=k.ConnectedStandardSolanaWallet,exports.poll=L.poll,exports.crossApp=D.index,exports.delegatedActions=_.index,exports.depositAddress=B.index,Object.defineProperty(exports,"getCountryCallingCode",{enumerable:!0,get:function(){return K.getCountryCallingCode}}),exports.BICONOMY="biconomy",exports.COINBASE_SMART_WALLET="coinbase_smart_wallet",exports.KERNEL="kernel",exports.LIGHT_ACCOUNT="light_account",exports.NEXUS="nexus",exports.SAFE="safe",exports.THIRDWEB="thirdweb",Object.keys(v).forEach((function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return v[e]}})}));
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("./embedded/stack/wallet-api-eth-transaction.js"),q=require("./utils/phoneNumberUtils.js"),j=require("./utils/getUserEmbeddedSolanaWallet.js"),g=require("./utils/toObjectKeys.js"),A=require("./utils/getIsTokenUsdc.js"),x=require("./utils/generateWalletIdempotencyKey.js"),b=require("./funding/moonpay.js"),y=require("./funding/coinbase.js"),h=require("./solana/client.js"),E=require("./solana/createSiwsMessage.js"),C=require("./solana/getSolanaRpcEndpointForCluster.js"),S=require("./solana/getSolanaUsdcMintAddressForCluster.js"),f=require("./solana/getSolanaClusterDisplayName.js"),W=require("./solana/offchain-message.js"),P=require("./types.js"),v=require("@privy-io/chains"),M=require("./utils/formatters.js"),U=require("./wallet-api/generate-authorization-signature.js"),I=require("./wallet-api/create.js"),T=require("./wallet-api/rpc.js"),w=require("./wallet-api/raw-sign.js"),O=require("./wallet-api/get-wallet.js"),R=require("./wallet-api/update-wallet.js"),F=require("./wallet-api/unified-wallet.js"),N=require("./embedded/stack/session-signers.js"),k=require("./solana/ConnectedStandardSolanaWallet.js"),L=require("./utils/poll.js"),D=require("./index-DzfqDJJ9.js"),_=require("./index-BDWdfIuK.js"),B=require("./index--nYkyGeH.js"),K=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-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("./session/keys.js"),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("viem/chains"),require("libphonenumber-js/examples.mobile.json"),require("@privy-io/encoding"),require("canonicalize"),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"),require("./action/depositAddress/generate.js"),require("./action/depositAddress/resolve-refund-address.js"),require("./action/depositAddress/polling.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.toWalletApiUnsignedEthTransaction=m.toWalletApiUnsignedEthTransaction,exports.countryCodesAndNumbers=q.countryCodesAndNumbers,exports.formatPhoneNumber=q.formatPhoneNumber,exports.getPhoneCountryCodeAndNumber=q.getPhoneCountryCodeAndNumber,exports.getPlaceholderPhoneNumber=q.getPlaceholderPhoneNumber,exports.lastFourDigits=q.lastFourDigits,exports.phoneNumberTypingFormatter=q.phoneNumberTypingFormatter,exports.validatePhoneNumber=q.validatePhoneNumber,exports.getUserEmbeddedSolanaWallet=j.getUserEmbeddedSolanaWallet,exports.toObjectKeys=g.toObjectKeys,exports.SolanaUsdcAddressMap=A.SolanaUsdcAddressMap,exports.UsdcAddressMap=A.UsdcAddressMap,exports.getIsTokenUsdc=A.getIsTokenUsdc,exports.generateWalletIdempotencyKey=x.generateWalletIdempotencyKey,exports.chainToMoonpayCurrency=b.chainToMoonpayCurrency,exports.fundingMethodToMoonpayPaymentMethod=b.fundingMethodToMoonpayPaymentMethod,exports.isSupportedChainIdForMoonpay=b.isSupportedChainIdForMoonpay,exports.getCoinbaseOnRampUrl=y.getCoinbaseOnRampUrl,exports.isSupportedChainIdForCoinbaseOnramp=y.isSupportedChainIdForCoinbaseOnramp,exports.toCoinbaseAssetId=y.toCoinbaseAssetId,exports.toCoinbaseBlockchainFromChainId=y.toCoinbaseBlockchainFromChainId,exports.SolanaClient=h.SolanaClient,exports.createSiwsMessage=E.createSiwsMessage,exports.getSolanaRpcEndpointForCluster=C.getSolanaRpcEndpointForCluster,exports.getSolanaUsdcMintAddressForCluster=S.getSolanaUsdcMintAddressForCluster,exports.getSolanaClusterDisplayName=f.getSolanaClusterDisplayName,exports.buildSolanaOffchainMessage=W.buildSolanaOffchainMessage,exports.deriveSolanaApplicationDomain=W.deriveSolanaApplicationDomain,exports.parseSolanaOffchainMessage=W.parseSolanaOffchainMessage,exports.ALL_WALLET_CLIENT_TYPES=P.ALL_WALLET_CLIENT_TYPES,exports.SUPPORTED_CONNECTOR_TYPES=P.SUPPORTED_CONNECTOR_TYPES,exports.formatLamportsAmount=M.formatLamportsAmount,exports.formatTokenAmount=M.formatTokenAmount,exports.formatWalletAddress=M.formatWalletAddress,exports.formatWeiAmount=M.formatWeiAmount,exports.generateAuthorizationSignature=U.generateAuthorizationSignature,exports.create=I.create,exports.rpc=T.rpc,exports.rawSign=w.rawSign,exports.getWallet=O.getWallet,exports.updateWallet=R.updateWallet,exports.isUnifiedWallet=F.isUnifiedWallet,exports.addSessionSigners=N.addSessionSigners,exports.removeSessionSigners=N.removeSessionSigners,exports.ConnectedStandardSolanaWallet=k.ConnectedStandardSolanaWallet,exports.poll=L.poll,exports.crossApp=D.index,exports.delegatedActions=_.index,exports.depositAddress=B.index,Object.defineProperty(exports,"getCountryCallingCode",{enumerable:!0,get:function(){return K.getCountryCallingCode}}),exports.BICONOMY="biconomy",exports.COINBASE_SMART_WALLET="coinbase_smart_wallet",exports.KERNEL="kernel",exports.LIGHT_ACCOUNT="light_account",exports.NEXUS="nexus",exports.SAFE="safe",exports.THIRDWEB="thirdweb",Object.keys(v).forEach((function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return v[e]}})}));
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/index.ts"],"names":[],"mappings":"8jTAewB,yCAEa,uCAEf,+BAEO,8BAMR,qBAJD,wBAEI"}
1
+ {"version":3,"file":"index.js","sources":["../../src/index.ts"],"names":[],"mappings":"2lTAewB,yCAEa,uCAEf,+BAEO,8BAMR,qBAJD,wBAEI"}
@@ -0,0 +1,2 @@
1
+ "use strict";exports.ACTIVE_USER_STORAGE_KEY="privy:active-user",exports.SAVED_USERS_STORAGE_KEY="privy:saved-users",exports.toCustomerAccessTokenCookieKey=e=>e?`privy-${e}-token`:"privy-token",exports.toCustomerAccessTokenStorageKey=e=>e?`privy:${e}:token`:"privy:token",exports.toIdentityTokenCookieKey=e=>e?`privy-${e}-id-token`:"privy-id-token",exports.toIdentityTokenStorageKey=e=>e?`privy:${e}:id-token`:"privy:id-token",exports.toPrivyAccessTokenStorageKey=e=>e?`privy:${e}:pat`:"privy:pat",exports.toRefreshTokenCookieKey=e=>e?`privy-${e}-refresh-token`:"privy-refresh-token",exports.toRefreshTokenStorageKey=e=>e?`privy:${e}:refresh_token`:"privy:refresh_token",exports.toSessionCookieKey=e=>e?`privy-${e}-session`:"privy-session";
2
+ //# sourceMappingURL=keys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keys.js","sources":["../../../src/session/keys.ts"],"names":["userId","e"],"mappings":"6CAAuC,oDACA,2DAmBQA,GAC7CA,EAAS,SAASA,UAF4B,sDAfDC,GAC7CD,EAAS,SAASA,UAF6B,+CAyBTC,GACtCD,EAAS,SAASA,aAFqB,mDAXCA,GACxCA,EAAS,SAASA,aAFsB,sDAPGA,GAC3CA,EAAS,SAASA,QAF0B,4CAiBPC,GACrCD,EAAS,SAASA,kBAFoB,uDAXAC,GACtCD,EAAS,SAASA,kBAFqB,iDAqBNA,GACjCA,EAAS,SAASA,YAFc"}
@@ -1104,6 +1104,8 @@ declare class MfaPromises extends EventEmitter<{
1104
1104
  }
1105
1105
 
1106
1106
  declare class UserApi {
1107
+ private readonly _embedded;
1108
+ private readonly _isMultiUserModeEnabled;
1107
1109
  /**
1108
1110
  * Get the logged in user.
1109
1111
  */
@@ -1113,6 +1115,16 @@ declare class UserApi {
1113
1115
  acceptTerms(): Promise<{
1114
1116
  user: _privy_io_api_types.User;
1115
1117
  }>;
1118
+ /**
1119
+ * @experimental
1120
+ *
1121
+ * Switches the active user to a saved local session and refreshes that user.
1122
+ */
1123
+ switchActiveUser(o: {
1124
+ userId: string;
1125
+ }): Promise<{
1126
+ user: _privy_io_api_types.User;
1127
+ }>;
1116
1128
  }
1117
1129
 
1118
1130
  type CreateOnLogin = 'off' | 'users-without-wallets' | 'all-users';
@@ -1951,6 +1963,23 @@ type PrivyOptions = {
1951
1963
  */
1952
1964
  supportedChains?: NonEmptyArray<Chain>;
1953
1965
  logger?: Logger;
1966
+ /**
1967
+ * @experimental
1968
+ *
1969
+ * Session management configuration.
1970
+ */
1971
+ sessions?: {
1972
+ /**
1973
+ * @experimental
1974
+ *
1975
+ * Controls whether the SDK supports multiple authenticated users on the same device.
1976
+ * `'single-user'` - default behavior, one authenticated user at a time.
1977
+ * `'multi-user'` - enables switching between saved users without re-authenticating.
1978
+ *
1979
+ * @default 'single-user'
1980
+ */
1981
+ mode?: 'single-user' | 'multi-user';
1982
+ };
1954
1983
  };
1955
1984
  /**
1956
1985
  * Privy API Client SDK
@@ -1996,8 +2025,14 @@ declare class Privy {
1996
2025
  * APIs for Cross App Connections
1997
2026
  */
1998
2027
  readonly crossApp: CrossAppApi;
2028
+ /**
2029
+ * @experimental
2030
+ *
2031
+ * Whether multi-user session mode is enabled.
2032
+ */
2033
+ readonly isMultiUserModeEnabled: boolean;
1999
2034
  /** Create a new `Privy` Client */
2000
- constructor({ clientId, ...o }: PrivyOptions);
2035
+ constructor({ clientId, sessions, ...o }: PrivyOptions);
2001
2036
  /**
2002
2037
  * Initialize the SDK
2003
2038
  *
@@ -1104,6 +1104,8 @@ declare class MfaPromises extends EventEmitter<{
1104
1104
  }
1105
1105
 
1106
1106
  declare class UserApi {
1107
+ private readonly _embedded;
1108
+ private readonly _isMultiUserModeEnabled;
1107
1109
  /**
1108
1110
  * Get the logged in user.
1109
1111
  */
@@ -1113,6 +1115,16 @@ declare class UserApi {
1113
1115
  acceptTerms(): Promise<{
1114
1116
  user: _privy_io_api_types.User;
1115
1117
  }>;
1118
+ /**
1119
+ * @experimental
1120
+ *
1121
+ * Switches the active user to a saved local session and refreshes that user.
1122
+ */
1123
+ switchActiveUser(o: {
1124
+ userId: string;
1125
+ }): Promise<{
1126
+ user: _privy_io_api_types.User;
1127
+ }>;
1116
1128
  }
1117
1129
 
1118
1130
  type CreateOnLogin = 'off' | 'users-without-wallets' | 'all-users';
@@ -1951,6 +1963,23 @@ type PrivyOptions = {
1951
1963
  */
1952
1964
  supportedChains?: NonEmptyArray<Chain>;
1953
1965
  logger?: Logger;
1966
+ /**
1967
+ * @experimental
1968
+ *
1969
+ * Session management configuration.
1970
+ */
1971
+ sessions?: {
1972
+ /**
1973
+ * @experimental
1974
+ *
1975
+ * Controls whether the SDK supports multiple authenticated users on the same device.
1976
+ * `'single-user'` - default behavior, one authenticated user at a time.
1977
+ * `'multi-user'` - enables switching between saved users without re-authenticating.
1978
+ *
1979
+ * @default 'single-user'
1980
+ */
1981
+ mode?: 'single-user' | 'multi-user';
1982
+ };
1954
1983
  };
1955
1984
  /**
1956
1985
  * Privy API Client SDK
@@ -1996,8 +2025,14 @@ declare class Privy {
1996
2025
  * APIs for Cross App Connections
1997
2026
  */
1998
2027
  readonly crossApp: CrossAppApi;
2028
+ /**
2029
+ * @experimental
2030
+ *
2031
+ * Whether multi-user session mode is enabled.
2032
+ */
2033
+ readonly isMultiUserModeEnabled: boolean;
1999
2034
  /** Create a new `Privy` Client */
2000
- constructor({ clientId, ...o }: PrivyOptions);
2035
+ constructor({ clientId, sessions, ...o }: PrivyOptions);
2001
2036
  /**
2002
2037
  * Initialize the SDK
2003
2038
  *
@@ -1,2 +1,2 @@
1
- import e from"eventemitter3";import{base64url as t}from"jose";import s from"js-cookie";import{Token as r}from"./Token.mjs";import{allSettled as i}from"./utils/allSettled.mjs";let o="privy:token",n="privy-token",a="privy:pat",_="privy:refresh_token",h="privy-refresh-token",g="privy:id-token",l="privy-id-token",c="privy-session";class k extends e{set isUsingServerCookies(e){this._isUsingServerCookies=e}async getCustomerAccessToken(){let e=await this._storage.get(o);try{return"string"==typeof e?new r(e).value:null}catch(e){return console.error(e),await this.destroyLocalState({reason:"getToken_error"}),null}}async getPrivyAccessToken(){let e=await this._storage.get(a);try{return"string"==typeof e?new r(e).value:null}catch(e){return console.error(e),await this.destroyLocalState({reason:"getToken_error"}),null}}async getRefreshToken(){let e=await this._storage.get(_);return"string"==typeof e?e:null}async getIdentityToken(){let e=await this._storage.get(g);return"string"==typeof e?e:null}get mightHaveServerCookies(){try{let e=s.get(c);return void 0!==e&&e.length>0}catch(e){console.error(e)}return!1}hasRefreshCredentials(e,t){return this.mightHaveServerCookies||"string"==typeof e&&"string"==typeof t}tokenIsActive(e){if(!e)return!1;let t=r.parse(e);return null!==t&&!t.isExpired(30)}async destroyLocalState(e){await i([this._storage.del(o),this._storage.del(a),this._storage.del(_),this._storage.del(g),this._storage.del(this.GUEST_CREDENTIAL_STORAGE_KEY)]),s.remove(n),s.remove(h),s.remove(l),s.remove(c),e?.reason&&this.emit("storage_cleared",{reason:e.reason})}async storeCustomerAccessToken(e){if("string"==typeof e){let t=await this._storage.get(o);if(await this._storage.put(o,e),!this._isUsingServerCookies){let t=r.parse(e)?.expiration;s.set(n,e,{sameSite:"Strict",secure:!0,expires:t?new Date(1e3*t):void 0})}t!==e&&this.emit("token_stored",{cookiesEnabled:this._isUsingServerCookies})}else{let e=await this._storage.get(o);await this._storage.del(o),s.remove(n),null!==e&&this.emit("token_cleared",{reason:"set_with_non_string_value"})}}async storePrivyAccessToken(e){"string"==typeof e?await this._storage.put(a,e):await this._storage.del(a)}async storeRefreshToken(e){"string"==typeof e?(await this._storage.put(_,e),this._isUsingServerCookies||(s.set(c,"t",{sameSite:"Strict",secure:!0,expires:30}),s.set(h,e,{sameSite:"Strict",secure:!0,expires:30})),this.emit("refresh_token_stored",{cookiesEnabled:this._isUsingServerCookies})):(await this._storage.del(_),s.remove(h),s.remove(c),this.emit("refresh_token_cleared",{reason:"set_with_non_string_value"}))}async updateWithTokensResponse(e){let t=(await i([this.storeCustomerAccessToken(e.token),this.storePrivyAccessToken(e.privy_access_token),this.storeRefreshToken(e.refresh_token),this.storeIdentityToken(e.identity_token),this.processOAuthTokens(e.oauth_tokens)])).filter((e=>"rejected"===e.status));t.length>0&&this.emit("error_storing_tokens",t.map((e=>String(e.reason))).join(", "))}async processOAuthTokens(e){e&&this.emit("oauth_tokens_granted",e)}async storeIdentityToken(e){if("string"==typeof e){let t=await this._storage.get(g);if(await this._storage.put(g,e),!this._isUsingServerCookies){let t=r.parse(e)?.expiration;s.set(l,e,{sameSite:"Strict",secure:!0,expires:t?new Date(1e3*t):void 0})}t!==e&&this.emit("identity_token_stored",{cookiesEnabled:this._isUsingServerCookies})}else{let e=await this._storage.get(g);await this._storage.del(g),s.remove(l),null!==e&&this.emit("identity_token_cleared",{reason:"set_with_non_string_value"})}}async getOrCreateGuestCredential(){let e=await this._storage.get(this.GUEST_CREDENTIAL_STORAGE_KEY);if(e&&"string"==typeof e)return e;let s=t.encode(crypto.getRandomValues(new Uint8Array(32)));return await this._storage.put(this.GUEST_CREDENTIAL_STORAGE_KEY,s),s}constructor(e){super(),this._isUsingServerCookies=!1,this._storage=e.storage,this.GUEST_CREDENTIAL_STORAGE_KEY=`privy:guest:${e.appId}`}}k.events=["storage_cleared","token_cleared","refresh_token_cleared","identity_token_cleared","token_stored","refresh_token_stored","identity_token_stored","oauth_tokens_granted","error_storing_tokens"];export{k as Session};
1
+ import e from"eventemitter3";import{base64url as t}from"jose";import s from"js-cookie";import{PrivyClientError as r}from"./Error.mjs";import{Token as i}from"./Token.mjs";import{toCustomerAccessTokenStorageKey as o,toPrivyAccessTokenStorageKey as a,toRefreshTokenStorageKey as n,toIdentityTokenStorageKey as l,toSessionCookieKey as h,ACTIVE_USER_STORAGE_KEY as g,toCustomerAccessTokenCookieKey as c,toRefreshTokenCookieKey as d,toIdentityTokenCookieKey as _,SAVED_USERS_STORAGE_KEY as u}from"./session/keys.mjs";import{allSettled as v}from"./utils/allSettled.mjs";let y="did:privy:";class k extends e{set isUsingServerCookies(e){this._isUsingServerCookies=e}setStoredUsersCallback(e){this._setStoredUsers=e,this.getSavedUserIds().then((e=>{this._hasEmittedStoredUsers||this._setStoredUsers?.({users:e.map((e=>({id:e})))})}))}async getCustomerAccessToken(){let e=await this.getActiveUserId(),t=await this._storage.get(o(e));try{return"string"==typeof t?new i(t).value:null}catch(e){return console.error(e),await this.destroyLocalState({reason:"getToken_error"}),null}}async getPrivyAccessToken(){let e=await this.getActiveUserId(),t=await this._storage.get(a(e));try{return"string"==typeof t?new i(t).value:null}catch(e){return console.error(e),await this.destroyLocalState({reason:"getToken_error"}),null}}async getRefreshToken(){let e=await this.getActiveUserId(),t=await this._storage.get(n(e));return"string"==typeof t?t:null}async getIdentityToken(){let e=await this.getActiveUserId(),t=await this._storage.get(l(e));return"string"==typeof t?t:null}async mightHaveServerCookies(){try{let e=await this.getActiveUserId(),t=s.get(h(e));if(void 0!==t&&t.length>0)return!0;let r=s.get(h(null));return void 0!==r&&r.length>0}catch(e){console.error(e)}return!1}async hasRefreshCredentials(e,t){return await this.mightHaveServerCookies()||"string"==typeof e&&"string"==typeof t}tokenIsActive(e){if(!e)return!1;let t=i.parse(e);return null!==t&&!t.isExpired(30)}async destroyLocalState(e){let t=await this.getActiveUserId(),r=[this._storage.del(o(null)),this._storage.del(a(null)),this._storage.del(n(null)),this._storage.del(l(null)),this._storage.del(this.GUEST_CREDENTIAL_STORAGE_KEY),this._storage.del(g)];t&&r.push(this._storage.del(o(t)),this._storage.del(a(t)),this._storage.del(n(t)),this._storage.del(l(t)),this.removeSavedUserId(t)),await v(r),s.remove(c(null)),s.remove(d(null)),s.remove(_(null)),s.remove(h(null)),t&&(s.remove(c(t)),s.remove(d(t)),s.remove(_(t)),s.remove(h(t))),e?.reason&&this.emit("storage_cleared",{reason:e.reason})}async storeCustomerAccessToken(e){let t=await this.getActiveUserId();await this.storeCustomerAccessTokenForUser(t,e)}async storeCustomerAccessTokenForUser(e,t){let r=o(e),a=c(e);if("string"==typeof t){let e=await this._storage.get(r);if(await this._storage.put(r,t),!this._isUsingServerCookies){let e=i.parse(t)?.expiration;s.set(a,t,{sameSite:"Strict",secure:!0,expires:e?new Date(1e3*e):void 0})}e!==t&&this.emit("token_stored",{cookiesEnabled:this._isUsingServerCookies})}else{let e=await this._storage.get(r);await this._storage.del(r),s.remove(a),null!==e&&this.emit("token_cleared",{reason:"set_with_non_string_value"})}}async storePrivyAccessToken(e){let t=await this.getActiveUserId();await this.storePrivyAccessTokenForUser(t,e)}async storePrivyAccessTokenForUser(e,t){let s=a(e);"string"==typeof t?await this._storage.put(s,t):await this._storage.del(s)}async storeRefreshTokenForUser(e,t){let r=n(e),i=d(e),o=h(e);"string"==typeof t?(await this._storage.put(r,t),this._isUsingServerCookies||(s.set(o,"t",{sameSite:"Strict",secure:!0,expires:30}),s.set(i,t,{sameSite:"Strict",secure:!0,expires:30})),this.emit("refresh_token_stored",{cookiesEnabled:this._isUsingServerCookies})):(await this._storage.del(r),s.remove(i),s.remove(o),this.emit("refresh_token_cleared",{reason:"set_with_non_string_value"}))}async updateWithTokensResponse(e){let t=e.user.id,s=(await v([this.storeCustomerAccessTokenForUser(t,e.token),this.storePrivyAccessTokenForUser(t,e.privy_access_token),this.storeRefreshTokenForUser(t,e.refresh_token),this.storeIdentityTokenForUser(t,e.identity_token)])).filter((e=>"rejected"===e.status));if(s.length>0)return void this.emit("error_storing_tokens",s.map((e=>String(e.reason))).join(", "));let r=(await v([this.storeCustomerAccessTokenForUser(null,e.token),this.storePrivyAccessTokenForUser(null,e.privy_access_token),this.storeRefreshTokenForUser(null,e.refresh_token),this.storeIdentityTokenForUser(null,e.identity_token)])).filter((e=>"rejected"===e.status));if(r.length>0)return void this.emit("error_storing_tokens",r.map((e=>String(e.reason))).join(", "));await this.storeActiveUserId(t);let i=(await v([this.processOAuthTokens(e.oauth_tokens)])).filter((e=>"rejected"===e.status));i.length>0&&this.emit("error_storing_tokens",i.map((e=>String(e.reason))).join(", "))}async backfillLegacySession(){if(await this.getActiveUserId())return;let[e,t,s,r]=await Promise.all([this._storage.get(o(null)),this._storage.get(a(null)),this._storage.get(n(null)),this._storage.get(l(null))]);if("string"!=typeof e||"string"!=typeof s)return;let h=(e=>e?.startsWith(y)?e.slice(10):e)(i.parse(e)?.subject);if("string"!=typeof h||0===h.length)return;let g=[this.storeCustomerAccessTokenForUser(h,e),this.storeRefreshTokenForUser(h,s)];"string"==typeof t&&g.push(this.storePrivyAccessTokenForUser(h,t)),"string"==typeof r&&g.push(this.storeIdentityTokenForUser(h,r));let c=(await v(g)).filter((e=>"rejected"===e.status));c.length>0?this.emit("error_storing_tokens",c.map((e=>String(e.reason))).join(", ")):await this.storeActiveUserId(h)}async processOAuthTokens(e){e&&this.emit("oauth_tokens_granted",e)}async storeIdentityToken(e){let t=await this.getActiveUserId();await this.storeIdentityTokenForUser(t,e)}async storeIdentityTokenForUser(e,t){let r=l(e),o=_(e);if("string"==typeof t){let e=await this._storage.get(r);if(await this._storage.put(r,t),!this._isUsingServerCookies){let e=i.parse(t)?.expiration;s.set(o,t,{sameSite:"Strict",secure:!0,expires:e?new Date(1e3*e):void 0})}e!==t&&this.emit("identity_token_stored",{cookiesEnabled:this._isUsingServerCookies})}else{let e=await this._storage.get(r);await this._storage.del(r),s.remove(o),null!==e&&this.emit("identity_token_cleared",{reason:"set_with_non_string_value"})}}async getOrCreateGuestCredential(){let e=await this._storage.get(this.GUEST_CREDENTIAL_STORAGE_KEY);if(e&&"string"==typeof e)return e;let s=t.encode(crypto.getRandomValues(new Uint8Array(32)));return await this._storage.put(this.GUEST_CREDENTIAL_STORAGE_KEY,s),s}async getActiveUserId(){let e=await this._storage.get(g);return"string"==typeof e?e:null}async storeActiveUserId(e){let t=await this.getSavedUserIds();await this.storeSavedUserIds([...t,e]),await this._storage.put(g,e)}async getSavedUserIds(){let e=await this._storage.get(u);if("string"!=typeof e)return[];try{let t=JSON.parse(e),s=Array.isArray(t)?t.filter((e=>"string"==typeof e)):[];return[...new Set(s)]}catch{return[]}}async storeSavedUserIds(e){let t=[...new Set(e)];t.length>0?await this._storage.put(u,JSON.stringify(t)):await this._storage.del(u),this._setStoredUsers&&(this._hasEmittedStoredUsers=!0,this._setStoredUsers({users:t.map((e=>({id:e})))}))}async removeSavedUserId(e){let t=await this.getSavedUserIds();await this.storeSavedUserIds(t.filter((t=>t!==e)))}async switchActiveUserId(e){if(!(await this.getSavedUserIds()).includes(e))throw new r({code:"invalid_input",error:"Cannot switch active user because the user ID is not saved on this device"});await this._storage.put(g,e)}constructor(e){super(),this._isUsingServerCookies=!1,this._hasEmittedStoredUsers=!1,this._storage=e.storage,this.GUEST_CREDENTIAL_STORAGE_KEY=`privy:guest:${e.appId}`,this._setStoredUsers=e.setStoredUsers}}k.events=["storage_cleared","token_cleared","refresh_token_cleared","identity_token_cleared","token_stored","refresh_token_stored","identity_token_stored","oauth_tokens_granted","error_storing_tokens"];export{k as Session};
2
2
  //# sourceMappingURL=Session.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Session.mjs","sources":["../../src/Session.ts"],"names":["TOKEN_STORAGE_KEY","TOKEN_COOKIE_KEY","PRIVY_ACCESS_TOKEN_STORAGE_KEY","REFRESH_TOKEN_STORAGE_KEY","REFRESH_TOKEN_COOKIE_KEY","IDENTITY_TOKEN_STORAGE_KEY","IDENTITY_TOKEN_COOKIE_KEY","SESSION_COOKIE_KEY","Session","EventEmitter","isUsingServerCookies","this","_isUsingServerCookies","getCustomerAccessToken","token","_storage","get","Token","value","error","console","destroyLocalState","reason","getPrivyAccessToken","getRefreshToken","refreshToken","getIdentityToken","identityToken","mightHaveServerCookies","sessionToken","Cookies","undefined","length","hasRefreshCredentials","tokenIsActive","tokenRaw","parse","isExpired","opts","allSettled","del","GUEST_CREDENTIAL_STORAGE_KEY","remove","emit","storeCustomerAccessToken","previousToken","put","exp","expiration","set","sameSite","secure","expires","Date","cookiesEnabled","storePrivyAccessToken","storeRefreshToken","updateWithTokensResponse","user","errors","privy_access_token","refresh_token","storeIdentityToken","identity_token","processOAuthTokens","oauth_tokens","filter","x","status","map","String","join","oAuthTokens","previousIdentityToken","getOrCreateGuestCredential","guestCredential","entropy","base64url","encode","crypto","getRandomValues","Uint8Array","constructor","o","super","storage","appId","events"],"mappings":"+KAWA,IAAMA,EAAoB,cACpBC,EAAmB,cAGnBC,EAAiC,YAGjCC,EAA4B,sBAC5BC,EAA2B,sBAG3BC,EAA6B,iBAC7BC,EAA4B,iBAG5BC,EAAqB,gBA2DpB,MAAMC,UAAgBC,EAgB3B,wBAAIC,CAAqBA,GACvBC,KAAKC,sBAAwBF,CAC/B,CAEA,4BAAMG,GACJ,IAAMC,QAAcH,KAAKI,SAASC,IAAIhB,GAEtC,IACE,MAAqB,iBAAVc,EAEF,IAAIG,EAAMH,GAAOI,MAEjB,IAEX,CA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BmC,GACpDA,CACT,CAnRAM,WAAAA,CAAYC,GACVC,QANYzE,KACNC,uBAAwB,EAM9BD,KAAKI,SAAWoE,EAAEE,QAClB1E,KAAK8B,6BAA+B,eAAe0C,EAAEG,OACvD,EAdW9E,EACJ+E,OAhCM,CACb,kBACA,gBACA,wBACA,yBACA,eACA,uBACA,wBACA,uBACA"}
1
+ {"version":3,"file":"Session.mjs","sources":["../../src/Session.ts"],"names":["PRIVY_DID_PREFIX","Session","EventEmitter","isUsingServerCookies","this","_isUsingServerCookies","setStoredUsersCallback","cb","_setStoredUsers","getSavedUserIds","then","e","_hasEmittedStoredUsers","users","ids","map","id","getCustomerAccessToken","userId","getActiveUserId","token","_storage","get","toCustomerAccessTokenStorageKey","Token","value","error","console","destroyLocalState","reason","getPrivyAccessToken","toPrivyAccessTokenStorageKey","getRefreshToken","refreshToken","toRefreshTokenStorageKey","getIdentityToken","identityToken","toIdentityTokenStorageKey","mightHaveServerCookies","sessionToken","Cookies","toSessionCookieKey","length","legacySessionToken","hasRefreshCredentials","tokenIsActive","tokenRaw","parse","isExpired","opts","deletes","del","GUEST_CREDENTIAL_STORAGE_KEY","ACTIVE_USER_STORAGE_KEY","push","removeSavedUserId","allSettled","remove","toCustomerAccessTokenCookieKey","toRefreshTokenCookieKey","toIdentityTokenCookieKey","emit","storeCustomerAccessToken","storeCustomerAccessTokenForUser","storageKey","cookieKey","previousToken","put","exp","expiration","set","sameSite","secure","expires","Date","undefined","cookiesEnabled","storePrivyAccessToken","storePrivyAccessTokenForUser","key","storeRefreshTokenForUser","refreshCookieKey","sessionCookieKey","updateWithTokensResponse","user","primaryErrors","privy_access_token","refresh_token","storeIdentityTokenForUser","identity_token","filter","x","status","String","join","legacyErrors","storeActiveUserId","oauthErrors","processOAuthTokens","oauth_tokens","backfillLegacySession","privyAccessToken","Promise","all","startsWith","slice","toStoredUserId","subject","writes","errors","oAuthTokens","storeIdentityToken","previousIdentityToken","getOrCreateGuestCredential","guestCredential","entropy","base64url","encode","crypto","getRandomValues","Uint8Array","storeSavedUserIds","savedUsers","SAVED_USERS_STORAGE_KEY","parsed","JSON","Array","isArray","Set","uniqueIds","stringify","t","savedId","switchActiveUserId","includes","PrivyClientError","code","constructor","o","super","storage","appId","setStoredUsers","events"],"mappings":"mjBAkDA,IAAMA,EAAmB,aAqClB,MAAMC,UAAgBC,EA+B3B,wBAAIC,CAAqBA,GACvBC,KAAKC,sBAAwBF,CAC/B,CAEA,sBAAAG,CAA8BC,GAC5BH,KAAKI,gBAAkBD,EAClBH,KAAKK,kBAAkBC,MAAKC,IAC1BP,KAAKQ,wBACRR,KAAKI,kBAAkB,CAACK,MAAOC,EAAIC,KAAKC,KAASA,GAAAA,UAGvD,CAEA,4BAAMC,GACJ,IAAMC,QAAed,KAAKe,kBACpBC,QAAchB,KAAKiB,SAASC,IAAIC,EAAgCL,IAEtE,IACE,MAAI,iBAAOE,EAEF,IAAII,EAAMJ,GAAOK,MAEjB,IAEX,CAAE,MAAOC,GAGP,OAFAC,QAAQD,MAAMA,SACRtB,KAAKwB,kBAAkB,CAACC,OAAQ,mBAC/B,IACT,CACF,CAEA,yBAAMC,GACJ,IAAMZ,QAAed,KAAKe,kBACpBC,QAAchB,KAAKiB,SAASC,IAAIS,EAA6Bb,IAEnE,IACE,MAAI,iBAAOE,EAEF,IAAII,EAAMJ,GAAOK,MAEjB,IAEX,CAAE,MAAOC,GAGP,OAFAC,QAAQD,MAAMA,SACRtB,KAAKwB,kBAAkB,CAACC,OAAQ,mBAC/B,IACT,CACF,CAEA,qBAAMG,GACJ,IAAMd,QAAed,KAAKe,kBACpBc,QAAqB7B,KAAKiB,SAASC,IAAIY,EAAyBhB,UAC1C,iBAAjBe,EACFA,EAGF,IACT,CAEA,sBAAME,GACJ,IAAMjB,QAAed,KAAKe,kBACpBiB,QAAsBhC,KAAKiB,SAASC,IAAIe,EAA0BnB,IACxE,MAAO,iBAAOkB,EAA6BA,EAAgB,IAC7D,CAIA,4BAAME,GACJ,IACE,IA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-1,2 +1,2 @@
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"viem/chains";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};
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 s from"./EmbeddedWalletApi.mjs";import m 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"viem/chains";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"../session/keys.mjs";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,sessions:u,...j}){let y=e(j.crypto);this.isMultiUserModeEnabled="multi-user"===u?.mode,this._privyInternal=new o({...j,appClientId:h,crypto:y,isMultiUserModeEnabled:this.isMultiUserModeEnabled}),this.mfa=new n(this._privyInternal),this.mfaPromises=new m,this.app=new t(this._privyInternal),this.embeddedWallet=new s(this._privyInternal,j.embeddedWalletMessagePoster,j.supportedChains,this.mfa,this.mfaPromises,this.app),this.user=new a(this._privyInternal,this.embeddedWallet,"multi-user"===u?.mode),this.auth=new p(this._privyInternal,this.embeddedWallet,j.storage,y,this.mfa),this.recovery=new d(this._privyInternal,j.storage,y),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","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":"kyFAiFe,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
+ {"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","sessions","o","crypto","resolveCryptoFns","isMultiUserModeEnabled","mode","PrivyInternal","appClientId","mfa","MfaApi","mfaPromises","MfaPromises","app","AppApi","EmbeddedWalletApi","embeddedWalletMessagePoster","supportedChains","user","UserApi","auth","AuthApi","storage","recovery","RecoveryApi","funding","FundingApi","delegated","Delegat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AK4C,KAAO,IAAIC,EAAQ7C,KAAKC,eAAgBD,KAAKK,eAAgBqB,EAAEoB,QAASnB,EAAQ3B,KAAKiC,KAC1FjC,KAAK+C,SAAW,IAAIC,EAAYhD,KAAKC,eAAgByB,EAAEoB,QAASnB,GAChE3B,KAAKiD,QAAU,IAAIC,EAAWlD,KAAKC,gBACnCD,KAAKmD,UAAY,IAAIC,EAAoBpD,KAAKC,gBAC9CD,KAAKqD,SAAW,IAAIC,EAAYtD,KAAKC,eAAgByB,EAAEoB,QACzD"}
@@ -1,2 +1,2 @@
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.67.3",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};
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 n,PrivyApiError as o}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 d}from"./logger.mjs";import"eventemitter3";import"jose";import"js-cookie";import"../Token.mjs";import"../session/keys.mjs";import"../utils/allSettled.mjs";import"../utils/noop.mjs";let g="privy:caid";class p{setCallbacks(e){this.callbacks={...this.callbacks,...e},this.session.setStoredUsersCallback(this.callbacks?.setStoredUsers)}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 n({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.isMultiUserModeEnabled&&await this.session.backfillLegacySession(),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 fetchWithoutAuthentication(e,t){if(!this.isMultiUserModeEnabled)throw new n({code:"invalid_input",error:'Unauthenticated requests require sessions.mode to be set to "multi-user"'});return this.fetch(e,{...t,onRequest:this._beforeRequestWithoutAuth.bind(this)})}async fetchForLogin(e,t){return this.isMultiUserModeEnabled?this.fetchWithoutAuthentication(e,t):this.fetch(e,t)}async fetch(e,{body:t,params:s,query:i,headers:r,onRequest:a=this._beforeRequest.bind(this)}){let n=new Request(this.getPath(e,{params:s,query:i}),{method:e.method,body:JSON.stringify(t),headers:r}),h=await a(n),c=await this._fetch(n,h),l=await c.json();if(c.status>299)throw new o({...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 _beforeRequestWithoutAuth(e){await this._initialize();let t=new Headers(e.headers);t.set("privy-app-id",this.appId),this.appClientId&&t.set("privy-client-id",this.appClientId),t.set("privy-client",this._sdkVersion),t.set("Content-Type","application/json"),t.set("Accept","application/json");let s=await this._getOrGenerateClientAnalyticsId();return s&&t.set("privy-ca-id",s),this.nativeAppIdentifier&&t.set("x-native-app-identifier",this.nativeAppIdentifier),{signal:c(2e4),headers:t}}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(g);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(g,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(g)}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 n({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(!await this.session.hasRefreshCredentials(i,e??null))throw this.logger.debug("[privy:refresh] missing tokens, skipping request"),await this._initialize(),new o({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 o&&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)&&await 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.68.0",this._cache=new Map,this.logger=d({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.isMultiUserModeEnabled=t.isMultiUserModeEnabled,this.session=new h({storage:this._storage,isUsingServerCookies:!1,appId:t.appId,setStoredUsers:t.callbacks?.setStoredUsers}),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","_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,WAAWQ,cAAa,GAIxBP,KAAKiB,YAAYC,WAAW,gBAC1BlB,KAAKmB,qBAAqB,iBAAkB,CAAA,EArBnD,CAuBF,CAKA,OAAAC,CACEC,GAEEC,OAAAA,EACAC,MAAAA,IAMF,MAAO,GAAGvB,KAAKc,UAAUU,EAAkBH,EAAEI,KAAMH,KAAUI,EAAeH,IAAQ,CAMtF,WAAMI,CACJN,GAEEO,KAAAA,EACAN,OAAAA,EACAC,MAAAA,EACAM,QAAAA,EACAC,UAAAA,EAAY9B,KAAK+B,eAAeC,KAAKhC,QASvC,IAAMi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,CACT,CACF,CAliBAmD,WAAAA,CAAYC,GAvBoCrH,KAC/BiB,YAAsB,qBActCjB,KACgBqF,OAAS,IAAIiC,IAS5BtH,KAAKkE,OAASqD,EAAkB,CAC9BC,MAAOH,EAAEnD,QAAQsD,OAASH,EAAEI,UAAY,QACxCvD,OAAQmD,EAAEnD,QAAUwD,UAKtB1H,KAAK8D,SAAWuD,EAAEM,QAClB3H,KAAKmE,QAAUkD,EAAEO,OACjB5H,KAAKK,aAAe,KACfL,KAAKoD,kCAEVpD,KAAKc,QAAUuG,EAAEvG,SArFS,wBAsF1Bd,KAAKkD,MAAQmE,EAAEnE,MACflD,KAAKmD,YAAckE,EAAElE,YACrBnD,KAAKiB,YAAcoG,EAAEQ,YAAc7H,KAAKiB,YACxCjB,KAAKD,UAAYsH,EAAEtH,UAKnBC,KAAKqD,oBAAsBgE,EAAEhE,oBAE7BrD,KAAKe,QAAU,IAAI+G,EAAQ,CACzBH,QAAS3H,KAAK8D,SACd9C,sBAAsB,EACtBkC,MAAOmE,EAAEnE,QAGXlD,KAAKwC,OAASuF,EAAOC,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
+ {"version":3,"file":"PrivyInternal.mjs","sources":["../../../src/client/PrivyInternal.ts"],"names":["CLIENT_ANALYTICS_ID_KEY","PrivyInternal","setCallbacks","callbacks","this","session","setStoredUsersCallback","setStoredUsers","isReady","_config","config","caid","_analyticsId","_initialize","setIsReady","isStorageAccessible","PrivyClientError","code","error","getAppConfig","custom_api_url","baseUrl","isUsingServerCookies","isMultiUserModeEnabled","backfillLegacySession","_sdkVersion","startsWith","createAnalyticsEvent","getPath","r","params","query","getPathWithParams","path","toSearchParams","fetchWithoutAuthentication","opts","fetch","onRequest","_beforeRequestWithoutAuth","bind","fetchForLogin","body","headers","_beforeRequest","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":"gmBAkEA,IAAMA,EAA0B,aAOzB,MAAMC,EA4HJC,YAAAA,CAAaC,GAClBC,KAAKD,UAAY,IAAIC,KAAKD,aAAcA,GACxCC,KAAKC,QAAQC,uBAAuBF,KAAKD,WAAWI,eACtD,CAOA,WAAIC,GACF,QAAeJ,KAAKK,OACtB,CAKA,UAAIC,GACF,OAAON,KAAKK,OAAO,CAUrB,QAAIE,GACF,OAAOP,KAAKQ,YAAY,CAQ1B,iBAAaC,GAEX,GAAIT,KAAKI,QACPJ,KAAKD,WAAWW,cAAa,OAD/B,CAKA,UAAYV,KAAKW,sBACf,MAAM,IAAIC,EAAiB,CACzBC,KAAM,gBACNC,MAAO,6BAIXd,KAAKK,cAAgBL,KAAKe,eAEtBf,KAAKK,SAASW,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B,CAAE,MAAOjD,GAEP,OADAzE,KAAK0E,OAAO5D,MAAM2D,IACX,CACT,CACF,CAtnBAmD,WAAAA,CAAYC,GA1BoC7H,KAC/BqB,YAAsB,qBAiBtCrB,KACgB6F,OAAS,IAAIiC,IAS5B9H,KAAK0E,OAASqD,EAAkB,CAC9BC,MAAOH,EAAEnD,QAAQsD,OAASH,EAAEI,UAAY,QACxCvD,OAAQmD,EAAEnD,QAAUwD,UAKtBlI,KAAKsE,SAAWuD,EAAEM,QAClBnI,KAAK2E,QAAUkD,EAAEO,OACjBpI,KAAKQ,aAAe,KACfR,KAAK4D,kCAEV5D,KAAKiB,QAAU4G,EAAE5G,SAxFS,wBAyF1BjB,KAAK0D,MAAQmE,EAAEnE,MACf1D,KAAK2D,YAAckE,EAAElE,YACrB3D,KAAKqB,YAAcwG,EAAEQ,YAAcrI,KAAKqB,YACxCrB,KAAKD,UAAY8H,EAAE9H,UAKnBC,KAAK6D,oBAAsBgE,EAAEhE,oBAC7B7D,KAAKmB,uBAAyB0G,EAAE1G,uBAEhCnB,KAAKC,QAAU,IAAIqI,EAAQ,CACzBH,QAASnI,KAAKsE,SACdpD,sBAAsB,EACtBwC,MAAOmE,EAAEnE,MACTvD,eAAgB0H,EAAE9H,WAAWI,iBAG/BH,KAAKgD,OAASuF,EAAOC,WAAWvG,MAAO,CACrCwG,QAAS,EAGTC,WAAYjE,GAAa,GAAKkE,EAAU,IAExCC,QAAS,CACP,IACA,IACA,IACA,IACA,IACA,IACA,OAKJ5I,KAAKC,QAAQ4I,GAAG,wBAAwBpE,IACjCzE,KAAKuB,qBAAqB,mCAAoC,CACjEuH,OAAAA,GACF,GAEJ"}
@@ -1,2 +1,2 @@
1
- import{AcceptTermsOnUser as r}from"@privy-io/routes";class t{async get(){let{user:r}=await this._privyInternal.refreshSession();return{user:r}}async acceptTerms(){return{user:await this._privyInternal.fetch(r,{})}}constructor(r){this._privyInternal=r}}export{t as default};
1
+ import{AcceptTermsOnUser as e}from"@privy-io/routes";import{PrivyClientError as r}from"../Error.mjs";class s{async get(){let{user:e}=await this._privyInternal.refreshSession();return{user:e}}async acceptTerms(){return{user:await this._privyInternal.fetch(e,{})}}async switchActiveUser(e){if(!this._isMultiUserModeEnabled)throw new r({code:"invalid_input",error:'User switching requires sessions.mode to be set to "multi-user"'});await this._privyInternal.session.switchActiveUserId(e.userId);try{this._embedded.reload();let{user:s}=await this._privyInternal.refreshSession(!0);if(s.id!==e.userId)throw new r({code:"invalid_input",error:"Cannot switch active user because the refreshed user did not match the requested user ID"});return this._privyInternal.callbacks?.setUser?.(s),{user:s}}catch(e){throw await this._privyInternal.session.destroyLocalState(),this._privyInternal.callbacks?.setUser?.(null),e}}constructor(e,r,s){this._privyInternal=e,this._embedded=r,this._isMultiUserModeEnabled=s}}export{s as default};
2
2
  //# sourceMappingURL=UserApi.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"UserApi.mjs","sources":["../../../src/client/UserApi.ts"],"names":["UserApi","get","user","this","_privyInternal","refreshSession","acceptTerms","fetch","AcceptTermsOnUser","constructor","privyInternal"],"mappings":"2DAIqBA,EAgBnB,SAAaC,GACX,IAAOC,KAAAA,SAAcC,KAAKC,eAAeC,iBACzC,MAAO,CAACH,KAAAA,EACV,CAEA,iBAAaI,GAEX,MAAO,CAACJ,WADWC,KAAKC,eAAeG,MAAMC,EAAmB,CAAA,GAElE,CAfA,WAAAC,CAAmBC,GACjBP,KAAKC,eAAiBM,CACxB"}
1
+ {"version":3,"file":"UserApi.mjs","sources":["../../../src/client/UserApi.ts"],"names":["UserApi","get","user","this","_privyInternal","refreshSession","acceptTerms","fetch","AcceptTermsOnUser","switchActiveUser","o","_isMultiUserModeEnabled","PrivyClientError","code","error","session","switchActiveUserId","userId","_embedded","reload","id","callbacks","setUser","destroyLocalState","constructor","privyInternal","embedded","isMultiUserModeEnabled"],"mappings":"qGAMe,MAAMA,EAwBnB,SAAaC,GACX,IAAOC,KAAAA,SAAcC,KAAKC,eAAeC,iBACzC,MAAO,CAACH,KAAAA,EACV,CAEA,iBAAaI,GAEX,MAAO,CAACJ,WADWC,KAAKC,eAAeG,MAAMC,EAAmB,CAAA,GAElE,CAMA,sBAAaC,CAAiBC,GAC5B,IAAKP,KAAKQ,wBACR,MAAM,IAAIC,EAAiB,CACzBC,KAAM,gBACNC,MAAO,0EAILX,KAAKC,eAAeW,QAAQC,mBAAmBN,EAAEO,QAEvD,IACEd,KAAKe,UAAUC,SAEf,IAAOjB,KAAAA,SAAcC,KAAKC,eAAeC,gBAAe,GAExD,GAAIH,EAAKkB,KAAOV,EAAEO,OAChB,MAAM,IAAIL,EAAiB,CACzBC,KAAM,gBACNC,MACE,6FAMN,OAFAX,KAAKC,eAAeiB,WAAWC,UAAUpB,GAElC,CAACA,KAAAA,EACV,CAAE,MAAOY,GAGP,YAFMX,KAAKC,eAAeW,QAAQQ,oBAClCpB,KAAKC,eAAeiB,WAAWC,UAAU,MACnCR,CACR,CACF,CA1DA,WAAAU,CACEC,EACAC,EACAC,GAEAxB,KAAKC,eAAiBqB,EACtBtB,KAAKe,UAAYQ,EACjBvB,KAAKQ,wBAA0BgB,CACjC"}
@@ -1,2 +1,2 @@
1
- import{CustomJWTAuthenticate as e,CustomJWTLink as t}from"@privy-io/routes";import{maybeCreateWalletOnLogin as s}from"./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";class i{async syncWithToken(t,i,r){let l=await this._privyInternal.fetch(e,{body:{token:t,mode:r}});await this._privyInternal.session.updateWithTokensResponse(l);let a=await s(this._embedded,l,i?.embedded);return this._privyInternal.callbacks?.setUser?.(a.user),a}async linkWithToken(e){await this._privyInternal.fetch(t,{body:{token:e}});let s=await this._privyInternal.refreshSession();return{user:s.user,identity_token:s.identity_token}}constructor(e,t){this._privyInternal=e,this._embedded=t}}export{i as default};
1
+ import{CustomJWTAuthenticate as e,CustomJWTLink as t}from"@privy-io/routes";import{maybeCreateWalletOnLogin as s}from"./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";class i{async syncWithToken(t,i,r){let l=await this._privyInternal.fetchForLogin(e,{body:{token:t,mode:r}});await this._privyInternal.session.updateWithTokensResponse(l);let a=await s(this._embedded,l,i?.embedded);return this._privyInternal.callbacks?.setUser?.(a.user),a}async linkWithToken(e){await this._privyInternal.fetch(t,{body:{token:e}});let s=await this._privyInternal.refreshSession();return{user:s.user,identity_token:s.identity_token}}constructor(e,t){this._privyInternal=e,this._embedded=t}}export{i as default};
2
2
  //# sourceMappingURL=CustomProviderApi.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"CustomProviderApi.mjs","sources":["../../../../src/client/auth/CustomProviderApi.ts"],"names":["CustomProviderApi","syncWithToken","token","opts","mode","res","this","_privyInternal","fetch","CustomJWTAuthenticate","body","session","updateWithTokensResponse","sessionWithWallets","maybeCreateWalletOnLogin","_embedded","embedded","callbacks","setUser","user","linkWithToken","CustomJWTLink","refreshSession","identity_token","constructor","privyInternal"],"mappings":"6gBAOqBA,EAwBnB,mBAAaC,CACXC,EACAC,EACAC,GAEA,IAAMC,QAAYC,KAAKC,eAAeC,MAAMC,EAAuB,CAACC,KAAM,CAACR,MAAAA,EAAOE,KAAAA,WAE5EE,KAAKC,eAAeI,QAAQC,yBAAyBP,GAE3D,IAAMQ,QAA2BC,EAAyBR,KAAKS,UAAWV,EAAKF,GAAMa,UAIrF,OAFAV,KAAKC,eAAeU,WAAWC,UAAUL,EAAmBM,MAErDN,CACT,CAOA,mBAAaO,CAAclB,SACnBI,KAAKC,eAAeC,MAAMa,EAAe,CAACX,KAAM,CAACR,MAAAA,KAGvD,IAAMG,QAAYC,KAAKC,eAAee,iBAEtC,MAAO,CAACH,KAAMd,EAAIc,KAAMI,eAAgBlB,EAAIkB,eAC9C,CAtCA,WAAAC,CAAmBC,EAA8BT,GAC/CV,KAAKC,eAAiBkB,EACtBnB,KAAKS,UAAYC,CACnB"}
1
+ {"version":3,"file":"CustomProviderApi.mjs","sources":["../../../../src/client/auth/CustomProviderApi.ts"],"names":["CustomProviderApi","syncWithToken","token","opts","mode","res","this","_privyInternal","fetchForLogin","CustomJWTAuthenticate","body","session","updateWithTokensResponse","sessionWithWallets","maybeCreateWalletOnLogin","_embedded","embedded","callbacks","setUser","user","linkWithToken","fetch","CustomJWTLink","refreshSession","identity_token","constructor","privyInternal"],"mappings":"6gBAOqBA,EAwBnB,mBAAaC,CACXC,EACAC,EACAC,GAEA,IAAMC,QAAYC,KAAKC,eAAeC,cAAcC,EAAuB,CACzEC,KAAM,CAACR,MAAAA,EAAOE,KAAAA,WAGVE,KAAKC,eAAeI,QAAQC,yBAAyBP,GAE3D,IAAMQ,QAA2BC,EAAyBR,KAAKS,UAAWV,EAAKF,GAAMa,UAIrF,OAFAV,KAAKC,eAAeU,WAAWC,UAAUL,EAAmBM,MAErDN,CACT,CAOA,mBAAaO,CAAclB,SACnBI,KAAKC,eAAec,MAAMC,EAAe,CAACZ,KAAM,CAACR,MAAAA,KAGvD,IAAMG,QAAYC,KAAKC,eAAegB,iBAEtC,MAAO,CAACJ,KAAMd,EAAIc,KAAMK,eAAgBnB,EAAImB,eAC9C,CAxCA,WAAAC,CAAmBC,EAA8BV,GAC/CV,KAAKC,eAAiBmB,EACtBpB,KAAKS,UAAYC,CACnB"}
@@ -1,2 +1,2 @@
1
- import{PasswordlessInit as e,PasswordlessAuthenticate as t,PasswordlessLink as s,PasswordlessUpdate as i,PasswordlessUnlink as r}from"@privy-io/routes";import{maybeCreateWalletOnLogin as d}from"./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";class a{async sendCode(t,s){return this._privyInternal.fetch(e,{body:{email:t,token:s}})}async loginWithCode(e,s,i,r){let a=await this._privyInternal.fetch(t,{body:{email:e,code:s,mode:i}});await this._privyInternal.session.updateWithTokensResponse(a);let l=await d(this._embedded,a,r?.embedded);return this._privyInternal.callbacks?.setUser?.(l.user),l}async linkWithCode(e,t){await this._privyInternal.fetch(s,{body:{email:e,code:t}});let i=await this._privyInternal.refreshSession();return{user:i.user,identity_token:i.identity_token}}async updateEmail({oldEmailAddress:e,newEmailAddress:t,code:s}){await this._privyInternal.fetch(i,{body:{oldAddress:e,newAddress:t,code:s}});let r=await this._privyInternal.refreshSession();return{user:r.user,identity_token:r.identity_token}}async unlink(e){await this._privyInternal.fetch(r,{body:{address:e}});let t=await this._privyInternal.refreshSession();return{user:t.user,identity_token:t.identity_token}}constructor(e,t){this._privyInternal=e,this._embedded=t}}export{a as default};
1
+ import{PasswordlessInit as e,PasswordlessAuthenticate as t,PasswordlessLink as s,PasswordlessUpdate as i,PasswordlessUnlink as r}from"@privy-io/routes";import{maybeCreateWalletOnLogin as d}from"./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";class a{async sendCode(t,s){return this._privyInternal.fetch(e,{body:{email:t,token:s}})}async loginWithCode(e,s,i,r){let a=await this._privyInternal.fetchForLogin(t,{body:{email:e,code:s,mode:i}});await this._privyInternal.session.updateWithTokensResponse(a);let n=await d(this._embedded,a,r?.embedded);return this._privyInternal.callbacks?.setUser?.(n.user),n}async linkWithCode(e,t){await this._privyInternal.fetch(s,{body:{email:e,code:t}});let i=await this._privyInternal.refreshSession();return{user:i.user,identity_token:i.identity_token}}async updateEmail({oldEmailAddress:e,newEmailAddress:t,code:s}){await this._privyInternal.fetch(i,{body:{oldAddress:e,newAddress:t,code:s}});let r=await this._privyInternal.refreshSession();return{user:r.user,identity_token:r.identity_token}}async unlink(e){await this._privyInternal.fetch(r,{body:{address:e}});let t=await this._privyInternal.refreshSession();return{user:t.user,identity_token:t.identity_token}}constructor(e,t){this._privyInternal=e,this._embedded=t}}export{a as default};
2
2
  //# sourceMappingURL=EmailApi.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"EmailApi.mjs","sources":["../../../../src/client/auth/EmailApi.ts"],"names":["EmailApi","sendCode","email","token","this","_privyInternal","fetch","PasswordlessInit","body","loginWithCode","code","mode","opts","res","PasswordlessAuthenticate","session","updateWithTokensResponse","sessionWithWallets","maybeCreateWalletOnLogin","_embedded","embedded","callbacks","setUser","user","linkWithCode","PasswordlessLink","refreshSession","identity_token","updateEmail","oldEmailAddress","newEmailAddress","PasswordlessUpdate","oldAddress","newAddress","unlink","PasswordlessUnlink","address","constructor","privyInternal"],"mappings":"mlBAae,MAAMA,EAyBnB,cAAaC,CAASC,EAAeC,GACnC,OAAOC,KAAKC,eAAeC,MAAMC,EAAkB,CAACC,KAAM,CAACN,MAAAA,EAAOC,MAAAA,IACpE,CASA,mBAAaM,CACXP,EACAQ,EACAC,EACAC,GAEA,IAAMC,QAAYT,KAAKC,eAAeC,MAAMQ,EAA0B,CACpEN,KAAM,CAACN,MAAAA,EAAOQ,KAAAA,EAAMC,KAAAA,WAGhBP,KAAKC,eAAeU,QAAQC,yBAAyBH,GAE3D,IAAMI,QAA2BC,EAAyBd,KAAKe,UAAWN,EAAKD,GAAMQ,UAIrF,OAFAhB,KAAKC,eAAegB,WAAWC,UAAUL,EAAmBM,MAErDN,CACT,CAQA,kBAAaO,CAAatB,EAAeQ,SACjCN,KAAKC,eAAeC,MAAMmB,EAAkB,CAACjB,KAAM,CAACN,MAAAA,EAAOQ,KAAAA,KAEjE,IAAMG,QAAYT,KAAKC,eAAeqB,iBAEtC,MAAO,CAACH,KAAMV,EAAIU,KAAMI,eAAgBd,EAAIc,eAC9C,CASA,iBAAaC,EACXC,gBAAAA,EACAC,gBAAAA,EACApB,KAAAA,UAMMN,KAAKC,eAAeC,MAAMyB,EAAoB,CAClDvB,KAAM,CAACwB,WAAYH,EAAiBI,WAAYH,EAAiBpB,KAAAA,KAGnE,IAAMG,QAAYT,KAAKC,eAAeqB,iBAEtC,MAAO,CAACH,KAAMV,EAAIU,KAAMI,eAAgBd,EAAIc,eAC9C,CAEA,YAAaO,CAAOhC,SACZE,KAAKC,eAAeC,MAAM6B,EAAoB,CAAC3B,KAAM,CAAC4B,QAASlC,KAErE,IAAMW,QAAYT,KAAKC,eAAeqB,iBACtC,MAAO,CAACH,KAAMV,EAAIU,KAAMI,eAAgBd,EAAIc,eAC9C,CArFA,WAAAU,CAAmBC,EAA8BlB,GAC/ChB,KAAKC,eAAiBiC,EACtBlC,KAAKe,UAAYC,CACnB"}
1
+ {"version":3,"file":"EmailApi.mjs","sources":["../../../../src/client/auth/EmailApi.ts"],"names":["EmailApi","sendCode","email","token","this","_privyInternal","fetch","PasswordlessInit","body","loginWithCode","code","mode","opts","res","fetchForLogin","PasswordlessAuthenticate","session","updateWithTokensResponse","sessionWithWallets","maybeCreateWalletOnLogin","_embedded","embedded","callbacks","setUser","user","linkWithCode","PasswordlessLink","refreshSession","identity_token","updateEmail","oldEmailAddress","newEmailAddress","PasswordlessUpdate","oldAddress","newAddress","unlink","PasswordlessUnlink","address","constructor","privyInternal"],"mappings":"mlBAae,MAAMA,EAyBnB,cAAaC,CAASC,EAAeC,GACnC,OAAOC,KAAKC,eAAeC,MAAMC,EAAkB,CAACC,KAAM,CAACN,MAAAA,EAAOC,MAAAA,IACpE,CASA,mBAAaM,CACXP,EACAQ,EACAC,EACAC,GAEA,IAAMC,QAAYT,KAAKC,eAAeS,cAAcC,EAA0B,CAC5EP,KAAM,CAACN,MAAAA,EAAOQ,KAAAA,EAAMC,KAAAA,WAGhBP,KAAKC,eAAeW,QAAQC,yBAAyBJ,GAE3D,IAAMK,QAA2BC,EAAyBf,KAAKgB,UAAWP,EAAKD,GAAMS,UAIrF,OAFAjB,KAAKC,eAAeiB,WAAWC,UAAUL,EAAmBM,MAErDN,CACT,CAQA,kBAAaO,CAAavB,EAAeQ,SACjCN,KAAKC,eAAeC,MAAMoB,EAAkB,CAAClB,KAAM,CAACN,MAAAA,EAAOQ,KAAAA,KAEjE,IAAMG,QAAYT,KAAKC,eAAesB,iBAEtC,MAAO,CAACH,KAAMX,EAAIW,KAAMI,eAAgBf,EAAIe,eAC9C,CASA,iBAAaC,EACXC,gBAAAA,EACAC,gBAAAA,EACArB,KAAAA,UAMMN,KAAKC,eAAeC,MAAM0B,EAAoB,CAClDxB,KAAM,CAACyB,WAAYH,EAAiBI,WAAYH,EAAiBrB,KAAAA,KAGnE,IAAMG,QAAYT,KAAKC,eAAesB,iBAEtC,MAAO,CAACH,KAAMX,EAAIW,KAAMI,eAAgBf,EAAIe,eAC9C,CAEA,YAAaO,CAAOjC,SACZE,KAAKC,eAAeC,MAAM8B,EAAoB,CAAC5B,KAAM,CAAC6B,QAASnC,KAErE,IAAMW,QAAYT,KAAKC,eAAesB,iBACtC,MAAO,CAACH,KAAMX,EAAIW,KAAMI,eAAgBf,EAAIe,eAC9C,CArFA,WAAAU,CAAmBC,EAA8BlB,GAC/CjB,KAAKC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