feat: add captcha support for sign in/up (#4582)

This commit is contained in:
DarkSky
2023-10-18 03:06:07 -05:00
committed by GitHub
parent 524e48c8e6
commit 63ca9671be
42 changed files with 1275 additions and 302 deletions
+6
View File
@@ -7,6 +7,7 @@ edition = "2021"
crate-type = ["cdylib"]
[dependencies]
chrono = "0.4"
jwst-codec = { git = "https://github.com/toeverything/OctoBase.git", rev = "ad51b2c" }
jwst-core = { git = "https://github.com/toeverything/OctoBase.git", rev = "ad51b2c" }
jwst-storage = { git = "https://github.com/toeverything/OctoBase.git", rev = "ad51b2c" }
@@ -15,6 +16,11 @@ napi = { version = "2", default-features = false, features = [
"async",
] }
napi-derive = { version = "2", features = ["type-def"] }
rand = "0.8"
sha3 = "0.10"
[dev-dependencies]
tokio = "1"
[build-dependencies]
napi-build = "2"
+9
View File
@@ -3,6 +3,15 @@
/* auto-generated by NAPI-RS */
export function verifyChallengeResponse(
response: string,
bits: number,
resource: string
): Promise<boolean>;
export function mintChallengeResponse(
resource: string,
bits?: number | undefined | null
): Promise<string>;
export interface Blob {
contentType: string;
lastModified: string;
+2
View File
@@ -7,3 +7,5 @@ const binding = require('./storage.node');
export const Storage = binding.Storage;
export const mergeUpdatesInApplyWay = binding.mergeUpdatesInApplyWay;
export const verifyChallengeResponse = binding.verifyChallengeResponse;
export const mintChallengeResponse = binding.mintChallengeResponse;
+1
View File
@@ -0,0 +1 @@
../../native/src/hashcash.rs
+2
View File
@@ -1,5 +1,7 @@
#![deny(clippy::all)]
pub mod hashcash;
use std::{
collections::HashMap,
fmt::{Debug, Display},