balena-cli/lib/token/token.coffee
2014-11-07 14:51:54 -04:00

19 lines
389 B
CoffeeScript

# TODO: Persist token in a secure manner
data = require('../data/data')
token = null
exports.saveToken = (newToken, callback) ->
token = newToken
return callback(null, token)
exports.hasToken = (callback) ->
return callback(token?)
exports.getToken = (callback) ->
return callback(null, token or undefined)
exports.clearToken = (callback) ->
token = null
return callback?(null)