Class: Keyring

Inherits:
Object
  • Object
show all
Defined in:
lib/keyring/version.rb,
lib/keyring.rb

Overview

keyring: System keyring abstraction library License: MIT (www.opensource.org/licenses/mit-license.php)

Defined Under Namespace

Classes: Backend, CLI

Constant Summary collapse

VERSION =
"0.4.1"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(backend = nil) ⇒ Keyring

If you want a particular backend then use, for example, Keyring.new(Keyring::Backend::Memory.new)



13
14
15
# File 'lib/keyring.rb', line 13

def initialize(backend=nil)
  @backend = backend || Keyring::Backend.create
end

Instance Attribute Details

#backendObject (readonly)

Returns the value of attribute backend.



9
10
11
# File 'lib/keyring.rb', line 9

def backend
  @backend
end

Instance Method Details

#delete_password(service, username) ⇒ Object



23
24
25
# File 'lib/keyring.rb', line 23

def delete_password(service, username)
  @backend.delete_password(service, username)
end

#get_password(service, username) ⇒ Object



17
18
19
# File 'lib/keyring.rb', line 17

def get_password(service, username)
  @backend.get_password(service, username)
end

#set_password(service, username, password) ⇒ Object



20
21
22
# File 'lib/keyring.rb', line 20

def set_password(service, username, password)
  @backend.set_password(service, username, password)
end