mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 03:04:13 +00:00
fix(proxy/utils.py): accept token hashes for deleting tokens
This commit is contained in:
parent
55b95e87dd
commit
e989175c10
1 changed files with 7 additions and 1 deletions
|
@ -814,7 +814,13 @@ class PrismaClient:
|
||||||
Allow user to delete a key(s)
|
Allow user to delete a key(s)
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
hashed_tokens = [self.hash_token(token=token) for token in tokens]
|
hashed_tokens = []
|
||||||
|
for token in tokens:
|
||||||
|
if isinstance(token, str) and token.startswith("sk-"):
|
||||||
|
hashed_token = self.hash_token(token=token)
|
||||||
|
else:
|
||||||
|
hashed_token = token
|
||||||
|
hashed_tokens.append(hashed_token)
|
||||||
await self.db.litellm_verificationtoken.delete_many(
|
await self.db.litellm_verificationtoken.delete_many(
|
||||||
where={"token": {"in": hashed_tokens}}
|
where={"token": {"in": hashed_tokens}}
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue