feat(totp): vlad updates for totp (#313) r=@vladikoff

This commit is contained in:
Vijay Budhram 2018-02-28 18:27:26 +00:00 коммит произвёл Vlad Filippov
Родитель ee19e1bc43
Коммит f6d603c706
3 изменённых файлов: 6 добавлений и 6 удалений

Просмотреть файл

@ -126,7 +126,7 @@ function createServer(db) {
api.get('/keyFetchToken/:id/verified', withIdAndBody(db.keyFetchTokenWithVerificationStatus))
api.post('/tokens/:id/verify', withIdAndBody(db.verifyTokens))
api.post('/tokens/:id/verifyWith', withIdAndBody(db.verifyTokensWithMethod))
api.post('/tokens/:id/verifyWithMethod', withIdAndBody(db.verifyTokensWithMethod))
api.post('/tokens/:code/verifyCode', withParamsAndBody(db.verifyTokenCode))
api.get('/accountResetToken/:id', withIdAndBody(db.accountResetToken))

Просмотреть файл

@ -1605,7 +1605,7 @@ module.exports = function(cfg, makeServer) {
const verifyOptions = {
verificationMethod: 'totp-2fa',
}
return client.postThen('/tokens/' + user.sessionTokenId + '/verifyWith', verifyOptions)
return client.postThen('/tokens/' + user.sessionTokenId + '/verifyWithMethod', verifyOptions)
.then((res) => {
respOkEmpty(res)
return client.getThen('/sessionToken/' + user.sessionTokenId + '/device')

Просмотреть файл

@ -91,7 +91,7 @@ The following datatypes are used throughout this document:
* forgotPasswordVerified : `POST /passwordForgotToken/:id/verified`
* Unverified tokens:
* verifyTokens : `POST /tokens/:tokenVerificationId/verify`
* verifyTokensWithMethod : `POST /tokens/:tokenId/verifyWith`
* verifyTokensWithMethod : `POST /tokens/:tokenId/verifyWithMethod`
* Sign-in codes
* createSigninCode : `PUT /signinCodes/:code`
* consumeSigninCode : `POST /signinCodes/:code/consume`
@ -1745,7 +1745,7 @@ Content-Length: 2
* Body : {"code":"InternalError","message":"...<message related to the error>..."}
```
## verifyTokens : `POST /tokens/<tokenId>/verifyWith`
## verifyTokens : `POST /tokens/<tokenId>/verifyWithMethod`
This method verifies sessionTokens, keyFetchTokens and sets
the the verification method used on the sessions table.
@ -1758,13 +1758,13 @@ curl \
-X POST \
-H "Content-Type: application/json" \
-d '{"verificatioMethod":"totp-2fa"}' \
http://localhost:8000/tokens/8e8c27b704dbf6a5dc556453c92e7506/verifyWith
http://localhost:8000/tokens/8e8c27b704dbf6a5dc556453c92e7506/verifyWithMethod
```
### Request
* Method : POST
* Path : `/tokens/<tokenId>/verifyWith`
* Path : `/tokens/<tokenId>/verifyWithMethod`
* tokenVerificationId : hex128
* Params:
* uid : hex128