ion-tools
ion-tools copied to clipboard
Unable to resolve short-form URL after publishing the document to ION
Using the following code and fill with some concrete detail information for DID:
import { anchor, DID, generateKeyPair } from '@decentralized-identity/ion-tools';
// Generate keys and ION DID
let authnKeys = await generateKeyPair();
let did = new DID(..);
// Generate and publish create request to an ION node
let createRequest = await did.generateRequest(0);
//anchor: post and publish DID document to https://beta.ion.msidentity.com/api/v1.0/proof-of-work-challenge
let anchorResponse = await anchor(createRequest);
console.log(anchorResponse)
let uri = await did.getURI();
let shortURI = await did.getURI('short');
console.log("Long URI "+ uri+ "\nShort URI: "+ shortURI);
const didDoc = await resolve(shortURI);
console.log(didDoc);
and the output is:
Short URI: did:ion:EiCLUBIxcHqc1CXNyru-hM5vQyo5yFT1GwLaWMG4ex2iPA
file:///work/did/did_demo/node_modules/@decentralized-identity/ion-tools/dist/esm/src/utils.js:175
throw new Error(response.statusText);
^
Error: Not Found
at resolve (file:///work/did/did_demo/node_modules/@decentralized-identity/ion-tools/dist/esm/src/utils.js:175:11)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async file:///work/did/did_demo/test.js:51:16
I also get the same 404 when using another two GUI resolvers: https://identity.foundation/ion/explorer
and https://dev.uniresolver.io/
(refer attached screenshot), while I could get the exact DID document using the resolver.
This error happens only since 28 June, and it still not work even today. According to the document, the short URI is also resolved when it is published to the ION network(i.e., completing anchoring).
Thanks
The output of script execution screenshot(The post request to https://beta.ion.msidentity.com/api/v1.0/proof-of-work-challenge succeeds, according to the ion-pow-sdk/src/index.js:IonProofOfWork::submitIonRequest )