Class: Sandal::Sig::None

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/sandal/sig.rb

Overview

The “none” JWA signature method.

Constant Summary collapse

NAME =

The JWA name of the algorithm.

"none"

Instance Method Summary collapse

Instance Method Details

#nameObject

The JWA name of the algorithm.



15
16
17
# File 'lib/sandal/sig.rb', line 15

def name
  NAME
end

#sign(payload) ⇒ String

Returns an empty signature.

Parameters:

  • payload (String)

    This parameter is ignored.

Returns:

  • (String)

    An empty string.



23
24
25
# File 'lib/sandal/sig.rb', line 23

def sign(payload)
  ""
end

#valid?(signature, payload) ⇒ Boolean

Validates that a signature is nil or empty.

Parameters:

  • signature (String)

    The signature to validate.

  • payload (String)

    This parameter is ignored.

Returns:

  • (Boolean)

    true if the signature is nil/empty; otherwise false.



32
33
34
# File 'lib/sandal/sig.rb', line 32

def valid?(signature, payload)
  signature.nil? || signature.empty?
end