50 lines
1.2 KiB
Python
50 lines
1.2 KiB
Python
|
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"}
|