Add public key to peer info and implement public key generation from private key
This commit is contained in:
@@ -46,6 +46,19 @@ class VpnSessionService {
|
||||
}
|
||||
}
|
||||
|
||||
/// Generates public key from private key
|
||||
static Future<String> _getPublicKeyFromPrivateKey(String privateKey) async {
|
||||
try {
|
||||
final pubProcess = await Process.start('wg', ['pubkey']);
|
||||
pubProcess.stdin.writeln(privateKey);
|
||||
await pubProcess.stdin.close();
|
||||
final publicKey = await pubProcess.stdout.transform(utf8.decoder).join();
|
||||
return publicKey.trim();
|
||||
} catch (e) {
|
||||
return 'Error generating public key: $e';
|
||||
}
|
||||
}
|
||||
|
||||
/// Gets keepalive info for a specific peer
|
||||
static Future<String> _getKeepaliveForPeer(String publicKey) async {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user