-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* build: add libsodium * refactor: remove hash for now
- Loading branch information
1 parent
8da3e9b
commit 5642108
Showing
5 changed files
with
55 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
find_package(Crow REQUIRED) | ||
find_package(SQLite3 REQUIRED) | ||
find_package(libsodium REQUIRED) | ||
|
||
add_library(src database.cpp password.cpp server.cpp) | ||
target_link_libraries(src Crow::Crow) | ||
|
||
add_executable(server main.cpp) | ||
target_link_libraries(server Crow::Crow SQLite::SQLite3 src) | ||
target_link_libraries(server Crow::Crow SQLite::SQLite3 libsodium::libsodium src) | ||
target_include_directories(server PRIVATE src) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,34 @@ | ||
import { | ||
crypto_pwhash_str, | ||
crypto_pwhash_str_verify, | ||
crypto_pwhash_OPSLIMIT_INTERACTIVE, | ||
crypto_pwhash_MEMLIMIT_INTERACTIVE, | ||
} from "libsodium-wrappers-sumo"; | ||
|
||
// Make API call to server to check if password was found in breached dataset | ||
export const checkSecurity = async (password: string) => { | ||
try { | ||
const response = await fetch("http://localhost:18080/intersection", { | ||
method: "POST", | ||
mode: "cors", | ||
headers: { | ||
"Access-Control-Allow-Headers": "*", // cors setting | ||
"Content-Type": "application/json" | ||
}, | ||
body: password | ||
}) | ||
const response = await fetch( | ||
"http://localhost:18080/intersection", | ||
{ | ||
method: "POST", | ||
mode: "cors", | ||
headers: { | ||
"Access-Control-Allow-Headers": "*", // cors setting | ||
"Content-Type": "application/json", | ||
}, | ||
body: password, | ||
} | ||
); | ||
const data = await response.json(); | ||
return data; | ||
} catch (error) { | ||
console.error("Error fetching data:", error); | ||
return { status: "error" }; | ||
} | ||
}; | ||
}; | ||
|
||
// Encrypt password using libsodium's ristretto. | ||
function encrypt(password: string) { | ||
return; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters