feat: Add signature checker
This commit is contained in:
50
signature-checker.py
Normal file
50
signature-checker.py
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
import json
|
||||||
|
import account
|
||||||
|
import requests
|
||||||
|
|
||||||
|
# Plugin Data
|
||||||
|
info = {
|
||||||
|
"name": "Check signatures",
|
||||||
|
"description": "Validate signatures",
|
||||||
|
"version": "1.0",
|
||||||
|
"author": "Nathan.Woodburn/"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Functions
|
||||||
|
functions = {
|
||||||
|
"validate":{
|
||||||
|
"name": "Validate signature",
|
||||||
|
"type": "default",
|
||||||
|
"description": "Validate that a message was signed by a specific domain",
|
||||||
|
"params": {
|
||||||
|
"domain": {
|
||||||
|
"name": "Signing domain",
|
||||||
|
"type": "text",
|
||||||
|
},
|
||||||
|
"message": {
|
||||||
|
"name": "Message",
|
||||||
|
"type": "text",
|
||||||
|
},
|
||||||
|
"signature": {
|
||||||
|
"name": "Signature",
|
||||||
|
"type": "text",
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"returns": {
|
||||||
|
"status":
|
||||||
|
{
|
||||||
|
"name": "Validity of the signature",
|
||||||
|
"type": "text"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def validate(params, authentication):
|
||||||
|
domain = params["domain"]
|
||||||
|
message = params["message"]
|
||||||
|
signature = params["signature"]
|
||||||
|
|
||||||
|
if account.verifyMessageWithName(domain, signature,message):
|
||||||
|
return {"status": "Valid"}
|
||||||
|
return {"status": "Invalid signature"}
|
||||||
Reference in New Issue
Block a user