spaces: a member wears a key minted for that room alone, so a roster stops naming personas
This commit is contained in:
1 parent
b3c121fa94
commit
67e52697b2
6 files changed
+462
-58
No files matched your search
@@ -12,7 +12,7 @@
|
||||
//! `profile_sign_payload` / `asset_sign_payload` return exactly what the
|
||||
//! identity delegate must be handed for each.
|
||||
|
||||
use ed25519_dalek::{Signature, Verifier, VerifyingKey};
|
||||
use ed25519_dalek::{Signature, Signer, SigningKey, Verifier, VerifyingKey};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
pub mod slsk_link;
|
||||
@@ -93,6 +93,19 @@ pub(crate) fn signable(domain: &str, payload: &[u8]) -> Vec<u8> {
|
||||
msg
|
||||
}
|
||||
|
||||
/// Sign with a raw ed25519 secret in an explicit domain. The delegate holds
|
||||
/// the persona and signs for it; these are the room-local keys it does not
|
||||
/// hold, so their signing lives beside the verification it has to match.
|
||||
/// Deterministic — no entropy, which is what keeps getrandom out of wasm.
|
||||
pub fn sign_local(domain: &str, secret: &[u8; 32], payload: &[u8]) -> Vec<u8> {
|
||||
SigningKey::from_bytes(secret).sign(&signable(domain, payload)).to_bytes().to_vec()
|
||||
}
|
||||
|
||||
/// The public half of a raw ed25519 secret.
|
||||
pub fn public_of(secret: &[u8; 32]) -> [u8; 32] {
|
||||
SigningKey::from_bytes(secret).verifying_key().to_bytes()
|
||||
}
|
||||
|
||||
pub fn verify_sig(public: &[u8; 32], payload: &[u8], sig: &[u8]) -> bool {
|
||||
verify_sig_in(SIGN_DOMAIN, public, payload, sig)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user