From e46183716530981eeabc1e36661e53304954e5d2 Mon Sep 17 00:00:00 2001 From: Hsiaoming Yang Date: Tue, 4 Jun 2024 11:23:02 +0900 Subject: [PATCH] chore: release 0.11.0 --- docs/changelog.rst | 11 +- docs/locales/zh/LC_MESSAGES/changelog.po | 146 +++++++++--------- docs/locales/zh/LC_MESSAGES/contributing.po | 53 +++---- docs/locales/zh/LC_MESSAGES/guide.po | 107 +++++++------ docs/locales/zh/LC_MESSAGES/index.po | 65 ++++---- docs/locales/zh/LC_MESSAGES/recipes.po | 158 +------------------- src/joserfc/__init__.py | 4 +- src/joserfc/jwk.py | 2 +- 8 files changed, 204 insertions(+), 342 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index d73ef05..0ede383 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -12,12 +12,21 @@ Changelog .. module:: joserfc :noindex: +0.11.0 +------ + +**Released on June 4, 2024** + +- ``jwe.decrypt_json`` allows to verify only one recipient. +- Prevent ``OctKey`` to import ``ssh-dss``. +- Deprecate use of string and bytes as key. + 0.10.0 ------ **Released on May 13, 2024** -- Change ``jwt.encode`` and ``jwt.decode`` to use JWS by default +- Change ``jwt.encode`` and ``jwt.decode`` to use JWS by default. 0.9.0 ----- diff --git a/docs/locales/zh/LC_MESSAGES/changelog.po b/docs/locales/zh/LC_MESSAGES/changelog.po index 99fc564..4d4f3be 100644 --- a/docs/locales/zh/LC_MESSAGES/changelog.po +++ b/docs/locales/zh/LC_MESSAGES/changelog.po @@ -8,16 +8,16 @@ msgid "" msgstr "" "Project-Id-Version: joserfc 0.5.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-11-16 17:05+0900\n" +"POT-Creation-Date: 2023-09-01 08:25+0900\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language: zh\n" "Language-Team: zh \n" -"Plural-Forms: nplurals=1; plural=0\n" +"Plural-Forms: nplurals=1; plural=0;\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 2.9.1\n" +"Generated-By: Babel 2.12.1\n" #: ../../changelog.rst:2 msgid "Changelog" @@ -28,226 +28,224 @@ msgid "Here is the history of joserfc_ package releases." msgstr "这里记录了 joserfc_ 的发布历史。" #: ../../changelog.rst:16 -msgid "0.9.0" +msgid "0.8.0" msgstr "" #: ../../changelog.rst:18 -msgid "**Released on November 16, 2023**" +msgid "**WIP**" msgstr "" #: ../../changelog.rst:20 -msgid "Use ``os.urandom`` for ``OctKey.generate_key``." -msgstr "" - -#: ../../changelog.rst:21 -msgid "Add ``allow_blank`` for ``JWTClaimsRegistry``." -msgstr "" - -#: ../../changelog.rst:22 -msgid "Improve callable key for :meth:`~jwk.guess_key`." -msgstr "" - -#: ../../changelog.rst:25 -msgid "0.8.0" -msgstr "" - -#: ../../changelog.rst:27 -msgid "**Released on September 06, 2023**" -msgstr "" - -#: ../../changelog.rst:29 msgid "Add :ref:`ensure_kid` method on key models." msgstr "" -#: ../../changelog.rst:30 +#: ../../changelog.rst:21 msgid "Add ``auto_kid`` parameter on key model ``.generate_key`` method." msgstr "" -#: ../../changelog.rst:31 ../../changelog.rst:41 -msgid "Improvements on type hints" -msgstr "" - -#: ../../changelog.rst:34 +#: ../../changelog.rst:24 msgid "0.7.0" msgstr "" -#: ../../changelog.rst:36 +#: ../../changelog.rst:26 msgid "**Released on August 14, 2023**" msgstr "" -#: ../../changelog.rst:38 +#: ../../changelog.rst:28 msgid "Add \"iat\" claims validation in JWT." msgstr "" -#: ../../changelog.rst:39 +#: ../../changelog.rst:29 msgid "Add ``__bool__`` magic method on :class:`jwk.KeySet`." msgstr "" -#: ../../changelog.rst:40 +#: ../../changelog.rst:30 msgid "" "Raise ``InvalidExchangeKeyError`` for ``exchange_derive_key`` on Curve " "key." msgstr "" -#: ../../changelog.rst:44 +#: ../../changelog.rst:31 +msgid "Improvements on type hints" +msgstr "" + +#: ../../changelog.rst:34 msgid "0.6.0" msgstr "" -#: ../../changelog.rst:46 +#: ../../changelog.rst:36 msgid "**Released on July 20, 2023**" msgstr "" -#: ../../changelog.rst:48 +#: ../../changelog.rst:38 msgid "Huge improvements on type hints, via :user:`Viicos`." msgstr "" -#: ../../changelog.rst:49 +#: ../../changelog.rst:39 msgid "Do not mutate the header when ``jwt.encode``, via :issue:`6`." msgstr "" -#: ../../changelog.rst:50 +#: ../../changelog.rst:40 msgid "Register algorithms with their matched key types on key set." msgstr "" -#: ../../changelog.rst:51 +#: ../../changelog.rst:41 msgid "Improve error handling, raise proper errors." msgstr "" -#: ../../changelog.rst:53 +#: ../../changelog.rst:43 msgid "**Breaking changes**:" msgstr "" -#: ../../changelog.rst:55 +#: ../../changelog.rst:45 msgid "" "``jws.JSONSignature`` is replaced by :class:`jws.GeneralJSONSignature` " "and :class:`jws.FlattenedJSONSignature`." msgstr "" -#: ../../changelog.rst:57 +#: ../../changelog.rst:47 msgid "" "``jwe.JSONEncryption`` is replaced by :class:`jwe.GeneralJSONEncryption` " "and :class:`jwe.FlattenedJSONEncryption`." msgstr "" -#: ../../changelog.rst:61 +#: ../../changelog.rst:51 msgid "0.5.0" msgstr "" -#: ../../changelog.rst:63 +#: ../../changelog.rst:53 msgid "**Released on July 12, 2023**" msgstr "" -#: ../../changelog.rst:65 +#: ../../changelog.rst:55 msgid "Add RFC7797 JSON Web Signature (JWS) Unencoded Payload Option" msgstr "" -#: ../../changelog.rst:66 +#: ../../changelog.rst:56 msgid "Fix ``decrypt_json`` when there is no ``encrypted_key``" msgstr "" -#: ../../changelog.rst:67 +#: ../../changelog.rst:57 msgid "Rename JWE CompleteJSONSerialization to GeneralJSONSerialization" msgstr "" -#: ../../changelog.rst:68 +#: ../../changelog.rst:58 msgid "Rename ``JSONEncryption.flatten`` to ``.flattened``" msgstr "" -#: ../../changelog.rst:69 +#: ../../changelog.rst:59 msgid "Load and dump RSA, EC, and OKP key with password" msgstr "" -#: ../../changelog.rst:70 +#: ../../changelog.rst:60 msgid "" "Rename Curve key method: ``exchange_shared_key`` to " "``exchange_derive_key``" msgstr "" -#: ../../changelog.rst:73 +#: ../../changelog.rst:63 msgid "0.4.0" msgstr "" -#: ../../changelog.rst:75 +#: ../../changelog.rst:65 msgid "**Released on July 6, 2023**" msgstr "" -#: ../../changelog.rst:77 +#: ../../changelog.rst:67 msgid "Change ``options`` to ``parameters`` for JWK methods" msgstr "" -#: ../../changelog.rst:78 +#: ../../changelog.rst:68 msgid "Change ``JWSRegistry`` and ``JWERegistry`` parameters" msgstr "" -#: ../../changelog.rst:79 +#: ../../changelog.rst:69 msgid "Guess ``sender_key`` from JWKs in JWE" msgstr "" -#: ../../changelog.rst:80 +#: ../../changelog.rst:70 msgid "Add importing key from DER encoding bytes" msgstr "" -#: ../../changelog.rst:81 +#: ../../changelog.rst:71 msgid "Fix JWS JSON serialization when members have only unprotected headers" msgstr "" -#: ../../changelog.rst:82 +#: ../../changelog.rst:72 msgid "Check key type before processing algorithms of JWS and JWE" msgstr "" -#: ../../changelog.rst:85 +#: ../../changelog.rst:75 msgid "0.3.0" msgstr "" -#: ../../changelog.rst:87 +#: ../../changelog.rst:77 msgid "**Released on June 29, 2023**" msgstr "" -#: ../../changelog.rst:89 +#: ../../changelog.rst:79 msgid "Return ``str`` instead of ``bytes`` for JWS and JWE serializations" msgstr "" -#: ../../changelog.rst:90 +#: ../../changelog.rst:80 msgid "Add a ``detach_content`` method for JWS" msgstr "" -#: ../../changelog.rst:91 +#: ../../changelog.rst:81 msgid "Remove ``jwt.extract`` method, because ``extract`` won't work for JWE" msgstr "" -#: ../../changelog.rst:92 +#: ../../changelog.rst:82 msgid "Add ``JWKRegistry`` for JWK" msgstr "" -#: ../../changelog.rst:93 +#: ../../changelog.rst:83 msgid "Update ``JSONEncryption.add_recipient`` parameters" msgstr "" -#: ../../changelog.rst:94 +#: ../../changelog.rst:84 msgid "Export register methods for JWE drafts" msgstr "" -#: ../../changelog.rst:97 +#: ../../changelog.rst:87 msgid "0.2.0" msgstr "" -#: ../../changelog.rst:99 +#: ../../changelog.rst:89 msgid "**Released on June 25, 2023**" msgstr "" -#: ../../changelog.rst:101 +#: ../../changelog.rst:91 msgid "A beta release." msgstr "" -#: ../../changelog.rst:104 +#: ../../changelog.rst:94 msgid "0.1.0" msgstr "" -#: ../../changelog.rst:106 +#: ../../changelog.rst:96 msgid "**Released on March 5, 2023**" msgstr "" -#: ../../changelog.rst:108 +#: ../../changelog.rst:98 msgid "Initial release." msgstr "" +#~ msgid "0.9.0" +#~ msgstr "" + +#~ msgid "**Released on November 16, 2023**" +#~ msgstr "" + +#~ msgid "Use ``os.urandom`` for ``OctKey.generate_key``." +#~ msgstr "" + +#~ msgid "Add ``allow_blank`` for ``JWTClaimsRegistry``." +#~ msgstr "" + +#~ msgid "Improve callable key for :meth:`~jwk.guess_key`." +#~ msgstr "" + +#~ msgid "**Released on September 06, 2023**" +#~ msgstr "" + diff --git a/docs/locales/zh/LC_MESSAGES/contributing.po b/docs/locales/zh/LC_MESSAGES/contributing.po index af03812..c8b170a 100644 --- a/docs/locales/zh/LC_MESSAGES/contributing.po +++ b/docs/locales/zh/LC_MESSAGES/contributing.po @@ -8,46 +8,32 @@ msgid "" msgstr "" "Project-Id-Version: joserfc 0.5.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-11-16 16:35+0900\n" +"POT-Creation-Date: 2023-09-01 08:56+0900\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language: zh\n" "Language-Team: zh \n" -"Plural-Forms: nplurals=1; plural=0\n" +"Plural-Forms: nplurals=1; plural=0;\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 2.9.1\n" +"Generated-By: Babel 2.12.1\n" #: ../../contributing/authors.rst:2 msgid "Authors" msgstr "作者列表" -#: ../../contributing/authors.rst:4 -msgid "" -"``joserfc`` is written and maintained by `Hsiaoming Yang " -"`_." +#: ../../contributing/authors.rst:5 +msgid "Owner" msgstr "" #: ../../contributing/authors.rst:8 -msgid "Contributors" -msgstr "贡献者" - -#: ../../contributing/authors.rst:10 -msgid "Here is the list of the main contributors:" +msgid "Maintainer" msgstr "" -#: ../../contributing/authors.rst:12 -msgid "`Viicos `_" -msgstr "" - -#: ../../contributing/authors.rst:13 -msgid "`Alon Bar-Lev `_" -msgstr "" - -#: ../../contributing/authors.rst:15 -msgid "And more on https://github.com/authlib/joserfc/graphs/contributors" -msgstr "" +#: ../../contributing/authors.rst:11 +msgid "Contributors" +msgstr "贡献者" #: ../../contributing/index.rst:2 msgid "Contributing" @@ -73,8 +59,7 @@ msgstr "报告错误" msgid "" "You're welcome to report bugs at `GitHub Issues " "`_." -msgstr "欢迎使用 `GitHub Issues `_ " -"来报告错误。" +msgstr "欢迎使用 `GitHub Issues `_ 来报告错误。" #: ../../contributing/index.rst:17 msgid "" @@ -315,3 +300,21 @@ msgid "" "within the ``locales/de/LC_MESSAGES`` directory. You can now edit these " "files to add the German translations accordingly." msgstr "" + +#~ msgid "" +#~ "``joserfc`` is written and maintained by" +#~ " `Hsiaoming Yang `_." +#~ msgstr "" + +#~ msgid "Here is the list of the main contributors:" +#~ msgstr "" + +#~ msgid "`Viicos `_" +#~ msgstr "" + +#~ msgid "`Alon Bar-Lev `_" +#~ msgstr "" + +#~ msgid "And more on https://github.com/authlib/joserfc/graphs/contributors" +#~ msgstr "" + diff --git a/docs/locales/zh/LC_MESSAGES/guide.po b/docs/locales/zh/LC_MESSAGES/guide.po index 621c370..72b1a1e 100644 --- a/docs/locales/zh/LC_MESSAGES/guide.po +++ b/docs/locales/zh/LC_MESSAGES/guide.po @@ -8,16 +8,16 @@ msgid "" msgstr "" "Project-Id-Version: joserfc 0.5.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-10-07 09:32+0900\n" +"POT-Creation-Date: 2023-09-01 08:26+0900\n" "PO-Revision-Date: 2023-07-15 14:44+0900\n" "Last-Translator: Hsiaoming Yang \n" "Language: zh\n" "Language-Team: zh \n" -"Plural-Forms: nplurals=1; plural=0\n" +"Plural-Forms: nplurals=1; plural=0;\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 2.9.1\n" +"Generated-By: Babel 2.12.1\n" #: ../../guide/algorithms.rst:6 ../../guide/jws.rst:252 #: ../../guide/registry.rst:21 @@ -695,7 +695,7 @@ msgstr "" msgid "And make sure only adding one recipient." msgstr "同时注意,你只能增加一位成员。" -#: ../../guide/jwe.rst:209 ../../guide/jwt.rst:288 +#: ../../guide/jwe.rst:209 ../../guide/jwt.rst:267 msgid "Algorithms & Registry" msgstr "算法和注册表" @@ -1401,81 +1401,65 @@ msgid "" "values, with the values appearing in order of preference." msgstr "" -#: ../../guide/jwt.rst:97 -msgid "And we added one more field:" -msgstr "" - -#: ../../guide/jwt.rst:100 -msgid "``allow_blank``" -msgstr "" - -#: ../../guide/jwt.rst:100 -msgid "OPTIONAL. Allow essential claims to be an empty string." -msgstr "" - -#: ../../guide/jwt.rst:103 +#: ../../guide/jwt.rst:98 msgid "Missing essential claims" msgstr "" -#: ../../guide/jwt.rst:118 -msgid "Allow empty essential claims" -msgstr "" - -#: ../../guide/jwt.rst:129 +#: ../../guide/jwt.rst:108 msgid "Invalid claims values" msgstr "" -#: ../../guide/jwt.rst:139 +#: ../../guide/jwt.rst:118 msgid "Default validators" msgstr "" -#: ../../guide/jwt.rst:141 +#: ../../guide/jwt.rst:120 msgid "" "The ``JWTClaimsRegistry`` has built-in validators for timing related " "fields:" msgstr "" -#: ../../guide/jwt.rst:143 +#: ../../guide/jwt.rst:122 msgid "``exp``: expiration time" msgstr "" -#: ../../guide/jwt.rst:144 +#: ../../guide/jwt.rst:123 msgid "``nbf``: not before" msgstr "" -#: ../../guide/jwt.rst:145 +#: ../../guide/jwt.rst:124 msgid "``iat``: issued at" msgstr "" -#: ../../guide/jwt.rst:148 +#: ../../guide/jwt.rst:127 msgid "JWS & JWE" msgstr "" -#: ../../guide/jwt.rst:150 +#: ../../guide/jwt.rst:129 msgid "" "JWT is built on top of JWS and JWE, all of the above examples are in JWS." " Here is an example of JWE:" msgstr "" -#: ../../guide/jwt.rst:163 +#: ../../guide/jwt.rst:142 msgid "" "The JWE formatted result contains 5 parts, while JWS only contains 3 " "parts, a JWE example would be something like this (line breaks for " "display only):" msgstr "" -#: ../../guide/jwt.rst:174 +#: ../../guide/jwt.rst:153 msgid "Another difference is the key used for ``encode`` and ``decode``." msgstr "" -#: ../../guide/jwt.rst:176 +#: ../../guide/jwt.rst:155 msgid "" "For :ref:`jws`, a private key is used for ``encode``, and a public key is" " used for ``decode``. The ``encode`` method will use a private key to " "sign, and the ``decode`` method will use a public key to verify." msgstr "" -#: ../../guide/jwt.rst:180 +#: ../../guide/jwt.rst:159 msgid "" "For :ref:`jwe`, it is the contrary, a public key is used for ``encode``, " "and a private key is used for ``decode``. The ``encode`` method will use" @@ -1483,110 +1467,110 @@ msgid "" "key to decrypt." msgstr "" -#: ../../guide/jwt.rst:185 +#: ../../guide/jwt.rst:164 msgid "The key parameter" msgstr "" -#: ../../guide/jwt.rst:187 +#: ../../guide/jwt.rst:166 msgid "" "In the above example, we're using :ref:`OctKey` only for simplicity. " "There are other types of keys in :ref:`jwk`." msgstr "" -#: ../../guide/jwt.rst:191 +#: ../../guide/jwt.rst:170 msgid "Key types" msgstr "" -#: ../../guide/jwt.rst:193 +#: ../../guide/jwt.rst:172 msgid "" "Each algorithm (``alg`` in header) requires a certain type of key. For " "example:" msgstr "" -#: ../../guide/jwt.rst:195 +#: ../../guide/jwt.rst:174 msgid "``HS256`` requires ``OctKey``" msgstr "" -#: ../../guide/jwt.rst:196 +#: ../../guide/jwt.rst:175 msgid "``RS256`` requires ``RSAKey``" msgstr "" -#: ../../guide/jwt.rst:197 +#: ../../guide/jwt.rst:176 msgid "``ES256`` requires ``ECKey`` or ``OKPKey``" msgstr "" -#: ../../guide/jwt.rst:199 +#: ../../guide/jwt.rst:178 msgid "You can find the correct key type for each algorithm at:" msgstr "" -#: ../../guide/jwt.rst:201 ../../guide/jwt.rst:296 +#: ../../guide/jwt.rst:180 ../../guide/jwt.rst:275 msgid ":ref:`JSON Web Signature Algorithms `" msgstr "" -#: ../../guide/jwt.rst:202 ../../guide/jwt.rst:297 +#: ../../guide/jwt.rst:181 ../../guide/jwt.rst:276 msgid ":ref:`JSON Web Encryption Algorithms `" msgstr "" -#: ../../guide/jwt.rst:204 +#: ../../guide/jwt.rst:183 msgid "Here is an example of a JWT with \"alg\" of ``RS256`` in JWS type:" msgstr "" -#: ../../guide/jwt.rst:223 +#: ../../guide/jwt.rst:202 msgid "" "In production, ``jwt.encode`` is usually used by the *client* side, a " "client normally does not have the access to private keys. The server " "provider would usually expose the public keys in JWK Set." msgstr "" -#: ../../guide/jwt.rst:228 +#: ../../guide/jwt.rst:207 msgid "Use key set" msgstr "" -#: ../../guide/jwt.rst:230 +#: ../../guide/jwt.rst:209 msgid "" "You can also pass a JWK Set to the ``key`` parameter of :meth:`encode` " "and :meth:`decode` methods." msgstr "" -#: ../../guide/jwt.rst:247 +#: ../../guide/jwt.rst:226 msgid "" "The methods will find the correct key according to the ``kid`` you " "specified. If there is no ``kid`` in header, it will pick on randomly and" " add the ``kid`` of the key into header." msgstr "" -#: ../../guide/jwt.rst:251 +#: ../../guide/jwt.rst:230 msgid "" "A client would usually get the public key set from a public URL, normally" " the ``decode`` code would be something like:" msgstr "" -#: ../../guide/jwt.rst:267 +#: ../../guide/jwt.rst:246 msgid "Callable key" msgstr "" -#: ../../guide/jwt.rst:269 +#: ../../guide/jwt.rst:248 msgid "It is also possible to assign a callable function as the ``key``:" msgstr "" -#: ../../guide/jwt.rst:290 +#: ../../guide/jwt.rst:269 msgid "" "The :meth:`encode` and :meth:`decode` accept an ``algorithms`` parameter " "for specifying the allowed algorithms. By default, it only allows your to" " use recommended algorithms." msgstr "" -#: ../../guide/jwt.rst:294 +#: ../../guide/jwt.rst:273 msgid "You can find out the recommended algorithms at:" msgstr "" -#: ../../guide/jwt.rst:299 +#: ../../guide/jwt.rst:278 msgid "" "For instance, ``HS386`` is not a recommended algorithm, and you want to " "use this algorithm:" msgstr "" -#: ../../guide/jwt.rst:310 +#: ../../guide/jwt.rst:289 msgid "" "If not specifying the ``algorithms`` parameter, the ``encode`` method " "will raise an error." @@ -1726,3 +1710,16 @@ msgid "" "Depending on the algorithm of the JWT, you need to decide whether to use " "``JWSRegistry`` or ``JWERegistry``." msgstr "" + +#~ msgid "And we added one more field:" +#~ msgstr "" + +#~ msgid "``allow_blank``" +#~ msgstr "" + +#~ msgid "OPTIONAL. Allow essential claims to be an empty string." +#~ msgstr "" + +#~ msgid "Allow empty essential claims" +#~ msgstr "" + diff --git a/docs/locales/zh/LC_MESSAGES/index.po b/docs/locales/zh/LC_MESSAGES/index.po index 24bda87..fb52056 100644 --- a/docs/locales/zh/LC_MESSAGES/index.po +++ b/docs/locales/zh/LC_MESSAGES/index.po @@ -8,30 +8,30 @@ msgid "" msgstr "" "Project-Id-Version: joserfc 0.5.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-11-16 16:35+0900\n" +"POT-Creation-Date: 2023-09-01 08:25+0900\n" "PO-Revision-Date: 2023-07-15 14:44+0900\n" "Last-Translator: Hsiaoming Yang \n" "Language: zh\n" "Language-Team: zh \n" -"Plural-Forms: nplurals=1; plural=0\n" +"Plural-Forms: nplurals=1; plural=0;\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 2.9.1\n" +"Generated-By: Babel 2.12.1\n" -#: ../../index.rst:65 +#: ../../index.rst:59 msgid "Getting started" msgstr "开始上手" -#: ../../index.rst:72 +#: ../../index.rst:66 msgid "Essentials" msgstr "必读文档" -#: ../../index.rst:81 +#: ../../index.rst:75 msgid "Recipes" msgstr "小技巧" -#: ../../index.rst:89 +#: ../../index.rst:83 msgid "Development" msgstr "开发者文档" @@ -71,83 +71,84 @@ msgstr "一个快速而简单的 JWT 编码和解码的示例如下:" msgid "You would find more details and advanced usage in :ref:`jwt` section." msgstr "您可以在 :ref:`jwt` 部分找到更多详细信息和高级用法。" -#: ../../index.rst:34 -msgid "" -"The string ``\"secret\"`` employed in the above example is solely " -"intended for demonstration purposes. In a production environment, it is " -"crucial to use a highly secure secret key to ensure robust security " -"measures." -msgstr "" - -#: ../../index.rst:39 +#: ../../index.rst:33 msgid "RFCs" msgstr "" -#: ../../index.rst:41 +#: ../../index.rst:35 msgid "It follows RFCs with extensible API. The module has implementations of:" msgstr "它遵循可扩展的 API,并遵循 RFC 标准。该模块包含以下实现:" -#: ../../index.rst:43 +#: ../../index.rst:37 msgid "RFC7515: :ref:`JSON Web Signature `" msgstr "" -#: ../../index.rst:44 +#: ../../index.rst:38 msgid "RFC7516: :ref:`JSON Web Encryption `" msgstr "" -#: ../../index.rst:45 +#: ../../index.rst:39 msgid "RFC7517: :ref:`JSON Web Key `" msgstr "" -#: ../../index.rst:46 +#: ../../index.rst:40 msgid "RFC7518: :ref:`JSON Web Algorithms `" msgstr "" -#: ../../index.rst:47 +#: ../../index.rst:41 msgid "RFC7519: :ref:`JSON Web Token `" msgstr "" -#: ../../index.rst:48 +#: ../../index.rst:42 msgid "" "RFC7520: Examples of Protecting Content Using JSON Object Signing and " "Encryption" msgstr "" -#: ../../index.rst:49 +#: ../../index.rst:43 msgid "RFC7638: ``thumbprint`` for JWK" msgstr "" -#: ../../index.rst:50 +#: ../../index.rst:44 msgid "RFC8037: ``OKP`` Key and ``EdDSA`` algorithm" msgstr "" -#: ../../index.rst:51 +#: ../../index.rst:45 msgid "RFC8812: ``ES256K`` algorithm" msgstr "" -#: ../../index.rst:53 +#: ../../index.rst:47 msgid "And draft RFCs implementation of:" msgstr "同时包含如下 JOSE 草案的实现:" -#: ../../index.rst:55 +#: ../../index.rst:49 msgid ":ref:`chacha20`" msgstr "" -#: ../../index.rst:56 +#: ../../index.rst:50 msgid ":ref:`ecdh1pu`" msgstr "" -#: ../../index.rst:58 +#: ../../index.rst:52 msgid "RFC7520 is implemented as test cases." msgstr "RFC7520 是测试案例,详情请参考源码里的 tests 部分。" -#: ../../index.rst:61 +#: ../../index.rst:55 msgid "Next" msgstr "继续阅读" -#: ../../index.rst:63 +#: ../../index.rst:57 msgid "" "Explore the following sections to discover more about ``joserfc`` and its" " features." msgstr "浏览以下部分,了解更多关于 ``joserfc`` 及其特性的内容。" +#~ msgid "" +#~ "The string ``\"secret\"`` employed in " +#~ "the above example is solely intended " +#~ "for demonstration purposes. In a " +#~ "production environment, it is crucial to" +#~ " use a highly secure secret key " +#~ "to ensure robust security measures." +#~ msgstr "" + diff --git a/docs/locales/zh/LC_MESSAGES/recipes.po b/docs/locales/zh/LC_MESSAGES/recipes.po index 4e61253..84fbb29 100644 --- a/docs/locales/zh/LC_MESSAGES/recipes.po +++ b/docs/locales/zh/LC_MESSAGES/recipes.po @@ -8,166 +8,27 @@ msgid "" msgstr "" "Project-Id-Version: joserfc 0.5.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-10-07 09:32+0900\n" +"POT-Creation-Date: 2023-09-01 08:25+0900\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language: zh\n" "Language-Team: zh \n" -"Plural-Forms: nplurals=1; plural=0\n" +"Plural-Forms: nplurals=1; plural=0;\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 2.9.1\n" +"Generated-By: Babel 2.12.1\n" #: ../../recipes/azure.rst:2 msgid "Dynamic keys for Azure" msgstr "" -#: ../../recipes/azure.rst:4 -msgid "" -"In scenarios where you need to decode a JWT received from Azure " -"(Microsoft), you may encounter a situation where you are unaware of the " -"public key required for the decoding process until after the token " -"arrives. In such cases, you will typically need to retrieve the key set " -"dynamically from the ``iss`` (issuer) value contained within the JWT." +#: ../../recipes/azure.rst:6 +msgid "Use callable key" msgstr "" #: ../../recipes/azure.rst:10 -msgid "" -"Let's illustrate this process using a JWT token extracted from " -"Microsoft's official documentation `Access tokens in the Microsoft " -"identity platform `_:" -msgstr "" - -#: ../../recipes/azure.rst:31 -msgid "" -"This token, obtained from Microsoft's official documentation, serves as " -"an example for decoding JWTs originating from Azure. The decoded payload " -"might look like:" -msgstr "" - -#: ../../recipes/azure.rst:57 -msgid "Steps for decoding" -msgstr "" - -#: ../../recipes/azure.rst:59 -msgid "" -"In order to decode JWT tokens from Azure, it is essential to retrieve the" -" necessary information from Microsoft's OpenID configuration, including " -"the JSON Web Key Set (JWK Set) URI. This information is crucial for " -"verifying the tokens." -msgstr "" - -#: ../../recipes/azure.rst:64 -msgid "OpenID Configuration Endpoint" -msgstr "" - -#: ../../recipes/azure.rst:66 -msgid "" -"You can obtain the OpenID configuration endpoint from Microsoft by " -"forming a URL in the following format:" -msgstr "" - -#: ../../recipes/azure.rst:73 -msgid "" -"In the example provided, replace {tenant} with your specific Azure tenant" -" ID or the tenant's globally unique identifier (GUID). The resulting URL " -"will lead you to the OpenID configuration details. Then, the OpenID " -"configuration endpoint for the above example could be:" -msgstr "" - -#: ../../recipes/azure.rst:83 -msgid "JWK Set URI" -msgstr "" - -#: ../../recipes/azure.rst:85 -msgid "" -"Within the OpenID configuration details, you will find the JSON Web Key " -"Set (JWK Set) URI. This URI is used to access the keys required for " -"verifying JWT tokens. The JWK Set URI can typically be found within the " -"configuration as follows:" -msgstr "" - -#: ../../recipes/azure.rst:93 -msgid "" -"Once again, remember to replace {tenant} with your Azure tenant ID or the" -" appropriate identifier. In the above example, the ``jwks_uri`` could be:" -msgstr "" - -#: ../../recipes/azure.rst:101 -msgid "Validating JWT Tokens" -msgstr "" - -#: ../../recipes/azure.rst:103 -msgid "" -"Once you have retrieved the JSON Web Key Set (JWK Set) from the JWK Set " -"URI provided in the OpenID configuration, you can proceed to validate JWT" -" tokens." -msgstr "" - -#: ../../recipes/azure.rst:107 -msgid "Using a Callable Key" -msgstr "" - -#: ../../recipes/azure.rst:109 -msgid "" -"In ``joserfc``, a callable key is a powerful feature that allows you to " -"dynamically retrieve and use the appropriate JSON Web Key (JWK) for token" -" decoding. In the context of Azure tokens, you can implement a callable " -"key to fetch the JWKs from the JWK Set URI and select the correct key " -"based on the kid (Key ID) in the token's header." -msgstr "" - -#: ../../recipes/azure.rst:139 -msgid "" -"When using the callable key method in ``joserfc`` to decode the tokens, " -"it retrieves the key dynamically on each token decoding request. However," -" you may encounter performance issues due to the repeated retrieval of " -"keys. In such cases, it's advisable to optimize the callable key by " -"implementing key set caching based on the issuer." -msgstr "" - -#: ../../recipes/azure.rst:144 -msgid "Let's enhance the callable key method to improve its efficiency." -msgstr "" - -#: ../../recipes/azure.rst:164 -msgid "" -"In this enhanced callable key, an LRU (Least Recently Used) cache is used" -" to store JWK Sets for different issuers. When decoding a token, the " -"callable key function first checks if the JWK Set for the specific issuer" -" is available in the cache. If it's not, it fetches the JWK Set for the " -"issuer, caches it, and then selects the appropriate JWK based on the kid." -" This caching mechanism significantly reduces the network requests for " -"JWK Sets and improves the efficiency of token decoding." -msgstr "" - -#: ../../recipes/azure.rst:172 -msgid "Manual Token Decoding" -msgstr "" - -#: ../../recipes/azure.rst:174 -msgid "" -"If you prefer a more hands-on approach and want to decode the token step " -"by step, you can opt for a manual decoding process. This method allows " -"you to extract the token string and work with it directly. Since the " -"token is a JWT in JWS format, you can utilize the ``extract_compact`` " -"method from the JWS module to obtain the necessary information. The " -"result of this extraction is an object of type " -":class:`~joserfc.jws.CompactSignature`." -msgstr "" - -#: ../../recipes/azure.rst:187 -msgid "" -"Similar to the approach detailed in the \"Using a Callable Key\" section," -" you can retrieve the key set based on the issuer (``iss``) claim. This " -"method allows you to access the necessary keys for token verification." -msgstr "" - -#: ../../recipes/azure.rst:204 -msgid "" -"Once you have obtained the key set based on the issuer (``iss``) claim, " -"you can use this set of keys to decode the token." +msgid "Step by step" msgstr "" #: ../../recipes/openssl.rst:2 @@ -215,10 +76,3 @@ msgstr "" #: ../../recipes/openssl.rst:82 msgid "EC key with crv secp256k1" msgstr "" - -#~ msgid "Use callable key" -#~ msgstr "" - -#~ msgid "Step by step" -#~ msgstr "" - diff --git a/src/joserfc/__init__.py b/src/joserfc/__init__.py index 8c6c2c9..09082cf 100644 --- a/src/joserfc/__init__.py +++ b/src/joserfc/__init__.py @@ -1,4 +1,4 @@ -__version__ = "0.10.0" -__homepage__ = "https://jose.authlib.org/" +__version__ = "0.11.0" +__homepage__ = "https://jose.authlib.org/en/" __author__ = "Hsiaoming Yang " __license__ = "BSD-3-Clause" diff --git a/src/joserfc/jwk.py b/src/joserfc/jwk.py index 2780862..5815fc9 100644 --- a/src/joserfc/jwk.py +++ b/src/joserfc/jwk.py @@ -84,5 +84,5 @@ def _normalize_key(key: KeyBase) -> t.Union[Key, KeySet]: DeprecationWarning, stacklevel=2, ) - return OctKey.import_key(key) + return OctKey.import_key(key) # pragma: no cover return key