Open Evanfeenstra opened 2 years ago
@tomastiminskas here are some assets to try getting running on kotlin. I used the UniFFI project to generate Kotlin bindings. Not sure how to load the binaries into Kotlin... here's a link https://mozilla.github.io/uniffi-rs/kotlin/gradle.html (but i dont think u need to integrate "compile time bindings" like that link explains, since we already have the bindings here:
Generated kotlin bindings: https://github.com/stakwork/sphinx-key/blob/master/crypter-ffi/src/uniffi/crypter/crypter.kt
ok @tomastiminskas here are the binaries for android: https://github.com/stakwork/sphinx-key/releases/tag/v0.1.1
Here you can see the methods and test: https://github.com/stakwork/sphinx-key/blob/master/crypter-ffi/src/lib.rs
Here's an example of someone using UniFFI on android: https://github.com/imWildCat/uniffi-rs-fullstack-examples/tree/main/hello/platforms/android/UniffiRustExample
let me know how it goes!
@tomastiminskas for ios there is a universal-crypter.a
attached to the release, and here you can find crypter.swift
, crypterFFI.h
, and crypterFFI.modulemap
files https://github.com/stakwork/sphinx-key/tree/master/crypter-ffi/src (not sure what files are needed for ios)
@tomastiminskas i made a little hardware emulator server to test the seed passing process. You can install Rust and in this repo run cargo run --bin config-server
, then test from the app:
{
seed: "encrypted_seed",
ssid: "xxx",
pass: "xxx",
broker: "xxx",
pubkey: "my_ecdh_pubkey",
network: "regtest",
}
Let's wrap up
ecdh
andchacha20poly1305
in a rust binary and put it inside Swift and Kotlin! First thing to do with this is securely pass the VLS seed from the phone to the hardware.ecdh
(using the Rust plugin)chacha20poly1305
(using the Rust plugin)blogs about Rust-on-mobile:
@tomastiminskas what do you know about wrapping Rust inside swift/kotlin?