Sha256: 7f12d9c5695d49826d8afa392a6aa7d32438cbc984f639969e557c078b0f9958

Contents?: true

Size: 581 Bytes

Versions: 3

Compression:

Stored size: 581 Bytes

Contents

# typed: strict
# frozen_string_literal: true

module Paseto
  class TokenTypes < T::Enum
    extend T::Sig

    enums do
      V3Local = new('v3.local')
      V3Public = new('v3.public')
      V4Local = new('v4.local')
      V4Public = new('v4.public')
    end

    sig { returns(T.nilable(T.class_of(Interface::Key))) }
    def key_klass
      case self
      in V3Local then V3::Local
      in V3Public then V3::Public
      in V4Local if Paseto.rbnacl?
        V4::Local
      in V4Public if Paseto.rbnacl?
        V4::Public
      else
        nil
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby-paseto-0.1.2 lib/paseto/token_types.rb
ruby-paseto-0.1.1 lib/paseto/token_types.rb
ruby-paseto-0.1.0 lib/paseto/token_types.rb