class CWT::ClaimsSet

Constants

LABEL_AUD
LABEL_CTI
LABEL_EXP
LABEL_IAT
LABEL_ISS
LABEL_NBF
LABEL_SUB

Attributes

aud[R]
cti[R]
exp[R]
iat[R]
iss[R]
nbf[R]
sub[R]

Public Class Methods

from_cbor(cbor) click to toggle source
# File lib/cwt/claims_set.rb, line 15
def self.from_cbor(cbor)
  from_map(CBOR.decode(cbor))
end
from_map(map) click to toggle source
# File lib/cwt/claims_set.rb, line 19
def self.from_map(map)
  new(
    iss: map[LABEL_ISS],
    sub: map[LABEL_SUB],
    aud: map[LABEL_AUD],
    exp: map[LABEL_EXP],
    nbf: map[LABEL_NBF],
    iat: map[LABEL_IAT],
    cti: map[LABEL_CTI]
  )
end
new(iss:, sub:, aud:, exp:, nbf:, iat:, cti:) click to toggle source
# File lib/cwt/claims_set.rb, line 33
def initialize(iss:, sub:, aud:, exp:, nbf:, iat:, cti:)
  @iss = iss
  @sub = sub
  @aud = aud
  @exp = exp
  @nbf = nbf
  @iat = iat
  @cti = cti
end

Public Instance Methods

expiration_time() click to toggle source
# File lib/cwt/claims_set.rb, line 47
def expiration_time
  Time.at(exp)
end
expired?() click to toggle source
# File lib/cwt/claims_set.rb, line 43
def expired?
  Time.now >= expiration_time
end