class OnePassword::EncryptionKey

Attributes

data[RW]

noinspection RubyResolve

identifier[RW]

noinspection RubyResolve

iterations[RW]

noinspection RubyResolve

level[RW]

noinspection RubyResolve

profile[RW]

noinspection RubyResolve

validation[RW]

noinspection RubyResolve

Public Class Methods

new(profile, data) click to toggle source
# File lib/one_password/encryption_key.rb, line 8
def initialize(profile, data)
  @profile = profile
  data.each do |name, value|
    send("#{name}=", value)
  end
end

Public Instance Methods

decrypt(password=self.profile.password) click to toggle source
# File lib/one_password/encryption_key.rb, line 22
def decrypt(password=self.profile.password)
  @decrypted_key = Encryption.decrypt_using_pbkdf2(data, password, iterations)
end
decrypted_key() click to toggle source
# File lib/one_password/encryption_key.rb, line 26
def decrypted_key
  @decrypted_key || decrypt
end
iterations=(iterations) click to toggle source

noinspection RubyResolve

# File lib/one_password/encryption_key.rb, line 16
def iterations=(iterations)
  @iterations = iterations.to_i
  @iterations = 1000 if @iterations < 1000
  @iterations
end
valid?() click to toggle source
# File lib/one_password/encryption_key.rb, line 30
def valid?
  Encryption.decrypt_using_key(validation, decrypted_key) == decrypted_key
end