Skip to content

Commit 472d42e

Browse files
committed
wip
1 parent 130a466 commit 472d42e

File tree

4 files changed

+45
-0
lines changed

4 files changed

+45
-0
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ members = [
1919
# crates.io deps
2020
anyhow = "1.0"
2121
async-trait = "0.1"
22+
ed25519-dalek = "2.1"
2223
everscale-types = { git = "https://github.com/broxus/everscale-types.git", features = ["tycho", "abi"] }
2324
futures-util = "0.3"
2425
hex = { version = "0.4" }

core/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ license.workspace = true
1111
[dependencies]
1212
anyhow = { workspace = true }
1313
async-trait = { workspace = true }
14+
ed25519-dalek = { workspace = true }
1415
everscale-types = { workspace = true }
1516
futures-util = { workspace = true }
1617
num-bigint = {workspace = true}

core/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ mod error;
33
pub mod models;
44
pub mod transactions;
55
pub mod transport;
6+
mod message;

core/src/message/mod.rs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
use anyhow::Result;
2+
use everscale_types::cell::HashBytes;
3+
use everscale_types::models::OwnedMessage;
4+
5+
pub struct SignedExternalMessage {
6+
pub inner: OwnedMessage,
7+
pub expire_at: u32,
8+
}
9+
10+
pub struct UnsignedExternalMessage {
11+
pub hash: HashBytes,
12+
pub expire_at: u32,
13+
}
14+
15+
impl UnsignedExternalMessage {
16+
pub fn sign(&self, signing_key: ed25519_dalek::SigningKey, sigrature_id: Option<u32>) -> SignedExternalMessage {
17+
18+
}
19+
20+
pub fn with_signature(&self, signature: ed25519_dalek::Signature) -> SignedExternalMessage {
21+
22+
}
23+
}
24+
25+
26+
pub struct UnsignedBody {
27+
pub hash: HashBytes,
28+
pub expire_at: u32,
29+
}
30+
31+
impl UnsignedBody {
32+
33+
fn fill_signature(&self, signature: Option<&[u8]>) -> <Cell> {
34+
let payload =
35+
everscale_types::models::Fun::fill_sign(&self.abi_version, signature, None, self.payload.clone())
36+
.handle_runtime_error()?;
37+
payload.into_cell().handle_runtime_error().map(Cell)
38+
}
39+
pub fn sign(&self, signing_key: ed25519_dalek::SigningKey, sigrature_id: Option<u32>) -> Result<everscale_types::cell::Cell> {
40+
41+
}
42+
}

0 commit comments

Comments
 (0)