GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com β€” GitHub - enmand/dwn-rs: Store implementation for dwn-sdk-js

BranchesTags
Open more actions menu

Latest commit

 

History

344 Commits
344 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
crates
crates
 
 
.editorconfig
.editorconfig
 
 
.envrc
.envrc
 
 
.gitignore
.gitignore
 
 
Cargo.lock
Cargo.lock
 
 
Cargo.toml
Cargo.toml
 
 
LICENSE
LICENSE
 
 
Makefile.toml
Makefile.toml
 
 
README.md
README.md
 
 
flake.lock
flake.lock
 
 
flake.nix
flake.nix
 
 
pkgx.yaml
pkgx.yaml
 
 

Repository files navigation

dwn-rs πŸŒπŸš€

dwn-rs is a Rust-based implementation of the Decentralized Web Node (DWN) specification. This library provides the core traits and implementations necessary to interact with DWN services, designed to be used by other libraries and applications. It can be compiled for WebAssembly for use in web browsers or run natively.

Notice

This project is no longer actively maintained. In general, it has migrated to enboxorg/enbox-rust-core. All new development will happen there under the Enbox banner.

Project Description πŸ“

dwn-rs aims to facilitate the development of decentralized web applications and services by providing a robust and easy-to-use DWN core library. Key features include:

  • Core DWN types and traits
  • Compatibility with WebAssembly and native environments
  • Integration with the dwn-sdk-js for JavaScript interoperability

Requirements πŸ› οΈ

  • Rust 1.75.0+
  • cargo-make
  • wasm-pack

To install cargo-make, run:

$ cargo install cargo-make

To install wasm-pack, run:

$ cargo install wasm-pack

Building and Running 🚧

Building for WebAssembly 🌐

To compile the project for WebAssembly, execute the following command:

$ cargo make build-wasm

Running in Pure Rust πŸ¦€ (WIP)

To build and run the project in a native Rust environment, use:

$ cargo build
$ cargo run

Integration with dwn-sdk-js πŸŒπŸ—„οΈ

Once you have compiled the project to WebAssembly, you can use the generated .wasm file in your dwn-sdk-js project to implement a store. Here's how to do it:

  1. Compile the Rust project to WASM:

Make sure you have built the WASM file using the following command:

$ cargo make build-wasm
  1. Copy the WASM file to your dwn-sdk-js project:

The compiled WASM file is usually located in the crates/dwn-rs-wasm/pks/ directory. Copy this file to an appropriate location in your dwn-sdk-js project.

  1. Initialize the WASM stores in your JavaScript code:

Use the following code to load and utilize the WASM file in your JavaScript project:

import {
  SurrealDataStore,
  SurrealMessageStore,
  SurrealEventLog,
  SurrealResumableTaskStore,
  EventStream,
  init_tracing,
  TracingLevel,
} from "../pkg/index.js";

// only needed in Node environments
import WebSocket from "isomorphic-ws";
global.WebSocket = WebSocket;

// only required if you want logging/tracing to the console
init_tracing(TracingLevel.Error);

let messageStore = new SurrealMessageStore();
await messageStore.connect("mem://");

let dataStore = new SurrealDataStore();
await dataStore.connect("mem://");

let eventLog = new SurrealEventLog();
await eventLog.connect("mem://");

let resumableTaskStore = new SurrealResumableTaskStore();
await t.connect("mem://");

let eventStream = new EventStream();

const dwn = await Dwn.create({
  messageStore,
  dataStore,
  eventLog,
  resumableTaskStore,
  eventStream,
});

To connect to a remove SurrealDB server, use a connection string in the form: ws://<username>:<password>@<host>:<port>/<namespace>. The auth type (root or namespace) can be given with ?auth=<type>. dwn-rs requires the full namespace for tenanted operations.

  1. Run your project:

Ensure that your project is set up to serve the WASM file correctly and run your project as usual.

Roadmap πŸ—ΊοΈ

Core Features

  • Implement core DWN types and traits
  • Compatibility with WebAssembly
  • Integration with dwn-sdk-js
    • Message store
    • Data store
    • Event Log
    • Event Stream
  • DWN Message processing
  • JSONAPI service
  • Light "DWN" proxy

Functional Requirements

  • Data sharing protocols

Contributions 🀝

We welcome contributions from the community! Please check out our contribution guidelines in the CONTRIBUTING.md file and feel free to open issues or submit pull requests.

License πŸ“œ

This project is licensed under the Apache License. See the LICENSE file for more details.

Acknowledgements πŸ™

Thanks to the Decentralized Identity Foundation (DIF) and the contributors to the DWN specification and companion guide for their invaluable resources and guidance.

About

Store implementation for dwn-sdk-js

Resources

Readme
Apache-2.0 license
Activity

Stars

2 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402792 β€” GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800Γ—600. No cookies required.