28 lines
504 B
Plaintext
28 lines
504 B
Plaintext
|
my-web-auth-part.code
|
||
|
|
||
|
open http listerner
|
||
|
|
||
|
pre_delivered_public_key = 123456789
|
||
|
|
||
|
if reguest get to /auth
|
||
|
check for json post data
|
||
|
post data:
|
||
|
{
|
||
|
person: {
|
||
|
user: username
|
||
|
token: token
|
||
|
},
|
||
|
signature: {
|
||
|
signature: ecdsa_signature
|
||
|
curve: curve
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if ecdsa.verify( username+token, pre_delivered_public_key )
|
||
|
then
|
||
|
print "allow"
|
||
|
return "{ status: success }"
|
||
|
else
|
||
|
print "deny from: ", user
|
||
|
return "{ status: ", failure }"
|