Pubkey
is base58
so this (dirty) vanilla (or any base58
lib) should work.
// ref: https://gist.github.com/diafygi/90a3e80ca1c2793220e5/
const MAP = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
const encode = function (B) { const A = MAP; var d = [], s = "", i, j, c, n; for (i in B) { j = 0, c = B[i]; s += c || s.length ^ i ? "" : 1; while (j in d || c) { n = d[j]; n = n ? n * 256 + c : c; c = n / 58 | 0; d[j] = n % 58; j++ } } while (j--) s += A[d[j]]; return s };
const decode = function (S) { const A = MAP; var d = [], b = [], i, j, c, n; for (i in S) { j = 0, c = A.indexOf(S[i]); if (c < 0) return undefined; c || b.length ^ i ? i : b.push(0); while (j in d || c) { n = d[j]; n = n ? n * 58 + c : c; c = n >> 8; d[j] = n % 256; j++ } } while (j--) b.push(d[j]); return new Uint8Array(b) };
encode(new Uint8Array([
102, 255, 46, 44, 90, 176, 207, 98,
251, 66, 136, 190, 240, 59, 198, 177,
169, 35, 153, 3, 163, 68, 188, 214,
225, 46, 55, 111, 159, 157, 182, 111
]))
Output
7w4GYV1BxE9Vvn93BG3NZzZQAYoiTXWnNX8rdXBgQ5Tt