23 releases (8 breaking)

new 0.9.2 May 23, 2024
0.9.0 Mar 25, 2024
0.4.4 Dec 3, 2023
0.4.3 Nov 29, 2023
0.1.0 Dec 15, 2022

#44 in WebAssembly

Download history 346/week @ 2024-02-02 188/week @ 2024-02-09 665/week @ 2024-02-16 903/week @ 2024-02-23 400/week @ 2024-03-01 498/week @ 2024-03-08 607/week @ 2024-03-15 742/week @ 2024-03-22 318/week @ 2024-03-29 326/week @ 2024-04-05 172/week @ 2024-04-12 237/week @ 2024-04-19 341/week @ 2024-04-26 83/week @ 2024-05-03 507/week @ 2024-05-10 941/week @ 2024-05-17

1,944 downloads per month
Used in vercre-wallet

Apache-2.0

355KB
3.5K SLoC

Rust 3K SLoC // 0.0% comments TypeScript 337 SLoC // 0.1% comments Swift 35 SLoC // 0.1% comments Java 18 SLoC

Crux HTTP capability

Crate version Docs

This crate contains the Http capability, which can be used to ask the Shell to make an HTTP request.

For an example of how to use the capability, see the integration test.

The code for this was largely copied from surf with some modifications made to fit into the crux paradigm.

Getting Started

Add crux_http as a dependency.

Additionally, if using crux type generation, include this line in your shared types generation script (e.g. shared_types/build.rs):

gen.register_type::<HttpError>()?;

About Crux Capabilities

Crux capabilities teach Crux how to interact with the shell when performing side effects. They do the following:

  1. define a Request struct to instruct the Shell how to perform the side effect on behalf of the Core
  2. define a Response struct to hold the data returned by the Shell after the side effect has completed
  3. declare one or more convenience methods for invoking the Shell's capability, each of which creates a Command (describing the effect and its continuation) that Crux can "execute"

Note that because Swift has no namespacing, there is currently a requirement to ensure that Request and Response are unambiguously named (e.g. HttpRequest and HttpResponse).

Dependencies

~8MB
~174K SLoC