Add auth and blacklist APIs

This commit is contained in:
MICHAEL JACKSON
2017-11-11 12:18:13 -08:00
parent cc70428986
commit 0e1f26849b
35 changed files with 1166 additions and 339 deletions

View File

@ -0,0 +1,7 @@
const BlacklistAPI = require('../../BlacklistAPI')
function withBlacklist(blacklist, callback) {
return Promise.all(blacklist.map(BlacklistAPI.addPackage)).then(callback)
}
module.exports = withBlacklist

View File

@ -0,0 +1,12 @@
const withToken = require('./withToken')
const AuthAPI = require('../../AuthAPI')
function withRevokedToken(scopes, callback) {
withToken(scopes, token => {
AuthAPI.revokeToken(token).then(() => {
callback(token)
})
})
}
module.exports = withRevokedToken

View File

@ -0,0 +1,7 @@
const AuthAPI = require('../../AuthAPI')
function withToken(scopes, callback) {
AuthAPI.createToken(scopes).then(callback)
}
module.exports = withToken