Adding bsides slides

This commit is contained in:
Kgothatso 2019-12-07 21:22:38 +02:00
parent e07ab9cee0
commit ebb36c954e
9 changed files with 444 additions and 7 deletions

View File

@ -19,6 +19,14 @@ module.exports = function (options) {
})
});
router.route('/bsides')
.get(function(request, response, next) {
response.render("bsides", {
user: request.user,
pageTitle: "HDAuth - Bsides 2019"
})
});
// TODO: load child routers automatically
var accountRouter = require('./account/index.js')(options);
var xpubAuth = require('./xpub-auth/index.js')(options);

View File

@ -0,0 +1,57 @@
/* Root element */
.json-document {
padding: 1em 2em;
}
/* Syntax highlighting for JSON objects */
ul.json-dict, ol.json-array {
list-style-type: none;
margin: 0 0 0 1px;
border-left: 1px dotted #ccc;
padding-left: 2em;
}
.json-string {
color: #0B7500;
}
.json-literal {
color: #1A01CC;
font-weight: bold;
}
/* Toggle button */
a.json-toggle {
position: relative;
color: inherit;
text-decoration: none;
}
a.json-toggle:focus {
outline: none;
}
a.json-toggle:before {
font-size: 1.1em;
color: #c0c0c0;
content: "\25BC"; /* down arrow */
position: absolute;
display: inline-block;
width: 1em;
text-align: center;
line-height: 1em;
left: -1.2em;
}
a.json-toggle:hover:before {
color: #aaa;
}
a.json-toggle.collapsed:before {
/* Use rotated down arrow, prevents right arrow appearing smaller than down arrow in some browsers */
transform: rotate(-90deg);
}
/* Collapsable placeholder links */
a.json-placeholder {
color: #aaa;
padding: 0 1em;
text-decoration: none;
}
a.json-placeholder:hover {
text-decoration: underline;
}

View File

