mirror of
https://github.com/Blah-IM/blahrs.git
synced 2025-07-07 22:55:33 +00:00
refactor(webapi,types)!: make challenge type extensive
We may allow more challenge types other than PoW in the future, eg. captcha. So make the relevent types more generic. Now the challenge is returned in JSON response as a individual top-level field `register_challenge` instead of in HTTP headers.
This commit is contained in:
parent
364e517b7d
commit
bc6e6c2056
11 changed files with 206 additions and 130 deletions
|
@ -2,7 +2,7 @@
|
|||
use std::hint::black_box;
|
||||
use std::time::Instant;
|
||||
|
||||
use blah_types::msg::{ChatPayload, UserRegisterPayload};
|
||||
use blah_types::msg::{ChatPayload, UserRegisterChallengeResponse, UserRegisterPayload};
|
||||
use blah_types::{get_timestamp, Id, PubKey, SignExt, Signee, UserKey};
|
||||
use criterion::{criterion_group, criterion_main, Criterion};
|
||||
use ed25519_dalek::SigningKey;
|
||||
|
@ -24,7 +24,7 @@ fn bench_register_pow(c: &mut Criterion) {
|
|||
id_key: id_key.clone(),
|
||||
server_url: "http://some.example.com".parse().unwrap(),
|
||||
id_url: "http://another.example.com".parse().unwrap(),
|
||||
challenge_nonce: rng.gen(),
|
||||
challenge: Some(UserRegisterChallengeResponse::Pow { nonce: rng.gen() }),
|
||||
};
|
||||
let mut signee = Signee {
|
||||
nonce: 0,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue