Skip to content

Instantly share code, notes, and snippets.

@ThomasLocke
Created October 12, 2014 15:12
Show Gist options
  • Save ThomasLocke/5ba07e9ffbd689399fd4 to your computer and use it in GitHub Desktop.
Save ThomasLocke/5ba07e9ffbd689399fd4 to your computer and use it in GitHub Desktop.
shelf.middleware.token.dart
library shelfmiddleware.token;
final List<String> _validTokens = new List<String>();
bool isValid(String token) => _validTokens.contains(token);
String getToken() {
final String token = new DateTime.now().millisecondsSinceEpoch.toString();
_validTokens.add(new DateTime.now().millisecondsSinceEpoch.toString());
return token;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment