Class: Shojiku::VerificationReport

Inherits:
Object
  • Object
show all
Defined in:
lib/shojiku/verification_report.rb

Overview

What verification found — INCLUDING what it did not look at.

not_checked is a field, not a footnote, and this binding passes it through untouched. A "valid" verdict that quietly skipped revocation is worse than no verifier at all: it turns a missing capability into a false assurance, which is exactly the trust a signing feature sells. Dropping it on the way through an SDK would be the same lie one layer up.

The four checks stay separate for the same reason. "The signature is valid but covers only part of the file" is a different fact from "the signature is wrong", and a caller that cannot tell them apart cannot explain the answer to anyone.

Defined Under Namespace

Classes: Check

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(payload) ⇒ VerificationReport

Returns a new instance of VerificationReport.



41
42
43
44
45
46
47
48
# File 'lib/shojiku/verification_report.rb', line 41

def initialize(payload)
  @valid = payload["valid"]
  @signature = Check.new(payload["signature"])
  @coverage = Check.new(payload["coverage"])
  @certificate_validity = Check.new(payload["certificateValidity"])
  @trust_chain = Check.new(payload["trustChain"])
  @not_checked = Array(payload["notChecked"]).map(&:to_sym).freeze
end

Instance Attribute Details

#certificate_validityObject (readonly)

Returns the value of attribute certificate_validity.



35
36
37
# File 'lib/shojiku/verification_report.rb', line 35

def certificate_validity
  @certificate_validity
end

#coverageObject (readonly)

Returns the value of attribute coverage.



35
36
37
# File 'lib/shojiku/verification_report.rb', line 35

def coverage
  @coverage
end

#not_checkedObject (readonly)

Returns the value of attribute not_checked.



35
36
37
# File 'lib/shojiku/verification_report.rb', line 35

def not_checked
  @not_checked
end

#signatureObject (readonly)

Returns the value of attribute signature.



35
36
37
# File 'lib/shojiku/verification_report.rb', line 35

def signature
  @signature
end

#trust_chainObject (readonly)

Returns the value of attribute trust_chain.



35
36
37
# File 'lib/shojiku/verification_report.rb', line 35

def trust_chain
  @trust_chain
end

Class Method Details

.parse(json) ⇒ Object



37
38
39
# File 'lib/shojiku/verification_report.rb', line 37

def self.parse(json)
  new(JSON.parse(json))
end

Instance Method Details

#checksObject



57
58
59
60
# File 'lib/shojiku/verification_report.rb', line 57

def checks
  { signature: @signature, coverage: @coverage,
    certificate_validity: @certificate_validity, trust_chain: @trust_chain }
end

#valid?Boolean

Whether every check this release PERFORMS passed. Read not_checked beside it: this is not "the document is trustworthy", it is "nothing we looked at was wrong".

Returns:

  • (Boolean)


53
54
55
# File 'lib/shojiku/verification_report.rb', line 53

def valid?
  @valid == true
end