Added sample notification JWT signature verification code to /api/index.html.
- Legacy-Id: 16207
This commit is contained in:
parent
f1ab5a78f1
commit
cda1d5eb32
|
@ -322,6 +322,24 @@
|
|||
<p>or alternatively:</p>
|
||||
|
||||
<pre>{{key.export_to_pem}}</pre>
|
||||
|
||||
<p>
|
||||
To verify a signature and get the verified data using Python with the
|
||||
<a href="https://jwcrypto.readthedocs.io/en/latest/">jwcrypto</a> module,
|
||||
you could do:
|
||||
<pre>
|
||||
from jwcrypto import jwk, jws
|
||||
|
||||
# ... receive json web signed data as 'data', used below ...
|
||||
|
||||
key = jwk.JWK()
|
||||
key.import_from_pem(API_PUBLIC_KEY_PEM) # the key above
|
||||
jwstoken = jws.JWS()
|
||||
jwstoken.deserialize(data)
|
||||
jwstoken.verify(key)
|
||||
payload = jwstoken.payload
|
||||
</pre>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue