From d82e98e34a180d6bd21aac43b2357e754973edd8 Mon Sep 17 00:00:00 2001
From: Gospodin Bodurov <gospodin@bodurov.net>
Date: Thu, 12 Nov 2020 20:31:30 +0200
Subject: [PATCH] Add skeleton for key signing

---
 main.go | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/main.go b/main.go
index 6d93162..99092e7 100644
--- a/main.go
+++ b/main.go
@@ -76,6 +76,7 @@ func buildViamAPI() string {
 	keysLen := len(keys)
 
 	result += "function ViamAPI() {\n" +
+		"    this.privateKey = \"\";\n" +
 		"    this.config = {\n" +
 		"        headers: {\n" +
 		"            'publicKey': '',\n" +
@@ -99,7 +100,16 @@ func buildViamAPI() string {
 		"    this.config.headers.publicKey = window.btoa(authenticationPublicKey);\n" +
 		"};\n\n"
 
-	result += "ViamAPI.prototype.getConfig = function() {\n" +
+	result += "ViamAPI.prototype.setPrivateKey = function(privateKey) {\n" +
+		"    this.privateKey = privateKey;\n" +
+		"};\n\n"
+
+	result += "ViamAPI.prototype.setPrivateKey = function(privateKey) {\n" +
+		"    this.privateKey = privateKey;\n" +
+		"};\n\n"
+
+	result += "this.generateNonce = function() {\n" +
+		"    var privateKey = config.privateKey;\n" +
 		"    return this.config;\n" +
 		"};\n\n"
 
-- 
GitLab