Class: Sigstore::Rekor::Checkpoint::LogCheckpoint

Inherits:
Struct
  • Object
show all
Defined in:
lib/sigstore/rekor/checkpoint.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#log_hashObject

Returns the value of attribute log_hash

Returns:

  • (Object)

    the current value of log_hash



80
81
82
# File 'lib/sigstore/rekor/checkpoint.rb', line 80

def log_hash
  @log_hash
end

#log_sizeObject

Returns the value of attribute log_size

Returns:

  • (Object)

    the current value of log_size



80
81
82
# File 'lib/sigstore/rekor/checkpoint.rb', line 80

def log_size
  @log_size
end

#originObject

Returns the value of attribute origin

Returns:

  • (Object)

    the current value of origin



80
81
82
# File 'lib/sigstore/rekor/checkpoint.rb', line 80

def origin
  @origin
end

#other_contentObject

Returns the value of attribute other_content

Returns:

  • (Object)

    the current value of other_content



80
81
82
# File 'lib/sigstore/rekor/checkpoint.rb', line 80

def other_content
  @other_content
end

Class Method Details

.from_text(text) ⇒ Object



83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/sigstore/rekor/checkpoint.rb', line 83

def self.from_text(text)
  lines = text.strip.split("\n")

  raise Error::InvalidCheckpoint, "too few items in header" if lines.size < 3

  origin = lines.shift
  log_size = lines.shift.to_i
  root_hash = lines.shift.unpack1("m0")

  raise Error::InvalidCheckpoint, "empty origin" if origin.empty?

  new(origin:, log_size:, log_hash: root_hash, other_content: lines)
end