ndk_rust_verifier

Nostr event verifier written in rust compatible with dart_ndk.

Main package: πŸ”— Dart Nostr Development Kit (NDK)

Setup Web

  1. Copy /pkg/ from /web/pkg/ into your project_root/web folder. => project_root/web/pkg/

  2. 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