Class: Linzer::Signature::Context
- Inherits:
-
Object
- Object
- Linzer::Signature::Context
- Defined in:
- lib/linzer/signature/context.rb
Overview
A mutable context object used during signature generation.
The context represents all state required to produce a signature, including:
-
the HTTP message being signed
-
the signing key
-
covered signature components
-
signature parameters
-
optional overlay headers introduced by signing profiles
Profiles may mutate this context before or during signing in order to influence the final signature output (e.g., adding headers, modifying components, or adjusting parameters).
This object is intentionally mutable and is not thread-safe.
Instance Attribute Summary collapse
-
#components ⇒ Array<String>
readonly
list of covered signature components.
-
#key ⇒ Object
readonly
the signing key used to generate the signature.
-
#message ⇒ Linzer::Message
readonly
Returns a message view that includes any overlay headers.
-
#overlay_headers ⇒ Hash
readonly
Overlay headers are merged into the message view during signature computation but do not mutate the underlying message.
-
#params ⇒ Hash
readonly
signature parameters (may include :label if provided).
Instance Method Summary collapse
-
#initialize(message:, key:, label:, components:, params:) ⇒ Context
constructor
Creates a new signing context.
Constructor Details
#initialize(message:, key:, label:, components:, params:) ⇒ Context
Creates a new signing context.
55 56 57 58 59 60 61 |
# File 'lib/linzer/signature/context.rb', line 55 def initialize(message:, key:, label:, components:, params:) @message = @key = key @components = components.dup @params = (label ? params.merge(label: label) : params).dup @overlay_headers = {} end |
Instance Attribute Details
#components ⇒ Array<String> (readonly)
list of covered signature components
37 38 39 |
# File 'lib/linzer/signature/context.rb', line 37 def components @components end |
#key ⇒ Object (readonly)
the signing key used to generate the signature
37 38 39 |
# File 'lib/linzer/signature/context.rb', line 37 def key @key end |
#message ⇒ Linzer::Message (readonly)
Returns a message view that includes any overlay headers.
The returned object is cached after first construction.
Overlay headers are applied lazily and only affect the derived signing view; the original message remains unchanged.
37 38 39 |
# File 'lib/linzer/signature/context.rb', line 37 def @message end |
#overlay_headers ⇒ Hash (readonly)
Overlay headers are merged into the message view during signature computation but do not mutate the underlying message.
37 38 39 |
# File 'lib/linzer/signature/context.rb', line 37 def @overlay_headers end |
#params ⇒ Hash (readonly)
signature parameters (may include :label if provided)
37 38 39 |
# File 'lib/linzer/signature/context.rb', line 37 def params @params end |