Class: CrxAppid

Inherits:
Object
  • Object
show all
Defined in:
lib/crx_appid.rb,
lib/crx_appid/version.rb

Constant Summary collapse

VERSION =
"0.0.2"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.calculate(pem) ⇒ Object



15
16
17
# File 'lib/crx_appid.rb', line 15

def calculate(pem)
  new.calculate(pem)
end

.calculate_from_file(pem) ⇒ Object



19
20
21
# File 'lib/crx_appid.rb', line 19

def calculate_from_file(pem)
  new.calculate_from_file(pem)
end

Instance Method Details

#calculate(pem) ⇒ Object



6
7
8
# File 'lib/crx_appid.rb', line 6

def calculate(pem)
  Digest::SHA256.hexdigest(OpenSSL::PKey::RSA.new(pem).public_key.to_der)[0...32].tr('0-9a-f', 'a-p')
end

#calculate_from_file(pem) ⇒ Object



10
11
12
# File 'lib/crx_appid.rb', line 10

def calculate_from_file(pem)
  calculate(open(pem).read)
end