Skip to content

Commit

Permalink
curve25519
Browse files Browse the repository at this point in the history
  • Loading branch information
mcfly722 committed Sep 15, 2024
1 parent a0adf68 commit 60d0c10
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 15 deletions.
18 changes: 9 additions & 9 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ var validators = {
cloakClient: function(value) { return isValidIPaddress(value); },
cloakServer: function(value) { return isValidIPaddress(value); },
cloakGateway: function(value) { return isValidIPaddress(value); },
cloakServerPrivate: function(value) { return !window.wireguard.generateKeypairForPrivate(value).publicKey.includes("INCORRECT"); },
cloakServerPrivate: function(value) { return !window.curve25519.generateKeypairForPrivate(value).publicKey.includes("INCORRECT"); },
cloakServerPublic: function(value) { return !value.includes("INCORRECT"); },
cloakUIDBase: function(value) { return !value.includes("INCORRECT"); },
wireguardClientPrivate: function(value) { return !window.wireguard.generateKeypairForPrivate(value).publicKey.includes("INCORRECT"); },
wireguardClientPrivate: function(value) { return !window.curve25519.generateKeypairForPrivate(value).publicKey.includes("INCORRECT"); },
wireguardClientPublic: function(value) { return !value.includes("INCORRECT"); },
wireguardServerPrivate: function(value) { return !window.wireguard.generateKeypairForPrivate(value).publicKey.includes("INCORRECT"); },
wireguardServerPrivate: function(value) { return !window.curve25519.generateKeypairForPrivate(value).publicKey.includes("INCORRECT"); },
wireguardServerPublic: function(value) { return !value.includes("INCORRECT"); },
clientArch: function(value) { return !value.includes("not specified"); },
serverArch: function(value) { return !value.includes("not specified"); }
Expand Down Expand Up @@ -108,21 +108,21 @@ function onChange(key, value){
}

function updateWGClient(privateKey){
wgClient = window.wireguard.generateKeypairForPrivate(privateKey)
wgClient = window.curve25519.generateKeypairForPrivate(privateKey)
document.getElementById("wireguardClientPublic").value = wgClient.publicKey;
onChange("wireguardClientPrivate",wgClient.privateKey);
onChange("wireguardClientPublic" ,wgClient.publicKey);
}

function updateWGServer(privateKey){
wgServer = window.wireguard.generateKeypairForPrivate(privateKey)
wgServer = window.curve25519.generateKeypairForPrivate(privateKey)
document.getElementById("wireguardServerPublic").value = wgServer.publicKey;
onChange("wireguardServerPrivate",wgServer.privateKey);
onChange("wireguardServerPublic" ,wgServer.publicKey);
}

function regenerateWGClient(){
var wgClient = window.wireguard.generateKeypair()
var wgClient = window.curve25519.generateKeypair()

document.getElementById("wireguardClientPrivate").value = wgClient.privateKey;
document.getElementById("wireguardClientPublic").value = wgClient.publicKey;
Expand All @@ -131,22 +131,22 @@ function regenerateWGClient(){
}

function regenerateWGServer(){
var wgServer = window.wireguard.generateKeypair()
var wgServer = window.curve25519.generateKeypair()
document.getElementById("wireguardServerPrivate").value = wgServer.privateKey;
document.getElementById("wireguardServerPublic").value = wgServer.publicKey;
onChange("wireguardServerPrivate",wgServer.privateKey);
onChange("wireguardServerPublic" ,wgServer.publicKey);
}

function updateCloakServer(privateKey){
cloakServer = window.wireguard.generateKeypairForPrivate(privateKey)
cloakServer = window.curve25519.generateKeypairForPrivate(privateKey)
document.getElementById("cloakServerPublic").value = cloakServer.publicKey;
onChange("cloakServerPrivate",cloakServer.privateKey);
onChange("cloakServerPublic" ,cloakServer.publicKey);
}

function regenerateCloakServer(){
var cloakServer = window.wireguard.generateKeypair()
var cloakServer = window.curve25519.generateKeypair()
document.getElementById("cloakServerPrivate").value = cloakServer.privateKey;
document.getElementById("cloakServerPublic").value = cloakServer.publicKey;
onChange("cloakServerPrivate",cloakServer.privateKey);
Expand Down
7 changes: 1 addition & 6 deletions wireguard.js → curve25519.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
/*! SPDX-License-Identifier: GPL-2.0
*
* Copyright (C) 2015-2020 Jason A. Donenfeld <[email protected]>. All Rights Reserved.
*/

(function() {
function gf(init) {
var r = new Float64Array(16);
Expand Down Expand Up @@ -180,7 +175,7 @@
return bytes;
}

window.wireguard = {
window.curve25519 = {
generatePresharedKey: function() {
return keyToBase64(generatePresharedKey());
},
Expand Down
Binary file modified index.html
Binary file not shown.

0 comments on commit 60d0c10

Please sign in to comment.