@ -0,0 +1,90 @@
{
"who?": {
"name": "Kgothatso",
"surname": "Ngako",
"twitter": "@440UrPp"
},
"what?": {
"title": "Hierarchically Deterministic Authentication",
"background": [
{
"cryptography": [
"https://people.xiph.org/~greg/gmaxwell_sfbitcoin_2015_04_20.pdf#page=28"
],
"defintion": [
"Cryptography is information bending."
]
},
"Symmetric Cryptography",
"Asymmetric Cryptography",
"Bitcoin",
"Bitcoin Improvement Proposals",
"BIP 39",
"BIP 32",
"https://github.com/bitcoinbook/bitcoinbook/blob/develop/ch05.asciidoc",
"Signatures"
]
},
"how?": {
"service": {
"setup": [
"create a wallet using a random mnemonic seed",
"generate a hardened xpub to use as service 'identity'.",
"generate server xpubs derived from service xpub derivation path",
"keep mnemonic seed secure"
],
"server": [
"gets a hardened xpriv from the service.",
"signs all messages it produces on behalf of the service using it's assigned xpriv",
"verifies that all signed client requests were signed with the clients xpub",
"keep xpriv secure"
]
},
"user": [
"creates a wallet using mnemonic seed",
"generates an xpub using a random derivation path on the master key from seed",
"registers with a service using the xpub as their ID",
"keep wallet secure"
]
},
"where?": [
"hd-auth-wallet",
"auth.sigidli.com"
],
"why?": {
"1": [
"Service Access Keys but decentralized."
],
"2": {
"Crypto stands for cryptography": [
"because cryptocurrencies are in your face"
]
},
"3": [
"Mutual Authentication"
],
"4": [
"Phone + Wallet + Keys"
],
"5": [
"Have you been pawned?"
],
"6": [
"explorerzydxu5ecjrkwceayqybizmpjjznk5izmitf2modhcusuqlid.onion"
],
"7": [
"Oauth? Federation?"
],
"8": [
"Deep fakes",
"photoshop social media posts"
]
},
"when?": [
"When do you find out that a site has been storing passwords insecurely",
"When will you know when a cryptographic operation becomes insecure?"
],
"but_really_how?": [
"https://code.sigidli.com/hd-auth"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

View File

@ -0,0 +1,158 @@
/**
* jQuery json-viewer
* @author: Alexandre Bodelot <alexandre.bodelot@gmail.com>
* @link: https://github.com/abodelot/jquery.json-viewer
*/
(function($) {
/**
* Check if arg is either an array with at least 1 element, or a dict with at least 1 key
* @return boolean
*/
function isCollapsable(arg) {
return arg instanceof Object && Object.keys(arg).length > 0;
}
/**
* Check if a string represents a valid url
* @return boolean
*/
function isUrl(string) {
var urlRegexp = /^(https?:\/\/|ftps?:\/\/)?([a-z0-9%-]+\.){1,}([a-z0-9-]+)?(:(\d{1,5}))?(\/([a-z0-9\-._~:/?#[\]@!$&'()*+,;=%]+)?)?$/i;
return urlRegexp.test(string);
}
/**
* Transform a json object into html representation
* @return string
*/
function json2html(json, options) {
var html = '';
if (typeof json === 'string') {
// Escape tags and quotes
json = json
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/'/g, '&apos;')
.replace(/"/g, '&quot;');
if (options.withLinks && isUrl(json)) {
html += '<a href="' + json + '" class="json-string" target="_blank">' + json + '</a>';
} else {
// Escape double quotes in the rendered non-URL string.
json = json.replace(/&quot;/g, '\\&quot;');
html += '<span class="json-string">"' + json + '"</span>';
}
} else if (typeof json === 'number') {
html += '<span class="json-literal">' + json + '</span>';
} else if (typeof json === 'boolean') {
html += '<span class="json-literal">' + json + '</span>';
} else if (json === null) {
html += '<span class="json-literal">null</span>';
} else if (json instanceof Array) {
if (json.length > 0) {
html += '[<ol class="json-array">';
for (var i = 0; i < json.length; ++i) {
html += '<li>';
// Add toggle button if item is collapsable
if (isCollapsable(json[i])) {
html += '<a href class="json-toggle"></a>';
}
html += json2html(json[i], options);
// Add comma if item is not last
if (i < json.length - 1) {
html += ',';
}
html += '</li>';
}
html += '</ol>]';
} else {
html += '[]';
}
} else if (typeof json === 'object') {
var keyCount = Object.keys(json).length;
if (keyCount > 0) {
html += '{<ul class="json-dict">';
for (var key in json) {
if (Object.prototype.hasOwnProperty.call(json, key)) {
html += '<li>';
var keyRepr = options.withQuotes ?
'<span class="json-string">"' + key + '"</span>' : key;
// Add toggle button if item is collapsable
if (isCollapsable(json[key])) {
html += '<a href class="json-toggle">' + keyRepr + '</a>';
} else {
html += keyRepr;
}
html += ': ' + json2html(json[key], options);
// Add comma if item is not last
if (--keyCount > 0) {
html += ',';
}
html += '</li>';
}
}
html += '</ul>}';
} else {
html += '{}';
}
}
return html;
}
/**
* jQuery plugin method
* @param json: a javascript object
* @param options: an optional options hash
*/
$.fn.jsonViewer = function(json, options) {
// Merge user options with default options
options = Object.assign({}, {
collapsed: false,
rootCollapsable: true,
withQuotes: false,
withLinks: true
}, options);
// jQuery chaining
return this.each(function() {
// Transform to HTML
var html = json2html(json, options);
if (options.rootCollapsable && isCollapsable(json)) {
html = '<a href class="json-toggle"></a>' + html;
}
// Insert HTML in target DOM element
$(this).html(html);
$(this).addClass('json-document');
// Bind click on toggle buttons
$(this).off('click');
$(this).on('click', 'a.json-toggle', function() {
var target = $(this).toggleClass('collapsed').siblings('ul.json-dict, ol.json-array');
target.toggle();
if (target.is(':visible')) {
target.siblings('.json-placeholder').remove();
} else {
var count = target.children('li').length;
var placeholder = count + (count > 1 ? ' items' : ' item');
target.after('<a href class="json-placeholder">' + placeholder + '</a>');
}
return false;
});
// Simulate click on toggle button when placeholder is clicked
$(this).on('click', 'a.json-placeholder', function() {
$(this).siblings('a.json-toggle').click();
return false;
});
if (options.collapsed == true) {
// Trigger click to collapse all nodes
$(this).find('a.json-toggle').click();
}
});
};
})(jQuery);

24
server/views/bsides.pug Normal file
View File

@ -0,0 +1,24 @@
extend templates/layout.pug
block content
.container
.center
figure
img.response-img(src="static/img/bsides.png", alt="bsides cpt 2019")
figcaption as seen at b-sides Cape Town 2019
.row
.col.s12
pre#json-renderer
.col.s12
.center
p.flow-text view annoted raw json
a(href="static/hd-auth.json") here
block additionalScripts
script(src="static/js/jquery.json-viewer.js")
script
include ./js/bsides.js
block additionalStyle
link(rel="stylesheet", href="static/css/jquery.json-viewer.css")

View File

@ -8,4 +8,8 @@ block content
p.flow-text Hello #{user.displayName}
h3 Hierarchically Deterministic Authentication
p.flow-text Using digital signatures for a challenge response authentication mechanism.
a.btn.blue(href="/bsides") Learn More
.row
.col.s12

94
server/views/js/bsides.js Normal file
View File

@ -0,0 +1,94 @@
$(document).ready(function (){
console.log("########");
$("#json-renderer").jsonViewer({
"who?": {
"name": "Kgothatso",
"surname": "Ngako",
"twitter": "@440UrPp"
},
"what?": {
"title": "Hierarchically Deterministic Authentication",
"background": [
{
"cryptography": [
"https://people.xiph.org/~greg/gmaxwell_sfbitcoin_2015_04_20.pdf#page=28"
],
"defintion": [
"Cryptography is information bending."
]
},
"Symmetric Cryptography",
"Asymmetric Cryptography",
"Bitcoin",
"Bitcoin Improvement Proposals",
"BIP 39",
"BIP 32",
"https://github.com/bitcoinbook/bitcoinbook/blob/develop/ch05.asciidoc",
"Signatures"
]
},
"where?": [
"https://auth.sigidli.com",
"https://code.sigidli.com/hd-auth/hd-auth-wallet"
],
"how?": {
"service": {
"setup": [
"create a wallet using a random mnemonic seed",
"generate a hardened xpub to use as service 'identity'.",
"generate server xpubs derived from service xpub derivation path",
"keep mnemonic seed secure"
],
"server": [
"gets a hardened xpriv from the service.",
"signs all messages it produces on behalf of the service using it's assigned xpriv",
"verifies that all signed client requests were signed with the clients xpub",
"keep xpriv secure"
]
},
"user": [
"creates a wallet using mnemonic seed",
"generates an xpub using a random derivation path on the master key from seed",
"registers with a service using the xpub as their ID",
"keep wallet secure"
]
},
"why?": {
"1": [
"Service Access Keys but decentralized."
],
"2": {
"Crypto stands for cryptography": [
"because cryptocurrencies are in your face"
]
},
"3": [
"Mutual Authentication"
],
"4": [
"Phone + Wallet + Keys"
],
"5": [
"Have you been pawned?"
],
"6": [
"explorerzydxu5ecjrkwceayqybizmpjjznk5izmitf2modhcusuqlid.onion"
],
"7": [
"Oauth? Federation?"
],
"8": [
"Deep fakes",
"photoshop social media posts"
]
},
"when?": [
"When do you find out that a site has been storing passwords insecurely",
"When will you know when a cryptographic operation becomes insecure?"
],
"but_really_how?": [
"https://code.sigidli.com/hd-auth"
]
}, {rootCollapsable: false, collapsed: true, withLinks: true})
})

View File

@ -44,7 +44,7 @@ html(lang="en" dir="ltr")
header(role="banner")
block navigation
nav
nav.blue.darken-4
.nav-wrapper
a.brand-logo.center HD-Auth
ul.left
@ -63,18 +63,20 @@ html(lang="en" dir="ltr")
block footer
footer.brand-colour.page-footer(role="footer")
footer.blue.darken-4.page-footer(role="footer")
.container
.row
.col.s12
p Links
p.flow-text Links
ul
li
a.grey-text.text-lighten-3(href="https://code.sigidli.com/hd-auth/") Code
a.white-text(href="bsides") b-sides Capetown 2019
li
a.grey-text.text-lighten-3(href="bitcoin:1GShZrpSK6LJZRDCSNcZhEiHcLV916afoX") Donate to 1GShZrpSK6LJZRDCSNcZhEiHcLV916afoX
a.white-text(href="https://code.sigidli.com/hd-auth/") Code
li
a.grey-text.text-lighten-3(href="http://xpub6CmUNwicBT2i7voSgpZJrJmr4nU77SsFd5UiKoMxiqpzWTtebwukbziMDsD3FNozPmS2Qb7sRSGzW2VgTkHYwnqAod16w81X44H145ovt5Y.onion") onion v4?
a.white-text(href="bitcoin:1GShZrpSK6LJZRDCSNcZhEiHcLV916afoX") Donate to 1GShZrpSK6LJZRDCSNcZhEiHcLV916afoX
li
a.white-text(href="http://xpub6CmUNwicBT2i7voSgpZJrJmr4nU77SsFd5UiKoMxiqpzWTtebwukbziMDsD3FNozPmS2Qb7sRSGzW2VgTkHYwnqAod16w81X44H145ovt5Y.onion") onion v4?
.footer-copyright
.container