sine-fdn / tandem Goto Github PK
View Code? Open in Web Editor NEWA maliciously secure two-party computation engine which is embeddable and accessible
License: MIT License
A maliciously secure two-party computation engine which is embeddable and accessible
License: MIT License
First of all, thanks for such an amazing project, I have enjoyed thinking about how to implement this in a real-world case, however, running the example of a smart cookie and modifying the Tandem.toml
to include a different key in the init
and after the log_interest
this should fail with LogResult::InvalidSignature
but it doesn't, I'd like to know if its something i'm doing is wrong!
thanks in advance.
[handlers.init]
_ = "SigningKey { key: [ 1u8, 2u8, 4u8, 4u8, 5u8, 6u8, 7u8, 8u8, 9u8, 10u8, 11u8, 12u8, 13u8, 14u8, 15u8, 17u8] }"
[handlers.log_interest]
article1 = "WebsiteVisit { key: SigningKey { key: [1u8; 16] }, interest: UserInterest::Luxury }"
article2 = "WebsiteVisit { key: SigningKey { key: [1u8; 16] }, interest: UserInterest::Politics }"
article3 = "WebsiteVisit { key: SigningKey { key: [1u8; 16] }, interest: UserInterest::Cars }"
article4 = "WebsiteVisit { key: SigningKey { key: [1u8; 16] }, interest: UserInterest::Sports }"
article5 = "WebsiteVisit { key: SigningKey { key: [255u8; 16] }, interest: UserInterest::Politics }"
[handlers.decide_ad]
_ = "SigningKey { key: [ 1u8, 2u8, 3u8, 4u8, 5u8, 6u8, 7u8, 8u8, 9u8, 10u8, 11u8, 12u8, 13u8, 14u8, 15u8, 16u8] }"
I modified this test to include article5
as log_interest which have a different signature that was used when was called the init
function
#![cfg(target_arch = "wasm32")]
// use std::{include_str, println};
use js_sys::Reflect;
use tandem_http_client::{compute, MpcData, MpcProgram};
use wasm_bindgen::prelude::*;
use wasm_bindgen_test::wasm_bindgen_test;
#[cfg(target_arch = "wasm32")]
wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);
#[wasm_bindgen]
extern "C" {
// Use `js_namespace` here to bind `console.log(..)` instead of just
// `log(..)`
#[wasm_bindgen(js_namespace = console)]
fn log(s: &str);
}
#[wasm_bindgen_test]
async fn test() {
console_log::init().expect("Could not init console_log");
let url = "http://127.0.0.1:8000";
let smart_cookie_prg = include_str!("smart_cookie_setup/program.garble.rs");
let function = "init".to_string();
let program = MpcProgram::new(smart_cookie_prg.to_string(), function)
.expect("Could not parse source code");
let metadata = "_";
let my_input =
MpcData::from_string(&program, "()".to_string()).unwrap_or_else(|e| panic!("{e}"));
let mut user_state = compute(url.to_string(), metadata.to_string(), program, my_input)
.await
.unwrap_or_else(|e| panic!("{e}"));
log(user_state.to_literal_string().as_ref());
let function = "log_interest".to_string();
let program = MpcProgram::new(smart_cookie_prg.to_string(), function)
.expect("Could not parse source code");
let metadata = "article5";
let log_result = compute(
url.to_string(),
metadata.to_string(),
program.clone(),
user_state,
)
.await
.unwrap_or_else(|e| panic!("{e}"))
.to_literal()
.unwrap_or_else(|e| panic!("{e}"));
let log_result = Reflect::get(&log_result, &"Enum".into()).unwrap_or_else(|e| panic!("{e:?}"));
let log_result_enum_name = Reflect::get_u32(&log_result, 0).unwrap_or_else(|e| panic!("{e:?}"));
assert_eq!(log_result_enum_name, JsValue::from("LogResult"));
let log_result_enum_variant =
Reflect::get_u32(&log_result, 1).unwrap_or_else(|e| panic!("{e:?}"));
assert_eq!(log_result_enum_variant, JsValue::from("Ok"));
let log_result = Reflect::get_u32(&log_result, 2).unwrap_or_else(|e| panic!("{e:?}"));
let log_result = Reflect::get(&log_result, &"Tuple".into()).unwrap_or_else(|e| panic!("{e:?}"));
let log_result = Reflect::get_u32(&log_result, 0).unwrap_or_else(|e| panic!("{e:?}"));
user_state = MpcData::from_object(&program, log_result).unwrap_or_else(|e| panic!("{e}"));
let function = "decide_ad".to_string();
let program = MpcProgram::new(smart_cookie_prg.to_string(), function)
.expect("Could not parse source code");
let metadata = "_";
let ad_decision = compute(url.to_string(), metadata.to_string(), program, user_state)
.await
.unwrap_or_else(|e| panic!("{e}"));
log(ad_decision.to_literal_string().as_ref());
// assert!(ad_decision.to_literal_string().contains("Sports"));
}
wee_alloc is Unmaintained
Details | |
---|---|
Status | unmaintained |
Package | wee_alloc |
Version | 0.4.5 |
URL | rustwasm/wee_alloc#107 |
Date | 2022-05-11 |
Two of the maintainers have indicated that the crate may not be maintained.
The crate has open issues including memory leaks and may not be suitable for production use.
It may be best to switch to the default Rust standard allocator on wasm32 targets.
Last release seems to have been three years ago.
The below list has not been vetted in any way and may or may not contain alternatives;
The below may serve to educate on potential future alternatives:
See advisory page for additional details.
Now that the repository is public, we should start thinking about how we want to handle a version mismatch between the client and server. Since the playground (or rather the echo server) is auto-deployed whenever something changes on main, everyone using a previously installed tandem_http_client
will simply get a very confusing error message whenever a change results in incompatibility:
tandem_http_client --function main --input 3u8 --metadata 7u8 add.garble.rs
Error: MaxRetriesExceeded([ServerError("{\"error\":\"BincodeError\"}"), ServerError("{\"error\":\"BincodeError\"}"), ServerError("{\"error\":\"BincodeError\"}"), ServerError("{\"error\":\"BincodeError\"}"), ServerError("{\"error\":\"BincodeError\"}"), ServerError("{\"error\":\"BincodeError\"}"), ServerError("{\"error\":\"BincodeError\"}"), ServerError("{\"error\":\"BincodeError\"}"), ServerError("{\"error\":\"BincodeError\"}"), ServerError("{\"error\":\"BincodeError\"}")])
I would propose 2 changes:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.