DaphneUtil

A pseudorandom credential generator to create/distribute application credentials and command line client for Daphne

Installation

Add this line to your application's Gemfile:

gem 'daphne_util'

And then execute:

$ bundle

Or install it yourself as:

$ git clone [email protected]:MTNSatelliteComm/daphne_util.git
$ cd daphne_util
$ gem build daphne_util.gemspec
$ gem install daphne_util-0.2.0.gem

Keep in mind the version may need to match the version created by gem build

CLI Usage

daphne_client_id arg1[,arg2[,argN]]

daphne_client_secret arg1[,arg2[,argN]]

daphne_client_api_key arg1[,arg2[,argN]]

Ruby App Usage

DaphneUtil::IdGenerator.generate(arg1[,arg2[,argN]])

DaphneUtil::SecretGenerator.generate(arg1[,arg2[,argN]])

DaphneUtil::ApiKeyGenerator.generate(arg1[,arg2[,argN]])

CLI Example

$ daphne_client_id aname aplace athing
application-636b685a-70ef-032f-857c-9f422af7a6b2

$ daphne_client_secret aname aplace athing
60934d2dd5069fd4f39550f90cde5b39e0337c91211eb9d8a01174563698fd32

$ daphne_client_api_key aname aplace athing
application-key-0079d3f97d0c27b457e428f86fa4f4cd910e2bd3f25b82716dcdc7301a312d35

Ruby Code Example

#calling module methods

DaphneUtil.generate_id("aname","aplace","athing")
#application-636b685a-70ef-032f-857c-9f422af7a6b2

DaphneUtil.generate_secret("aname","aplace","athing")
#60934d2dd5069fd4f39550f90cde5b39e0337c91211eb9d8a01174563698fd32

DaphneUtil.generate_api_key("aname","aplace","athing")
application-key-0079d3f97d0c27b457e428f86fa4f4cd910e2bd3f25b82716dcdc7301a312d35


#extending a class

class Foo
  extend DaphneUtil
end

Foo.generate_id("aname","aplace","athing")
#application-636b685a-70ef-032f-857c-9f422af7a6b2

Foo.generate_secret("aname","aplace","athing")
#60934d2dd5069fd4f39550f90cde5b39e0337c91211eb9d8a01174563698fd32

Foo.generate_api_key("aname","aplace","athing")
application-key-0079d3f97d0c27b457e428f86fa4f4cd910e2bd3f25b82716dcdc7301a312d35

Example using the Daphne client

create an environment

$ daphne create env my_env_name http://my_env_target.com

create application credentials

$ daphne creds a_pre_loaded_app value1 value2

create an application token

$ daphne create token a_pre_loaded_app

if there are no preloaded app app uid and secret can create a token. if that is accompanied with email and password a resource owner token associated to the application is created.

set the token for this environment

$ daphne token dba23d73388e1326cb461f4410fe4ce73667e5ccecd6911341b7af1af9173d9a

verify the token

$ daphne verify token dba23d73388e1326cb461f4410fe4ce73667e5ccecd6911341b7af1af9173d9a

with a token with api access you can create/modify/delete/view Daphne resources

$ daphne create resource_owner [email protected] entity_id=an_id password=password

$ daphne update resource_owner [email protected] password=new_password

use daphne help command to see the usage information

$ daphne help

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request