Module: IosAppAttest::Validators::Utils

Defined in:
lib/ios_app_attest/validators/utils.rb

Overview

Utility methods for iOS App Attest validators

This module provides common cryptographic and encoding utilities used throughout the iOS App Attest validation process. It includes methods for base64 encoding/decoding, SHA256 hashing, and AES cipher creation.

Class Method Summary collapse

Class Method Details

.cipher ⇒ OpenSSL::Cipher

Create AES cipher

Returns:

  • (OpenSSL::Cipher) —

    AES256-CBC cipher instance



34
35
36
# File 'lib/ios_app_attest/validators/utils.rb', line 34

def self.cipher
  OpenSSL::Cipher::AES256.new(:CBC)
end

.decode_base64(base64_string) ⇒ String

Decode base64 string

Parameters:

  • base64_string (String) —

    The base64 encoded string

Returns:

  • (String) —

    The decoded string



15
16
17
# File 'lib/ios_app_attest/validators/utils.rb', line 15

def self.decode_base64(base64_string)
  Base64.strict_decode64(base64_string)
end

.encode_base64(string) ⇒ String

Encode base64 string

Parameters:

  • string (String) —

    The string to encode

Returns:

  • (String) —

    The base64 encoded string



22
23
24
# File 'lib/ios_app_attest/validators/utils.rb', line 22

def self.encode_base64(string)
  Base64.strict_encode64(string)
end

.sha256 ⇒ OpenSSL::Digest

Get SHA256 digest

Returns:

  • (OpenSSL::Digest) —

    SHA256 digest instance



28
29
30
# File 'lib/ios_app_attest/validators/utils.rb', line 28

def self.sha256
  OpenSSL::Digest.new('SHA256')
end