Skip to content

Instantly share code, notes, and snippets.

@strfry
Created April 10, 2017 16:25
Show Gist options
  • Save strfry/b433a8167f645306c8e7afa682353738 to your computer and use it in GitHub Desktop.
Save strfry/b433a8167f645306c8e7afa682353738 to your computer and use it in GitHub Desktop.
# TODO: Exceptions Different Error Classes?
# - Card not present / token_id not found
# - Transport Error (try again)
# - Key Error (retry is futile?)
# - Unknown Token Error
class AuthenticationDriver(object):
def __init__(self, slot=4):
self.slot = slot
def detect(self):
"""Scans for Authentication Tokens, returns Token ID on success"""
return
def check(self, token_id, transport_key, known_secret):
"""Connect and read the token, verify against known secret
Returns True when auth token seems valid"""
return False
def withdraw(self, token_id, transport_key):
"""Invalidate a token (by overwriting secret with garbage)"""
return False
def assign(self, token_id, transport_key)
"""Initialize a new token with given parameters"""
return False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment