Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement a token system #78 #67

Merged
merged 6 commits into from
Jan 2, 2025
Merged

Implement a token system #78 #67

merged 6 commits into from
Jan 2, 2025

Conversation

suresh-kumara-gist
Copy link
Collaborator

@suresh-kumara-gist suresh-kumara-gist commented Dec 30, 2024

Test this functionality in ./scripts/node-cli.sh:-

  1. Create and store token string of length 6 and its hash.
> await app.c('tokens').newToken({
    name: 'something',
    permissions: ['some-permission', 'another-permission'],
    whatever: 'hello world',
    _length: 6,
    _digits_only: false
  });

it will return string of length 6 as a token as a response.

await app.c('tokens').checkToken('something', '<replace token here>');

it would return true i.e.. token is valid.

next try this:-

await app.c('tokens').checkToken('something', '<some value>');

it would return null i.e.. no record found for that token.

  1. Create and store 6 digits token and its hash.
  await app.c('tokens').newToken({
    name: 'something',
    permissions: ['some-permission', 'another-permission'],
    whatever: 'hello world',
    _length: 6,
    _digits_only: true
  });

it would return 6 digits token as a response.

  await app.c('tokens').checkToken('something', '<replace token here>');

it would return true i.e.. token is valid.

next try this:-

  await app.c('tokens').checkToken('something', '522559');

it would return null i.e.. no record found for that token.

@suresh-kumara-gist
Copy link
Collaborator Author

I have to update README and add test cases for this PR.

@alberto56 alberto56 merged commit 4fa2f9d into master Jan 2, 2025
1 check passed
@alberto56 alberto56 deleted the token-system branch January 2, 2025 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants