pub struct NodeClient { /* private fields */ }Expand description
The client to the user node.
Requests are proxied via the gateway CONNECT proxies. These proxies avoid exposing user nodes to the public internet and enforce user authentication and other request rate limits.
- Requests made to running nodes use the Run-specific
RestClient. - Requests made to provisioning nodes use a
RestClientwhich is created on-the-fly. This is because it is necessary to include a TLS config which checks the server’s remote attestation against aMeasurementwhich is only known at provisioning time. This is also desirable because provision requests generally happen only once, so there is no need to maintain a connection pool after provisioning has complete.
Implementations§
Source§impl NodeClient
impl NodeClient
pub fn new( rng: &mut impl Crng, use_sgx: bool, deploy_env: DeployEnv, gateway_client: GatewayClient, credentials: CredentialsRef<'_>, ) -> Result<Self>
Sourcepub fn user_pk(&self) -> Option<UserPk>
pub fn user_pk(&self) -> Option<UserPk>
Returns the user’s public key, if available from the credentials.
Returns None if credentials were created before node v0.8.11,
which didn’t include user_pk.
Sourcepub async fn create_client_credentials(
&self,
req: CreateRevocableClientRequest,
) -> Result<(RevocableClient, ClientCredentials)>
pub async fn create_client_credentials( &self, req: CreateRevocableClientRequest, ) -> Result<(RevocableClient, ClientCredentials)>
Ask the user node to create a new RevocableClient and return it
along with its ClientCredentials.
Sourcepub async fn request_provision_token(&self) -> Result<BearerAuthToken>
pub async fn request_provision_token(&self) -> Result<BearerAuthToken>
Get a short-lived auth token with Scope::All for provisioning.
Trait Implementations§
Source§impl AppNodeProvisionApi for NodeClient
impl AppNodeProvisionApi for NodeClient
Source§async fn provision(
&self,
measurement: Measurement,
data: NodeProvisionRequest,
) -> Result<Empty, NodeApiError>
async fn provision( &self, measurement: Measurement, data: NodeProvisionRequest, ) -> Result<Empty, NodeApiError>
Measurement. The provisioning node’s
remote attestation will be checked against the given Measurement. Read moreSource§impl AppNodeRunApi for NodeClient
impl AppNodeRunApi for NodeClient
Source§async fn list_channels(&self) -> Result<ListChannelsResponse, NodeApiError>
async fn list_channels(&self) -> Result<ListChannelsResponse, NodeApiError>
Empty -> ListChannelsResponseSource§async fn sign_message(
&self,
data: SignMsgRequest,
) -> Result<SignMsgResponse, NodeApiError>
async fn sign_message( &self, data: SignMsgRequest, ) -> Result<SignMsgResponse, NodeApiError>
Source§async fn verify_message(
&self,
data: VerifyMsgRequest,
) -> Result<VerifyMsgResponse, NodeApiError>
async fn verify_message( &self, data: VerifyMsgRequest, ) -> Result<VerifyMsgResponse, NodeApiError>
Source§async fn open_channel(
&self,
data: OpenChannelRequest,
) -> Result<OpenChannelResponse, NodeApiError>
async fn open_channel( &self, data: OpenChannelRequest, ) -> Result<OpenChannelResponse, NodeApiError>
Source§async fn preflight_open_channel(
&self,
data: PreflightOpenChannelRequest,
) -> Result<PreflightOpenChannelResponse, NodeApiError>
async fn preflight_open_channel( &self, data: PreflightOpenChannelRequest, ) -> Result<PreflightOpenChannelResponse, NodeApiError>
PreflightOpenChannelRequest
-> PreflightOpenChannelResponse Read moreSource§async fn close_channel(
&self,
data: CloseChannelRequest,
) -> Result<Empty, NodeApiError>
async fn close_channel( &self, data: CloseChannelRequest, ) -> Result<Empty, NodeApiError>
Source§async fn preflight_close_channel(
&self,
data: PreflightCloseChannelRequest,
) -> Result<PreflightCloseChannelResponse, NodeApiError>
async fn preflight_close_channel( &self, data: PreflightCloseChannelRequest, ) -> Result<PreflightCloseChannelResponse, NodeApiError>
PreflightCloseChannelRequest
-> PreflightCloseChannelResponse Read moreSource§async fn create_invoice(
&self,
data: CreateInvoiceRequest,
) -> Result<CreateInvoiceResponse, NodeApiError>
async fn create_invoice( &self, data: CreateInvoiceRequest, ) -> Result<CreateInvoiceResponse, NodeApiError>
CreateInvoiceRequest
-> CreateInvoiceResponseSource§async fn pay_invoice(
&self,
req: PayInvoiceRequest,
) -> Result<PayInvoiceResponse, NodeApiError>
async fn pay_invoice( &self, req: PayInvoiceRequest, ) -> Result<PayInvoiceResponse, NodeApiError>
PayInvoiceRequest -> PayInvoiceResponseSource§async fn preflight_pay_invoice(
&self,
req: PreflightPayInvoiceRequest,
) -> Result<PreflightPayInvoiceResponse, NodeApiError>
async fn preflight_pay_invoice( &self, req: PreflightPayInvoiceRequest, ) -> Result<PreflightPayInvoiceResponse, NodeApiError>
Source§async fn pay_onchain(
&self,
req: PayOnchainRequest,
) -> Result<PayOnchainResponse, NodeApiError>
async fn pay_onchain( &self, req: PayOnchainRequest, ) -> Result<PayOnchainResponse, NodeApiError>
Source§async fn preflight_pay_onchain(
&self,
req: PreflightPayOnchainRequest,
) -> Result<PreflightPayOnchainResponse, NodeApiError>
async fn preflight_pay_onchain( &self, req: PreflightPayOnchainRequest, ) -> Result<PreflightPayOnchainResponse, NodeApiError>
Source§async fn create_offer(
&self,
req: CreateOfferRequest,
) -> Result<CreateOfferResponse, NodeApiError>
async fn create_offer( &self, req: CreateOfferRequest, ) -> Result<CreateOfferResponse, NodeApiError>
Source§async fn pay_offer(
&self,
req: PayOfferRequest,
) -> Result<PayOfferResponse, NodeApiError>
async fn pay_offer( &self, req: PayOfferRequest, ) -> Result<PayOfferResponse, NodeApiError>
Source§async fn preflight_pay_offer(
&self,
req: PreflightPayOfferRequest,
) -> Result<PreflightPayOfferResponse, NodeApiError>
async fn preflight_pay_offer( &self, req: PreflightPayOfferRequest, ) -> Result<PreflightPayOfferResponse, NodeApiError>
Source§async fn get_address(&self) -> Result<GetAddressResponse, NodeApiError>
async fn get_address(&self) -> Result<GetAddressResponse, NodeApiError>
Source§async fn get_payments_by_indexes(
&self,
_: PaymentCreatedIndexes,
) -> Result<VecBasicPaymentV1, NodeApiError>
async fn get_payments_by_indexes( &self, _: PaymentCreatedIndexes, ) -> Result<VecBasicPaymentV1, NodeApiError>
since app-v0.8.9+29 and sdk-sidecar-v0.3.1: Use get_payments_by_ids instead
Source§async fn get_new_payments(
&self,
_: GetNewPayments,
) -> Result<VecBasicPaymentV1, NodeApiError>
async fn get_new_payments( &self, _: GetNewPayments, ) -> Result<VecBasicPaymentV1, NodeApiError>
since app-v0.8.9+29 and sdk-sidecar-v0.3.1: Use get_updated_payments instead
GetNewPayments -> VecBasicPaymentV1Source§async fn get_updated_payments(
&self,
req: GetUpdatedPayments,
) -> Result<VecBasicPaymentV2, NodeApiError>
async fn get_updated_payments( &self, req: GetUpdatedPayments, ) -> Result<VecBasicPaymentV2, NodeApiError>
GetUpdatedPayments
-> VecBasicPaymentV2Source§async fn get_payment_by_id(
&self,
req: PaymentIdStruct,
) -> Result<MaybeBasicPaymentV2, NodeApiError>
async fn get_payment_by_id( &self, req: PaymentIdStruct, ) -> Result<MaybeBasicPaymentV2, NodeApiError>
PaymentIdStruct -> MaybeBasicPaymentV2Source§async fn update_payment_note(
&self,
req: UpdatePaymentNote,
) -> Result<Empty, NodeApiError>
async fn update_payment_note( &self, req: UpdatePaymentNote, ) -> Result<Empty, NodeApiError>
UpdatePaymentNote -> EmptySource§async fn get_revocable_clients(
&self,
req: GetRevocableClients,
) -> Result<RevocableClients, NodeApiError>
async fn get_revocable_clients( &self, req: GetRevocableClients, ) -> Result<RevocableClients, NodeApiError>
Source§async fn create_revocable_client(
&self,
req: CreateRevocableClientRequest,
) -> Result<CreateRevocableClientResponse, NodeApiError>
async fn create_revocable_client( &self, req: CreateRevocableClientRequest, ) -> Result<CreateRevocableClientResponse, NodeApiError>
Source§async fn update_revocable_client(
&self,
req: UpdateClientRequest,
) -> Result<UpdateClientResponse, NodeApiError>
async fn update_revocable_client( &self, req: UpdateClientRequest, ) -> Result<UpdateClientResponse, NodeApiError>
Source§async fn list_broadcasted_txs(&self) -> Result<Value, NodeApiError>
async fn list_broadcasted_txs(&self) -> Result<Value, NodeApiError>
Source§async fn backup_info(&self) -> Result<BackupInfo, NodeApiError>
async fn backup_info(&self) -> Result<BackupInfo, NodeApiError>
Source§async fn setup_gdrive(&self, req: SetupGDrive) -> Result<Empty, NodeApiError>
async fn setup_gdrive(&self, req: SetupGDrive) -> Result<Empty, NodeApiError>
Source§async fn get_human_bitcoin_address(
&self,
) -> Result<HumanBitcoinAddress, NodeApiError>
async fn get_human_bitcoin_address( &self, ) -> Result<HumanBitcoinAddress, NodeApiError>
Source§async fn update_human_bitcoin_address(
&self,
req: UsernameStruct,
) -> Result<HumanBitcoinAddress, NodeApiError>
async fn update_human_bitcoin_address( &self, req: UsernameStruct, ) -> Result<HumanBitcoinAddress, NodeApiError>
Source§async fn get_payment_address(&self) -> Result<HumanBitcoinAddress, NodeApiError>
async fn get_payment_address(&self) -> Result<HumanBitcoinAddress, NodeApiError>
since app-v0.9.3 and sdk-sidecar-v0.4.2: Use get_human_bitcoin_address instead
Empty -> HumanBitcoinAddressSource§async fn update_payment_address(
&self,
req: UsernameStruct,
) -> Result<HumanBitcoinAddress, NodeApiError>
async fn update_payment_address( &self, req: UsernameStruct, ) -> Result<HumanBitcoinAddress, NodeApiError>
since app-v0.9.3 and sdk-sidecar-v0.4.2: Use update_human_bitcoin_address instead
UsernameStruct -> HumanBitcoinAddressSource§async fn list_nwc_clients(&self) -> Result<ListNwcClientResponse, NodeApiError>
async fn list_nwc_clients(&self) -> Result<ListNwcClientResponse, NodeApiError>
Source§async fn create_nwc_client(
&self,
req: CreateNwcClientRequest,
) -> Result<CreateNwcClientResponse, NodeApiError>
async fn create_nwc_client( &self, req: CreateNwcClientRequest, ) -> Result<CreateNwcClientResponse, NodeApiError>
Source§async fn update_nwc_client(
&self,
req: UpdateNwcClientRequest,
) -> Result<UpdateNwcClientResponse, NodeApiError>
async fn update_nwc_client( &self, req: UpdateNwcClientRequest, ) -> Result<UpdateNwcClientResponse, NodeApiError>
Source§async fn delete_nwc_client(
&self,
req: NostrPkStruct,
) -> Result<Empty, NodeApiError>
async fn delete_nwc_client( &self, req: NostrPkStruct, ) -> Result<Empty, NodeApiError>
Source§impl Clone for NodeClient
impl Clone for NodeClient
Source§fn clone(&self) -> NodeClient
fn clone(&self) -> NodeClient
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more