-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(browser-extension): store encrypted email
- Loading branch information
1 parent
492edce
commit 87bfc77
Showing
5 changed files
with
63 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
GET http://localhost:3000/auth/register | ||
|
||
### | ||
|
||
GET http://localhost:3000/auth/login?username=denny&password=denny_pw | ||
|
||
### | ||
|
@@ -9,12 +13,12 @@ GET http://localhost:3000/user/e3be8f99-7ec7-11ec-a714-0242ac140002 | |
# IF id is sent, it updates the post else creates a new one | ||
POST http://localhost:3000/preference | ||
content-type : application/json | ||
Authorization: token e3be8fa9-7ec7-11ec-a714-0242ac140002 | ||
Authorization: token f88f7ab3-c428-40a9-90fb-3cee9e820f90 | ||
|
||
{ | ||
"id" : "8066828c-4928-4bc2-8b98-c79f0b5e2bb3", | ||
"language":"ta", | ||
"friends": "[email protected],[email protected],[email protected],swastika@tattle.co.in", | ||
"email": "dog@tattle.co.in", | ||
"slurList": "apple,dog,cat" | ||
} | ||
|
||
|
@@ -33,7 +37,7 @@ Authorization: token e3be8fa9-7ec7-11ec-a714-0242ac140002 | |
|
||
### | ||
GET http://localhost:3000/preference | ||
Authorization: token e3be8fa9-7ec7-11ec-a714-0242ac140002 | ||
Authorization: token f88f7ab3-c428-40a9-90fb-3cee9e820f90 | ||
|
||
### | ||
GET http://localhost:3000/auth/register | ||
|
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,21 @@ | ||
const Cryptr = require("cryptr"); | ||
|
||
let crypter; | ||
try { | ||
crypter = new Cryptr(process.env.DB_FIELD_ENCRYPTION_KEY); | ||
} catch { | ||
console.log("could not initialize crytper"); | ||
} | ||
|
||
function encrypt(value) { | ||
return crypter.encrypt(value); | ||
} | ||
|
||
function decrypt(encryptedValue) { | ||
return crypter.decrypt(encryptedValue); | ||
} | ||
|
||
module.exports = { | ||
encrypt, | ||
decrypt, | ||
}; |
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