diff --git a/client/register.go b/client/register.go
new file mode 100644
index 0000000..7e7de84
--- /dev/null
+++ b/client/register.go
@@ -0,0 +1,43 @@
+package client
+
+import (
+	"bytes"
+	"encoding/json"
+	"fmt"
+	"io"
+	"net/http"
+
+	"crispbyte.dev/sig-auth/server"
+)
+
+func RegisterKey(key string, userId string) error {
+	request := server.RegisterRequest{
+		UserId: userId,
+		Key:    key,
+	}
+
+	json_data, _ := json.Marshal(request)
+
+	resp, err := http.DefaultClient.Post(
+		"http://localhost:8080/register",
+		"application/json",
+		bytes.NewBuffer(json_data))
+
+	if err != nil {
+		return err
+	}
+
+	defer resp.Body.Close()
+
+	out, err := io.ReadAll(resp.Body)
+
+	if err != nil {
+		return err
+	}
+
+	fmt.Println(resp.StatusCode)
+	fmt.Println(resp.Header)
+	fmt.Println(string(out[:]))
+
+	return nil
+}
diff --git a/main.go b/main.go
index 6c8773c..1a48c66 100644
--- a/main.go
+++ b/main.go
@@ -130,31 +130,9 @@ func registerKey(keyFile string, userId string) {
 
 	keyText := string(keyBytes)
 
-	request := server.RegisterRequest{
-		UserId: userId,
-		Key:    keyText,
-	}
-
-	json_data, _ := json.Marshal(request)
-
-	resp, err := http.DefaultClient.Post(
-		"http://localhost:8080/register",
-		"application/json",
-		bytes.NewBuffer(json_data))
+	err = client.RegisterKey(keyText, userId)
 
 	if err != nil {
 		log.Fatal(err)
 	}
-
-	defer resp.Body.Close()
-
-	out, err := io.ReadAll(resp.Body)
-
-	if err != nil {
-		log.Fatal(err)
-	}
-
-	fmt.Println(resp.StatusCode)
-	fmt.Println(resp.Header)
-	fmt.Println(string(out[:]))
 }