ucan.storage icon indicating copy to clipboard operation
ucan.storage copied to clipboard

Examples are wrong

Open soccerarenadev opened this issue 3 years ago • 0 comments

Examples in this section: https://nftstorage.github.io/ucan.storage/#saving-and-loading-keypairs

Have some errors.

This line: await fs.promises.writeFile(kp.export()) is missing an argument (outputFilename).

The function loadKeyPairFromFile gets this error:

/nft-storage-quickstart/node_modules/ucan-storage/src/encoding.js:38
      throw new SyntaxError(`Non-${name} character`)
            ^

SyntaxError: Non-base64pad character
    at decode (/nft-storage-quickstart/node_modules/ucan-storage/src/encoding.js:38:13)
    at Object.decode (/nft-storage-quickstart/node_modules/ucan-storage/src/encoding.js:123:14)
    at Function.fromExportedKey (nft-storage-quickstart/node_modules/ucan-storage/src/keypair.js:42:34)
    at loadKeyPairFromFile (/nft-storage-quickstart/test.mjs:22:20)
    at async /nft-storage-quickstart/test.mjs:64:10

soccerarenadev avatar Jul 07 '22 07:07 soccerarenadev