UNPKG

did-jwt

Version:

Library for Signing and Verifying JWTs that use DIDs as issuers and JWEs that use DIDs as recipients

10 lines • 426 B
import { bech32 } from '@scure/base'; import { ripemd160, sha256 } from '../Digest.js'; import { hexToBytes } from '../util.js'; export function publicKeyToAddress(publicKey, prefix) { const publicKeyBuffer = hexToBytes(publicKey); const hash = ripemd160(sha256(publicKeyBuffer)); const words = bech32.toWords(hash); return bech32.encode(prefix, words).replace(prefix, ''); } //# sourceMappingURL=cosmos.js.map