Class: Sandal::Sig::None

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

Overview

The ‘none’ JWA signature method.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeNone

Creates a new instance.



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

def initialize
  @name = 'none'
end

Instance Attribute Details

#nameString (readonly)

Returns The JWA name of the algorithm.

Returns:

  • (String)

    The JWA name of the algorithm.



12
13
14
# File 'lib/sandal/sig.rb', line 12

def name
  @name
end

Instance Method Details

#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 verify.

  • payload (String)

    This parameter is ignored.

Returns:

  • (Boolean)

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



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

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