jheiss / keyring Goto Github PK
View Code? Open in Web Editor NEWStore and access your passwords safely
License: MIT License
Store and access your passwords safely
License: MIT License
2.6.5 :001 > require 'keyring'
true
2.6.5 :002 > keyring = Keyring.new
Traceback (most recent call last):
16: from ~/.rvm/gems/ruby-2.6.5/gems/keyring-0.4.1/lib/keyring/backend.rb:14:in `block in create'
15: from ~/.rvm/gems/ruby-2.6.5/gems/keyring-0.4.1/lib/keyring/backend.rb:14:in `new'
14: from ~/.rvm/gems/ruby-2.6.5/gems/keyring-0.4.1/lib/keyring/backends/gnome_keyring.rb:12:in `initialize'
13: from ~/.rvm/rubies/ruby-2.6.5/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:34:in `require'
12: from ~/.rvm/rubies/ruby-2.6.5/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:130:in `rescue in require'
11: from ~/.rvm/rubies/ruby-2.6.5/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:130:in `require'
10: from ~/.rvm/gems/ruby-2.6.5/gems/gir_ffi-gnome_keyring-0.0.10/lib/gir_ffi-gnome_keyring.rb:5:in `<top (required)>'
9: from ~/.rvm/gems/ruby-2.6.5/gems/gir_ffi-0.13.1/lib/gir_ffi/core.rb:29:in `setup'
8: from ~/.rvm/gems/ruby-2.6.5/gems/gir_ffi-0.13.1/lib/gir_ffi/builder.rb:42:in `build_module'
7: from ~/.rvm/gems/ruby-2.6.5/gems/gir_ffi-0.13.1/lib/gir_ffi/builders/module_builder.rb:23:in `generate'
6: from ~/.rvm/gems/ruby-2.6.5/gems/gir_ffi-0.13.1/lib/gir_ffi/builders/module_builder.rb:60:in `modul'
5: from ~/.rvm/gems/ruby-2.6.5/gems/gir_ffi-0.13.1/lib/gir_ffi/builders/module_builder.rb:69:in `build_dependencies'
4: from ~/.rvm/gems/ruby-2.6.5/gems/gir_ffi-0.13.1/lib/gir_ffi/builders/module_builder.rb:116:in `gir'
3: from ~/.rvm/gems/ruby-2.6.5/gems/gir_ffi-0.13.1/lib/gir_ffi/builders/module_builder.rb:116:in `tap'
2: from ~/.rvm/gems/ruby-2.6.5/gems/gir_ffi-0.13.1/lib/gir_ffi/builders/module_builder.rb:117:in `block in gir'
1: from ~/.rvm/gems/ruby-2.6.5/gems/gir_ffi-0.13.1/lib/ffi-gobject_introspection/i_repository.rb:42:in `require'
RuntimeError (Typelib file for namespace 'GnomeKeyring' (any version) not found)
➤ lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: Fedora
Description: Fedora release 31 (Thirty One)
Release: 31
Codename: ThirtyOne
Ruby ver: 2.4.1
Keystring ver: 0.4.1 (latest)
Thanks for a great gem! Everything works except I'm having a weird issue.
nil
I tested in a other ruby file, and it correctly grabbed the right password.
Could there be something that affects the scope of keyring that I might be changing unknowingly inside my app?
Edit: in-app keyring instance actually can't find any passwords defined in seahorse
program :/
Edit 2: in-app keyring instance is printed as this in pry:
#<Keyring:0x00563e62e44228 @backend=#<Keyring::Backend::Memory:0x00563e62dee738 @keyring={}>>
, where as in-pry insance does not have @keyring
defined. How could this be happening?
Edit 3: Think previous edit made it clear that it was using Keyring::Backends::Memory and not Gnome one. I explicitly added require "gir_ffi-gnome_keyring"
in my app, and it now loads Gnome instance aka I have access to my passwords. Would be interested in making PR for this but dunno where this is being caused from
Hi,
I need to install the keyring
Gem on a Linux Machine running Ruby 2.3.8
but it fails with
$ gem install keyring
Fetching corefoundation-0.2.0.gem
Fetching keyring-0.4.1.gem
Fetching ffi-1.13.1.gem
Fetching ruby-keychain-0.3.2.gem
Fetching slop-3.6.0.gem
Building native extensions. This could take a while...
Successfully installed ffi-1.13.1
Successfully installed corefoundation-0.2.0
Successfully installed ruby-keychain-0.3.2
Successfully installed slop-3.6.0
Building native extensions. This could take a while...
ERROR: Error installing keyring:
ERROR: Failed to build gem native extension.
current directory: /home/zinga/.rvm/gems/ruby-2.3.8@keyring-test/gems/keyring-0.4.1/ext
/usr/share/rvm/rubies/ruby-2.3.8/bin/ruby mkrf_conf.rb
*linux: installing gir_ffi-gnome_keyring...
rake failed, exit code 1
Gem files will remain installed in /home/zinga/.rvm/gems/ruby-2.3.8@keyring-test/gems/keyring-0.4.1 for inspection.
Results logged to /home/zinga/.rvm/gems/ruby-2.3.8@keyring-test/extensions/x86_64-linux/2.3.0/keyring-0.4.1/gem_make.out
This is because
gir_ffi-gnome_keyring
dependency with version constraint ~> 0.0.3
isgir_ffi-gnome_keyring
version 0.0.11
which in turngir_ffi
version ~> 0.15.1
whichRuby
version >= 2.5
So, the installation of the gir_ffi-gnome_keyring
dependency fails and thus the installation of keyring
itself too.
Notes:
Ruby 2.3.8
is EOL but I'd expect that an install of a Gem which worked "yesterday" on a machine should work "today" as well (when using the exact same version).gir_ffi-gnome_keyring
to me seems to be a bit "loose" here and I filed a bug for that as well.In general in the past (with other Gems) I was able to resolve such problems by installing a version of the problematic dependency which fulfilled the version constraint and worked on my platform. When installing the Gem then the dependency was already satisfied and the gem install
worked.
With keyring
this doesn't work though because it manages the dependency by itself via the extension build mechanism (instead of letting it be resolved by the gem
tool) and that kind of forces an installation of the most recent version of the dependency (which satisfies the version constraint).
To make dependency handling of keyring
conform a bit more to the "normal behaviour" it could install the dependency/ies only if necessary, like the gem install command with --conservative option, i.e. do something like
name, version = ["gir_ffi-gnome_keyring", '~> 0.0.3']
inst.install name, version if Gem::Dependency.new(name, version).matching_specs.empty?
i.e. install the dependency only if there is none (satisfying the version constraint) already.
Then my workaround with "nailing down" certain dependency versions would work and installation of keyring on older Ruby versions (2.3
, 2.4
) would work again too.
Hi,
if I am not mistaken the ruby-keychain
dependency is not supposed to be installed (because not necessary/sensible) on Linux, is it?
When I install keyring
(version 0.4.1) on my Linux (elementary OS Juno - based on ubuntu 18.04) with gem install
(within rvm
) it installs the ruby-keychain
dependency.
$ gem install -V keyring
[...]
Successfully installed ruby-keychain-0.3.2
[...]
Building native extensions. This could take a while...
[...]
*linux: installing gir_ffi-gnome_keyring...
[...]
Successfully installed keyring-0.4.1
$ gem list -l key
*** LOCAL GEMS ***
gir_ffi-gnome_keyring (0.0.10)
keyring (0.4.1)
ruby-keychain (0.3.2)
The gem dependency
command also lists it:
$ gem dependency keyring
Gem keyring-0.4.1
bundler (~> 1.3, development)
mocha (>= 0, development)
rake (>= 0, development)
ruby-keychain (~> 0.3.2)
slop (< 4.0)
As well as the website on rubygems.org: https://rubygems.org/gems/keyring/versions/0.4.1
$ ruby -e 'puts Gem::Platform.local.os'
linux
It's not a big deal because (at least after installing the libgnome-keyring-dev libgirepository1.0-dev
packages) the Gem works fine (with the Gnome keyring) but the commit(s) in 0.4.1 sound like the dependencies should be handled for the different platforms separately.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.