@@ -45,10 +45,10 @@ You can call :meth:`jws.serialize_compact` to construct a compact JWS serializat
4545 from joserfc import jws
4646 from joserfc.jwk import OctKey
4747
48- key = OctKey.import_key(" secret" )
48+ key = OctKey.import_key(" your- secret-key " )
4949 protected = {" alg" : " HS256" }
5050 jws.serialize_compact(protected, " hello" , key)
51- # => 'eyJhbGciOiJIUzI1NiJ9.aGVsbG8.UYmO_lPAY5V0Wf4KZsfhiYs1SxqXPhxvjuYqellDV5A '
51+ # => 'eyJhbGciOiJIUzI1NiJ9.aGVsbG8.i_RrfHeMxwHrhk5Xi3J_bU9B9O-gjkMaQtagtqiCndM '
5252
5353 A compact JWS is constructed by protected header, payload and a private key. In the above
5454example, ``protected `` is the "protected header" part, `"hello" ` is the payload part, and
@@ -65,8 +65,8 @@ serialization with a public key.
6565 from joserfc import jws
6666 from joserfc.jwk import OctKey
6767
68- text = " eyJhbGciOiJIUzI1NiJ9.aGVsbG8.UYmO_lPAY5V0Wf4KZsfhiYs1SxqXPhxvjuYqellDV5A "
69- key = OctKey.import_key(" secret" )
68+ text = " eyJhbGciOiJIUzI1NiJ9.aGVsbG8.i_RrfHeMxwHrhk5Xi3J_bU9B9O-gjkMaQtagtqiCndM "
69+ key = OctKey.import_key(" your- secret-key " )
7070 obj = jws.deserialize_compact(text, key)
7171 # obj.protected => {"alg": "HS256"}
7272 # obj.payload => b"hello"
@@ -298,7 +298,7 @@ either by the ``algorithms`` parameter, or ``registry`` parameter.
298298
299299 >> > from joserfc import jws
300300 >> > from joserfc.jwk import OctKey
301- >> > key = OctKey.import_key(" secret" )
301+ >> > key = OctKey.import_key(" your- secret-key " )
302302 >> > jws.serialize_compact({" alg" : " HS384" }, b " payload" , key, algorithms = [" HS384" ])
303303 ' eyJhbGciOiJIUzM4NCJ9.cGF5bG9hZA.TJEvlp74g89hNRNGNZxCQvB7YDEAWP5vFAjgu1O9Qr5BLMj0NtvbxvYkVYPGp-xQ'
304304
@@ -309,7 +309,7 @@ of using :ref:`registry`.
309309
310310 >> > from joserfc import jws
311311 >> > from joserfc.jwk import OctKey
312- >> > key = OctKey.import_key(" secret" )
312+ >> > key = OctKey.import_key(" your- secret-key " )
313313 >> > registry = jws.JWSRegistry(algorithms = [" HS384" ])
314314 >> > jws.serialize_compact({" alg" : " HS384" }, b " payload" , key, registry = registry)
315315 ' eyJhbGciOiJIUzM4NCJ9.cGF5bG9hZA.TJEvlp74g89hNRNGNZxCQvB7YDEAWP5vFAjgu1O9Qr5BLMj0NtvbxvYkVYPGp-xQ'
@@ -332,7 +332,7 @@ Here are examples demonstrating the usage of the ``b64`` option:
332332 from joserfc.jws import serialize_compact, deserialize_compact
333333 from joserfc.jwk import OctKey
334334
335- key = OctKey.import_key(" secret" )
335+ key = OctKey.import_key(" your- secret-key " )
336336 protected = {" alg" : " HS256" , " b64" : False , " crit" : [" b64" ]}
337337 value = serialize_compact(protected, " hello" , key)
338338 # => 'eyJhbGciOiJIUzI1NiIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19.hello.mdPbZLtc3tqQ6NCV1pKF-qfEx-3jtR6rv109phKAc4I'
@@ -351,10 +351,10 @@ characters, the compact serialization will detach the payload:
351351 from joserfc.jws import serialize_compact, deserialize_compact
352352 from joserfc.jwk import OctKey
353353
354- key = OctKey.import_key(" secret" )
354+ key = OctKey.import_key(" your- secret-key " )
355355 protected = {" alg" : " HS256" , " b64" : False , " crit" : [" b64" ]}
356356 value = serialize_compact(protected, " $.02" , key)
357- # => 'eyJhbGciOiJIUzI1NiIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..GbtzAD3Cwe6snTZnaAxapwQz5QftEz7agx_6aMtZ4w0 '
357+ # => 'eyJhbGciOiJIUzI1NiIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..6iWgAK_TZLgwzk1mhtxs6Imw-dJM1cRstsOKVQ5MjFQ '
358358 # since the payload is detached, you need to specify the
359359 # payload when calling deserialize_compact
360360 deserialize_compact(value, key, payload = " $.02" )
0 commit comments