Class: Linzer::JWS::Key
Overview
JWS-compatible signing key implementation.
Wraps a JWT::JWK key object to provide the Linzer Key interface. This enables using JWK-format keys with HTTP Message Signatures.
Instance Attribute Summary
Attributes inherited from Key
Instance Method Summary collapse
-
#sign(data) ⇒ String
Signs data using the JWS key.
-
#verify(signature, data) ⇒ Boolean
Verifies a signature using the JWS key.
Methods inherited from Key
#initialize, #key_id, #private?, #public?
Constructor Details
This class inherits a constructor from Linzer::Key
Instance Method Details
#sign(data) ⇒ String
Signs data using the JWS key.
86 87 88 89 90 |
# File 'lib/linzer/jws.rb', line 86 def sign(data) validate_signing_key algo = resolve_algorithm algo.sign(data: data, signing_key: signing_key) end |
#verify(signature, data) ⇒ Boolean
Verifies a signature using the JWS key.
98 99 100 101 102 |
# File 'lib/linzer/jws.rb', line 98 def verify(signature, data) validate_verify_key algo = resolve_algorithm algo.verify(data: data, signature: signature, verification_key: verify_key) end |