Skip to main content

NodeClient

Struct NodeClient 

Source
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 RestClient which is created on-the-fly. This is because it is necessary to include a TLS config which checks the server’s remote attestation against a Measurement which 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

Source

pub fn new( rng: &mut impl Crng, use_sgx: bool, deploy_env: DeployEnv, gateway_client: GatewayClient, credentials: CredentialsRef<'_>, ) -> Result<Self>

Source

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.

Source

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.

Source

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

Source§

async fn provision( &self, measurement: Measurement, data: NodeProvisionRequest, ) -> Result<Empty, NodeApiError>

Provision a node with the given Measurement. The provisioning node’s remote attestation will be checked against the given Measurement. Read more
Source§

impl AppNodeRunApi for NodeClient

Source§

async fn node_info(&self) -> Result<NodeInfo, NodeApiError>

GET /app/node_info Empty -> NodeInfo
Source§

async fn list_channels(&self) -> Result<ListChannelsResponse, NodeApiError>

GET /app/list_channels Empty -> ListChannelsResponse
Source§

async fn sign_message( &self, data: SignMsgRequest, ) -> Result<SignMsgResponse, NodeApiError>

POST /app/sign_message SignMsgRequest -> SignMsgResponse Read more
Source§

async fn verify_message( &self, data: VerifyMsgRequest, ) -> Result<VerifyMsgResponse, NodeApiError>

POST /app/verify_message VerifyMsgRequest -> VerifyMsgResponse Read more
Source§

async fn open_channel( &self, data: OpenChannelRequest, ) -> Result<OpenChannelResponse, NodeApiError>

Source§

async fn preflight_open_channel( &self, data: PreflightOpenChannelRequest, ) -> Result<PreflightOpenChannelResponse, NodeApiError>

Source§

async fn close_channel( &self, data: CloseChannelRequest, ) -> Result<Empty, NodeApiError>

POST /app/close_channel CloseChannelRequest -> Empty Read more
Source§

async fn preflight_close_channel( &self, data: PreflightCloseChannelRequest, ) -> Result<PreflightCloseChannelResponse, NodeApiError>

Source§

async fn create_invoice( &self, data: CreateInvoiceRequest, ) -> Result<CreateInvoiceResponse, NodeApiError>

POST /app/create_invoice CreateInvoiceRequest -> CreateInvoiceResponse
Source§

async fn pay_invoice( &self, req: PayInvoiceRequest, ) -> Result<PayInvoiceResponse, NodeApiError>

POST /app/pay_invoice PayInvoiceRequest -> PayInvoiceResponse
Source§

async fn preflight_pay_invoice( &self, req: PreflightPayInvoiceRequest, ) -> Result<PreflightPayInvoiceResponse, NodeApiError>

Source§

async fn pay_onchain( &self, req: PayOnchainRequest, ) -> Result<PayOnchainResponse, NodeApiError>

Source§

async fn preflight_pay_onchain( &self, req: PreflightPayOnchainRequest, ) -> Result<PreflightPayOnchainResponse, NodeApiError>

Source§

async fn create_offer( &self, req: CreateOfferRequest, ) -> Result<CreateOfferResponse, NodeApiError>

Source§

async fn pay_offer( &self, req: PayOfferRequest, ) -> Result<PayOfferResponse, NodeApiError>

Source§

async fn preflight_pay_offer( &self, req: PreflightPayOfferRequest, ) -> Result<PreflightPayOfferResponse, NodeApiError>

Source§

async fn get_address(&self) -> Result<GetAddressResponse, NodeApiError>

POST /app/get_address Empty -> GetAddressResponse Read more
Source§

async fn get_payments_by_indexes( &self, _: PaymentCreatedIndexes, ) -> Result<VecBasicPaymentV1, NodeApiError>

👎Deprecated:

since app-v0.8.9+29 and sdk-sidecar-v0.3.1: Use get_payments_by_ids instead

POST /app/payments/indexes PaymentCreatedIndexes -> VecDbPaymentV1 Read more
Source§

async fn get_new_payments( &self, _: GetNewPayments, ) -> Result<VecBasicPaymentV1, NodeApiError>

👎Deprecated:

since app-v0.8.9+29 and sdk-sidecar-v0.3.1: Use get_updated_payments instead

GET /app/payments/new GetNewPayments -> VecBasicPaymentV1
Source§

async fn get_updated_payments( &self, req: GetUpdatedPayments, ) -> Result<VecBasicPaymentV2, NodeApiError>

GET /app/payments/updated GetUpdatedPayments -> VecBasicPaymentV2
Source§

async fn get_payment_by_id( &self, req: PaymentIdStruct, ) -> Result<MaybeBasicPaymentV2, NodeApiError>

GET /app/v1/payments/id PaymentIdStruct -> MaybeBasicPaymentV2
Source§

async fn update_payment_note( &self, req: UpdatePaymentNote, ) -> Result<Empty, NodeApiError>

PUT /app/payments/note UpdatePaymentNote -> Empty
Source§

async fn get_revocable_clients( &self, req: GetRevocableClients, ) -> Result<RevocableClients, NodeApiError>

Lists all revocable clients. Read more
Source§

async fn create_revocable_client( &self, req: CreateRevocableClientRequest, ) -> Result<CreateRevocableClientResponse, NodeApiError>

Creates a new revocable client. Returns the newly issued client cert. Read more
Source§

async fn update_revocable_client( &self, req: UpdateClientRequest, ) -> Result<UpdateClientResponse, NodeApiError>

Updates this revocable client. Returns the updated client. Read more
Source§

async fn list_broadcasted_txs(&self) -> Result<Value, NodeApiError>

List all broadcasted transactions. Read more
Source§

async fn backup_info(&self) -> Result<BackupInfo, NodeApiError>

Get the current status of Node backup. Read more
Source§

async fn setup_gdrive(&self, req: SetupGDrive) -> Result<Empty, NodeApiError>

Setup GDrive backup. Read more
Source§

async fn get_human_bitcoin_address( &self, ) -> Result<HumanBitcoinAddress, NodeApiError>

Get current user’s human Bitcoin address. Read more
Source§

async fn update_human_bitcoin_address( &self, req: UsernameStruct, ) -> Result<HumanBitcoinAddress, NodeApiError>

Update current user’s human Bitcoin address. Read more
Source§

async fn get_payment_address(&self) -> Result<HumanBitcoinAddress, NodeApiError>

👎Deprecated:

since app-v0.9.3 and sdk-sidecar-v0.4.2: Use get_human_bitcoin_address instead

GET /app/payment_address Empty -> HumanBitcoinAddress
Source§

async fn update_payment_address( &self, req: UsernameStruct, ) -> Result<HumanBitcoinAddress, NodeApiError>

👎Deprecated:

since app-v0.9.3 and sdk-sidecar-v0.4.2: Use update_human_bitcoin_address instead

PUT /app/payment_address UsernameStruct -> HumanBitcoinAddress
Source§

async fn list_nwc_clients(&self) -> Result<ListNwcClientResponse, NodeApiError>

List NWC clients for the current user. Returns client info without sensitive data (no connection strings). Read more
Source§

async fn create_nwc_client( &self, req: CreateNwcClientRequest, ) -> Result<CreateNwcClientResponse, NodeApiError>

Create a new NWC client. Generates new keys and returns the connection string. Read more
Source§

async fn update_nwc_client( &self, req: UpdateNwcClientRequest, ) -> Result<UpdateNwcClientResponse, NodeApiError>

Update an existing NWC client’s label. Read more
Source§

async fn delete_nwc_client( &self, req: NostrPkStruct, ) -> Result<Empty, NodeApiError>

Delete an NWC client given its nostr client public key. Read more
Source§

impl Clone for NodeClient

Source§

fn clone(&self) -> NodeClient

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<F, T, U> Apply<F, U> for T
where F: FnOnce(T) -> U,

Source§

fn apply(self, f: F) -> U

Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more