Class: Kdf
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- Kdf
- Defined in:
- lib/schemas.rb
Overview
Kdf from prelogin
Key Derivation Function for Bitwarden Account
In Bitwarden accounts can use multiple KDFs to derive their master key from their password. This Enum represents all the possible KDFs.
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_dynamic!(d) ⇒ Object
605 606 607 608 609 610 611 |
# File 'lib/schemas.rb', line 605 def self.from_dynamic!(d) d = Types::Hash[d] new( p_bkdf2: d["pBKDF2"] ? PBKDF2.from_dynamic!(d["pBKDF2"]) : nil, argon2_id: d["argon2id"] ? Argon2ID.from_dynamic!(d["argon2id"]) : nil, ) end |
.from_json!(json) ⇒ Object
613 614 615 |
# File 'lib/schemas.rb', line 613 def self.from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#to_dynamic ⇒ Object
617 618 619 620 621 622 |
# File 'lib/schemas.rb', line 617 def to_dynamic { "pBKDF2" => p_bkdf2&.to_dynamic, "argon2id" => argon2_id&.to_dynamic, } end |
#to_json(options = nil) ⇒ Object
624 625 626 |
# File 'lib/schemas.rb', line 624 def to_json( = nil) JSON.generate(to_dynamic, ) end |