Skip to content

Commit

Permalink
Merged PR 4352: Added readme warning for wallet auth
Browse files Browse the repository at this point in the history
Added readme warning for wallet auth
  • Loading branch information
silimarius committed Jun 12, 2023
1 parent 4f92290 commit 9e63172
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ If the pods are running correctly, the services should be accessible at the foll
- Nakama dashboard: <http://backend.localhost>
- Nakama API: <http://api.localhost>

> ⚠️ Currently Aleo Wallet does not work with the local kubernetes frontend deployment, so prefer running it in dev mode as illustrated in the following section.
>
> ⚠️ On MacOS you may need to configure `dnsmasq` in order to access custom domain names. Consider following this [guide](https://www.stevenrombauts.be/2018/01/use-dnsmasq-instead-of-etc-hosts/#2-only-send-test-and-box-queries-to-dnsmasq) and use `.localhost` instead of `.test` and `.box`.
### Run frontend in dev mode
Expand Down
9 changes: 7 additions & 2 deletions backend/src/hooks/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ export const beforeAuthenticateCustom = beforeHookHandler((ctx, logger, nk, data
// log in
data.create = false;
const signature: string = splitId[0];
if (!verifySignature(nk, ctx, logger, address, signature)) throw errors.invalidSignature;

const isSignatureValid = verifySignature(nk, ctx, logger, address, signature);

if (!isSignatureValid) throw errors.invalidSignature;
data.username = storedUsername;
} else if (splitId.length === 2) {
// registration
Expand All @@ -70,7 +73,9 @@ export const beforeAuthenticateCustom = beforeHookHandler((ctx, logger, nk, data
const signature: string = splitId[0];
const username: string = splitId[1].toLowerCase();

if (!verifySignature(nk, ctx, logger, address, signature)) throw errors.invalidSignature;
const isSignatureValid = verifySignature(nk, ctx, logger, address, signature);

if (!isSignatureValid) throw errors.invalidSignature;
if (profanityFilter.isProfane(username)) throw errors.containsProfanity;

saveUsername(nk, address, username);
Expand Down

0 comments on commit 9e63172

Please sign in to comment.