ndk_rust_verifier
Nostr event verifier written in rust compatible with dart_ndk.
Main package: π Dart Nostr Development Kit (NDK)
Setup Web
-
Copy
/pkg/
from/web/pkg/
into yourproject_root/web
folder. =>project_root/web/pkg/
-
Run with
flutter run --web-header=Cross-Origin-Opener-Policy=same-origin --web-header=Cross-Origin-Embedder-Policy=require-corp
project_root/
βββ web/
βββ pkg/
βββ rust_lib_ndk_bg.wasm
βββ rust_lib_ndk.js
!!!
The RustEventVerifier()
object must only be created once!
Use a singleton pattern to ensure only one instance is created
!!!
Performance on Web
The verifier runs in wasm
to enable threading your server must send the following headers:
Cross-Origin-Embedder-Policy: credentialless or require-corp
and
Cross-Origin-Opener-Policy: same-origin
you can read more about it in the flutter docs, flutter rust bridge.
When enabled the verification is done in a background thread/worker.
How to build the rust_verifier from source library development
normal build
flutter_rust_bridge_codegen generate
upgrade
cargo install flutter_rust_bridge_codegen && flutter_rust_bridge_codegen generate
web build
flutter_rust_bridge_codegen build-web
RUN: flutter run --web-header=Cross-Origin-Opener-Policy=same-origin --web-header=Cross-Origin-Embedder-Policy=require-corp