board now uses sha256

This commit is contained in:
Kevin Froman 2019-09-27 18:04:49 -05:00
parent 24d682860f
commit 71c9337ab7
6 changed files with 16 additions and 8 deletions

View File

@ -3,5 +3,5 @@
After installing Onionr, there are several things to do: After installing Onionr, there are several things to do:
1. Setup a [deterministic address](usage/deterministic.md) (optional) 1. Setup a [deterministic address](usage/deterministic.md) (optional)
2. Add friends' ids 2. Start your node `/path/to/onionr.sh start`
3. Publish your id 3. Copy your ID and share it with friends

View File

@ -89,7 +89,7 @@ def show_details():
details = { details = {
'Node Address' : gethostname.get_hostname(), 'Node Address' : gethostname.get_hostname(),
'Web Password' : config.get('client.webpassword'), 'Web Password' : config.get('client.webpassword'),
'Public Key' : onionrcrypto.pub_key, 'Public Key' : onionrcrypto.pub_key.replace('=', ''),
'Human-readable Public Key' : mnemonickeys.get_human_readable_ID() 'Human-readable Public Key' : mnemonickeys.get_human_readable_ID()
} }

View File

@ -39,4 +39,5 @@ def set_data(data)->str:
else: else:
raise onionrexceptions.DataExists("Data is already set for " + dataHash) raise onionrexceptions.DataExists("Data is already set for " + dataHash)
return dataHash print(dataHash, nonce_hash)
return dataHash

View File

@ -6,4 +6,4 @@ def check_ui(test_manager):
if not result: raise ValueError if not result: raise ValueError
result = result.lower() result = result.lower()
if not 'onionr' in result and not 'Onionr' in result: if not 'onionr' in result and not 'Onionr' in result:
raise ValueError raise ValueError

View File

@ -97,7 +97,9 @@ function appendMessages(msg, blockHash, beforeHash){
div[3].textContent = msg['meta']['signer'].substr(0, 5) div[3].textContent = msg['meta']['signer'].substr(0, 5)
setHumanReadableIDOnPost(div[3], msg['meta']['signer']) setHumanReadableIDOnPost(div[3], msg['meta']['signer'])
div[3].title = msg['meta']['signer'] div[3].title = msg['meta']['signer']
identicon[0].src = "data:image/svg+xml;base64," + userIcon(msg['meta']['signer']) userIcon(msg['meta']['signer']).then(function(data){
identicon[0].src = "data:image/svg+xml;base64," + data
})
} }
else{ else{
identicon[0].remove() identicon[0].remove()

View File

@ -7,8 +7,13 @@ function toHexString(byteArray) {
return s; return s;
} }
function userIcon(pubkey, imgSize=64){ async function sha256(str) {
pubkey = toHexString(base32.decode.asBytes(pubkey)) const buf = await crypto.subtle.digest("SHA-256", new TextEncoder("utf-8").encode(str));
return Array.prototype.map.call(new Uint8Array(buf), x=>(('00'+x.toString(16)).slice(-2))).join('');
}
async function userIcon(pubkey, imgSize=64){
pubkey = await sha256(base32.decode.asBytes(pubkey))
let options = { let options = {
//foreground: [0,0,0,1], // rgba black //foreground: [0,0,0,1], // rgba black
background: [255, 255, 255, 255], // rgba white background: [255, 255, 255, 255], // rgba white