Opa.Wasm
0.90.0
dotnet add package Opa.Wasm --version 0.90.0
NuGet\Install-Package Opa.Wasm -Version 0.90.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Opa.Wasm" Version="0.90.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Opa.Wasm --version 0.90.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Opa.Wasm, 0.90.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Opa.Wasm as a Cake Addin #addin nuget:?package=Opa.Wasm&version=0.90.0 // Install Opa.Wasm as a Cake Tool #tool nuget:?package=Opa.Wasm&version=0.90.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
About
Built and tested against Open Policy Agent v1.0.0
Features
- Simple API on top of Open Policy Agent Web Assembly ABI
- Support for advanced scenarios (runtime and module caching)
- Fast execution path on ABI version 1.2 and greater
- Ability to define builtin0-4
- Extended error messages via opa_abort / Wasmtime.TrapException
Usage
The simplest use case - load a WASM module into a policy object, pass data and evaluate based on input:
using var module = OpaPolicyModule.Load("example.wasm");
using var opaPolicy = module.CreatePolicyInstance();
// Use the typed methods to interact with the policy instance
opaPolicy.SetData(new { world = "world" });
var output = opaPolicy.Evaluate<bool>(new { message = "world" });
// Alternatively, send raw Json for the utmost control (advanced scenario)
opaPolicy.SetDataJson(@"{""world"": ""world""}");
string output = opaPolicy.EvaluateJson(@"{""message"": ""world""}");
For higher-performance scenarios, you can keep the engine as well as the loaded WASM module around. Note that one engine can handle multiple modules, and the OpaPolicyModule keeps the correct reference to the engine to guarantee thread safety:
using var engine = OpaPolicyModule.CreateEngine();
using var opaPolicyModule = OpaPolicyModule.Load("example.wasm", engine);
// Now instantiate as many policy objects you want on top of the engine & module
using var opaPolicy = opaPolicyModule.CreatePolicyInstance();
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- System.Text.Json (>= 8.0.5)
- Wasmtime (>= 22.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.90.0 | 76 | 12/24/2024 |
0.82.0 | 7,631 | 3/17/2024 |
0.81.0 | 1,309 | 1/3/2024 |
0.80.0 | 24,579 | 5/26/2023 |
0.70.0 | 36,391 | 1/29/2023 |
0.60.0 | 391 | 12/9/2022 |
0.50.0 | 397 | 11/10/2022 |
0.40.0 | 552 | 9/27/2022 |
0.33.0 | 437 | 8/30/2022 |
0.32.0 | 484 | 7/30/2022 |
0.31.0 | 2,423 | 4/5/2022 |
0.30.0 | 518 | 3/10/2022 |
0.23.0 | 16,744 | 2/7/2022 |
0.22.0 | 352 | 1/8/2022 |
0.21.0 | 349 | 1/5/2022 |
0.20.0 | 6,865 | 11/18/2021 |
0.19.0 | 403 | 11/7/2021 |
0.18.0 | 404 | 11/2/2021 |
0.17.0 | 400 | 10/6/2021 |
0.16.0 | 373 | 9/18/2021 |
0.15.0 | 391 | 9/1/2021 |
0.14.0 | 45,037 | 6/16/2021 |
0.13.0 | 463 | 5/22/2021 |
0.12.0 | 397 | 4/27/2021 |
0.11.0 | 401 | 3/20/2021 |
0.9.0 | 1,225 | 1/24/2021 |
0.8.0 | 455 | 1/21/2021 |
0.7.0 | 395 | 1/15/2021 |
0.6.0 | 1,260 | 11/7/2020 |
0.5.0 | 523 | 8/3/2020 |
0.4.0 | 529 | 7/2/2020 |
0.3.0 | 532 | 7/2/2020 |
0.2.1 | 543 | 3/9/2020 |
0.2.0 | 538 | 3/9/2020 |
0.1.0 | 815 | 11/19/2019 |