Skip to content

Comments

take() method added for single-read values#160

Merged
erdii merged 3 commits intonode-cache:masterfrom
KrishnaPG:master
Dec 4, 2019
Merged

take() method added for single-read values#160
erdii merged 3 commits intonode-cache:masterfrom
KrishnaPG:master

Conversation

@KrishnaPG
Copy link
Contributor

Fix for #159

Single-use tokens (such as OTPs) cannot be used under two circumstances:

  • time expired,
  • already used

TTL solves the first problem. This take method aims to solve the second problem. The value could be active (TTL not expired), but if it is already "touched" (get() called for verification), then just delete it, so that no replay attack is possible.

@KrishnaPG KrishnaPG mentioned this pull request Nov 27, 2019
Copy link
Member

@erdii erdii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice pr 👍

Edit: lol now it looks snarky with the change request comment next to it! i really want to say that it's a nice pr

@KrishnaPG KrishnaPG requested a review from erdii December 4, 2019 01:31
Copy link
Member

@erdii erdii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice! even with tests for the bug <3

@erdii erdii merged commit f0a8860 into node-cache:master Dec 4, 2019
@erdii
Copy link
Member

erdii commented Dec 4, 2019

thank you! i will provide an update on the weekend

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