diff --git a/src/api/acts/client.ts b/src/api/acts/client.ts index 25b535b..ff2e6fd 100644 --- a/src/api/acts/client.ts +++ b/src/api/acts/client.ts @@ -32,7 +32,7 @@ export const createSignature = { const server = selfTag; const tag = `${client.name}@${server.host}:${server.port}-${data.publicKey}`; var signature = await sign(tag, await getSettings(SETTINGS.privateKey)); - aws("ok", signature); + aws("ok", { sign: signature }); } }; diff --git a/src/api/acts/login.ts b/src/api/acts/login.ts index 2cc1e8f..ebff4fc 100644 --- a/src/api/acts/login.ts +++ b/src/api/acts/login.ts @@ -179,7 +179,7 @@ export const remote1 = { client.challenge = get64(64); client.state = STATE.remoteP; client.remoteKey = data.publicKey; - aws("ok", client.challenge); + aws("ok", { challenge: client.challenge }); } catch (e) { client.suspect(); aws("error", "signature"); diff --git a/tests/tests/post.js b/tests/tests/post.js index 70b3948..6d787eb 100644 --- a/tests/tests/post.js +++ b/tests/tests/post.js @@ -33,10 +33,10 @@ const list = [ accountKey }, "error", "config"); }], ["remote", async (req) => { - let signature = await req({ "authorization": `Digest name=${name1} server=localhost:7224 accountKey=${accountKey}` }, + let signature = (await req({ "authorization": `Digest name=${name1} server=localhost:7224 accountKey=${accountKey}` }, "createSignature", { publicKey - }, "ok", null); + }, "ok", null)).sign; let falseSignature = await sign("lol", privateKey); let token = (await req({}, "requestTempToken", {}, "ok", { token: null })).token; @@ -58,14 +58,14 @@ const list = [ sign: falseSignature }, "error", "signature"); - let challenge = await req({ + let challenge = (await req({ "authorization": `Bearer ${token}` }, "remote1", { name: name1, server: "localhost:7224", publicKey, sign: signature - }, "ok", null); + }, "ok", null)).challenge; await req({ "authorization": `Bearer ${token}` diff --git a/tests/tests/ws.js b/tests/tests/ws.js index d7a07ad..ef39609 100644 --- a/tests/tests/ws.js +++ b/tests/tests/ws.js @@ -40,9 +40,9 @@ const list = [ server: "localhost:7224", accountKey }, "ok", ""); - let signature = await req(handler, "createSignature", { + let signature = (await req(handler, "createSignature", { publicKey - }, "ok", null); + }, "ok", null)).sign; let falseSignature = await sign("lol", privateKey); let h2 = await newHandler(); await req(h2, "remote1", { @@ -57,12 +57,12 @@ const list = [ publicKey, sign: falseSignature }, "error", "signature"); - let challenge = await req(h2, "remote1", { + let challenge = (await req(h2, "remote1", { name: name1, server: "localhost:7224", publicKey, sign: signature - }, "ok", null); + }, "ok", null)).challenge; await req(h2, "remote1", { name: name1, server: "localhost:7224",