#lang racket/base (require racket/class racket/contract simple-ini/class "users.rkt") (provide set-user) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Provided functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; goal : Interactively add or replace one configured web-player user. ; pre : Standard input supplies a username and a password of at least ; twelve characters; rkt-web-player.ini is writable. ; post : The INI file's [users] section contains an Argon2id hash for the ; entered username; the clear-text password is not stored. ; result : Void after the configuration file has been updated. ; internals: ; The small utility uses simple-ini directly and intentionally owns ; no duplicate configuration representation. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define/contract (set-user) (-> void?) (displayln "Using rkt-web-player.ini as configuration file") (newline) (display "Give username: >") (let ((user (read-line))) (display "Give password: >") (let* ((password (read-line)) (hash (make-password-hash password)) (ini (new ini% (file "rkt-web-player.ini")))) (send ini set! 'users (string->symbol user) hash) (void))))