Skip to content

Commit

Permalink
encoding-decoding: add new Encoding/Decoding page
Browse files Browse the repository at this point in the history
  • Loading branch information
guggero committed Jul 22, 2024
1 parent 2563355 commit e3f71a3
Show file tree
Hide file tree
Showing 6 changed files with 362 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@
<a href="#!/shamir-secret-sharing">Shamir's Secret Sharing
Scheme</a>
</li>
<li ng-class="{active: $root.isActive('/encoding-decoding')}">
<a href="#!/encoding-decoding">Encoding/Decoding</a>
</li>
</ul>
</li>
</ul>
Expand Down
1 change: 1 addition & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ function routeConfig($locationProvider, $routeProvider) {
.when('/hd-wallet', {template: '<hd-wallet-page></hd-wallet-page>', containerClass: 'container'})
.when('/bitcoin-block', {template: '<bitcoin-block-page></bitcoin-block-page>', containerClass: 'container'})
.when('/shamir-secret-sharing', {template: '<shamir-secret-sharing-page></shamir-secret-sharing-page>', containerClass: 'container'})
.when('/encoding-decoding', {template: '<encoding-decoding-page></encoding-decoding-page>', containerClass: 'container'})
.when('/mu-sig', {template: '<mu-sig-page></mu-sig-page>', containerClass: 'container'})
.when('/schnorr', {template: '<schnorr-page></schnorr-page>', containerClass: 'container'})
.when('/transaction-creator', {template: '<transaction-creator-page></transaction-creator-page>', containerClass: 'container'})
Expand Down
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<script src="pages/hd-wallet/hd-wallet.js"></script>
<script src="pages/bitcoin-block/bitcoin-block.js"></script>
<script src="pages/shamir-secret-sharing/shamir-secret-sharing.js"></script>
<script src="pages/encoding-decoding/encoding-decoding.js"></script>
<script src="pages/mu-sig/mu-sig.js"></script>
<script src="pages/schnorr/schnorr.js"></script>
<script src="pages/transaction-creator/transaction-creator.js"></script>
Expand Down
126 changes: 126 additions & 0 deletions libs/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ angular.module('app').run(['$templateCache', function($templateCache) {
" <a href=\"#!/shamir-secret-sharing\">Shamir's Secret Sharing\n" +
" Scheme</a>\n" +
" </li>\n" +
" <li ng-class=\"{active: $root.isActive('/encoding-decoding')}\">\n" +
" <a href=\"#!/encoding-decoding\">Encoding/Decoding</a>\n" +
" </li>\n" +
" </ul>\n" +
" </li>\n" +
" </ul>\n" +
Expand Down Expand Up @@ -145,6 +148,7 @@ angular.module('app').run(['$templateCache', function($templateCache) {
" <script src=\"pages/hd-wallet/hd-wallet.js\"></script>\n" +
" <script src=\"pages/bitcoin-block/bitcoin-block.js\"></script>\n" +
" <script src=\"pages/shamir-secret-sharing/shamir-secret-sharing.js\"></script>\n" +
" <script src=\"pages/encoding-decoding/encoding-decoding.js\"></script>\n" +
" <script src=\"pages/mu-sig/mu-sig.js\"></script>\n" +
" <script src=\"pages/schnorr/schnorr.js\"></script>\n" +
" <script src=\"pages/transaction-creator/transaction-creator.js\"></script>\n" +
Expand Down Expand Up @@ -2549,6 +2553,128 @@ angular.module('app').run(['$templateCache', function($templateCache) {
);


$templateCache.put('pages/encoding-decoding/encoding-decoding.html',
"<h1>Encoding/Decoding</h1>\n" +
"\n" +
"<h3>Hex</h3>\n" +
"<div class=\"well\">\n" +
" <form class=\"form-horizontal\">\n" +
"\n" +
" <div class=\"form-group\">\n" +
" <label class=\"col-sm-2 control-label\" for=\"hex\">Hex encoded string:</label>\n" +
" <div class=\"col-sm-10 input-group\">\n" +
" <textarea id=\"hex\"\n" +
" rows=\"10\"\n" +
" ng-model=\"vm.hexString\"\n" +
" ng-change=\"vm.parseHexString()\"\n" +
" class=\"form-control\"\n" +
" ng-class=\"{'well-error': vm.error}\">\n" +
" </textarea>\n" +
" </div>\n" +
" <div class=\"input-group\" ng-if=\"vm.error\">\n" +
" <div class=\"input-group-addon well-error\">{{vm.error}}</div>\n" +
" </div>\n" +
" </div>\n" +
"\n" +
" <div class=\"form-group\">\n" +
" <label class=\"col-sm-2 control-label\" for=\"hexDecoded\">Plain UTF-8 string:</label>\n" +
" <div class=\"col-sm-10 input-group\">\n" +
" <textarea id=\"hexDecoded\"\n" +
" rows=\"10\"\n" +
" ng-model=\"vm.hexDecodedString\"\n" +
" ng-change=\"vm.encodeHexString()\"\n" +
" class=\"form-control\"\n" +
" ng-class=\"{'well-error': vm.error2}\">\n" +
" </textarea>\n" +
" </div>\n" +
" <div class=\"input-group\" ng-if=\"vm.error2\">\n" +
" <div class=\"input-group-addon well-error\">{{vm.error2}}</div>\n" +
" </div>\n" +
" </div>\n" +
" </form>\n" +
"</div>\n" +
"\n" +
"<h3>Base64</h3>\n" +
"<div class=\"well\">\n" +
" <form class=\"form-horizontal\">\n" +
"\n" +
" <div class=\"form-group\">\n" +
" <label class=\"col-sm-2 control-label\" for=\"base64\">Base64 encoded string:</label>\n" +
" <div class=\"col-sm-10 input-group\">\n" +
" <textarea id=\"base64\"\n" +
" rows=\"10\"\n" +
" ng-model=\"vm.base64String\"\n" +
" ng-change=\"vm.parseBase64String()\"\n" +
" class=\"form-control\"\n" +
" ng-class=\"{'well-error': vm.error3}\">\n" +
" </textarea>\n" +
" </div>\n" +
" <div class=\"input-group\" ng-if=\"vm.error3\">\n" +
" <div class=\"input-group-addon well-error\">{{vm.error3}}</div>\n" +
" </div>\n" +
" </div>\n" +
"\n" +
" <div class=\"form-group\">\n" +
" <label class=\"col-sm-2 control-label\" for=\"base64Decoded\">Plain UTF-8 string:</label>\n" +
" <div class=\"col-sm-10 input-group\">\n" +
" <textarea id=\"base64Decoded\"\n" +
" rows=\"10\"\n" +
" ng-model=\"vm.base64DecodedString\"\n" +
" ng-change=\"vm.encodeBase64String()\"\n" +
" class=\"form-control\"\n" +
" ng-class=\"{'well-error': vm.error4}\">\n" +
" </textarea>\n" +
" </div>\n" +
" <div class=\"input-group\" ng-if=\"vm.error4\">\n" +
" <div class=\"input-group-addon well-error\">{{vm.error4}}</div>\n" +
" </div>\n" +
" </div>\n" +
" </form>\n" +
"</div>\n" +
"\n" +
"<h3>Bitcoin Outpoint</h3>\n" +
"<div class=\"well\">\n" +
" <form class=\"form-horizontal\">\n" +
"\n" +
" <div class=\"form-group\">\n" +
" <label class=\"col-sm-2 control-label\" for=\"outpoint\">\n" +
" Outpoint string <code>&lt;txid&gt;:&lt;vout&gt;</code>:</label>\n" +
" <div class=\"col-sm-10 input-group\">\n" +
" <textarea id=\"outpoint\"\n" +
" rows=\"10\"\n" +
" ng-model=\"vm.outpointString\"\n" +
" ng-change=\"vm.parseOutpointString()\"\n" +
" class=\"form-control\"\n" +
" ng-class=\"{'well-error': vm.error5}\">\n" +
" </textarea>\n" +
" </div>\n" +
" <div class=\"input-group\" ng-if=\"vm.error5\">\n" +
" <div class=\"input-group-addon well-error\">{{vm.error5}}</div>\n" +
" </div>\n" +
" </div>\n" +
"\n" +
" <div class=\"form-group\">\n" +
" <label class=\"col-sm-2 control-label\" for=\"outpointEncoded\">\n" +
" Serialized Outpoint as hex:\n" +
" </label>\n" +
" <div class=\"col-sm-10 input-group\">\n" +
" <textarea id=\"outpointEncoded\"\n" +
" rows=\"10\"\n" +
" ng-model=\"vm.outpointEncodedString\"\n" +
" ng-change=\"vm.decodeEncodedOutpoint()\"\n" +
" class=\"form-control\"\n" +
" ng-class=\"{'well-error': vm.error6}\">\n" +
" </textarea>\n" +
" </div>\n" +
" <div class=\"input-group\" ng-if=\"vm.error6\">\n" +
" <div class=\"input-group-addon well-error\">{{vm.error6}}</div>\n" +
" </div>\n" +
" </div>\n" +
" </form>\n" +
"</div>\n"
);


$templateCache.put('pages/hd-wallet/hd-wallet.html',
"<h1>Hierarchical Deterministic Wallet (BIP32/38/39/44/49/84)</h1>\n" +
"\n" +
Expand Down
118 changes: 118 additions & 0 deletions pages/encoding-decoding/encoding-decoding.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
<h1>Encoding/Decoding</h1>

<h3>Hex</h3>
<div class="well">
<form class="form-horizontal">

<div class="form-group">
<label class="col-sm-2 control-label" for="hex">Hex encoded string:</label>
<div class="col-sm-10 input-group">
<textarea id="hex"
rows="10"
ng-model="vm.hexString"
ng-change="vm.parseHexString()"
class="form-control"
ng-class="{'well-error': vm.error}">
</textarea>
</div>
<div class="input-group" ng-if="vm.error">
<div class="input-group-addon well-error">{{vm.error}}</div>
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label" for="hexDecoded">Plain UTF-8 string:</label>
<div class="col-sm-10 input-group">
<textarea id="hexDecoded"
rows="10"
ng-model="vm.hexDecodedString"
ng-change="vm.encodeHexString()"
class="form-control"
ng-class="{'well-error': vm.error2}">
</textarea>
</div>
<div class="input-group" ng-if="vm.error2">
<div class="input-group-addon well-error">{{vm.error2}}</div>
</div>
</div>
</form>
</div>

<h3>Base64</h3>
<div class="well">
<form class="form-horizontal">

<div class="form-group">
<label class="col-sm-2 control-label" for="base64">Base64 encoded string:</label>
<div class="col-sm-10 input-group">
<textarea id="base64"
rows="10"
ng-model="vm.base64String"
ng-change="vm.parseBase64String()"
class="form-control"
ng-class="{'well-error': vm.error3}">
</textarea>
</div>
<div class="input-group" ng-if="vm.error3">
<div class="input-group-addon well-error">{{vm.error3}}</div>
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label" for="base64Decoded">Plain UTF-8 string:</label>
<div class="col-sm-10 input-group">
<textarea id="base64Decoded"
rows="10"
ng-model="vm.base64DecodedString"
ng-change="vm.encodeBase64String()"
class="form-control"
ng-class="{'well-error': vm.error4}">
</textarea>
</div>
<div class="input-group" ng-if="vm.error4">
<div class="input-group-addon well-error">{{vm.error4}}</div>
</div>
</div>
</form>
</div>

<h3>Bitcoin Outpoint</h3>
<div class="well">
<form class="form-horizontal">

<div class="form-group">
<label class="col-sm-2 control-label" for="outpoint">
Outpoint string <code>&lt;txid&gt;:&lt;vout&gt;</code>:</label>
<div class="col-sm-10 input-group">
<textarea id="outpoint"
rows="10"
ng-model="vm.outpointString"
ng-change="vm.parseOutpointString()"
class="form-control"
ng-class="{'well-error': vm.error5}">
</textarea>
</div>
<div class="input-group" ng-if="vm.error5">
<div class="input-group-addon well-error">{{vm.error5}}</div>
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label" for="outpointEncoded">
Serialized Outpoint as hex:
</label>
<div class="col-sm-10 input-group">
<textarea id="outpointEncoded"
rows="10"
ng-model="vm.outpointEncodedString"
ng-change="vm.decodeEncodedOutpoint()"
class="form-control"
ng-class="{'well-error': vm.error6}">
</textarea>
</div>
<div class="input-group" ng-if="vm.error6">
<div class="input-group-addon well-error">{{vm.error6}}</div>
</div>
</div>
</form>
</div>
Loading

0 comments on commit e3f71a3

Please sign in to comment.