Skip to content
This repository has been archived by the owner on Feb 9, 2023. It is now read-only.
/ dl-google-keys-hs Public archive

Download Google's public OAuth2 encryption keys as a Cronjob

Notifications You must be signed in to change notification settings

cideM/dl-google-keys-hs

Repository files navigation

Download and Cache Public Google Keys

This is a glorified shell script which you can run as a Cronjob. It downloads Google encryption keys which can be used to implement OAuth2 if you can't use an SDK. The keys are cached in a file, in the form of JSON. If the cached keys are still valid, nothing happens.

Quickstart

$ export PUBLIC_KEYS_URL="https://www.googleapis.com/robot/v1/metadata/x509/securetoken@system.gserviceaccount.com"
$ export KEYS_CACHE_PATH="./foo.json"
$ ./download-keys
"No cached keys found, downloading new keys..."
"Stored new keys at: ./foo.json"
$ ./download-keys
"Cached keys are valid until: 2020-11-09 18:10:20.260362 UTC"

Building

This project uses Nix. You can build the executable with just nix-build in the project root. Alternatively Cabal commands also work, such as cabal v2-run.

Info

This project aims to keep things simple. That's why I'm manually parsing environment variables and using do notation liberally.

About

Download Google's public OAuth2 encryption keys as a Cronjob

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published