INNER CODE UNIT · JavaScript

hexDecode

dfinity/examples · motoko/vetkeys/basic_vetkd/frontend/src/main.js:51

function hexDecode(str) {
  const matches = str.match(/.{1,2}/g);
  if (!matches) throw new Error("Invalid hex string");
  return new Uint8Array(matches.map((b) => parseInt(b, 16)));
}

async function handleFetchVetKey() {
  if (!myPrincipal) {
    setStatus("sym-status", "Please log in first.");
    return;
  }
  setStatus("sym-status", "Fetching VetKey…");
  try {
    const actor = await getActor();

    const pkBytes = Uint8Array.from(await actor.symmetric_key_verification_key());
    const dpk = DerivedPublicKey.deserialize(pkBytes);

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…