Class: HttpSignatures::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/http_signatures/context.rb

Instance Method Summary collapse

Constructor Details

#initialize(keys: {}, signing_key_id: nil, algorithm: nil, headers: nil) ⇒ Context

Returns a new instance of Context.



4
5
6
7
8
9
# File 'lib/http_signatures/context.rb', line 4

def initialize(keys: {}, signing_key_id: nil, algorithm: nil, headers: nil)
  @key_store = KeyStore.new(keys)
  @signing_key_id = signing_key_id
  @algorithm_name = algorithm
  @headers = headers
end

Instance Method Details

#signerObject



11
12
13
14
15
16
17
# File 'lib/http_signatures/context.rb', line 11

def signer
  Signer.new(
    key: signing_key,
    algorithm: Algorithm.create(@algorithm_name),
    header_list: HeaderList.new(@headers),
  )
end

#verifierObject



19
20
21
# File 'lib/http_signatures/context.rb', line 19

def verifier
  Verifier.new(key_store: @key_store)
end