Module: Linzer::Signer

Extended by:
Common
Defined in:
lib/linzer/signer.rb

Constant Summary collapse

DEFAULT_LABEL =
"sig1"

Class Method Summary collapse

Methods included from Common

signature_base, validate_components, validate_uniqueness

Class Method Details

.default_labelObject



22
23
24
# File 'lib/linzer/signer.rb', line 22

def default_label
  DEFAULT_LABEL
end

.sign(key, message, components, options = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/linzer/signer.rb', line 10

def sign(key, message, components, options = {})
  validate key, message, components

  parameters = populate_parameters(key, options)
  signature_base = signature_base(message, components, parameters)

  signature = key.sign(signature_base)
  label = options[:label] || DEFAULT_LABEL

  Linzer::Signature.build(serialize(signature, components, parameters, label))
end