Class: S7n::GPassFile
Overview
GPass のファイルに関する処理を表現する。
Defined Under Namespace
Classes: GPassFileError
Constant Summary collapse
- DEFAULT_PATH =
GPass のファイルが格納されているデフォルトのパス。
"~/.gpass/passwords.gps"
- IV =
Blowfish の初期化配列。
[5, 23, 1, 123, 12, 3, 54, 94].pack("C8")
- MAGIC_PATTERN =
GPass のファイルであることを示すマジック。
/\AGPassFile version (\d\.\d\.\d)/
- ENTRY_ATTRIBUTE_TEMPLATES =
GPass で扱う秘密情報の種類と属性。
{ "entry" => [TextAttribute.new("name" => N_("name")), TextAttribute.new("name" => N_("description")), DateTimeAttribute.new("name" => N_("created_at")), DateTimeAttribute.new("name" => N_("updated_at")), BooleanAttribute.new("name" => N_("expiration")), DateTimeAttribute.new("name" => N_("expire_at"))], "folder" => ["entry"], "password" => ["entry", TextAttribute.new("name" => N_("username")), TextAttribute.new("name" => N_("password"), "secret" => true)], "general" => ["password", TextAttribute.new("name" => N_("hostname"))], "shell" => ["general"], "website" => ["password", TextAttribute.new("name" => N_("url"))], }
Instance Method Summary collapse
Instance Method Details
#read(passphrase, path = DEFAULT_PATH) ⇒ Object
61 62 63 64 65 66 67 68 69 |
# File 'lib/s7n/gpass_file.rb', line 61 def read(passphrase, path = DEFAULT_PATH) res = EntryCollection.new File.open(File.(path), "r") do |f| f.flock(File::LOCK_EX) s = decrypt(f, passphrase) parse(s, res) end return res end |