Skip to content

Commit

Permalink
cheqd suppots dock: idents
Browse files Browse the repository at this point in the history
  • Loading branch information
olegnn committed Jan 17, 2025
1 parent d73d56c commit 6aa0590
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/cheqd-blockchain-api/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import {
CheqdMainnetOffchainSignatureKeyRef,
CheqdTestnetAccumulator,
CheqdMainnetAccumulator,
DockDidOrDidMethodKey,
} from '@docknetwork/credential-sdk/types';
import { TypedEnum } from '@docknetwork/credential-sdk/types/generic';

Expand Down Expand Up @@ -263,6 +264,7 @@ export class CheqdAPI extends AbstractApiProvider {
return ['cheqd'];
}

// eslint-disable-next-line
supportsIdentifier(id) {
this.ensureInitialized();
const { network } = this.sdk.options;
Expand All @@ -283,6 +285,19 @@ export class CheqdAPI extends AbstractApiProvider {
return true;
}

// Dock identifiers
if (id instanceof NamespaceDid) {
return id.isDock || id.isDidMethodKey;
} else if (id instanceof DockDidOrDidMethodKey) {
return true;
} else if (id instanceof DidRef) {
return this.supportsIdentifier(id[0]);
} else if (id instanceof TypedEnum) {
return this.supportsIdentifier(id.value);
} else if (String(id).includes(':dock:')) {
return true;
}

return false;
}
}
Expand Down

0 comments on commit 6aa0590

Please sign in to comment.