Created
June 1, 2019 20:23
-
-
Save fkfk/808fd1ae63ee87ef5d68dff809b1ca0d to your computer and use it in GitHub Desktop.
mpurse sign message example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<title>mpurse sign message example</title> | |
<meta charset="UTF-8"> | |
</head> | |
<body> | |
<script> | |
window.addEventListener("load", async (ev) => { | |
if (window.mpurse) { | |
const button = document.querySelector("#do-sign") | |
button["disabled"] = false | |
} else { | |
window.alert("mpurseが未インストールまたは無効化されています。") | |
} | |
}) | |
const doSign = async () => { | |
const message = document.querySelector("#message")["value"] | |
const sign = await window.mpurse.signMessage(message) | |
document.querySelector("#sign").innerHTML = sign | |
} | |
</script> | |
<p>Message: <input id="message"><input id="do-sign" type="button" value="署名" onclick="doSign()" disabled></p> | |
<p id="sign"></p> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment