LucaCastelnuovo
07/14/2020, 1:12 PMuser
07/14/2020, 1:13 PMLucaCastelnuovo
07/14/2020, 1:14 PMuser
07/14/2020, 1:14 PMuser
07/14/2020, 1:14 PMuser
07/14/2020, 1:14 PMLucaCastelnuovo
07/14/2020, 1:15 PMHTTPS
I have mTLS
user
07/14/2020, 1:16 PMLucaCastelnuovo
07/14/2020, 1:16 PMLucaCastelnuovo
07/14/2020, 1:17 PMuser
07/14/2020, 1:17 PMuser
07/14/2020, 1:18 PMLucaCastelnuovo
07/14/2020, 1:19 PMhttps://server.com/auth/key
> 2. Server: Generate keypair (maybe 2048bits if performance allows it)
> 3. Server: Encrypt privateKey
with applicationKey
(set in .env)
> 4. Server: Store encryptedPrivateKey
in DB with an random keyId
> 5. Server: Return publicKey
and keyId
to Client
> 6. Client: The middleware will then encrypt the original payload with this publicKey
and also provide the keyId
> 7. Client: Sends request
> 8. Server: Looks up keyId
in DB and gets encryptedPrivateKey
> 9. Server: Decrypts encryptedPrivateKey
and gets privateKey
> 10. Server: Decrypts request
> 11. Server: Handles requestuser
07/14/2020, 1:19 PMLucaCastelnuovo
07/14/2020, 1:19 PMuser
07/14/2020, 1:20 PMLucaCastelnuovo
07/14/2020, 1:21 PMuser
07/14/2020, 1:22 PMuser
07/14/2020, 1:22 PMLucaCastelnuovo
07/14/2020, 1:22 PMuser
07/14/2020, 1:22 PMuser
07/14/2020, 1:23 PMtmetrics/
user
07/14/2020, 1:23 PMhttps://tmetrics.companyname.com
user
07/14/2020, 1:23 PMuser
07/14/2020, 1:23 PMLucaCastelnuovo
07/14/2020, 1:24 PMLucaCastelnuovo
07/14/2020, 8:04 PMLucaCastelnuovo
07/14/2020, 8:04 PMjs
SuperTokensRequest.init(
'https://try.supertokens.io',
440,
'example.com',
{}
);
LucaCastelnuovo
07/14/2020, 8:05 PMjs
const isLoggedin = () => SuperTokensRequest.doesSessionExist();
https://github.com/Luca-Castelnuovo/Secure/blob/master/client/src/services/Auth.jsrp
07/14/2020, 8:05 PMrp
07/14/2020, 8:05 PM