mirror of
https://github.com/CPunch/Laika.git
synced 2025-10-18 21:10:22 +00:00
Added config inis, key refactoring
- CNC can accept multiple different auth keys now - laikaK_checkAuth() added - shell defaults to using shell.ini config file - CNC doesn't require a config file however it's highly recommended
This commit is contained in:
@@ -167,7 +167,8 @@ void shellC_init(tShell_client *client) {
|
||||
LAIKA_ERROR("LibSodium failed to initialize!\n");
|
||||
}
|
||||
|
||||
if (!laikaK_loadKeys(client->pub, client->priv, LAIKA_PUBKEY, LAIKA_PRIVKEY)) {
|
||||
/* by default use random key */
|
||||
if (!laikaK_genKeys(client->pub, client->priv)) {
|
||||
shellC_cleanup(client);
|
||||
LAIKA_ERROR("Failed to init keypair!\n");
|
||||
}
|
||||
@@ -251,6 +252,13 @@ bool shellC_poll(tShell_client *client, int timeout) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void shellC_loadKeys(tShell_client *client, const char *pub, const char *priv) {
|
||||
if (!laikaK_loadKeys(pub ? client->pub : NULL, priv ? client->priv : NULL, pub, priv)) {
|
||||
shellC_cleanup(client);
|
||||
LAIKA_ERROR("Failed to init keypair!\n");
|
||||
}
|
||||
}
|
||||
|
||||
tShell_peer *shellC_getPeerByPub(tShell_client *client, uint8_t *pub, int *id) {
|
||||
tShell_hashMapElem *elem = (tShell_hashMapElem*)hashmap_get(client->peers, &(tShell_hashMapElem){.pub = pub});
|
||||
|
||||
|
Reference in New Issue
Block a user