async def encode_jwt(self, identity: SessionIdentity) -> str:
assert identity<EOL>payload = {<EOL>"<STR_LIT>": identity.identity,<EOL>"<STR_LIT>": identity.user_id,<EOL>"<STR_LIT>": int(time.time() + self._max_age) <EOL>}<EOL>if identity.client_id:<EOL><INDENT>payload['<STR_LIT>'] = identity.client_id<EOL><DEDENT>token = jwt.encode({'<STR_LIT>': '<STR_LIT>'}, payload, self._secure_key)<EOL>return token.decode('<STR_LIT:ascii>')<EOL>
将identity编码为JWT