How to capture an auto-generated passphrase into a shell variable? #642
Unanswered
nickpiaddo
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I am currently working on a project, nixos-fde-config, for which I need to capture a passphrase
auto-generated by
age
.Context
The script uses a pinned version of
age-v1.0.0
with which the code snippet above works.However, when I tried to update it to the latest version (i.e.
v1.2.1
) I noticed thatPASSPHRASE
is always empty. Even when the end-user chooses to auto-generate one while runningnixos-fde-config
.I do not know
go
(yet!), but I went through the source code ofage
, and spotted the linesbelow in version
v1.0.0
of the functionpassphrasePromptForEncryption
.age/cmd/age/age.go
Lines 241 to 242 in 552aa0a
As far as I can tell,
passphrasePromptForEncryption
is in charge of generating, then printingpassphrases.
Since
v1.1.0
, the same function switched to printing the auto-generated passphrase throughprintToTerminal
, which callswithTerminal
who, I assume, writes the output to/dev/tty
.age/cmd/age/age.go
Line 301 in 7354aa0
age/cmd/age/tui.go
Lines 115 to 120 in 7354aa0
age/cmd/age/tui.go
Lines 105 to 108 in 7354aa0
I know it is a bit cliché, but how can I get newer versions of
age
to output auto-generatedpassphrases to
stderr
?Thank you!
Beta Was this translation helpful? Give feedback.
All reactions