storacha / ucanto

🐧 UCAN RPC
Other
50 stars 6 forks source link

serialised private keys with forward slash fails parsing #85

Closed hugomrdias closed 2 years ago

hugomrdias commented 2 years ago

SigningAuthority.parse fails with private keys with forward slash in ipld/car with unexpected end of data

// ../../node_modules/.pnpm/@ipld+car@4.1.4/node_modules/@ipld/car/esm/lib/decoder.js
  var CIDV0_BYTES = {
    SHA2_256: 18,
    LENGTH: 32,
    DAG_PB: 112
  };
  var V2_HEADER_LENGTH = 16 + 8 + 8 + 8;
  async function readVarint(reader) {
    const bytes = await reader.upTo(8);
    if (!bytes.length) {
      throw new Error("Unexpected end of data");
    }
    const i = import_varint3.default.decode(bytes);
    reader.seek(import_varint3.default.decode.bytes);
    return i;
  }
Gozala commented 2 years ago

Do you have an example or something, I'm not sure I fully understand what the problem is

hugomrdias commented 2 years ago

MgCYY9lYduqC9rrtD1YvZzcEfPCFBaYsTe0T+8RLLBawPWu0BAaNqeI86jQPsOeSaZ7p+ZPWGFqggfvSMFw+AJ7BH8/U= this private key string would fail