1
0
Fork 0
mirror of https://github.com/nishiki/manage-password.git synced 2025-03-17 20:29:29 +00:00

fix comments

This commit is contained in:
nishiki 2016-05-07 12:08:36 +02:00
parent d56ab48797
commit 8f29eb8d58

View file

@ -77,8 +77,7 @@ class MPW
end end
# Encrypt a file # Encrypt a file
# @rtrn: true if the file has been encrypted # TODO backup and restore file with raise
# TODO export key pub
def write_data def write_data
data = {} data = {}
@ -119,12 +118,15 @@ class MPW
end end
end end
# TODO comment # Get a password
# args: id -> the item id
def get_password(id) def get_password(id)
return decrypt(@passwords[id]) return decrypt(@passwords[id])
end end
# TODO comment # Set a password
# args: id -> the item id
# password -> the new password
def set_password(id, password) def set_password(id, password)
@passwords[id] = encrypt(password) @passwords[id] = encrypt(password)
end end
@ -138,8 +140,6 @@ class MPW
# Add a new item # Add a new item
# @args: item -> Object MPW::Item # @args: item -> Object MPW::Item
# @rtrn: true if add item
# TODO add password
def add(item) def add(item)
if not item.instance_of?(Item) if not item.instance_of?(Item)
raise I18n.t('error.bad_class') raise I18n.t('error.bad_class')
@ -192,7 +192,7 @@ class MPW
return nil return nil
end end
# Export to csv # Export to yaml
# @args: file -> file where you export the data # @args: file -> file where you export the data
def export(file) def export(file)
data = {} data = {}
@ -261,8 +261,7 @@ class MPW
end end
# Decrypt a gpg file # Decrypt a gpg file
# @args: password -> the GPG key password # @args: data -> string to decrypt
# @rtrn: true if data has been decrypted
private private
def decrypt(data) def decrypt(data)
crypto = GPGME::Crypto.new(armor: true) crypto = GPGME::Crypto.new(armor: true)
@ -273,7 +272,7 @@ class MPW
end end
# Encrypt a file # Encrypt a file
# @rtrn: true if the file has been encrypted # args: data -> string to encrypt
private private
def encrypt(data) def encrypt(data)
recipients = [] recipients = []