Add getters and setters for the keychain

This commit is contained in:
Ben Ogle
2013-12-06 11:45:18 -08:00
parent c36ee1dbe6
commit f0fece2cf0
2 changed files with 9 additions and 3 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,9 +353,13 @@ class Atom
getVersion: ->
app.getVersion()
# Public: Get the name of the github token in the keychain
getGitHubTokenName: ->
'Atom GitHub API Token'
# Public: Set the the github token in the keychain
setGitHubAuthToken: (token) ->
keytar.replacePassword('Atom GitHub API Token', 'github', token)
# Public: Get the github token from the keychain
getGitHubAuthToken: ->
keytar.getPassword('Atom GitHub API Token', 'github')
# Public: Get the directory path to Atom's configuration area.
#