Class: JayDoubleuTee::PrepareSignature

Inherits:
Object
  • Object
show all
Defined in:
lib/jay_doubleu_tee/prepare_signature.rb

Instance Method Summary collapse

Instance Method Details

#call(algorithm:, secret:) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/jay_doubleu_tee/prepare_signature.rb', line 7

def call(algorithm:, secret:)
  return OpenSSL::PKey::RSA.new(secret) if algorithm == "RS256"
  return OpenSSL::PKey::EC.new(secret) if algorithm == "ES256"
  return RbNaCl::Signatures::Ed25519::VerifyKey.new(secret) if algorithm == "ED25519"
  return OpenSSL::PKey::RSA.new(secret) if algorithm == "PS256"

  secret
end