firebase-admin 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: be6f75e823e4cb67948c9e7f421d8ecbf853e67a2d82a327f130e9d885a2647e
4
- data.tar.gz: a1875e974a100cd4718add6cf91157717345bb2f722285bb5818556395d98980
3
+ metadata.gz: e8ff8b5b882e80cee049010198961bde97f52c64dc5a5e6d5902bcab4dd40060
4
+ data.tar.gz: 35e4530ed48199101dd666743c959af4890b161e594545470a1a37dec02993ff
5
5
  SHA512:
6
- metadata.gz: 9aa236550ed151bf5668751a0981dd80162414418838393da4d0d1e994b1f2e67dd0ad049b3f4faa861842ca376291b87480008c48b26498751947216c26d790
7
- data.tar.gz: 64d74c30441e8ba9666d93d21cbab49ecca8c1ba96f391c33bccd8b4b7b98504c60ad11d5d7f9e8022a7808b1121d354380fcefa07a831825ca97c53e6413ec0
6
+ metadata.gz: 54cd5fc99fd435c7f5151ca76b47456da8cdee6b38eaaf3afcb72048adb9219d329ceec054e1e8634881fd9326f8ddece9ea0d7801c686a509b11d2c269137b1
7
+ data.tar.gz: 5c117435a3122766517027c076faf2591cc5b66e38964e9e881d2f3bf64a0a9dd902ae572585d7bba2c2e7c681a9a169daf15e90e1a1a0f1cc62655794f70911
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- firebase-admin (0.1.0)
4
+ firebase-admin (0.1.1)
5
5
  addressable (~> 2.7)
6
6
  faraday (~> 1.3)
7
7
  faraday_middleware (~> 1.0)
@@ -106,7 +106,7 @@ module FirebaseAdmin
106
106
  credentials = default_credentials
107
107
 
108
108
  service_account_email = credentials.fetch('client_email', ENV['GOOGLE_CLIENT_EMAIL'])
109
- private_key = OpenSSL::PKey::RSA.new credentials.fetch('private_key', ENV['GOOGLE_PRIVATE_KEY'])
109
+ private_key = OpenSSL::PKey::RSA.new credentials.fetch('private_key', unescape(ENV['GOOGLE_PRIVATE_KEY']))
110
110
 
111
111
  now_seconds = Time.now.to_i
112
112
  payload = {
@@ -118,6 +118,7 @@ module FirebaseAdmin
118
118
  uid: uid
119
119
  }
120
120
  JWT.encode(payload, private_key, 'RS256')
121
+ JWT.decode()
121
122
  end
122
123
 
123
124
  # Get user by email/phone/uid
@@ -149,6 +150,12 @@ module FirebaseAdmin
149
150
 
150
151
  private
151
152
 
153
+ def unescape(str)
154
+ str = str.gsub '\n', "\n"
155
+ str = str[1..-2] if str.start_with?('"') && str.end_with?('"')
156
+ str
157
+ end
158
+
152
159
  def default_credentials
153
160
  return {} if ENV['GOOGLE_APPLICATION_CREDENTIALS'].nil?
154
161
 
@@ -1,3 +1,3 @@
1
1
  module FirebaseAdmin
2
- VERSION = '0.1.0'.freeze unless defined?(::FirebaseAdmin::VERSION)
2
+ VERSION = '0.1.1'.freeze unless defined?(::FirebaseAdmin::VERSION)
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: firebase-admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Colin Harris
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-10 00:00:00.000000000 Z
11
+ date: 2021-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake