{"id":44927,"library":"fastokens","title":"Fastokens","description":"Fastokens is a Python library for generating secure, time-limited tokens using cryptographic hashing and HMAC. It provides simple APIs for creating and verifying tokens with expiration, suitable for password reset links, API tokens, and one-time codes. Current version 0.2.0, released as an alpha. Release cadence is irregular.","status":"active","version":"0.2.0","language":"python","source_language":"en","source_url":"https://github.com/Atero-ai/fastokens","tags":["tokens","security","hmac","authentication"],"install":[{"cmd":"pip install fastokens","lang":"bash","label":"Latest stable"}],"dependencies":[],"imports":[{"wrong":"from fastokens import TokenManager","symbol":"Tokenizer","correct":"from fastokens import Tokenizer"},{"symbol":"patch_transformers","correct":"from fastokens import patch_transformers"},{"symbol":"unpatch_transformers","correct":"from fastokens import unpatch_transformers"}],"quickstart":{"code":"from fastokens import TokenManager\nimport os\n\nsecret = os.environ.get('FASTOKENS_SECRET', 'my-secret-key')\ntm = TokenManager(secret=secret, token_ttl=600)  # 10 minutes\ntoken = tm.create(data={'user_id': 42})\nprint('Token:', token)\ndata = tm.verify(token)\nprint('Verified data:', data)","lang":"python","description":"Initialize TokenManager with a secret and TTL, create a token from a dict, then verify it."},"warnings":[{"fix":"Replace 'Token' with 'TokenManager' in imports and instantiation.","message":"The 'TokenManager' class was renamed from 'Token' in version 0.2.0. Code using 'from fastokens import Token' will fail.","severity":"breaking","affected_versions":">=0.2.0"},{"fix":"Ensure secret is at least 32 characters long, or use a secret generated by os.urandom(32).","message":"The 'secret' parameter must be at least 32 bytes. A short secret will raise a ValueError.","severity":"gotcha","affected_versions":"all"},{"fix":"Always wrap non-dict values in a dict, e.g., create(data={'value': 'some_string'}).","message":"The 'data' parameter to create() must be a dict. Passing a string or int (as in some examples) is deprecated and will be removed in a future release.","severity":"deprecated","affected_versions":"<0.3.0"}],"env_vars":null,"search_vec":"'0.2.0':44 'alpha':48 'api':22,35 'authent':56 'cadenc':50 'code':41 'creat':24 'cryptograph':15 'current':42 'expir':29 'fastoken':1,2 'generat':8 'hash':16 'hmac':18,55 'irregular':52 'librari':6 'limit':12 'link':34 'one':39 'one-tim':38 'password':32 'provid':20 'python':5 'releas':45,49 'reset':33 'secur':9,54 'simpl':21 'suitabl':30 'time':11,40 'time-limit':10 'token':13,27,36,53 'use':14 'verifi':26 'version':43","created_at":"2026-06-07T12:52:31.752282+00:00","updated_at":"2026-06-07T12:52:31.752282+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/Atero-ai/fastokens","github":"https://github.com/Atero-ai/fastokens","docs":null,"changelog":null,"pypi":null,"npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["security"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-08-02","install_tag":null}}