better validation on pubkeys

This commit is contained in:
Lee Salminen 2022-12-20 07:14:03 -06:00
parent 3ca9edeee6
commit 9e857e6329

View file

@ -114,7 +114,7 @@ async def api_address_create(
status_code=HTTPStatus.NOT_FOUND, detail="Local part already exists." status_code=HTTPStatus.NOT_FOUND, detail="Local part already exists."
) )
if len(data.pubkey) != 64: if len(bytes.fromhex(data.pubkey)) != 32:
raise HTTPException( raise HTTPException(
status_code=HTTPStatus.NOT_FOUND, detail="Pubkey must be in hex format." status_code=HTTPStatus.NOT_FOUND, detail="Pubkey must be in hex format."
) )