Skip to content

Commit

Permalink
rename: authenticator to verifier
Browse files Browse the repository at this point in the history
  • Loading branch information
berzanorg committed Apr 30, 2024
1 parent f2e12cd commit d768d9e
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 65 deletions.
65 changes: 0 additions & 65 deletions processes/src/authenticator/process.rs

This file was deleted.

File renamed without changes.
32 changes: 32 additions & 0 deletions processes/src/verifier/process.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
use super::{Processor, Request};
use nacho_data_structures::ByteConversion;
use tokio::sync::mpsc;

pub fn process(path: &str) -> Processor {
let (sender, mut receiver) = mpsc::channel::<Request>(1000);

let (stdin, stdout) = nacho_js_process::spawn(&[path]).unwrap();

tokio::spawn(async move {
while let Some(request) = receiver.recv().await {
match request {
Request::CheckSignature { sender, tx } => {
let input = tx.to_bytes();
let mut output = [0u8; 1];

nacho_js_process::interact(stdin, stdout, &input, &mut output)
.await
.ok();

let is_valid = output[0] != 0;

sender.send(Some(is_valid)).unwrap();
}
}
}
});

Processor {
sender: Box::leak(Box::new(sender)),
}
}
File renamed without changes.
File renamed without changes.

0 comments on commit d768d9e

Please sign in to comment.