bitpay / ruby-client

Powerful, flexible, lightweight SDK for the BitPay Bitcoin Payment Gateway API.
MIT License
79 stars 64 forks source link

"bitpay pair" #17

Closed scottrobertson closed 10 years ago

scottrobertson commented 10 years ago

What does this do? It does not seem to save any config files locally etc?

How do you handle this in automatic deployments if it does not save a token locally to commit?

philosodad commented 10 years ago

Tokens are stored in the object when it is created or when it is paired. Once you have paired a key, the object uses the get_tokens call to retrieve a token from the server. The next client that is created will retrieve all paired tokens when instantiated with the load_tokens call. Examples of creating invoices with the library can be found in the spec/features/pos_spec file.

From the point of view of an automatic deployment, the plugin currently requires some interaction. Each key that is created has to be paired separately.

scottrobertson commented 10 years ago

Sorry if I am being an idiot. But if I run bitpay pair, surely it has to store the response of that somewhere? Otherwise the client will not know what token to use? If i run pair, shut my mac down, and come back, will it know what token to use somehow, or does it need run again? Again, sorry if I am missing something.

philosodad commented 10 years ago

When you pair the client, you're verifying your keypair, which is stored in $HOME/.bitpay/bitpay.pem. The next time you instantiate the client, it finds the keypair and contacts bitpay to retrieve the tokens. The keypair is created by the client and stored on your system.

scottrobertson commented 10 years ago

Hmm ok, going to cause a few issues with automation then. Will have to look into it some more. Thanks.