Key generation, saving and loading works.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
use bft_crdt_derive::add_crdt_fields;
|
||||
|
||||
use bft_json_crdt::{
|
||||
@@ -10,6 +12,8 @@ use serde::{Deserialize, Serialize};
|
||||
use serde_json::{json, Value};
|
||||
use websockets::WebSocket;
|
||||
|
||||
use crate::keys;
|
||||
|
||||
#[add_crdt_fields]
|
||||
#[derive(Clone, CrdtNode, Serialize, Deserialize)]
|
||||
pub(crate) struct CrdtList {
|
||||
@@ -25,8 +29,9 @@ pub(crate) struct Transaction {
|
||||
amount: f64,
|
||||
}
|
||||
|
||||
pub(crate) fn new() -> (BaseCrdt<CrdtList>, Ed25519KeyPair) {
|
||||
let keys = make_keypair();
|
||||
pub(crate) fn new(side_dir: PathBuf) -> (BaseCrdt<CrdtList>, Ed25519KeyPair) {
|
||||
let keys = keys::load_from_file(side_dir);
|
||||
// let keys = make_keypair();
|
||||
let bft_crdt = BaseCrdt::<CrdtList>::new(&keys);
|
||||
println!("Author is {}", keys.public().to_string());
|
||||
(bft_crdt, keys)
|
||||
|
||||
Reference in New Issue
Block a user