summary refs log tree commit diff
path: root/gnu/installer/user.scm
diff options
context:
space:
mode:
authorJosselin Poiret <dev@jpoiret.xyz>2022-01-15 14:50:10 +0100
committerMathieu Othacehe <othacehe@gnu.org>2022-02-02 16:46:44 +0100
commit112ef30b84744872b3a7617d9e54b3df5db95560 (patch)
tree3f097eb44042246716e683c3877e8a0f2d38ecc0 /gnu/installer/user.scm
parent41eb0f01fcf05902be9972cc993fdb332edb928c (diff)
downloadguix-112ef30b84744872b3a7617d9e54b3df5db95560.tar.gz
installer: Turn passwords into opaque records.
* gnu/installer/user.scm (<secret>, secret?, make-secret,
secret-content): Add opaque <secret> record that boxes its contents,
with a custom printer that doesn't display anything.
* gnu/installer/newt/user.scm (run-user-add-page, run-user-page): Box
it.
* gnu/installer/final.scm (create-user-database): Unbox it.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
Diffstat (limited to 'gnu/installer/user.scm')
-rw-r--r--gnu/installer/user.scm19
1 files changed, 18 insertions, 1 deletions
diff --git a/gnu/installer/user.scm b/gnu/installer/user.scm
index 4e701e64ce..c894a91dc8 100644
--- a/gnu/installer/user.scm
+++ b/gnu/installer/user.scm
@@ -19,7 +19,14 @@
 (define-module (gnu installer user)
   #:use-module (guix records)
   #:use-module (srfi srfi-1)
-  #:export (<user>
+  #:use-module (srfi srfi-9)
+  #:use-module (srfi srfi-9 gnu)
+  #:export (<secret>
+            secret?
+            make-secret
+            secret-content
+
+            <user>
             user
             make-user
             user-name
@@ -30,6 +37,16 @@
 
             users->configuration))
 
+(define-record-type <secret>
+  (make-secret content)
+  secret?
+  (content secret-content))
+
+(set-record-type-printer!
+ <secret>
+ (lambda (secret port)
+   (format port "<secret>")))
+
 (define-record-type* <user>
   user make-user
   user?