Reorg client code

This commit is contained in:
cheddar 2025-02-20 21:49:05 -05:00
parent 61aa1be730
commit f313a8f1c9
No known key found for this signature in database
4 changed files with 58 additions and 37 deletions

View file

@ -6,11 +6,12 @@ import (
"fmt"
"io"
"net/http"
"net/url"
"crispbyte.dev/sig-auth/server"
)
func RegisterKey(key string, userId string) error {
func RegisterKey(baseUrl *url.URL, key string, userId string) error {
request := server.RegisterRequest{
UserId: userId,
Key: key,
@ -18,8 +19,10 @@ func RegisterKey(key string, userId string) error {
json_data, _ := json.Marshal(request)
registerUrl := baseUrl.JoinPath("register")
resp, err := http.DefaultClient.Post(
"http://localhost:8080/register",
registerUrl.String(),
"application/json",
bytes.NewBuffer(json_data))