hammerspoon-config icon indicating copy to clipboard operation
hammerspoon-config copied to clipboard

client id exposed

Open JonathanDoughty opened this issue 7 years ago • 0 comments

You might not want your unsplash client id exposed for the world https://github.com/cmsj/hammerspoon-config/blob/master/init.lua#L507

One of the hammerspoon abilities I love most is the ability to use it to access passwords and generic info in KeyChain:

function extractPassword(type, service) local cmd = "security " .. type .. " -s " .. service .. " -a " .. os.getenv("USER") .. " -w" local str_p, status = hs.execute(cmd) str_p = string.gsub(str_p, "\n", "") return str_p end

used like: hs.hotkey.bind({"cmd", "alt"}, "S", nil, function() -- CLI: security add-generic-password -a ${USER} -s "ssh passphrase" -w local str_p = extractPassword("find-generic-password", "'ssh passphrase'") str_p = string.gsub(str_p, "\n", "") -- trim newline hs.eventtap.keyStrokes(str_p) end)

or hs.hotkey.bind({"cmd", "alt"}, "P", nil, function() -- CLI: security add-internet-password -a ${USER} -s $(hostname) -w local str_p = extractPassword("find-internet-password", hs.host.localizedName()) str_p = string.gsub(str_p, "\n", "") -- trim newline hs.eventtap.keyStrokes(str_p) end)

the latter is golden for the countless times I get asked each day for my password on work web sites.

Thanks for all the work you put into Hammerspoon - it makes my Mac life far nicer!

JonathanDoughty avatar Dec 01 '18 18:12 JonathanDoughty