forked from Kieran/snort
Bug fix #22
This commit is contained in:
parent
77ad8a3052
commit
ccbf041b2a
@ -58,6 +58,10 @@ export function eventLink(hex) {
|
|||||||
* @param {string} hex
|
* @param {string} hex
|
||||||
*/
|
*/
|
||||||
export function hexToBech32(hrp, hex) {
|
export function hexToBech32(hrp, hex) {
|
||||||
|
if (typeof hex !== "string" || hex.length === 0 || hex.length % 2 != 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
let buf = secp.utils.hexToBytes(hex);
|
let buf = secp.utils.hexToBytes(hex);
|
||||||
return bech32.encode(hrp, bech32.toWords(buf));
|
return bech32.encode(hrp, bech32.toWords(buf));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user