pub struct PrivyClient { /* private fields */ }Expand description
Privy API client for wallet operations and transaction signing.
Shared core used by both api-v2 and settlement-service:
- P-256 ECDSA authorization signatures
- Wallet lookup (GET /v1/wallets)
- Transaction signing (POST /v1/wallets/{id}/rpc)
Implementations§
Source§impl PrivyClient
impl PrivyClient
pub fn new(config: PrivyConfig) -> PrivyResult<Self>
Sourcepub async fn get_user_solana_wallet(
&self,
user_did: &str,
) -> PrivyResult<Option<Wallet>>
pub async fn get_user_solana_wallet( &self, user_did: &str, ) -> PrivyResult<Option<Wallet>>
Get the user’s first Solana wallet from Privy.
Sourcepub async fn sign_transaction(
&self,
wallet_id: &str,
transaction_base64: &str,
) -> PrivyResult<String>
pub async fn sign_transaction( &self, wallet_id: &str, transaction_base64: &str, ) -> PrivyResult<String>
Sign a transaction using a Privy-managed wallet.
Takes the Privy wallet ID and a base64-encoded serialized transaction. Returns the signed transaction as base64.
Compute the privy-authorization-signature header value.
P-256 ECDSA signature over canonical JSON payload, encoded as base64 DER.
serde_json serializes json!({}) maps using BTreeMap (alphabetical key order),
which satisfies RFC 8785 for our payload.
Sourcepub async fn get_with_basic_auth(&self, url: &str) -> PrivyResult<Response>
pub async fn get_with_basic_auth(&self, url: &str) -> PrivyResult<Response>
Make a basic-auth-only request (no authorization signature). Used for GET endpoints like /v1/wallets and /v1/policies/{id}.
Sourcepub async fn request_with_signature(
&self,
method: Method,
url: &str,
body: &Value,
) -> PrivyResult<Response>
pub async fn request_with_signature( &self, method: Method, url: &str, body: &Value, ) -> PrivyResult<Response>
Make a request with authorization signature. Used for POST/PATCH endpoints that modify wallet state.
Trait Implementations§
Source§impl Clone for PrivyClient
impl Clone for PrivyClient
Source§fn clone(&self) -> PrivyClient
fn clone(&self) -> PrivyClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more