Merge pull request #1240 from atom/bo-token-stuff

Add token dealings to atom core
This commit is contained in:
Ben Ogle
2013-12-06 12:04:52 -08:00
2 changed files with 13 additions and 0 deletions

View File

@@ -30,6 +30,7 @@
"guid": "0.0.10",
"jasmine-focused": "~0.15.0",
"mkdirp": "0.3.5",
"keytar": "0.13.0",
"less-cache": "0.10.0",
"nslog": "0.1.0",
"oniguruma": "0.24.0",

View File

@@ -1,5 +1,6 @@
crypto = require 'crypto'
ipc = require 'ipc'
keytar = require 'keytar'
os = require 'os'
path = require 'path'
remote = require 'remote'
@@ -352,6 +353,17 @@ class Atom
getVersion: ->
app.getVersion()
getGitHubAuthTokenName: ->
'Atom GitHub API Token'
# Public: Set the the github token in the keychain
setGitHubAuthToken: (token) ->
keytar.replacePassword(@getGitHubAuthTokenName(), 'github', token)
# Public: Get the github token from the keychain
getGitHubAuthToken: ->
keytar.getPassword(@getGitHubAuthTokenName(), 'github')
# Public: Get the directory path to Atom's configuration area.
#
# Returns the absolute path to ~/.atom