Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
22_23-J 16
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
22_23-J 16
22_23-J 16
Commits
311ab2e2
Commit
311ab2e2
authored
Mar 15, 2023
by
Kiridena I.T.K_IT19981840
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'Patient-RSA-on-registration' into 'master'
RSA key generation on patient reg done See merge request
!18
parents
3f3416e6
f8c1a215
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
3 deletions
+33
-3
ExpressBackend/.env
ExpressBackend/.env
+2
-2
ExpressBackend/model/patient/patient.js
ExpressBackend/model/patient/patient.js
+1
-0
ExpressBackend/route/patient-routes/register-route.js
ExpressBackend/route/patient-routes/register-route.js
+30
-1
No files found.
ExpressBackend/.env
View file @
311ab2e2
...
...
@@ -2,8 +2,8 @@ STELLARTESTNET="https://horizon-testnet.stellar.org"
STELLARPUBNET="https://horizon.stellar.org"
DATABASE_URL="mongodb+srv://dbUser:1997Ishini%21@cluster0.lmazo.mongodb.net/research?retryWrites=true&w=majority"
SERVER_PORT=4000
STELLARPUBLICKEY="G
B3U2F6MWAQ43O6J4AIUQXEMTK5XQZWURC3SF4D37DPBFRY4HCZGRBLG
"
STELLARSEED="S
BUXCZ7F7G5Z3QK3NKM52UWVJWFSLEVVGQOCIEWEJY4DOYMYVOMUTS4B
"
STELLARPUBLICKEY="G
C4WG5GU55INE4ELR3AZNBQTOZJTORXVXZWYRXWW2DRMCEYKGRJDGRSD
"
STELLARSEED="S
CB3PQXMYF4K77JXMKC4WZUMVF5OQ2GMMOEXO5ABVK7YN4DCB2DZJDUJ
"
AESKEY="QfTjWnZr4u7x!A%D"
IPFSPROJECTID="2KmA9x9x9odbbz9uA00GD5ZKOnv"
IPFSAPIKEY="975ea3b06bd36d434b57a315a86287ee"
...
...
ExpressBackend/model/patient/patient.js
View file @
311ab2e2
...
...
@@ -5,6 +5,7 @@ const Patient = new mongoose.Schema({
password
:
String
,
email
:
String
,
publickey
:
String
,
rsa
:
String
,
genesishash
:
String
,
currenthash
:
String
,
timestamp
:
String
,
...
...
ExpressBackend/route/patient-routes/register-route.js
View file @
311ab2e2
...
...
@@ -6,6 +6,7 @@ const DecryptWithServerKey = require("./../../services/decryptionservice");
const
EncryptionService
=
require
(
"
./../../services/encryptionservice
"
);
const
AccountCreateCollection
=
require
(
"
../../model/stellar/accountCreate
"
);
const
UserSchema
=
require
(
"
../../model/patient/patient
"
);
const
{
generateKeyPairSync
}
=
require
(
"
crypto
"
);
let
timestamp
;
router
.
post
(
"
/
"
,
async
(
req
,
res
)
=>
{
...
...
@@ -260,13 +261,39 @@ router.post("/", async (req, res) => {
genesisTxnResult
.
hash
);
timestamp
=
new
Date
();
console
.
log
(
new
Date
());
//generate RSA key pair
const
keyOptions
=
[
{
modulusLength
:
2048
,
publicKeyEncoding
:
{
type
:
"
spki
"
,
format
:
"
pem
"
,
},
privateKeyEncoding
:
{
type
:
"
pkcs8
"
,
format
:
"
pem
"
,
cipher
:
"
aes-256-cbc
"
,
passphrase
:
"
top secret
"
,
},
},
];
const
[{
publicKey
:
RSAPK
,
privateKey
:
RSASK
}]
=
keyOptions
.
map
(
(
options
)
=>
generateKeyPairSync
(
"
rsa
"
,
options
)
);
//base64 encoding of the key
const
b64RSApk
=
btoa
(
RSAPK
);
const
b64RSAsk
=
btoa
(
RSASK
);
//create the user collection object to be added to the DB
const
userCollectionObject
=
new
UserSchema
({
username
:
decryptedUserName
,
password
:
req
.
body
.
password
,
email
:
decryptedEmail
,
publickey
:
userKeyPair
.
publicKey
(),
rsa
:
b64RSApk
,
genesishash
:
genesisTxnResult
.
hash
,
currenthash
:
genesisTxnResult
.
hash
,
timestamp
:
timestamp
,
...
...
@@ -285,6 +312,8 @@ router.post("/", async (req, res) => {
userKeyPair
.
publicKey
()
),
seed
:
EncryptionService
.
EncryptWithServerKey
(
userKeyPair
.
secret
()),
rsapk
:
EncryptionService
.
EncryptWithServerKey
(
b64RSApk
),
rsask
:
EncryptionService
.
EncryptWithServerKey
(
b64RSAsk
),
});
console
.
log
(
"
/patient/register - register patient details successful
"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment