Use cafy
This commit is contained in:
parent
f210260826
commit
17a23c3eb5
67 changed files with 202 additions and 801 deletions
|
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
import rndstr from 'rndstr';
|
||||
const crypto = require('crypto');
|
||||
import it from '../../it';
|
||||
import it from 'cafy';
|
||||
import App from '../../models/app';
|
||||
import AuthSess from '../../models/auth-session';
|
||||
import AccessToken from '../../models/access-token';
|
||||
|
|
@ -40,7 +40,7 @@ import AccessToken from '../../models/access-token';
|
|||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'token' parameter
|
||||
const [token, tokenErr] = it(params.token).expect.string().required().qed();
|
||||
const [token, tokenErr] = it(params.token).expect.string().required().get();
|
||||
if (tokenErr) return rej('invalid token param');
|
||||
|
||||
// Fetch token
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* Module dependencies
|
||||
*/
|
||||
import * as uuid from 'uuid';
|
||||
import it from '../../../it';
|
||||
import it from 'cafy';
|
||||
import App from '../../../models/app';
|
||||
import AuthSess from '../../../models/auth-session';
|
||||
import config from '../../../../conf';
|
||||
|
|
@ -46,7 +46,7 @@ import config from '../../../../conf';
|
|||
*/
|
||||
module.exports = (params) => new Promise(async (res, rej) => {
|
||||
// Get 'app_secret' parameter
|
||||
const [appSecret, appSecretErr] = it(params.app_secret).expect.string().required().qed();
|
||||
const [appSecret, appSecretErr] = it(params.app_secret).expect.string().required().get();
|
||||
if (appSecretErr) return rej('invalid app_secret param');
|
||||
|
||||
// Lookup app
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* Module dependencies
|
||||
*/
|
||||
import it from '../../../it';
|
||||
import it from 'cafy';
|
||||
import AuthSess from '../../../models/auth-session';
|
||||
import serialize from '../../../serializers/auth-session';
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ import serialize from '../../../serializers/auth-session';
|
|||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'token' parameter
|
||||
const [token, tokenErr] = it(params.token).expect.string().required().qed();
|
||||
const [token, tokenErr] = it(params.token).expect.string().required().get();
|
||||
if (tokenErr) return rej('invalid token param');
|
||||
|
||||
// Lookup session
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* Module dependencies
|
||||
*/
|
||||
import it from '../../../it';
|
||||
import it from 'cafy';
|
||||
import App from '../../../models/app';
|
||||
import AuthSess from '../../../models/auth-session';
|
||||
import AccessToken from '../../../models/access-token';
|
||||
|
|
@ -51,7 +51,7 @@ import serialize from '../../../serializers/user';
|
|||
*/
|
||||
module.exports = (params) => new Promise(async (res, rej) => {
|
||||
// Get 'app_secret' parameter
|
||||
const [appSecret, appSecretErr] = it(params.app_secret).expect.string().required().qed();
|
||||
const [appSecret, appSecretErr] = it(params.app_secret).expect.string().required().get();
|
||||
if (appSecretErr) return rej('invalid app_secret param');
|
||||
|
||||
// Lookup app
|
||||
|
|
@ -64,7 +64,7 @@ module.exports = (params) => new Promise(async (res, rej) => {
|
|||
}
|
||||
|
||||
// Get 'token' parameter
|
||||
const [token, tokenErr] = it(params.token).expect.string().required().qed();
|
||||
const [token, tokenErr] = it(params.token).expect.string().required().get();
|
||||
if (tokenErr) return rej('invalid token param');
|
||||
|
||||
// Fetch token
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue