-
-
Notifications
You must be signed in to change notification settings - Fork 515
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose Go library functions (please review the API!) #63
Comments
According to the
|
perhaps we're just getting caught by the 1.4/1.5 design stricture? If |
@ovalseven8 That's great! I should have been more specific - I'm actually wondering if this implementation ( |
@xt0fer exactly, any name change would allow it to be used as a library. However it was probably purposely done to be |
I'd welcome this for attempting to compile this under TamaGo (https://github.com/inversepath/tamago). |
I made this for now: https://github.com/schollz/age/ but I'd rather not have to merge upstream to keep it up to date, so it would be nice if this repo is the library. @FiloSottile, do you plan on having this repo be used as a library? |
Exposing age as a library would very much benefit building mobile apps with good encryption through gomobile! |
Is there any word on this? I'd love to avoid shelling out to age if I can avoid it. |
Apologies in advance for not fully understanding the ask here but since 'age' is using the Go crypto library, why would someone then want to have 'age' be a crypto library for use in a Go program? I guess I would think one would just use the same libs that 'age' uses for their Go program...please help me see what I am missing... |
@cyb3rz3us it's not "just" using the Go crypto package... it's also implementing a specific format. The simplest (and probably most naïve) solution to this issue would be to expose all the packages that are currently in https://github.com/FiloSottile/age/tree/master/internal; but I don't think @FiloSottile really wants to do that 😉... |
Count me in as wanting this all this age goodness as an importable package. I think internal/age is the only one that needs moving out of the internal/ directory. That's what PR #119 does. |
Hey folks, sorry for taking so long, I am indeed preparing to expose an API and would love some feedback on the current plan which is to expose the age, agessh, and armor packages! (Sorry for not just taking #120, but you won't be surprised to learn I have strong opinions on APIs :)) |
Thanks for the initial API draft. It's a nice and clean API that seems to provide anything that gopass needs. Some questions:
|
Thank you for the feedback, all very useful!
It's specifically for decryption deferral, if you are sure you need to decrypt it you can just use the x/crypto/ssh functions to do so. But I guess it is general enough to be useful, so I moved it to agessh, thanks for the suggestion.
@str4d and I worked on a plugin support which should make it possible to implement an agent as a plugin.
Hmm, yeah, this is a great example of something that would be nice to configure. The current API allows neither returning information about the file nor passing options. |
age uses a modification on bech32, and age isn't yet something that can be imported - see FiloSottile/age#63 For proof of concept, simply copy the code. License and copyright as it appears in bech32/bech32.go still applies.
It's out! There is now a Go API for age! https://pkg.go.dev/filippo.io/age@v1.0.0-beta4 Still in beta so we can fix it if we realize I made some horrible mistake (let me know!) but otherwise I expect it to be pretty stable (and probably to grow an |
Thanks for the tool and the API nice and clean! Just a question, any thoughts about to expose in some way the generation of a |
It used to be exposed but I realized it was probably more of a footgun than useful. What's your use case? |
The use case is to encrypt a file using an existing private key derived from a user's password with scrypt. |
I see. Can't you store a fresh private key encrypted with the user's password? That would also let you rotate the password without changing the public key.
|
Apologies, I'd have shared more details about the use case. |
That sounds like it doesn't need a public key, so maybe you can use the |
Indeed, this was my first try too. In this case I'm able to encrypt but still need to generate another private key with scrypt to generate the services' password :(. But this is something related to my project's UX not to age. Right now I'm using with success
|
I don't really understand how this is not compatible with ScryptIdentity / ScryptRecipient, you can use the same passphrase, as the salts will be different. (This is probably a better fit for the mailing list than the issue tracker.) |
Agreed. Moved the discussion to the mailing list. Thanks @FiloSottile |
The API has now been around for a bit, closing this issue! |
Line 38 in 2e09054
use []byte to replace exists arg password string should be better?
|
What were you trying to do
Use age encryption in a Go program by importing it.
What happened
Because
age
usesinternal
it prevents importing. I suspect this was on purpose, and that's okay, but just wanted to check if this was sought a possibility for this spec.The text was updated successfully, but these errors were encountered: