Skip to content

Commit

Permalink
Fix qualifier
Browse files Browse the repository at this point in the history
Signed-off-by: lovesh <[email protected]>
  • Loading branch information
lovesh committed Oct 10, 2022
1 parent 104ba60 commit 6cb77a8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions src/modules/did/did.js
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ class DIDModule {
/**
* Gets a DID from the Dock chain and create a DID document according to W3C spec.
* Throws NoDID if the DID does not exist on chain.
* @param {string} did - The DID can be passed as fully qualified DID like `dock:did:<SS58 string>` or
* @param {string} did - The DID can be passed as fully qualified DID like `did:dock:<SS58 string>` or
* a 32 byte hex string
* @return {Promise<object>} The DID document.
*/
Expand All @@ -737,7 +737,7 @@ class DIDModule {

let didDetails = await this.api.rpc.core_mods.didDetails(hexId, 15);
if (didDetails.isNone) {
throw new NoDIDError(`dock:did:${hexDIDToQualified(hexId)}`);
throw new NoDIDError(`did:dock:${hexDIDToQualified(hexId)}`);
}
didDetails = didDetails.unwrap();

Expand Down Expand Up @@ -912,12 +912,12 @@ class DIDModule {
validateDockDIDHexIdentifier(didIdentifier);
let resp = await this.api.query.didModule.dids(didIdentifier);
if (resp.isNone) {
throw new NoDIDError(`dock:did:${didIdentifier}`);
throw new NoDIDError(`did:dock:${didIdentifier}`);
}

resp = resp.unwrap();
if (resp.isOffChain) {
throw new NoOnchainDIDError(`dock:did:${didIdentifier}`);
throw new NoOnchainDIDError(`did:dock:${didIdentifier}`);
}
const didDetail = resp.asOnChain;
const data = didDetail.data || didDetail;
Expand All @@ -938,11 +938,11 @@ class DIDModule {
validateDockDIDHexIdentifier(didIdentifier);
let resp = await this.api.query.didModule.dids(didIdentifier);
if (resp.isNone) {
throw new NoDIDError(`dock:did:${didIdentifier}`);
throw new NoDIDError(`did:dock:${didIdentifier}`);
}
resp = resp.unwrap();
if (resp.isOnChain) {
throw new NoOffchainDIDError(`dock:did:${didIdentifier}`);
throw new NoOffchainDIDError(`did:dock:${didIdentifier}`);
}
resp = resp.asOffChain;
const detail = { accountId: u8aToHex(resp.accountId) };
Expand Down
2 changes: 1 addition & 1 deletion src/utils/did.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export function validateDockDIDSS58Identifier(identifier) {

/**
* Gets the hexadecimal value of the given DID.
* @param {string} did - The DID can be passed as fully qualified DID like `dock:did:<SS58 string>` or
* @param {string} did - The DID can be passed as fully qualified DID like `did:dock:<SS58 string>` or
* a 32 byte hex string
* @return {string} Returns the hexadecimal representation of the DID.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/utils/vc/credentials.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function getId(obj) {
if (typeof obj === 'string') {
return obj;
}
return obj.id;// || 'dock:did:' + String(obj);
return obj.id;// || 'did:dock:' + String(obj);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tutorials/src/tutorial_resolver.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import { DockResolver } from '@docknetwork/sdk/resolver';

// Assuming the presence of Dock API object `dock`
const dockResolver = new DockResolver(dock);
// Say you had a DID `dock:did:5D.....`
const didDocument = dockResolver.resolve('dock:did:5D.....');
// Say you had a DID `did:dock:5D.....`
const didDocument = dockResolver.resolve('did:dock:5D.....');
```

## Creating a resolver class for a different method
Expand Down

0 comments on commit 6cb77a8

Please sign in to comment.