edas / bitwapi

Unofficial Bitwarden API client in ruby
Other
8 stars 1 forks source link

Doesn't work #2

Closed zxzharmlesszxz closed 9 months ago

zxzharmlesszxz commented 5 years ago

Traceback (most recent call last): 12360: from test.rb:11:in

' 12359: from /opt/puppetlabs/puppet/lib/ruby/gems/2.5.0/gems/bitwapi-0.1.0/lib/bitwapi/api.rb:73:in register' 12358: from /opt/puppetlabs/puppet/lib/ruby/gems/2.5.0/gems/bitwapi-0.1.0/lib/bitwapi/api.rb:54:intransport' 12357: from /opt/puppetlabs/puppet/lib/ruby/gems/2.5.0/gems/bitwapi-0.1.0/lib/bitwapi/api.rb:54:in tap' 12356: from /opt/puppetlabs/puppet/lib/ruby/gems/2.5.0/gems/bitwapi-0.1.0/lib/bitwapi/api.rb:54:inblock in transport' 12355: from /opt/puppetlabs/puppet/lib/ruby/gems/2.5.0/gems/bitwapi-0.1.0/lib/bitwapi/api.rb:117:in get_valid_token' 12354: from /opt/puppetlabs/puppet/lib/ruby/gems/2.5.0/gems/bitwapi-0.1.0/lib/bitwapi/api.rb:146:inrefresh_token' 12353: from /opt/puppetlabs/puppet/lib/ruby/gems/2.5.0/gems/bitwapi-0.1.0/lib/bitwapi/api.rb:54:in transport' ... 12348 levels... 4: from /opt/puppetlabs/puppet/lib/ruby/gems/2.5.0/gems/bitwapi-0.1.0/lib/bitwapi/api.rb:146:inrefresh_token' 3: from /opt/puppetlabs/puppet/lib/ruby/gems/2.5.0/gems/bitwapi-0.1.0/lib/bitwapi/api.rb:54:in transport' 2: from /opt/puppetlabs/puppet/lib/ruby/gems/2.5.0/gems/bitwapi-0.1.0/lib/bitwapi/api.rb:54:intap' 1: from /opt/puppetlabs/puppet/lib/ruby/gems/2.5.0/gems/bitwapi-0.1.0/lib/bitwapi/api.rb:54:in block in transport' /opt/puppetlabs/puppet/lib/ruby/gems/2.5.0/gems/bitwapi-0.1.0/lib/bitwapi/api.rb:117:inget_valid_token': stack level too deep (SystemStackError) `

edas commented 5 years ago

Hi

Thank you for the report

I may look in the following weeks but do not use this lib anymore. You may also try with nono's PR as it was working in september with it. https://github.com/edas/bitwapi/pull/1

Could post me your test.rb ?

zxzharmlesszxz commented 5 years ago

test.rb - contain strings from readme

require 'json'
require 'bitwapi'

api = Bitwapi::API.official()
api.register('puppet@mail.com.ua', 'PuppetServer', name: "puppet server")
api.login('puppet@mail.com.ua', 'PuppetServer', device_name: "puppet server")
credentials = api.credentials
File.write("mycredentials.json", credentials.to_json)
 json_credentials = File.read("mycredentials.json")
credentials = JSON.parse(json_credentials, symbolize_names: true)
api = Bitwapi::API.new(credentials)
vault = api.get_vault
# all ciphers
ciphers = vault.ciphers.to_a
id = ciphers[0].id
# a cipher by its id
cipher = vault.cipher(id)
# access to data
# you should have all the accessors you need
cipher.name
cipher.login
cipher.id
cipher.fields
cipher.notes