-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(grpc) add simple multisig (#211)
* Update to latest tofn * rename ServiceKv->KvManager * Init kv manager out of gg20 service * Rename gg20.kv->gg20.kv_manager * Handle mnemonic from kv manager * Move mnemonic mod at the root level * implement multisig service * small changes in handle keygen * Add basic multisig keygen test * rm wild import * Add basic multisig sign test * Use local tofn * Use updated `encoded_verifying_key()` * update protobuf * Add some todos * point to remote tofn * throw error if internal handlers don't succeed * Use single-char shorts https://docs.rs/clap/2.33.0/clap/struct.Arg.html#method.short Sadly "m" is reserved by mnemonic * Add TODO for better service shutdown * use default port values for default config * remove comment * move type declaration after use * * better comment in main.rs Co-authored-by: Gus Gutoski <[email protected]> * point to tofn main * Revert "better comment in main.rs" This reverts commit a58cf04. * add party-uid in sign * spin up gg20 and multisig services under the same grpc server * use protobuf main * Add comments in keygen and sign * log keygen and sign result * fix: query key_uid instead or party_uid duh * update tofn main * add tests for multisig * Fix message digest size in tests * Update src/main.rs Co-authored-by: Gus Gutoski <[email protected]> * [no ci] add some comments in tests * [no ci] Update src/multisig/service.rs Co-authored-by: Milap Sheth <[email protected]> * [no ci] Update src/multisig/service.rs Co-authored-by: Milap Sheth <[email protected]> Co-authored-by: Gus Gutoski <[email protected]> Co-authored-by: Milap Sheth <[email protected]>
- Loading branch information
1 parent
117a35b
commit 0a70c4b
Showing
31 changed files
with
612 additions
and
176 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,20 @@ | ||
//! This mod includes the service implementation derived from | ||
use super::mnemonic::FileIo; | ||
use super::proto; | ||
use super::types::{ServiceKv, DEFAULT_KV_NAME}; | ||
use crate::config::Config; | ||
use crate::encrypted_sled::Password; | ||
use std::path::PathBuf; | ||
|
||
// error handling | ||
use crate::TofndResult; | ||
use anyhow::anyhow; | ||
use crate::kv_manager::KvManager; | ||
|
||
#[cfg(feature = "malicious")] | ||
pub mod malicious; | ||
|
||
/// Gg20Service | ||
#[derive(Clone)] | ||
pub struct Gg20Service { | ||
pub(super) kv: ServiceKv, | ||
pub(super) io: FileIo, | ||
pub(super) kv_manager: KvManager, | ||
pub(super) cfg: Config, | ||
} | ||
|
||
/// create a new Gg20 gRPC server | ||
pub async fn new_service( | ||
cfg: Config, | ||
password: Password, | ||
) -> TofndResult<impl proto::gg20_server::Gg20> { | ||
let kv = ServiceKv::new(&cfg.tofnd_path, DEFAULT_KV_NAME, password) | ||
.map_err(|err| anyhow!("Shares KV store error: {}", err))?; | ||
|
||
let io = FileIo::new(PathBuf::from(&cfg.tofnd_path)); | ||
|
||
let gg20 = Gg20Service { kv, io, cfg }; | ||
|
||
gg20.handle_mnemonic().await?; | ||
Ok(gg20) | ||
pub fn new_service(cfg: Config, kv_manager: KvManager) -> impl proto::gg20_server::Gg20 { | ||
Gg20Service { kv_manager, cfg } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.