-
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.
Merge pull request #33 from Cosmian/feat/encrypt_findex_db
feat:update findex
- Loading branch information
Showing
29 changed files
with
1,691 additions
and
1,020 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { AesGcm } from "cloudproof_js"; | ||
import { findexClearEmployeesDatabase, encryptedEmployeesDatabase } from "../../utils/findexConfig"; | ||
|
||
export const encryptDatabase = async ( | ||
clearDatabase: findexClearEmployeesDatabase[], | ||
key: Uint8Array, | ||
nonce: Uint8Array, | ||
authData: Uint8Array | ||
): Promise<encryptedEmployeesDatabase[]> => { | ||
const { Aes256Gcm } = await AesGcm(); | ||
|
||
return Promise.all( | ||
clearDatabase.map((e) => | ||
Object.keys(e) | ||
.filter((k) => k !== "uuid") | ||
.reduce( | ||
(acc, k) => { | ||
const index = k as keyof Omit<typeof e, "uuid">; | ||
return { | ||
...acc, | ||
[index]: Aes256Gcm.encrypt(e[index].toString(), key, nonce, authData), | ||
}; | ||
}, | ||
{ uuid: e.uuid } as encryptedEmployeesDatabase | ||
) | ||
) | ||
); | ||
}; |
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
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { AesGcm } from "cloudproof_js"; | ||
import { findexClearEmployeesDatabase, encryptedEmployeesDatabase } from "../../utils/findexConfig"; | ||
|
||
export const encryptDatabase = async ( | ||
clearDatabase: findexClearEmployeesDatabase[], | ||
key: Uint8Array, | ||
nonce: Uint8Array, | ||
authData: Uint8Array | ||
): Promise<encryptedEmployeesDatabase[]> => { | ||
const { Aes256Gcm } = await AesGcm(); | ||
|
||
return Promise.all( | ||
clearDatabase.map((e) => | ||
Object.keys(e) | ||
.filter((k) => k !== "uuid") | ||
.reduce( | ||
(acc, k) => { | ||
const index = k as keyof Omit<typeof e, "uuid">; | ||
return { | ||
...acc, | ||
[index]: Aes256Gcm.encrypt(e[index].toString(), key, nonce, authData), | ||
}; | ||
}, | ||
{ uuid: e.uuid } as encryptedEmployeesDatabase | ||
) | ||
) | ||
); | ||
}; |
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
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
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
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
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
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
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
Oops, something went wrong.