#lang scheme/base
(require scheme/contract
"base.ss"
"idcheck-util.ss")
(define db (make-hash))
(define (add-user! key data)
(hash-set! db (key->number/fail key) data))
(define (remove-user! key)
(hash-remove! db (key->number/fail key)))
(define (lookup-user key)
(hash-ref db (key->number/fail key) #f))
(define (get-username str)
(define port (open-input-string str))
(read-line port 'any)
(read-line port 'any))
(define (key->number/fail str)
(if (registered-key? str)
(string->number str)
(raise-exn:idcheck (format "The string ~a is not a valid IDCheck key" str))))
(provide/contract
[add-user! (-> string? string? any)]
[remove-user! (-> string? any)]
[lookup-user (-> string? (or/c string? false/c))]
[get-username (-> string? string?)])