@privy-io/js-sdk-core
Advanced tools
Comparing version 0.31.0 to 0.32.0
@@ -146,2 +146,3 @@ export default class EmailApi { | ||
address: string; | ||
public_key: string; | ||
chain_id: string; | ||
@@ -162,2 +163,3 @@ verified_at: number; | ||
address: string; | ||
public_key: string; | ||
chain_id: string; | ||
@@ -396,2 +398,3 @@ verified_at: number; | ||
address: string; | ||
public_key: string; | ||
chain_id: string; | ||
@@ -412,2 +415,3 @@ verified_at: number; | ||
address: string; | ||
public_key: string; | ||
chain_id: string; | ||
@@ -414,0 +418,0 @@ verified_at: number; |
@@ -147,2 +147,59 @@ /** | ||
} | ||
export type BaseBitcoinRpcRequestType = { | ||
method: string; | ||
params: any; | ||
}; | ||
export type BaseBitcoinRpcResponseType = { | ||
method: string; | ||
data: any; | ||
}; | ||
/** | ||
* Within the Privy SDK(s), the caller of Bitcoin `sign` will pass us the `message` | ||
* as a `Uint8Array`. Our SDK(s) will then serialize that `Uint8Array` to a utf8 `string` | ||
* to pass it over the iframe message bus. | ||
* Thus, our iframe accepts the message as a `string` but must deserialize it back to a `Uint8Array` | ||
* before computing the signature over it. | ||
*/ | ||
export interface bitcoin_sign extends BaseBitcoinRpcRequestType { | ||
method: 'sign'; | ||
params: { | ||
message: string; | ||
}; | ||
} | ||
/** | ||
* The Privy SDK(s) will return the signature as a `Uint8Array`, but the iframe must serialize it to | ||
* a `string` in order to pass it over the message bus. You can see how this is done in the signature handler. | ||
* | ||
* The Privy SDK(s) themselves must then deserialize the `string` to a `Uint8Array` before | ||
* returning the signature to the caller. | ||
*/ | ||
export interface bitcoin_signResponse extends BaseBitcoinRpcResponseType { | ||
method: 'sign'; | ||
data: { | ||
signature: string; | ||
}; | ||
} | ||
/** | ||
* RPC method for signing a transaction. | ||
* | ||
* The iframe expects a Partially Signed Bitcoin Transaction or PSBT, for short. We | ||
* will parse the hex-endoed input to a Transaction object and sign it with the private | ||
* key, returning the signed transaction hash, rather than just a signature. | ||
* | ||
* ref: https://github.com/bitcoin/bitcoin/blob/master/doc/psbt.md | ||
*/ | ||
export interface bitcoin_signTransaction extends BaseBitcoinRpcRequestType { | ||
method: 'signTransaction'; | ||
params: { | ||
psbt: string; | ||
}; | ||
} | ||
export interface bitcoin_signTransactionResponse extends BaseBitcoinRpcResponseType { | ||
method: 'signTransaction'; | ||
data: { | ||
signedTransaction: string; | ||
}; | ||
} | ||
export type BitcoinRpcRequestType = bitcoin_sign | bitcoin_signTransaction; | ||
export type BitcoinRpcResponseType = bitcoin_signResponse | bitcoin_signTransactionResponse; | ||
export type PrivyEventType = 'privy:iframe:ready' | 'privy:wallets:create' | 'privy:wallets:add' | 'privy:wallets:set-recovery' | 'privy:wallets:connect' | 'privy:wallets:recover' | 'privy:wallets:rpc' | 'privy:wallet:create' | 'privy:wallet:connect' | 'privy:wallet:recover' | 'privy:wallet:rpc' | 'privy:solana-wallet:create' | 'privy:solana-wallet:create-additional' | 'privy:solana-wallet:connect' | 'privy:solana-wallet:recover' | 'privy:solana-wallet:rpc' | 'privy:mfa:verify' | 'privy:mfa:init-enrollment' | 'privy:mfa:submit-enrollment' | 'privy:mfa:unenroll' | 'privy:mfa:clear'; | ||
@@ -351,3 +408,3 @@ export type IEmbeddedWalletRecoveryOptions = 'privy' | 'user-passcode' | 'google-drive' | 'icloud' | 'icloud-native'; | ||
chainType: 'bitcoin-taproot' | 'bitcoin-segwit'; | ||
request: unknown; | ||
request: BitcoinRpcRequestType; | ||
}; | ||
@@ -389,3 +446,3 @@ export type WalletsRpcRequestDataType = BaseWalletsRequestData & { | ||
chainType: 'bitcoin-taproot' | 'bitcoin-segwit'; | ||
response: unknown; | ||
response: BitcoinRpcResponseType; | ||
}; | ||
@@ -392,0 +449,0 @@ export type WalletsRpcResponseDataType = { |
import type { PrivyBitcoinSegwitEmbeddedWalletAccount, PrivyBitcoinTaprootEmbeddedWalletAccount, PrivyEthereumEmbeddedWalletAccount, PrivySolanaEmbeddedWalletAccount, PrivyUser } from '@privy-io/public-api/schemas'; | ||
import { EmbeddedSolanaWalletProvider, EmbeddedWalletProvider } from './embedded'; | ||
import type { EntropyIdVerifier, IEmbeddedWalletRecoveryOptions, PrivyResponseEvent, SetRecoveryInput, SetRecoveryOutput } from './embedded/types'; | ||
import { EmbeddedBitcoinWalletProvider } from './embedded/EmbeddedBitcoinWalletProvider'; | ||
import type { ChainType, EntropyIdVerifier, IEmbeddedWalletRecoveryOptions, PrivyResponseEvent, SetRecoveryInput, SetRecoveryOutput } from './embedded/types'; | ||
/** Options for creating the Solana embedded wallet */ | ||
@@ -23,2 +24,280 @@ type CreateSolanaOpts = { | ||
/** | ||
* Add a new embedded wallet account. | ||
* | ||
* Requires that the user already have created an embedded wallet via `create`. | ||
* | ||
* @param o input options | ||
* @param o.chainType the type of wallet to create | ||
* @param o.hdWalletIndex the index of the wallet to create | ||
* @param o.entropyId the key used to look up the existing wallet | ||
* @param o.entropyIdVerifier the method used to verify the entropy ID | ||
* | ||
* @returns the updated user | ||
*/ | ||
add(opts: { | ||
chainType: ChainType; | ||
hdWalletIndex: number; | ||
entropyId: string; | ||
entropyIdVerifier: EntropyIdVerifier; | ||
}): Promise<{ | ||
user: { | ||
id: string; | ||
mfa_methods: ({ | ||
type: "sms"; | ||
verified_at: number; | ||
} | { | ||
type: "totp"; | ||
verified_at: number; | ||
} | { | ||
type: "passkey"; | ||
verified_at: number; | ||
})[]; | ||
linked_accounts: ({ | ||
type: "email"; | ||
address: string; | ||
verified_at: number; | ||
first_verified_at: number | null; | ||
latest_verified_at: number | null; | ||
} | { | ||
type: "phone"; | ||
verified_at: number; | ||
first_verified_at: number | null; | ||
latest_verified_at: number | null; | ||
phoneNumber: string; | ||
} | { | ||
type: "wallet"; | ||
address: string; | ||
verified_at: number; | ||
first_verified_at: number | null; | ||
latest_verified_at: number | null; | ||
chain_type: "ethereum"; | ||
wallet_client: "unknown"; | ||
chain_id?: string | undefined; | ||
wallet_client_type?: string | undefined; | ||
connector_type?: string | undefined; | ||
} | { | ||
type: "smart_wallet"; | ||
address: string; | ||
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet"; | ||
verified_at: number; | ||
first_verified_at: number | null; | ||
latest_verified_at: number | null; | ||
} | { | ||
type: "wallet"; | ||
address: string; | ||
verified_at: number; | ||
first_verified_at: number | null; | ||
latest_verified_at: number | null; | ||
chain_type: "solana"; | ||
wallet_client: "unknown"; | ||
wallet_client_type?: string | undefined; | ||
connector_type?: string | undefined; | ||
} | { | ||
type: "farcaster"; | ||
fid: number; | ||
verified_at: number; | ||
first_verified_at: number | null; | ||
latest_verified_at: number | null; | ||
owner_address: string; | ||
username?: string | undefined; | ||
display_name?: string | undefined; | ||
bio?: string | undefined; | ||
profile_picture?: string | undefined; | ||
profile_picture_url?: string | undefined; | ||
homepage_url?: string | undefined; | ||
signer_public_key?: string | undefined; | ||
} | { | ||
type: "passkey"; | ||
verified_at: number; | ||
first_verified_at: number | null; | ||
latest_verified_at: number | null; | ||
credential_id: string; | ||
enrolled_in_mfa: boolean; | ||
created_with_browser?: string | undefined; | ||
created_with_os?: string | undefined; | ||
created_with_device?: string | undefined; | ||
authenticator_name?: string | undefined; | ||
} | { | ||
telegramUserId: string; | ||
firstName: string | null | undefined; | ||
type: "telegram"; | ||
verified_at: number; | ||
first_verified_at: number | null; | ||
latest_verified_at: number | null; | ||
telegram_user_id: string; | ||
username?: string | null | undefined; | ||
first_name?: string | null | undefined; | ||
last_name?: string | null | undefined; | ||
photo_url?: string | null | undefined; | ||
} | { | ||
type: "wallet"; | ||
address: string; | ||
chain_id: string; | ||
verified_at: number; | ||
first_verified_at: number | null; | ||
latest_verified_at: number | null; | ||
chain_type: "ethereum"; | ||
wallet_client: "privy"; | ||
wallet_client_type: "privy"; | ||
connector_type: "embedded"; | ||
imported: boolean; | ||
delegated: boolean; | ||
wallet_index: number; | ||
recovery_method: "user-passcode" | "google-drive" | "icloud" | "privy"; | ||
} | { | ||
type: "wallet"; | ||
address: string; | ||
public_key: string; | ||
chain_id: string; | ||
verified_at: number; | ||
first_verified_at: number | null; | ||
latest_verified_at: number | null; | ||
chain_type: "solana"; | ||
wallet_client: "privy"; | ||
wallet_client_type: "privy"; | ||
connector_type: "embedded"; | ||
imported: boolean; | ||
delegated: boolean; | ||
wallet_index: number; | ||
recovery_method: "user-passcode" | "google-drive" | "icloud" | "privy"; | ||
} | { | ||
type: "wallet"; | ||
address: string; | ||
public_key: string; | ||
chain_id: string; | ||
verified_at: number; | ||
first_verified_at: number | null; | ||
latest_verified_at: number | null; | ||
chain_type: "bitcoin-segwit"; | ||
wallet_client: "privy"; | ||
wallet_client_type: "privy"; | ||
connector_type: "embedded"; | ||
imported: boolean; | ||
delegated: boolean; | ||
wallet_index: number; | ||
recovery_method: "user-passcode" | "google-drive" | "icloud" | "privy"; | ||
} | { | ||
type: "wallet"; | ||
address: string; | ||
public_key: string; | ||
chain_id: string; | ||
verified_at: number; | ||
first_verified_at: number | null; | ||
latest_verified_at: number | null; | ||
chain_type: "bitcoin-taproot"; | ||
wallet_client: "privy"; | ||
wallet_client_type: "privy"; | ||
connector_type: "embedded"; | ||
imported: boolean; | ||
delegated: boolean; | ||
wallet_index: number; | ||
recovery_method: "user-passcode" | "google-drive" | "icloud" | "privy"; | ||
} | { | ||
type: "google_oauth"; | ||
name: string | null; | ||
email: string; | ||
verified_at: number; | ||
first_verified_at: number | null; | ||
latest_verified_at: number | null; | ||
subject: string; | ||
} | { | ||
type: "twitter_oauth"; | ||
name: string | null; | ||
username: string | null; | ||
verified_at: number; | ||
first_verified_at: number | null; | ||
latest_verified_at: number | null; | ||
profile_picture_url: string | null; | ||
subject: string; | ||
} | { | ||
type: "discord_oauth"; | ||
email: string | null; | ||
username: string | null; | ||
verified_at: number; | ||
first_verified_at: number | null; | ||
latest_verified_at: number | null; | ||
subject: string; | ||
} | { | ||
type: "github_oauth"; | ||
name: string | null; | ||
email: string | null; | ||
username: string | null; | ||
verified_at: number; | ||
first_verified_at: number | null; | ||
latest_verified_at: number | null; | ||
subject: string; | ||
} | { | ||
type: "linkedin_oauth"; | ||
email: string | null; | ||
verified_at: number; | ||
first_verified_at: number | null; | ||
latest_verified_at: number | null; | ||
subject: string; | ||
name?: string | undefined; | ||
vanity_name?: string | undefined; | ||
} | { | ||
type: "spotify_oauth"; | ||
name: string | null; | ||
email: string | null; | ||
verified_at: number; | ||
first_verified_at: number | null; | ||
latest_verified_at: number | null; | ||
subject: string; | ||
} | { | ||
type: "instagram_oauth"; | ||
username: string | null; | ||
verified_at: number; | ||
first_verified_at: number | null; | ||
latest_verified_at: number | null; | ||
subject: string; | ||
} | { | ||
type: "tiktok_oauth"; | ||
name: string | null; | ||
username: string | null; | ||
verified_at: number; | ||
first_verified_at: number | null; | ||
latest_verified_at: number | null; | ||
subject: string; | ||
} | { | ||
type: "apple_oauth"; | ||
email: string | null; | ||
verified_at: number; | ||
first_verified_at: number | null; | ||
latest_verified_at: number | null; | ||
subject: string; | ||
} | { | ||
type: "custom_auth"; | ||
verified_at: number; | ||
first_verified_at: number | null; | ||
latest_verified_at: number | null; | ||
custom_user_id: string; | ||
} | { | ||
type: "cross_app"; | ||
provider_app_id: string; | ||
verified_at: number; | ||
first_verified_at: number | null; | ||
latest_verified_at: number | null; | ||
subject: string; | ||
embedded_wallets: { | ||
address: string; | ||
}[]; | ||
smart_wallets: { | ||
address: string; | ||
}[]; | ||
})[]; | ||
created_at: number; | ||
has_accepted_terms: boolean; | ||
is_guest: boolean; | ||
custom_metadata?: Record<string, string | number | boolean> | undefined; | ||
}; | ||
}>; | ||
getBitcoinProvider({ wallet, entropyId, entropyIdVerifier, recoveryPassword, recoveryAccessToken, recoverySecretOverride, }: { | ||
wallet: PrivyBitcoinSegwitEmbeddedWalletAccount | PrivyBitcoinTaprootEmbeddedWalletAccount; | ||
entropyId: string; | ||
entropyIdVerifier: EntropyIdVerifier; | ||
recoveryPassword?: string; | ||
recoveryAccessToken?: string; | ||
recoverySecretOverride?: string; | ||
}): Promise<EmbeddedBitcoinWalletProvider>; | ||
/** | ||
* Creates an embedded wallet | ||
@@ -25,0 +304,0 @@ * |
@@ -157,2 +157,3 @@ export default class FarcasterApi { | ||
address: string; | ||
public_key: string; | ||
chain_id: string; | ||
@@ -173,2 +174,3 @@ verified_at: number; | ||
address: string; | ||
public_key: string; | ||
chain_id: string; | ||
@@ -412,2 +414,3 @@ verified_at: number; | ||
address: string; | ||
public_key: string; | ||
chain_id: string; | ||
@@ -428,2 +431,3 @@ verified_at: number; | ||
address: string; | ||
public_key: string; | ||
chain_id: string; | ||
@@ -430,0 +434,0 @@ verified_at: number; |
@@ -12,2 +12,4 @@ import Privy from './Privy'; | ||
export { getAllUserEmbeddedSolanaWallets } from './utils/getAllUserEmbeddedSolanaWallets'; | ||
export { getAllUserEmbeddedBitcoinWallets } from './utils/getAllUserEmbeddedBitcoinWallets'; | ||
export type { EmbeddedBitcoinWalletProvider } from './embedded/EmbeddedBitcoinWalletProvider'; | ||
export { type CountryCode, countryCodesAndNumbers, formatPhoneNumber, getCountryCallingCode, getPhoneCountryCodeAndNumber, getPlaceholderPhoneNumber, lastFourDigits, phoneNumberTypingFormatter, validatePhoneNumber, } from './utils/phoneNumberUtils'; | ||
@@ -14,0 +16,0 @@ export { getUserEmbeddedSolanaWallet } from './utils/getUserEmbeddedSolanaWallet'; |
@@ -150,2 +150,3 @@ import type { OAuthProviderType } from '@privy-io/public-api'; | ||
address: string; | ||
public_key: string; | ||
chain_id: string; | ||
@@ -166,2 +167,3 @@ verified_at: number; | ||
address: string; | ||
public_key: string; | ||
chain_id: string; | ||
@@ -406,2 +408,3 @@ verified_at: number; | ||
address: string; | ||
public_key: string; | ||
chain_id: string; | ||
@@ -422,2 +425,3 @@ verified_at: number; | ||
address: string; | ||
public_key: string; | ||
chain_id: string; | ||
@@ -424,0 +428,0 @@ verified_at: number; |
@@ -146,2 +146,3 @@ export default class PhoneApi { | ||
address: string; | ||
public_key: string; | ||
chain_id: string; | ||
@@ -162,2 +163,3 @@ verified_at: number; | ||
address: string; | ||
public_key: string; | ||
chain_id: string; | ||
@@ -396,2 +398,3 @@ verified_at: number; | ||
address: string; | ||
public_key: string; | ||
chain_id: string; | ||
@@ -412,2 +415,3 @@ verified_at: number; | ||
address: string; | ||
public_key: string; | ||
chain_id: string; | ||
@@ -414,0 +418,0 @@ verified_at: number; |
import type { EmbeddedWalletProvider, EmbeddedSolanaWalletProvider } from './embedded'; | ||
export type { UnsignedTransactionRequest, UnsignedTransactionRequestWithChainId, } from './embedded/types'; | ||
export type { UnsignedTransactionRequest, UnsignedTransactionRequestWithChainId, EntropyIdVerifier, } from './embedded/types'; | ||
export { type EIP1193Provider } from './embedded/'; | ||
@@ -4,0 +4,0 @@ export type PrivyEmbeddedWalletProvider = EmbeddedWalletProvider; |
@@ -129,2 +129,3 @@ export default class UserApi { | ||
address: string; | ||
public_key: string; | ||
chain_id: string; | ||
@@ -145,2 +146,3 @@ verified_at: number; | ||
address: string; | ||
public_key: string; | ||
chain_id: string; | ||
@@ -147,0 +149,0 @@ verified_at: number; |
{ | ||
"name": "@privy-io/js-sdk-core", | ||
"version": "0.31.0", | ||
"version": "0.32.0", | ||
"description": "Vanilla JS client for the Privy Auth API", | ||
@@ -46,3 +46,2 @@ "keywords": [ | ||
"test": "jest --testMatch \"**/test/**/*.test.ts\"", | ||
"test:ci": "npm run test", | ||
"test:watch": "npm run test -- --watch" | ||
@@ -63,3 +62,3 @@ }, | ||
"@privy-io/api-base": "^1.4.0", | ||
"@privy-io/public-api": "2.12.1", | ||
"@privy-io/public-api": "2.12.2", | ||
"eventemitter3": "^5.0.1", | ||
@@ -66,0 +65,0 @@ "fetch-retry": "^5.0.6", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
924620
274
7142
+ Added@privy-io/api-base@1.4.1(transitive)
+ Added@privy-io/public-api@2.12.2(transitive)
- Removed@privy-io/public-api@2.12.1(transitive)
Updated@privy-io/public-api@2.12.2