Opa.Wasm
0.50.0
See the version list below for details.
dotnet add package Opa.Wasm --version 0.50.0
NuGet\Install-Package Opa.Wasm -Version 0.50.0
<PackageReference Include="Opa.Wasm" Version="0.50.0" />
paket add Opa.Wasm --version 0.50.0
#r "nuget: Opa.Wasm, 0.50.0"
// Install Opa.Wasm as a Cake Addin #addin nuget:?package=Opa.Wasm&version=0.50.0 // Install Opa.Wasm as a Cake Tool #tool nuget:?package=Opa.Wasm&version=0.50.0
About
Built and tested against Open Policy Agent v0.46.1.
Note: 0.30 and higher changed the target framework to net6.0 (from netstandard2.1) because Wasmtime changed its TFM.
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 | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net6.0
- System.Text.Json (>= 6.0.7)
- Wasmtime (>= 2.0.1)
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,741 | 3/17/2024 |
0.81.0 | 1,309 | 1/3/2024 |
0.80.0 | 24,582 | 5/26/2023 |
0.70.0 | 36,391 | 1/29/2023 |
0.60.0 | 391 | 12/9/2022 |
0.50.0 | 398 | 11/10/2022 |
0.40.0 | 553 | 9/27/2022 |
0.33.0 | 438 | 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,040 | 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 |