diff options
author | juerg <juerg@google.com> | 2023-07-13 02:09:51 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-07-13 02:10:54 -0700 |
commit | 991859c6d3088659bf0465f30c31e11d0f746917 (patch) | |
tree | e06056b774ec25206a6bdc46243baa1c9ced16c6 /python | |
parent | dec6e09a0954c6304d8399611aaeba422525cf7b (diff) | |
download | tink-991859c6d3088659bf0465f30c31e11d0f746917.tar.gz |
Simplify JWT example in Python.
Register should always work, when it fails it's a bug, so it's better to not catch that exception.
PiperOrigin-RevId: 547728738
Diffstat (limited to 'python')
-rw-r--r-- | python/examples/jwt/jwt_generate_public_jwk_set.py | 6 | ||||
-rw-r--r-- | python/examples/jwt/jwt_sign.py | 6 | ||||
-rw-r--r-- | python/examples/jwt/jwt_verify.py | 6 |
3 files changed, 3 insertions, 15 deletions
diff --git a/python/examples/jwt/jwt_generate_public_jwk_set.py b/python/examples/jwt/jwt_generate_public_jwk_set.py index a8143be46..72a269741 100644 --- a/python/examples/jwt/jwt_generate_public_jwk_set.py +++ b/python/examples/jwt/jwt_generate_public_jwk_set.py @@ -34,11 +34,7 @@ def main(argv): del argv # Unused. # Initialise Tink - try: - jwt.register_jwt_signature() - except tink.TinkError as e: - logging.exception('Error initialising Tink: %s', e) - return 1 + jwt.register_jwt_signature() # Read the keyset into a KeysetHandle with open(_PUBLIC_KEYSET_PATH.value, 'rt') as keyset_file: diff --git a/python/examples/jwt/jwt_sign.py b/python/examples/jwt/jwt_sign.py index 7fda7f2bd..782b3f3eb 100644 --- a/python/examples/jwt/jwt_sign.py +++ b/python/examples/jwt/jwt_sign.py @@ -40,11 +40,7 @@ def main(argv): del argv # Unused. # Initialise Tink - try: - jwt.register_jwt_signature() - except tink.TinkError as e: - logging.exception('Error initialising Tink: %s', e) - return 1 + jwt.register_jwt_signature() # Read the keyset into a KeysetHandle with open(_PRIVATE_KEYSET_PATH.value, 'rt') as keyset_file: diff --git a/python/examples/jwt/jwt_verify.py b/python/examples/jwt/jwt_verify.py index af59abfb5..102205693 100644 --- a/python/examples/jwt/jwt_verify.py +++ b/python/examples/jwt/jwt_verify.py @@ -40,11 +40,7 @@ def main(argv): del argv # Unused. # Initialise Tink - try: - jwt.register_jwt_signature() - except tink.TinkError as e: - logging.exception('Error initialising Tink: %s', e) - return 1 + jwt.register_jwt_signature() # Read the keyset into a KeysetHandle if _PUBLIC_KEYSET_PATH.present: |