See Java API for more on key addresses.
Usually, you get it from
or corresponding properties of the provate key, which just get the public key
from packed binary
let keyAddress = new KeyAddress(packed);
packedshould be a
Uint8Arrayinstance with binary packed data.
String representation uses a special encoding, safe58 to get non ambigous
representation of the binary packed form. The
packed property of the
returns a binary backed address.
let keyAddress = new KeyAddress(string);
packedshould be a valid string representation. Use
toString()to get it.
let addressString = keyAddress.toString();
returns just as expected, Universa safe58 represetnation of the
Binary packed representation
let addressString = keyAddress.packed;
returns Universa binary represntation of the KeyAddress in the
Check the key is matching
let ska = publicKey.shortAddress; let lka = publicKey.shortAddress; assert(ska.match(publicKey)); assert(lka.match(publicKey));