mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Move safe-chain package to packages/safe-chain
This commit is contained in:
parent
fc9a9ca129
commit
7673d32912
68 changed files with 85 additions and 52 deletions
|
|
@ -1,31 +0,0 @@
|
|||
const malwareDatabaseUrl =
|
||||
"https://malware-list.aikido.dev/malware_predictions.json";
|
||||
|
||||
export async function fetchMalwareDatabase() {
|
||||
const response = await fetch(malwareDatabaseUrl);
|
||||
if (!response.ok) {
|
||||
throw new Error(`Error fetching malware database: ${response.statusText}`);
|
||||
}
|
||||
|
||||
try {
|
||||
let malwareDatabase = await response.json();
|
||||
return {
|
||||
malwareDatabase: malwareDatabase,
|
||||
version: response.headers.get("etag") || undefined,
|
||||
};
|
||||
} catch (error) {
|
||||
throw new Error(`Error parsing malware database: ${error.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
export async function fetchMalwareDatabaseVersion() {
|
||||
const response = await fetch(malwareDatabaseUrl, {
|
||||
method: "HEAD",
|
||||
});
|
||||
if (!response.ok) {
|
||||
throw new Error(
|
||||
`Error fetching malware database version: ${response.statusText}`
|
||||
);
|
||||
}
|
||||
return response.headers.get("etag") || undefined;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue