1 Commits
0.1.3 ... main

Author SHA1 Message Date
4c7084563f Make the generated code compatible with nodejs natives modules 2025-12-09 18:02:28 +01:00
4 changed files with 115 additions and 100 deletions

4
Cargo.lock generated
View File

@ -561,7 +561,7 @@ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
[[package]]
name = "jrpc-cli"
version = "0.1.3"
version = "0.1.5"
dependencies = [
"anyhow",
"clap",
@ -607,7 +607,7 @@ checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5"
[[package]]
name = "libjrpc"
version = "0.1.0"
version = "0.1.5"
dependencies = [
"anyhow",
"lazy_static",

View File

@ -1,7 +1,7 @@
[package]
edition = "2021"
name = "jrpc-cli"
version = "0.1.3"
version = "0.1.5"
[workspace]
resolver = "2"

View File

@ -1,6 +1,6 @@
[package]
name = "libjrpc"
version = "0.1.0"
version = "0.1.5"
edition = "2021"
[features]

View File

@ -63,7 +63,10 @@ export class ServiceProvider {
let resListener = this.requests.get(msg.id);
if (!resListener) return; // Ignore wrong responses
if (msg.error) {
if (msg.error.data && msg.error.data.$ == "verification_error") {
if (
msg.error.data &&
msg.error.data.$ == "verification_error"
) {
resListener.err(
new VerificationError(
msg.error.data.type,
@ -112,14 +115,26 @@ export const getRandomBytes = (
return function (n: number) {
var a = new Uint8Array(n);
for (var i = 0; i < n; i += QUOTA) {
crypto.getRandomValues(a.subarray(i, i + Math.min(n - i, QUOTA)));
crypto.getRandomValues(
a.subarray(i, i + Math.min(n - i, QUOTA)),
);
}
return a;
};
}
: function () {
// Node
if (typeof require !== "undefined") {
return require("crypto").randomBytes;
} else {
return (n: number) => {
let a = new Uint8Array(n);
for (let i = 0; i < n; i++) {
a[i] = Math.floor(Math.random() * 256);
}
return a;
};
}
}
)() as (cnt: number) => Uint8Array;