18 releases (8 breaking)

0.9.0 Mar 25, 2024
0.8.0 Feb 26, 2024
0.4.4 Dec 3, 2023
0.4.3 Nov 29, 2023
0.1.0 Dec 15, 2022

#54 in WebAssembly

Download history 77/week @ 2023-12-22 12/week @ 2023-12-29 170/week @ 2024-01-05 100/week @ 2024-01-12 347/week @ 2024-01-19 276/week @ 2024-01-26 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 310/week @ 2024-04-05

2,014 downloads per month
Used in vercre-wallet

Apache-2.0

350KB
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

~9MB
~191K SLoC