Giter Site home page Giter Site logo

identity-toolkit-ruby's Introduction

This is the Ruby client library for Google Identity Toolkit services.

Sample usage
=====================

require 'gitkit_client'

# Initialize the Gitkit client instance
gitkit_client = GitkitLib::GitkitClient.create_from_config_file 'gitkit-server-config.json'

# Verifies a GitkitToken
gitkit_user, error = gitkit_client.verify_gitkit_token token_string

# Upload passwords
  def calc_sha1(key, plain_text, salt)
    hmac = OpenSSL::HMAC.new key, 'sha1'
    hmac << plain_text
    hmac << salt
    hmac.digest
  end

  hash_key = 'hash-key'

  user1 = GitkitLib::GitkitUser.new
  user1.email = '[email protected]'
  user1.user_id = '1234'
  user1.salt = 'salt-1'
  user1.password_hash = calc_sha1(hash_key, '1111', 'salt-1')

  user2 = GitkitLib::GitkitUser.new
  user2.email = '[email protected]'
  user2.user_id = '5678'
  user2.salt = 'salt-2'
  user2.password_hash = calc_sha1(hash_key, '5555', 'salt-2')
  user2.name = '56 78'

  gitkit_client.upload_users 'HMAC_SHA1', hash_key, [user1, user2]

# Get user by email
gitkit_client.get_user_by_email '[email protected]'

# Get user by id
gitkit_client.get_user_by_id '1234'

# Delete a user
gitkit_client.delete_user '1234'

# Download all accounts
gitkit_client.get_all_users { |account|
  pp account
}

identity-toolkit-ruby's People

Contributors

cslink avatar dereksalama avatar jdgreenberg avatar jin-liu avatar liujin-google avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.