-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use direct call to
holo-client
for jurisdictions (#198)
Replace hpos-api call with direct call to holo-client for jurisdictions > NB: This PR is associated with holo-nixpkgs pr #2255 and should be merged in once it is, to avoid any regressions. --------- Co-authored-by: Zeeshan Abid <[email protected]>
- Loading branch information
1 parent
d98152f
commit 5b169bd
Showing
9 changed files
with
255 additions
and
45 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -4,3 +4,4 @@ tmp | |
.cargo | ||
logs | ||
.vscode | ||
.env |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
use super::hpos_agent::get_signing_admin; | ||
use anyhow::{Context, Result}; | ||
use base64::encode_config; | ||
use ed25519_dalek::*; | ||
use holochain_types::prelude::ExternIO; | ||
use hpos_config_core::public_key; | ||
|
||
#[derive(Clone, Debug)] | ||
pub struct HostKeys { | ||
pub email: String, | ||
keypair: SigningKey, | ||
pub pubkey_base36: String, | ||
pub holoport_id: String, | ||
} | ||
|
||
impl HostKeys { | ||
pub async fn new() -> Result<Self> { | ||
let (keypair, email) = get_signing_admin().await?; | ||
let pubkey_base36 = public_key::to_holochain_encoded_agent_key(&keypair.verifying_key()); | ||
let holoport_id = public_key::to_base36_id(&keypair.verifying_key()); | ||
|
||
Ok(Self { | ||
email, | ||
keypair, | ||
pubkey_base36, | ||
holoport_id, | ||
}) | ||
} | ||
|
||
pub async fn sign(&self, payload: ExternIO) -> Result<String> { | ||
let signature = self | ||
.keypair | ||
.try_sign(payload.as_bytes()) | ||
.context("Failed to sign payload")?; | ||
|
||
Ok(encode_config( | ||
&signature.to_bytes()[..], | ||
base64::STANDARD_NO_PAD, | ||
)) | ||
} | ||
} |
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.