Merge branch 'fix-wasm-compile' into 'main'
Fix veilid-wasm errors so it compiles, emit TypeScript types. See merge request veilid/veilid!124
This commit is contained in:
commit
7b25517a40
@ -161,7 +161,7 @@ pub struct VeilidWASMConfig {
|
|||||||
#[derive(Debug, Deserialize, Serialize)]
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct VeilidRouteBlob {
|
pub struct VeilidRouteBlob {
|
||||||
pub route_id: veilid_core::RouteId,
|
pub route_id: veilid_core::RouteId,
|
||||||
#[serde(with = "veilid_core::json_as_base64")]
|
#[serde(with = "veilid_core::as_human_base64")]
|
||||||
pub blob: Vec<u8>,
|
pub blob: Vec<u8>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -429,7 +429,7 @@ pub fn routing_context_create_dht_record(id: u32, schema: String, kind: u32) ->
|
|||||||
};
|
};
|
||||||
|
|
||||||
let dht_record_descriptor = routing_context
|
let dht_record_descriptor = routing_context
|
||||||
.create_dht_record(crypto_kind, schema)
|
.create_dht_record(schema, crypto_kind)
|
||||||
.await?;
|
.await?;
|
||||||
APIResult::Ok(dht_record_descriptor)
|
APIResult::Ok(dht_record_descriptor)
|
||||||
})
|
})
|
||||||
@ -1347,7 +1347,7 @@ pub fn crypto_decrypt_aead(
|
|||||||
.unwrap()
|
.unwrap()
|
||||||
});
|
});
|
||||||
|
|
||||||
wrap_api_future(async move {
|
wrap_api_future_plain(async move {
|
||||||
let veilid_api = get_veilid_api()?;
|
let veilid_api = get_veilid_api()?;
|
||||||
let crypto = veilid_api.crypto()?;
|
let crypto = veilid_api.crypto()?;
|
||||||
let csv = crypto.get(kind).ok_or_else(|| {
|
let csv = crypto.get(kind).ok_or_else(|| {
|
||||||
@ -1396,7 +1396,7 @@ pub fn crypto_encrypt_aead(
|
|||||||
.unwrap()
|
.unwrap()
|
||||||
});
|
});
|
||||||
|
|
||||||
wrap_api_future(async move {
|
wrap_api_future_plain(async move {
|
||||||
let veilid_api = get_veilid_api()?;
|
let veilid_api = get_veilid_api()?;
|
||||||
let crypto = veilid_api.crypto()?;
|
let crypto = veilid_api.crypto()?;
|
||||||
let csv = crypto.get(kind).ok_or_else(|| {
|
let csv = crypto.get(kind).ok_or_else(|| {
|
||||||
@ -1438,7 +1438,7 @@ pub fn crypto_crypt_no_auth(
|
|||||||
let shared_secret: veilid_core::SharedSecret =
|
let shared_secret: veilid_core::SharedSecret =
|
||||||
veilid_core::deserialize_json(&shared_secret).unwrap();
|
veilid_core::deserialize_json(&shared_secret).unwrap();
|
||||||
|
|
||||||
wrap_api_future(async move {
|
wrap_api_future_plain(async move {
|
||||||
let veilid_api = get_veilid_api()?;
|
let veilid_api = get_veilid_api()?;
|
||||||
let crypto = veilid_api.crypto()?;
|
let crypto = veilid_api.crypto()?;
|
||||||
let csv = crypto.get(kind).ok_or_else(|| {
|
let csv = crypto.get(kind).ok_or_else(|| {
|
||||||
@ -1449,8 +1449,8 @@ pub fn crypto_crypt_no_auth(
|
|||||||
)
|
)
|
||||||
})?;
|
})?;
|
||||||
csv.crypt_in_place_no_auth(&mut body, &nonce, &shared_secret);
|
csv.crypt_in_place_no_auth(&mut body, &nonce, &shared_secret);
|
||||||
let out = data_encoding::BASE64URL_NOPAD.encode(&out);
|
let out = data_encoding::BASE64URL_NOPAD.encode(&body);
|
||||||
APIResult::Ok(body)
|
APIResult::Ok(out)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ if [[ "$1" == "release" ]]; then
|
|||||||
|
|
||||||
cargo build --target wasm32-unknown-unknown --release
|
cargo build --target wasm32-unknown-unknown --release
|
||||||
mkdir -p $OUTPUTDIR
|
mkdir -p $OUTPUTDIR
|
||||||
wasm-bindgen --out-dir $OUTPUTDIR --target web --no-typescript $INPUTDIR/veilid_wasm.wasm
|
wasm-bindgen --out-dir $OUTPUTDIR --target web $INPUTDIR/veilid_wasm.wasm
|
||||||
wasm-strip $OUTPUTDIR/veilid_wasm_bg.wasm
|
wasm-strip $OUTPUTDIR/veilid_wasm_bg.wasm
|
||||||
else
|
else
|
||||||
OUTPUTDIR=../target/wasm32-unknown-unknown/debug/pkg
|
OUTPUTDIR=../target/wasm32-unknown-unknown/debug/pkg
|
||||||
@ -36,7 +36,7 @@ else
|
|||||||
|
|
||||||
RUSTFLAGS="-O -g" cargo build --target wasm32-unknown-unknown
|
RUSTFLAGS="-O -g" cargo build --target wasm32-unknown-unknown
|
||||||
mkdir -p $OUTPUTDIR
|
mkdir -p $OUTPUTDIR
|
||||||
wasm-bindgen --out-dir $OUTPUTDIR --target web --no-typescript --keep-debug --debug $INPUTDIR/veilid_wasm.wasm
|
wasm-bindgen --out-dir $OUTPUTDIR --target web --keep-debug --debug $INPUTDIR/veilid_wasm.wasm
|
||||||
./wasm-sourcemap.py $OUTPUTDIR/veilid_wasm_bg.wasm -o $OUTPUTDIR/veilid_wasm_bg.wasm.map --dwarfdump $DWARFDUMP
|
./wasm-sourcemap.py $OUTPUTDIR/veilid_wasm_bg.wasm -o $OUTPUTDIR/veilid_wasm_bg.wasm.map --dwarfdump $DWARFDUMP
|
||||||
# wasm-strip $OUTPUTDIR/veilid_wasm_bg.wasm
|
# wasm-strip $OUTPUTDIR/veilid_wasm_bg.wasm
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user