Module: Capsium::Package::Verification
- Included in:
- Capsium::Package
- Defined in:
- lib/capsium/package/verification.rb,
sig/capsium/package/verification.rbs
Overview
Integrity and digital-signature verification of a loaded package (ARCHITECTURE.md section 6), mixed into Package.
Instance Method Summary collapse
-
#signed? ⇒ Boolean
Whether security.json declares a digital signature for this package.
-
#verify_integrity ⇒ Array[Security::ChecksumMismatch | Security::MissingFile | Security::UncheckedFile]
Verifies the package against security.json.
- #verify_integrity! ⇒ void
-
#verify_signature ⇒ Boolean
Verifies the declared digital signature (RSA-SHA256) against the checksum-covered payload.
- #verify_signature! ⇒ void
Instance Method Details
#signed? ⇒ Boolean
Whether security.json declares a digital signature for this package.
20 |
# File 'lib/capsium/package/verification.rb', line 20 def signed? = @security.signed? |
#verify_integrity ⇒ Array[Security::ChecksumMismatch | Security::MissingFile | Security::UncheckedFile]
Verifies the package against security.json. Returns a list of typed errors; empty when no security.json is present or all checksums match.
11 12 13 |
# File 'lib/capsium/package/verification.rb', line 11 def verify_integrity @security.present? ? @security.verify(@path) : [] end |
#verify_integrity! ⇒ void
This method returns an undefined value.
15 16 17 |
# File 'lib/capsium/package/verification.rb', line 15 def verify_integrity! @security.verify!(@path) if @security.present? end |
#verify_signature ⇒ Boolean
Verifies the declared digital signature (RSA-SHA256) against the checksum-covered payload. True when the package is unsigned or the signature verifies; false on mismatch.
25 |
# File 'lib/capsium/package/verification.rb', line 25 def verify_signature = !signed? || Signer.new(@path).verify |