Skip to content

jzr/base62-token

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

base62_token

Proof-of-concept for a GitHub1 / npm2 style token library in Python.

This may not fulfill the security requirements for a real world application. Please do not use it in production.

Usage

import base62_token

token = base62_token.generate("prefix",32)
if base62_token.is_valid(token):
    ...

Compatibility

The base62 algorithms used in encode/decode should be COMPATIBLE3 with saltpack / GMP / GnuPG.

generate and is_valid are not designed to be compatible with anything else.

is_valid_gh verifies prefix and checksum for the old new GitHub tokens1. generate_gh creates dummy tokens that should be indistinguishable from real ones without active validation.

References

Footnotes

  1. https://github.blog/2021-04-05-behind-githubs-new-authentication-token-formats/ 2

  2. https://github.blog/2021-09-23-announcing-npms-new-access-token-format/

  3. https://github.com/therootcompany/base62.js/issues/1

About

Base62 token generation and validation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages