Sha256: 757b373f8a3feda315973463997dba7dac84779c05fc9bef14d681dad55126da
Contents?: true
Size: 631 Bytes
Versions: 6
Compression:
Stored size: 631 Bytes
Contents
# frozen_string_literal: true module AppStoreConnect class Authorization AUDIENCE = 'appstoreconnect-v1' ALGORITHM = 'ES256' attr_reader :key_id, :issuer_id, :private_key def initialize(key_id:, issuer_id:, private_key:) @key_id = key_id @issuer_id = issuer_id @private_key = OpenSSL::PKey.read(private_key) end def payload { exp: Time.now.to_i + 20 * 60, iss: issuer_id, aud: AUDIENCE } end def header_fields { kid: key_id } end def token JWT.encode(payload, private_key, ALGORITHM, header_fields) end end end
Version data entries
6 entries across 6 versions & 1 rubygems