|
@@ -107,20 +107,21 @@ class JitsiMeetToken(object):
|
107
|
107
|
self.duration = duration
|
108
|
108
|
self.context = context
|
109
|
109
|
|
110
|
|
- def generate(self) -> str:
|
|
110
|
+ def generate(self, issue_date: typing.Optional[datetime.datetime] = None) -> str:
|
111
|
111
|
"""
|
112
|
112
|
Generate JWT token
|
113
|
113
|
:return: JWT token as str
|
114
|
114
|
"""
|
115
|
|
- now = datetime.datetime.utcnow()
|
116
|
|
- exp = now+datetime.timedelta(seconds=self.duration)
|
|
115
|
+ if not issue_date:
|
|
116
|
+ issue_date = datetime.datetime.utcnow()
|
|
117
|
+ exp = issue_date+datetime.timedelta(seconds=self.duration)
|
117
|
118
|
data = {
|
118
|
119
|
"iss": self.app_id, # Issuer
|
119
|
120
|
"room": self.room, # Custom-param for jitsi_meet
|
120
|
121
|
"aud": "*", # TODO: Understood this param
|
121
|
122
|
"exp": exp, # Expiration date
|
122
|
|
- "nbf": now, # NotBefore
|
123
|
|
- "iat": now, # IssuedAt
|
|
123
|
+ "nbf": issue_date, # NotBefore
|
|
124
|
+ "iat": issue_date, # IssuedAt
|
124
|
125
|
}
|
125
|
126
|
if self.context:
|
126
|
127
|
data['context'] = self.context.as_dict()
|