Module: Sigstore::TUF::MetaFile::ClassMethods

Defined in:
lib/sigstore/tuf/file.rb

Instance Method Summary collapse

Instance Method Details

#from_hash(meta_dict) ⇒ Object



86
87
88
89
90
91
92
93
# File 'lib/sigstore/tuf/file.rb', line 86

def from_hash(meta_dict)
  version = meta_dict.fetch("version") { raise KeyError, "version is required, given #{meta_dict.inspect}" }
  length = meta_dict.fetch("length", nil)
  hashes = meta_dict.fetch("hashes", nil)

  new(version:, length:, hashes:,
      unrecognized_fields: meta_dict.slice(*(meta_dict.keys - %w[version length hashes])))
end