<commit_before>
module WhoGrantSig
  class Header
    attr_accessor :signer, :email_identifier

    def initialize(signer)
      self.signer = signer
      self.email_identifier = self.signer.email_identifier
    end


    def grant
      {
        'from' => email_identifier,
        'X-WhoGrantSig-signature' => signature,
        'X-WhoGrantSig-valid-until' => valid_until
      }
    end

    def valid_until
      @time ||= (Time.now + TIME_THRESHOLD).to_i.to_s
    end

    def id_string
      [email_identifier, valid_until].join(',')
    end

    #where should I base64?
    def signature
      Base64.encode64(encryption_key.sign(OpenSSL::Digest::SHA256.new, id_string))
    end

    def encryption_key
      signer.private_key
    end
  end
end

<commit_msg>reorder the signature and valid_util for kicks<commit_after>
module WhoGrantSig
  class Header
    attr_accessor :signer, :email_identifier

    def initialize(signer)
      self.signer = signer
      self.email_identifier = self.signer.email_identifier
    end


    def grant
      {
        'from' => email_identifier,
        'X-WhoGrantSig-valid-until' => valid_until,
        'X-WhoGrantSig-signature' => signature
      }
    end

    def valid_until
      @time ||= (Time.now + TIME_THRESHOLD).to_i.to_s
    end

    def id_string
      [email_identifier, valid_until].join(',')
    end

    #where should I base64?
    def signature
      Base64.encode64(encryption_key.sign(OpenSSL::Digest::SHA256.new, id_string))
    end

    def encryption_key
      signer.private_key
    end
  end
end


{'fraction_non_alphanumeric': 0.08795411089866156, 'fraction_numerical': 0.011472275334608031, 'mean_word_length': 2.5763097949886107, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3597991', 'n_tokens_mistral': 539, 'n_tokens_neox': 506, 'n_words': 106}