Skip to content
A captcha service based on micropayments (server)
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


A server-side Pennyauth authenticator built on Google Cloud Functions.

Setup and testing

Install the Cloud Functions Emulator to develop and test pennyauth-server.

# Install Cloud Functions NodeJS emulator
$ npm install -g @google-cloud/functions-emulator

# Start datastore emulator
$ gcloud beta emulators datastore start --no-store-on-disk --consistency 1.0

$ export DATASTORE_EMULATOR_HOST=localhost:8081
$ functions start

# Deploy to emulator and test
$ functions deploy validateCaptcha --trigger-http
$ functions call validateCaptcha --file=request.json
$ functions logs read

# Create key
$ functions call createAPIKey --data='{"origin": "http://localhost:8080"}'

# Create validate captcha

Production notes

  • GCP Project: pennyauth
  • Service account
  • Cloud function: validateCaptcha

Deploying to production

$ gcloud auth login
$ gcloud config set project pennyauth
$ gcloud functions deploy createAPIKey --runtime nodejs8 --trigger-http
$ gcloud functions deploy validateCaptcha --runtime nodejs8 --trigger-http

# Update secrets
gcloud functions deploy createAPIKey --update-env-vars QUID_API_SECRET=ks-XXX
gcloud functions deploy validateCaptcha --update-env-vars QUID_API_SECRET=ks-XXX


Logs via console.log are written to the cloud function logs (and stackdriver in prod.)

$ gcloud functions call validateCaptcha --file=params.json
$ curl -X POST "" \
  -H "Content-Type:application/json" \
  --data '@params.json'

$ gcloud functions logs read
You can’t perform that action at this time.