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:
1. Setup a [deterministic address](usage/deterministic.md) (optional)
2. Add friends' ids
3. Publish your id
2. Start your node `/path/to/onionr.sh start`
3. Copy your ID and share it with friends

View File

@ -89,7 +89,7 @@ def show_details():
details = {
'Node Address' : gethostname.get_hostname(),
'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()
}

View File

@ -39,4 +39,5 @@ def set_data(data)->str:
else:
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
result = result.lower()
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)
setHumanReadableIDOnPost(div[3], 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{
identicon[0].remove()

View File

@ -7,8 +7,13 @@ function toHexString(byteArray) {
return s;
}
function userIcon(pubkey, imgSize=64){
pubkey = toHexString(base32.decode.asBytes(pubkey))
async function sha256(str) {
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 = {
//foreground: [0,0,0,1], // rgba black
background: [255, 255, 255, 255], // rgba white