@@ -179,13 +179,13 @@ def put_together_aud(recv, aud=None):
179179
180180 return _aud
181181
182- def pack_init (self , recv , aud ):
182+ def pack_init (self , recv , aud , iat = None ):
183183 """
184184 Gather initial information for the payload.
185185
186186 :return: A dictionary with claims and values
187187 """
188- argv = {"iss" : self .iss , "iat" : utc_time_sans_frac ()}
188+ argv = {"iss" : self .iss , "iat" : iat or utc_time_sans_frac ()}
189189 if self .lifetime :
190190 argv ["exp" ] = argv ["iat" ] + self .lifetime
191191
@@ -210,7 +210,7 @@ def pack_key(self, issuer_id="", kid=""):
210210
211211 return keys [0 ] # Might be more then one if kid == ''
212212
213- def pack (self , payload = None , kid = "" , issuer_id = "" , recv = "" , aud = None , ** kwargs ):
213+ def pack (self , payload = None , kid = "" , issuer_id = "" , recv = "" , aud = None , iat = None , ** kwargs ):
214214 """
215215
216216 :param payload: Information to be carried as payload in the JWT
@@ -219,13 +219,14 @@ def pack(self, payload=None, kid="", issuer_id="", recv="", aud=None, **kwargs):
219219 :param recv: The intended immediate receiver
220220 :param aud: Intended audience for this JWS/JWE, not expected to
221221 contain the recipient.
222+ :param iat: Override issued at (default current timestamp)
222223 :param kwargs: Extra keyword arguments
223224 :return: A signed or signed and encrypted Json Web Token
224225 """
225226 _args = {}
226227 if payload is not None :
227228 _args .update (payload )
228- _args .update (self .pack_init (recv , aud ))
229+ _args .update (self .pack_init (recv , aud , iat ))
229230
230231 try :
231232 _encrypt = kwargs ["encrypt" ]
0 commit comments