GithubHelp home page GithubHelp logo

Comments (5)

dakra avatar dakra commented on June 29, 2024

Hi,

thanks for testing this package. The "problem" is that it's a Emacs module which is C and needs to be compiled first. When I created it I didn't know how I can distribute it in a portable way and put in on melpa. I now know of e.g. vterm and zeromq that are modules as well and they have helper function to compile the module for you on first invokation, I just didn't have time to implement that yet.

To your actual problem, it's strange that make only calls Emacs. Can you explicitly maybe try make all or make libsodium.so as the elisp code needs the module first.
For me it looks like:

λ make
cc -shared -std=c99 -s -Wall -Wextra -O3 -fpic -lsodium -o libsodium.so libsodium.c
emacs -Q -batch -L . -f batch-byte-compile sodium.el

Also regarding keepassxc.el I use it mainly to open/lock/unlock my keepass database.
Looking up passwords works but the keepassxc interface only provides looking it up by URL
so you have to specify the exact URL which is kinda annoying.
In the keepassxc git repo (unreleased) The added Freedesktop.org Secret Storage Spec integration and I haven't had time for it yet but that makes searching hopefully mor pleasant.

I also plan to write an auth-source backend that uses keepassxc.
What is your use-case?

from sodium.el.

Lenbok avatar Lenbok commented on June 29, 2024

Sorry, that make output I posted was from a re-attempt. If I make clean and rerun I do get the cc command, but the emacs command is still failing:

$ make
cc -shared -std=c99 -s -Wall -Wextra -O3 -fpic -lsodium -o libsodium.so libsodium.c
emacs -Q -batch -L . -f batch-byte-compile sodium.el
emacs: symbol lookup error: /home/len/.emacs.d/straight/repos/sodium.el/libsodium.so: undefined symbol: sodium_init
Makefile:19: recipe for target 'sodium.elc' failed
make: *** [sodium.elc] Error 127

There is a libsodium there:

$ ll
total 92
-rw-rw-r-- 1 len len 11403 Oct 26 13:15 emacs-module.h
-rw-rw-r-- 1 len len  9459 Oct 26 13:15 libsodium.c
-rwxrwxr-x 1 len len 14416 Oct 26 13:16 libsodium.so*
-rw-rw-r-- 1 len len 35147 Oct 26 13:15 LICENSE
-rw-rw-r-- 1 len len   825 Oct 26 13:15 Makefile
-rw-rw-r-- 1 len len  1744 Oct 26 13:15 README.md
-rw-rw-r-- 1 len len  1082 Oct 26 13:15 sodium-box-demo.el
-rw-rw-r-- 1 len len  1276 Oct 26 13:15 sodium.el

It just looks like the emacs command isn't able to connect from the newly built libsodium.so there to the actual system sodium library in /usr/lib/x86_64-linux-gnu/libsodium.so (is it getting confused by the fact they have the same name?)

In terms of my use case, I have several secrets (e.g. passwords, GitHub API tokens for grip-mode, etc) currently sitting in my init.el that I want to move out. It sounds like emacs auth-source deals with that, but I was hoping there would be an auth-source backend that uses keepassxc (since that is what I use for my other password storage) rather than having to make a new location for storing passwords.

from sodium.el.

dakra avatar dakra commented on June 29, 2024

Hmm. undefined symbol: sodium_init means that Emacs does find my Emacs C Module and it tries to call sodium_init (here)[https://github.com/dakra/sodium.el/blob/a67dd5db8c85ba1793343fcb0fbd78e066a74797/libsodium.c#L228) but it can't find it.

I know my Makefile is very sparse and basically only works for me. Googleing for that error comes up with multiple different projects with the same error.
I guess it's "just" some additional argument to gcc.
Maybe I should just switch to cmake or something more sophisticated but I don't think I have the time for that in the near future.
It would be great if we can figure out what's missing with your setup and change it in the Makefile here.

In terms of my use case, I have several secrets (e.g. passwords,
GitHub API tokens for grip-mode, etc) currently sitting in my
init.el that I want to move out. It sounds like emacs auth-source
deals with that, but I was hoping there would be an auth-source
backend that uses keepassxc (since that is what I use for my other
password storage) rather than having to make a new location for
storing passwords.

Jep, auth-source is exactly what you want there.
It's on my todo to write an auth-source backend but I really
don't know when I have time for this.

But in the meantime you could replace your logins/passwords in your
config with something like
(gethash "password" (aref (keepassxc-get-logins "https://accounts.google.com") 0))
to get your first stored password for google.
(I could make the API nicer if you want)

Thanks.

from sodium.el.

Lenbok avatar Lenbok commented on June 29, 2024

@dakra I'll give it a bit of poking and see if I can work out why it isn't working.

BTW, I also found https://github.com/tangxinfa/counsel-keepassxc which works pretty well for interactive lookups, but from what I have tried so far it needs to unlock the database on each lookup, whereas I assume your sodium connection approach is more like the browser integration where unlocking (and re-locking after timeouts etc) is managed by the keepassxc app.

from sodium.el.

dakra avatar dakra commented on June 29, 2024

I'll give it a bit of poking and see if I can work out why it isn't working

That would be great. I will also improving the Makefile but I don't think I have any time for this this year.

BTW, I also found https://github.com/tangxinfa/counsel-keepassxc

Ah, nice, didn't know that.
Initially I also wanted to create a simple wrapper around keepassxc-cli and just shell out to the command line, but (like you said) it doesn't hold a session and you need to enter the password every time. My keepassxc.el is like the browser extension, you accept this connection once and then you can simply use it when the database is unlocked (or you can even (un)lock it from Emacs).
One annoyance is that this and the browser extension currently only "search" in the URL field while
kkeepassxc-cli searches like the search box in keepassxc itself. This would actually preferred in my Emacs extension but I didn't research enough to create a feature request in the official repo.

from sodium.el.

Related Issues (2)

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.