Skip to content
R1NCPublic

About

A cross-platform framework based on Rust, supporting biz dev via Lua & JS.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

Β 

History

92 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

DynRS

A cross-platform framework based on Rust, supporting biz dev via Lua & JS.

πŸ‘‰ The modern C++ counterpart: DynXX.

API Docs & Test Reports zread
Windows Linux macOS iOS Android OHOS WASM

πŸ“‹ Progress

Module Core C ABI Unit tests Compared with DynXX
Crypto βœ”οΈ βœ”οΈ βœ”οΈ
  • RSA encryption takes PKCS#1 and OAEP, the only paddings OpenSSL 3.x accepts
  • DynXX answers empty for the other padding ids too
Network βœ”οΈ βœ”οΈ βœ”οΈ
  • get / post / download / upload instead of one request
  • CA path, proxy and DNS overrides included
SQLite βœ”οΈ βœ”οΈ βœ”οΈ
Key-Value βœ”οΈ βœ”οΈ βœ”οΈ
  • one store key can hold one value per type, where DynXX's MMKV keeps a single typed value per key
  • DynXX's 256 byte key limit is not enforced
Zip βœ”οΈ βœ”οΈ βœ”οΈ
  • one-shot compress / decompress only
  • DynXX's streaming zip_init / input / process_do API, its FILE * variants and the compression modes are not ported
Lua βœ”οΈ βœ”οΈ βœ”οΈ addTimer / pollTimers / removeTimer are a DynRS addition, DynXX has no timer API
JS (QuickJS) βœ”οΈ βœ”οΈ βœ”οΈ same three timer functions as the Lua bridge
Platform bridges (JNI / ArkTS / …) Not started
  • βœ”οΈ : Done;
  • ❌ : To do;

Unfixed advisory: RSA decryption is not constant time, the rsa crate has no patch for the Marvin timing sidechannel (RUSTSEC-2023-0071). That advisory does not cover the OpenSSL RSA DynXX uses.

↔️ The C ABI

Every exported function returns a status, writes its results through out-parameters, and catches panics at the boundary β€” an escaping panic would abort the host, so it is reported as Panicked.

Status Meaning
Ok (0) The call did what it says.
Empty (1) Nothing to report, and not an error β€” no value for this key, no current row, no body. Kept apart from Ok so a zero is never read as data.
InvalidArgument (2) The input was rejected: a null string, non-UTF-8 text, an empty key.
InvalidHandle (3) The handle is null or cannot answer yet, e.g. a result set before ngenrs_db_next_row.
Failed (4) The operation failed: network, store, script engine.
Panicked (5) The body panicked.

Out-parameters are untouched when a call is refused. Read them only after the status you expect. Where the status alone is not enough β€” a load error, an unreadable body β€” the reason goes to an err_out C string.

Memory ownership

The release function follows the out-parameter the result arrived in:

Result arrived as Release with
A byte buffer plus a length (out / len_out) ngenrs_free_bytes(ptr)
A *mut c_char (out, err_out, header entries) ngenrs_free_cstr(ptr)
A key list from ngenrs_kv_all_keys ngenrs_kv_free_keys(keys)
A handle from ngenrs_*_open / _init / _query the matching ngenrs_*_close / _release / _free_*
An HTTP response ngenrs_http_release_rsp(rsp)

Data is bytes, not C strings

Data β€” script returns, text columns, HTTP bodies, store keys β€” crosses as a buffer plus its length. Such a value may contain a NUL, which a C string cannot carry: it would arrive truncated to nothing, indistinguishable from "no value". An empty value is a real allocation of length zero; Empty is the answer with no buffer at all.

Only strings this library writes itself β€” error messages, PEM text, header names and values β€” come back as C strings.

πŸ› οΈ Build

  • Rust 1.90+ (edition 2024). The floor is set by the dependency graph, not by the edition.
  • libclang for bindgen (via libquickjs-ng-sys); set LIBCLANG_PATH when it is not on PATH.
  • A C toolchain for the vendored QuickJS, Lua and SQLite.
cargo build                                 # the static library, plus the qjsc tool
cargo test
cargo fmt --all --check
cargo clippy --workspace --all-targets --locked -- -D warnings
cargo xtask build --target wasm --release   # also: android, ohos, ios (each needs its SDK)

πŸ§ͺ Tests

  • src/core/* β€” behaviour of the portable layer, mirroring DynXX's gtest coverage.
  • src/c/* β€” ABI contract tests only: null arguments, empty results, ownership.

About

A cross-platform framework based on Rust, supporting biz dev via Lua & JS.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Used by

Contributors

Languages