Skip to content
Snippets Groups Projects
Commit d82e98e3 authored by Gospodin Bodurov's avatar Gospodin Bodurov
Browse files

Add skeleton for key signing

parent 94f32f24
No related branches found
No related tags found
1 merge request!104Implement request signing and permitted domains
Pipeline #34929 passed with stages
in 26 minutes and 35 seconds
......@@ -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"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment