You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: jwt_token.rb
    path of file: ./repos/Portus/lib/portus
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

require "portus/migrate"

module Portus
  # This class implements the JSON Web Token as expected by the registry. Read
  # the `spec` for more information:
  #
  #   https://github.com/docker/distribution/blob/master/docs/spec/auth/token.md
  #
  class JwtToken
    # The constructor takes the query parameters as specified in the
    # specification. The given scopes are assumed to have already been processed
    # by the caller with the authorized scopes.
    def initialize(account, service, scopes)
      @account = account
      @service = service
      @scopes = scopes
    end

    # Returns a hash containing the enc
    
    def self.kid(private_key)
      sha256 = Digest::SHA256.new
      sha256.update(private_key.public_key.to_der)
      payload = StringIO.new(sha256.digest).read(30)
      Base32.encode(payload).split("").each_slice(4).each_with_object([]) do |slice, mem|
        mem << slice.join
      end.join(":")
    end

    protected

    # The expiration time to be added to the current token.
    def expiration_time
      APP_CONFIG["registry"]["jwt_expiration_time"]["value"].to_i.minutes
    end

    # Returns an array with the authorized actions hash.
    def authorized_access
      @scopes.map do |scope|
        {
          type:    scope.resource_type,
          name:    scope.resource_name,
          actions: scope.actions
        }
      end
    end

    # Returns a (hopefully) unique id for the JWT token.
    def jwt_id
      SecureRandom.base58(42)
    end

    # Returns the time in which the token has been issued (now).
    def issued_at
      @issued_at ||= Time.zone.now.to_i
    end
  end