Frontend work (#109)

This commit is contained in:
Ahmad Afuni 2025-03-05 21:02:28 +10:00 committed by GitHub
parent 7eeb595dc2
commit 9d60b0ec3a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 611 additions and 262 deletions

View file

@ -13,16 +13,22 @@ pub struct MockSigner {
pub pk: String,
}
impl MockSigner {
pub fn pubkey(&self) -> Value {
Value(hash_str(&self.pk).0)
}
}
impl PodSigner for MockSigner {
fn sign(&mut self, _params: &Params, kvs: &HashMap<Hash, Value>) -> Result<Box<dyn Pod>> {
let mut kvs = kvs.clone();
let pk_hash = hash_str(&self.pk);
kvs.insert(hash_str(&KEY_SIGNER), Value(pk_hash.0));
let pubkey = self.pubkey();
kvs.insert(hash_str(&KEY_SIGNER), pubkey);
kvs.insert(hash_str(&KEY_TYPE), Value::from(PodType::MockSigned));
let dict = Dictionary::new(&kvs)?;
let id = PodId(dict.commitment());
let signature = format!("{}_signed_by_{}", id, pk_hash);
let signature = format!("{}_signed_by_{}", id, pubkey);
Ok(Box::new(MockSignedPod {
dict,
id,