浏览代码

Bump up outdated dependencies

develop
Silvestr Predko 2 年前
父节点
当前提交
c4981d06fe

+ 1
- 2
common-api/Cargo.toml 查看文件

@@ -11,8 +11,7 @@ structures should be serializable with "serde" and "borsh"
11 11
 
12 12
 [dependencies]
13 13
 borsh = "0.9"
14
-near-account-id = { version = "0.15" }
15
-near-client = "0.1"
14
+near-client = { git = "https://github.com/Relayz-io/near-client.git" }
16 15
 serde = { version = "1", default-features = false, features = ["derive"] }
17 16
 
18 17
 [dev-dependencies]

+ 1
- 2
common-api/src/api.rs 查看文件

@@ -1,6 +1,5 @@
1 1
 use borsh::{BorshDeserialize, BorshSerialize};
2
-use near_account_id::AccountId;
3
-use near_client::crypto::prelude::*;
2
+use near_client::prelude::*;
4 3
 use serde::{Deserialize, Serialize};
5 4
 use std::{collections::HashSet, time::Duration};
6 5
 

+ 1
- 2
common-api/src/headers.rs 查看文件

@@ -1,5 +1,4 @@
1
-use near_account_id::AccountId;
2
-use near_client::crypto::prelude::*;
1
+use near_client::prelude::*;
3 2
 use serde::{Deserialize, Serialize};
4 3
 
5 4
 pub const SIGNATURE_HEADER_NAME: &str = "signature";

+ 4
- 6
web-client/Cargo.toml 查看文件

@@ -1,6 +1,6 @@
1 1
 [package]
2 2
 name = "web-client"
3
-version = "0.1.0"
3
+version = "0.1.1"
4 4
 edition = "2021"
5 5
 authors = ["silvestr@relayz.io"]
