Implementation of RFC7638 JSON Web Key (JWK) Thumbprint.
(self)
| 96 | return json_dumps(obj) |
| 97 | |
| 98 | def thumbprint(self): |
| 99 | """Implementation of RFC7638 JSON Web Key (JWK) Thumbprint.""" |
| 100 | fields = list(self.REQUIRED_JSON_FIELDS) |
| 101 | fields.append("kty") |
| 102 | fields.sort() |
| 103 | data = OrderedDict() |
| 104 | |
| 105 | for k in fields: |
| 106 | data[k] = self.tokens[k] |
| 107 | |
| 108 | json_data = json_dumps(data) |
| 109 | digest_data = hashlib.sha256(to_bytes(json_data)).digest() |
| 110 | return to_unicode(urlsafe_b64encode(digest_data)) |
| 111 | |
| 112 | @classmethod |
| 113 | def check_required_fields(cls, data): |