Elvis Gastelum Posted May 30, 2023 Share Posted May 30, 2023 CONTEXT: - Machines i use: MBP 13" M1, and MBP 16" M1 Pro First a small disclaimer, I'm not a native English speaker, so probably i will have some grammatical problems. Yesterday I was trying to configure pass https://www.passwordstore.org/ with alfred, but i found with the alfred-pass workflow was not working for me https://github.com/CGenie/alfred-pass, so the first thing i notice was, the repo has no activity from "Nov 21, 2021", i know this is a niche workflow and the author don't needs to maintain constantly but i really want to have it working on my machine, so i clone it on my machine, and do a little changes to get it working with python3, because my computer (MBP 13) doesn't have python 2, and i dont wanna install it just for the workflow, but i cant avoid to install two pip packages listed on the readme, that's fine. works!, i got it working, and i dont wanna lose this changes i do, so i create a fork and make the commits on my fork https://github.com/elvisgastelum/alfred-pass, everything goes well at that point. Today, i wake up and use the second computer i have (MBP 16), and i had to install again the workflow with all the pip staff, and i just thing, "okay i know how works this one, because i had to fix it yesterday, why not rewrite it but with removing python and the pip dependencies", so i started, i was looking for a way to make a rewrite on a know language for me like javascript or typescript, because I'm a React developer, but again, now we got a new dependency... "node". That's when i remember something about js/ts compiled with Deno, so i started creating a hello world on typescript with Deno, and run the `deno compile src/index.ts --output hello-world`, and it works!, i had a new file with no dependencies like node, deno, npm installing, etc. but my smile goes away when i look the file size ~82 MB, that's not acceptable for a simple wrapper to the pass cli. That's when i finally think about golang, it compiles, is more fast the js/ts, the final size is not too big (~1/2 MB my final size of the workflow with the golang binary inside), and the language is relatively easy to use, in special when gets compared with things like rust (remember i dont have too much exp out of web dev world so its an important thing for me that), everything looks well, so i begin, in really the python dependency and pip packages was for the filter algorithm, so i just need to port the filter logic and should be done. In the time i was looking i found a library to make specifically alfred workflows on golang https://github.com/deanishe/awgo, in really says is a library for alfred 3 and 4, but the things i test, worked perfectly on alfred 5 too. they also have the filter algorithm included, so for me was just put the pieces together, test everything, and works!. fast, small and with any python, pip, dependencies. The idea is just download the workflow and never had to worry about other thing. Only setup properly pass, gpg-agent, pinentry-mac, pass-otp, obviously, but that doesn't depend on me. well, if someone have alfred 5, use the pass manager, and want to test it i will look the comments. For now i dont share the final binaries because i have only apple silicon processors, and i imagine the golang binaries will not work on intel machines. so all you need to do is clone the repo, have installed (while there is not distribution files) go1.20.4 and run ```make``` to generate the alfred workflow on the dist folder ready to be opened with alfred 5, or run ```make dev``` to open automatically when it gets generated The repository is this one: https://github.com/elvisgastelum/alfred-x-pass Link to comment
vitor Posted May 30, 2023 Share Posted May 30, 2023 14 hours ago, Elvis Gastelum said: For now i dont share the final binaries because i have only apple silicon processors, and i imagine the golang binaries will not work on intel machines. With Apple Silicon you can compile for both in the same binary. It’s called a Universal Binary. But unless you can also sign and notarise it, it won’t run on other user’s machines by default due to macOS’ security policies. Elvis Gastelum 1 Link to comment
Elvis Gastelum Posted May 30, 2023 Author Share Posted May 30, 2023 19 minutes ago, vitor said: With Apple Silicon you can compile for both in the same binary. It’s called a Universal Binary. But unless you can also sign and notarise it, it won’t run on other user’s machines by default due to macOS’ security policies. Do you have any documentation to make the sign and notarize?, i can try to make that, in order to get in the future a submit for introduce on the alfred gallery Link to comment
vitor Posted May 30, 2023 Share Posted May 30, 2023 (edited) To sign and notarise a binary or app you first need to enroll in the Apple Developer Program (paid). To sign you use the codesign tool. To notarise I have described the process in another post. Edited May 30, 2023 by vitor Fixed second link Elvis Gastelum 1 Link to comment
Elvis Gastelum Posted May 30, 2023 Author Share Posted May 30, 2023 6 minutes ago, vitor said: To sign and notarise a binary or app you first need to enroll in the Apple Developer Program (paid). To sign you use the codesign tool. To notarise I have described the process in another post. The "another post" goes to the same link as "enroll in the Apple Developer Program", but don't worry, thanks for the info, i will need to save some money later to buy the apple developer membership, then i can try to look the other part. again thanks for the comments! Link to comment
vitor Posted May 30, 2023 Share Posted May 30, 2023 1 minute ago, Elvis Gastelum said: The "another post" goes to the same link as "enroll in the Apple Developer Program" Fixed. Thank you. Link to comment
kofm Posted June 6, 2023 Share Posted June 6, 2023 Hey thank you for this workflow! I managed to get it running with my previous installation but after resetting my Mac I can't get it working for some reason. I can't figure out why and I don't know where to start to debug this. When I try to search for a secret it always tells me "No matches found". I've installed all the dependencies and successfully "make" the workflow. If I try using pass from the CLI it works correctly. If it can help, I'm using gopass so my ~/.password-store is a symlink to ~/.local/share/gopass/stores/root but it worked before and I can run all the commands from the shell. Do you have any guidance on how to debug this? Thanks Link to comment
vitor Posted June 6, 2023 Share Posted June 6, 2023 35 minutes ago, kofm said: Do you have any guidance on how to debug this? Open the workflow debugger and run the failing command. Link to comment
kofm Posted June 6, 2023 Share Posted June 6, 2023 Thank you very much and sorry for not doing this in the first place. Unfortunately, I'm afraid the debugger output won't help much [14:40:10.628] Pass[Script Filter] Queuing argument 'spo' [14:40:10.712] Pass[Script Filter] Script with argv 'spo' finished [14:40:10.718] STDERR: Pass[Script Filter] 14:40:10 feedback.go:509: Sent 1 result(s) to Alfred [14:40:10.718] Pass[Script Filter] { "variables": { "AW_SESSION_ID": "IOWS2XJM7NKQZ0ZYDUMKK5YB" }, "items": [ { "title": "No matches found", "subtitle": "Try a different query?", "valid": false, "icon": { "path": "assets/not-found-icon.png" } } ] } It should return at least the secret for spotify.com Link to comment
Elvis Gastelum Posted June 6, 2023 Author Share Posted June 6, 2023 1 hour ago, kofm said: Thank you very much and sorry for not doing this in the first place. Unfortunately, I'm afraid the debugger output won't help much [14:40:10.628] Pass[Script Filter] Queuing argument 'spo' [14:40:10.712] Pass[Script Filter] Script with argv 'spo' finished [14:40:10.718] STDERR: Pass[Script Filter] 14:40:10 feedback.go:509: Sent 1 result(s) to Alfred [14:40:10.718] Pass[Script Filter] { "variables": { "AW_SESSION_ID": "IOWS2XJM7NKQZ0ZYDUMKK5YB" }, "items": [ { "title": "No matches found", "subtitle": "Try a different query?", "valid": false, "icon": { "path": "assets/not-found-icon.png" } } ] } It should return at least the secret for spotify.com Looks like it didn’t find any match, in order to search I’m using a walkDir function and this function “don’t follow symlinks” that’s the problem you have, this workflow can’t follow the symlink you have created, now there is two solutions. 1. Use the default “~/.password_store” directory as a real path (no symlink to other place) 2. (And let me know if works for you, since I didn’t test it yet, but the code I did should work) Setup a env variable PASSWORD_STORE_DIR with the path of your ~/.local/share/gopass/stores/root In the case this second didn’t work, let me know and I will find a way to fix it, probably I gonna setup a custom path variable on the workflow configuration. I hope this was helpful and thanks for the comment, remember “symlinks doesn’t work with this workflow” Link to comment
kofm Posted June 6, 2023 Share Posted June 6, 2023 Solution 2 works perfectly! Just you can't use the tilde (~) to refer to home dir (it was throwing some error), I had to use the whole path to my password store. Thank you very much!! Link to comment
Elvis Gastelum Posted June 6, 2023 Author Share Posted June 6, 2023 1 minute ago, kofm said: Solution 2 works perfectly! Just you can't use the tilde (~) to refer to home dir (it was throwing some error), I had to use the whole path to my password store. Thank you very much!! Probably gonna work “$HOME/.local/share/gopass/stores/root” as replacement of ~ let me know if you tried and works this one Link to comment
Elvis Gastelum Posted June 6, 2023 Author Share Posted June 6, 2023 (edited) 33 minutes ago, kofm said: Unfortunately, it does not Okay, don’t worry, and thanks for help me on the testing, I hope is useful for you this tool remember read the api on the readme so you can know how to use it to get for example, usernames from an entry instead the password, or get otp codes. If you feel this workflow was helpful give me an star on GitHub 🎉 Edited June 6, 2023 by Elvis Gastelum Link to comment
kofm Posted June 6, 2023 Share Posted June 6, 2023 Extremely useful! I starred the repo already. Thanks for you work. Elvis Gastelum 1 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now