- if(!digest_open_by_nid(&c->indigest, digest, -1)) {
- logger(LOG_ERR, "Error during initialisation of digest from %s (%s)", c->name, c->hostname);
+ // Recover the filename from the cookie and the key
+ char *fingerprint = ecdsa_get_base64_public_key(mesh->invitation_key);
+ char hash[64];
+ char hashbuf[18 + strlen(fingerprint)];
+ char cookie[25];
+ memcpy(hashbuf, data, 18);
+ memcpy(hashbuf + 18, fingerprint, sizeof(hashbuf) - 18);
+ sha512(hashbuf, sizeof(hashbuf), hash);
+ b64encode_urlsafe(hash, cookie, 18);
+ free(fingerprint);
+
+ config_t config;
+
+ if(!invitation_read(mesh, "current", cookie, &config, mesh->config_key)) {
+ logger(mesh, MESHLINK_ERROR, "Error while trying to read invitation file\n");