README.md in firebase_id_token-1.2.2 vs README.md in firebase_id_token-1.3.0
- old
+ new
@@ -12,13 +12,13 @@
## Pre-release Notes
**This gem was developed recently and needs real world feedback.**
-If you are going to use it in production environment, please note that I am still testing it. It has realistc RSpec examples that uses real X509 certificates and signed JWT to perform tests and I can say it's working great. But using it implies in security risks, you should be aware.
+If you are going to use it in a production environment, please note that I am still testing it. It has realistic RSpec examples that use real X509 certificates and signed JWT to perform tests and I can say it's working great. But using it implies in security risks, you should be aware.
-Feel free to open any issue or to [contact me](https://fschuindt.github.io/blog/about/) regarding it's performance.
+Feel free to open any issue or to [contact me](https://fschuindt.github.io/blog/about/) regarding its performance.
## Docs
+ http://www.rubydoc.info/gems/firebase_id_token
@@ -32,11 +32,11 @@
gem install firebase_id_token
```
or in your Gemfile
```
-gem 'firebase_id_token', '~> 1.2.2'
+gem 'firebase_id_token', '~> 1.3.0'
```
then
```
bundle install
```
@@ -55,22 +55,25 @@
`project_ids` must be a Array.
*If you want to verify signatures from more than one Firebase project, just add more Project IDs to the list.*
You can also pass a Redis instance to `config` if you are not using Redis defaults.
-In this case you must have the gem `redis` in your `Gemfile`.
+In this case, you must have the gem `redis` in your `Gemfile`.
```ruby
FirebaseIdToken.configure do |config|
config.project_ids = ['your-firebase-project-id']
- congig.redis = Redis.new(host: '10.0.1.1', port: 6380, db: 15)
+ config.redis = Redis.new(host: '10.0.1.1', port: 6380, db: 15)
end
```
-Otherwise it will use just `Redis.new` as the instance.
+Otherwise, it will use just `Redis.new` as the instance.
## Usage
+You can get a glimpse of it by reading our RSpec output on your machine. It's
+really helpful. But here is a complete guide:
+
### Downloading Certificates
Before verifying tokens, you need to download Google's x509 certificates.
To do it simply:
@@ -78,30 +81,30 @@
FirebaseIdToken::Certificates.request
```
It will download the certificates and save it in Redis, but only if Redis certificates database is empty. To force download and override Redis database, use:
```ruby
-FirebaseIdToken::Certificates.request_anyway
+FirebaseIdToken::Certificates.request!
```
-Google give us information about the certificates expiration time, it's used to set a Redis TTL (Time-To-Live) when saving it. By doing so, the certificates will be automatically deleted after it's expiration.
+Google give us information about the certificates expiration time, it's used to set a Redis TTL (Time-To-Live) when saving it. By doing so, the certificates will be automatically deleted after its expiration.
#### Certificates Info
Checks the presence of certificates in Redis database.
```ruby
FirebaseIdToken::Certificates.present?
=> true
```
-How many seconds until the certificates expiration.
+How many seconds until the certificate's expiration.
```ruby
FirebaseIdToken::Certificates.ttl
=> 22352
```
-Lists all certificates in database.
+Lists all certificates in a database.
```ruby
FirebaseIdToken::Certificates.all
=> [{"ec8f292sd30224afac5c55540df66d1f999d" => <OpenSSL::X509::Certificate: [...]]
```
@@ -127,20 +130,20 @@
task request: :environment do
FirebaseIdToken::Certificates.request
end
desc "Request Google's x509 certificates and override Redis"
- task request_anyway: :environment do
- FirebaseIdToken::Certificates.request_anyway
+ task request!: :environment do
+ FirebaseIdToken::Certificates.request!
end
end
end
```
And in your `config/schedule.rb` you might have:
```ruby
every 1.hour do
- rake 'firebase:certificates:request_anyway'
+ rake 'firebase:certificates:request!'
end
```
Then:
```