Skip to content
This repository has been archived by the owner on Feb 14, 2024. It is now read-only.

Commit

Permalink
Merge pull request #5 from lastcanal/feature/api_sign_message
Browse files Browse the repository at this point in the history
Sign message with key path
  • Loading branch information
EricLarch committed Jan 9, 2017
2 parents 9d65dcd + 40698ff commit 16e8d55
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions example.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
<input type="text" id="path">
<input type="button" onclick="Ledger.getXPubKey(document.getElementById('path').value)" value="Get xpubkey">
<p>
<input type="text" id="message_path">
<textarea id="message"></textarea>
<input type="button" onclick="Ledger.signMessage(document.getElementById('message_path').value, document.getElementById('message').value)" value="Sign message">
<p>
<input type="button" onclick="p2sh()" value="Sign P2SH">
<script>
function callback(event) {
Expand Down
3 changes: 3 additions & 0 deletions ledger.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ var Ledger = {
getXPubKey: function(path) {
Ledger._messageAfterSession({ command:"get_xpubkey", path:path })
},
signMessage: function(path, message) {
Ledger._messageAfterSession({ command:"sign_message", path:path, message:message })
},
signP2SH: function(inputs, scripts, outputs_number, outputs_script, paths) {
Ledger._messageAfterSession({ command:"sign_p2sh", inputs: inputs, scripts: scripts, outputs_number: outputs_number, outputs_script: outputs_script, paths: paths })
},
Expand Down

0 comments on commit 16e8d55

Please sign in to comment.