6 6
 description = """
@@ -12,7 +12,7 @@ crate-type = ["cdylib", "rlib"]
12 12
 [dependencies]
13 13
 aes-gcm = "0.10"
14 14
 blake3 = "1.3"
15
-base64 = "0.20"
15
+base64 = "0.21"
16 16
 console_error_panic_hook = "0.1"
17 17
 common-api = { path = "../common-api" }
18 18
 console_log = { version = "0.2", features = ["color"] }
@@ -21,13 +21,11 @@ gloo-timers = { version = "0.2", features = ["futures-core", "futures"] }
21 21
 itertools = "0.10"
22 22
 js-sys = "0.3"
23 23
 log = "0.4"
24
-near-client = "0.1"
25
-near-primitives-core = "0.15"
26
-near-units = "0.2"
24
+near-client = { git = "https://github.com/Relayz-io/near-client.git" }
27 25
 rand = { version = "0.8" }
28 26
 rand_chacha = "0.3"
29 27
 reqwest = { version = "0.11", features = ["json"] }
30
-serde-wasm-bindgen = "0.4"
28
+serde-wasm-bindgen = "0.5"
31 29
 serde = { version = "1", default-features = false, features = ["derive"] }
32 30
 serde_json = { version = "1", default-features = false }
33 31
 uuid = { version = "1.1.2", features = ["v4", "serde", "js"] }

+ 1
- 3
web-client/src/contract.rs 查看文件

@@ -1,7 +1,5 @@
1 1
 use crate::{error::ApiError, Handler};
2
-use near_client::{crypto::prelude::*, prelude::*, Finality};
3
-use near_primitives_core::{hash::CryptoHash, types::AccountId};
4
-use near_units::parse_gas;
2
+use near_client::{core::hash::CryptoHash, near_units::parse_gas, prelude::*};
5 3
 use std::collections::HashSet;
6 4
 use uuid::Uuid;
7 5
 use wasm_bindgen::prelude::*;

+ 1
- 2
web-client/src/error.rs 查看文件

@@ -1,5 +1,4 @@
1
-use near_client::{crypto::Error as CryptoErr, Error};
2
-use near_primitives_core::account::id::ParseAccountError;
1
+use near_client::{core::account::id::ParseAccountError, crypto::Error as CryptoErr, Error};
3 2
 use reqwest::Error as ExchangeError;
4 3
 use serde::{Deserialize, Serialize};
5 4
 use serde_json::Error as SerializationError;

+ 5
- 3
web-client/src/exchange_client.rs 查看文件

@@ -9,8 +9,8 @@ use reqwest::{
9 9
 };
10 10
 
11 11
 use crate::{contract::view_server_key, error::ApiError, Handler};
12
+use base64::prelude::*;
12 13
 use near_client::prelude::*;
13
-use near_primitives_core::types::AccountId;
14 14
 use std::{collections::HashSet, time::Duration};
15 15
 use uuid::Uuid;
16 16
 use wasm_bindgen::JsValue;
@@ -138,7 +138,7 @@ fn signature_header<T: serde::Serialize>(value: &T, signer: &Signer) -> Result<S
138 138
 
139 139
             serde_json::to_vec(&header).map_err(|_| ApiError::CreateSignatureHeader.into())
140 140
         })
141
-        .map(base64::encode)
141
+        .map(|it| BASE64_STANDARD_NO_PAD.encode(it))
142 142
 }
143 143
 
144 144
 async fn verify_response(handler: &Handler, response: Response) -> Result<Vec<u8>> {
@@ -150,7 +150,9 @@ async fn verify_response(handler: &Handler, response: Response) -> Result<Vec<u8
150 150
         .to_str()
151 151
         .map_err(|_| ApiError::VerifySignatureHeader)
152 152
         .and_then(|header_str| {
153
-            base64::decode(header_str).map_err(|_| ApiError::VerifySignatureHeader)
153
+            BASE64_STANDARD_NO_PAD
154
+                .decode(header_str)
155
+                .map_err(|_| ApiError::VerifySignatureHeader)
154 156
         })
155 157
         .and_then(|bytes| {
156 158
             serde_json::from_slice::<SignatureHeader>(&bytes)

+ 13
- 4
web-client/src/lib.rs 查看文件

@@ -8,6 +8,12 @@ pub use contract::{
8 8
     view_moderator_account,
9 9
 };
10 10
 
11
+use near_client::{
12
+    core::{hash::CryptoHash, types::Nonce},
13
+    prelude::*,
14
+};
15
+
16
+use base64::prelude::*;
11 17
 use common_api::api::{ApiResponse, Data, ExchangeMessage};
12 18
 use crypto::{decrypt, encrypt, secret};
13 19
 use error::ApiError;
@@ -17,8 +23,6 @@ use gloo_timers::future::TimeoutFuture;
17 23
 use itertools::Itertools;
18 24
 use js_sys::Promise;
19 25
 use log::{info, warn};
20
-use near_client::prelude::*;
21
-use near_primitives_core::{account::id::AccountId, hash::CryptoHash, types::Nonce};
22 26
 use serde::{Deserialize, Serialize};
23 27
 use std::{collections::HashSet, str::FromStr, sync::Arc};
24 28
 use url::Url;
@@ -142,6 +146,7 @@ impl KeyProvisioner {
142 146
     ///
143 147
     /// - participants_set - The [`js_sys::Set`] represents hash set of participants' keys
144 148
     /// - timeout_ms - The [`u32`] that represents milliseconds that were given not to be exceeded
149
+    #[wasm_bindgen(js_name = initMeeting)]
145 150
     pub fn init_meeting(&self, participants_set: js_sys::Set, timeout_ms: u32) -> Promise {
146 151
         let handler = self.handler();
147 152
         let signer = self.signer();
@@ -184,6 +189,7 @@ impl KeyProvisioner {
184 189
     ///
185 190
     /// - meeting_id - The [`String`] that indicates ID of the meeting room
186 191
     /// - timeout_ms - The [`u32`] that represents milliseconds that were given not to be exceeded
192
+    #[wasm_bindgen(js_name = sendKeys)]
187 193
     pub fn send_keys(&self, meeting_id: String, timeout_ms: u32) -> Promise {
188 194
         let handler = self.handler();
189 195
         let signer = self.signer();
@@ -239,7 +245,9 @@ impl KeyProvisioner {
239 245
                 exchange(&handler, &signer, meet_id, messages).await?;
240 246
             }
241 247
 
242
-            Ok(JsValue::from_str(&base64::encode(handler.secret)))
248
+            Ok(JsValue::from_str(
249
+                &BASE64_STANDARD_NO_PAD.encode(handler.secret),
250
+            ))
243 251
         };
244 252
 
245 253
         wasm_bindgen_futures::future_to_promise(async move {
@@ -258,6 +266,7 @@ impl KeyProvisioner {
258 266
     ///
259 267
     /// - meeting_id - The [`String`] that indicates ID of the meeting room
260 268
     /// - timeout_ms - The [`u32`] that represents milliseconds that were given not to be exceeded
269
+    #[wasm_bindgen(js_name = getKey)]
261 270
     pub fn get_key(&self, meeting_id: String, timeout_ms: u32) -> Promise {
262 271
         let handler = self.handler();
263 272
         let signer = self.signer();
@@ -269,7 +278,7 @@ impl KeyProvisioner {
269 278
                 if let ApiResponse::Success(data) = receive(&handler, &signer, meet_id).await? {
270 279
                     let secret =
271 280
                         decrypt(signer.secret_key(), data.moderator_pk, meet_id, data.data)?;
272
-                    return Ok(JsValue::from_str(&base64::encode(secret)));
281
+                    return Ok(JsValue::from_str(&BASE64_STANDARD_NO_PAD.encode(secret)));
273 282
                 }
274 283
             }
275 284
         };

+ 1
- 2
web-client/tests/integration.rs 查看文件

@@ -1,5 +1,4 @@
1
-use near_client::{crypto::prelude::*, prelude::*, Finality};
2
-use near_primitives_core::account::id::AccountId;
1
+use near_client::{near_units, prelude::*};
3 2
 use serde::{Deserialize, Serialize};
4 3
 use std::str::FromStr;
5 4
 use url::Url;

正在加载...
取消
保存