Skip to content

Commit 70b8c75

Browse files
authored
Added check endpoint
added the check endpoint that no other example has added for now, checks if the current session is validated or not
1 parent 1f7938b commit 70b8c75

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

keyauth.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,24 @@ def file(self, fileid):
231231
time.sleep(5)
232232
sys.exit()
233233
return binascii.unhexlify(json["contents"])
234+
235+
def check(self):
236+
init_iv = SHA256.new(str(uuid4())[:8].encode()).hexdigest()
237+
post_data = {
238+
"type": binascii.hexlify(("check").encode()),
239+
"sessionid": binascii.hexlify(self.sessionid.encode()),
240+
"name": binascii.hexlify(self.name.encode()),
241+
"ownerid": binascii.hexlify(self.ownerid.encode()),
242+
"init_iv": init_iv
243+
}
244+
response = self.__do_request(post_data)
245+
246+
response = encryption.decrypt(response, self.enckey, init_iv)
247+
json = jsond.loads(response)
248+
if json["success"]:
249+
return True
250+
else:
251+
return False
234252

235253
def webhook(self, webid, param):
236254

0 commit comments

Comments
 (0)