board now uses sha256
This commit is contained in:
parent
24d682860f
commit
71c9337ab7
6 changed files with 16 additions and 8 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue