Class: JWT::JWK::Thumbprint

Inherits:
Object
  • Object
show all
Defined in:
lib/jwt/jwk/thumbprint.rb

Overview

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(jwk) ⇒ Thumbprint

Returns a new instance of Thumbprint.



9
10
11
# File 'lib/jwt/jwk/thumbprint.rb', line 9

def initialize(jwk)
  @jwk = jwk
end

Instance Attribute Details

#jwkObject (readonly)

Returns the value of attribute jwk.



7
8
9
# File 'lib/jwt/jwk/thumbprint.rb', line 7

def jwk
  @jwk
end

Instance Method Details

#generateObject Also known as: to_s



13
14
15
16
17
18
19
20
21
# File 'lib/jwt/jwk/thumbprint.rb', line 13

def generate
  ::Base64.urlsafe_encode64(
    Digest::SHA256.digest(
      JWT::JSON.generate(
        jwk.members.sort.to_h
      )
    ), padding: false
  )
end