Skip to content

Commit

Permalink
feat(utils/did): use Chain from ew-did-reg/did
Browse files Browse the repository at this point in the history
Better to use enum to ensure consistent use of strings
  • Loading branch information
jrhender committed Dec 6, 2021
1 parent 5b853ac commit 03b7624
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/utils/did.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Methods, isValidErc1056EWC, isValidErc1056VOLTA } from "@ew-did-registry/did";
import { Methods, Chain, isValidErc1056EWC, isValidErc1056VOLTA } from "@ew-did-registry/did";

const validators = new Map<string, (did: string) => boolean>();

Expand All @@ -10,9 +10,9 @@ export function isValidDID(did: string): boolean {
return Array.from(validators.values()).some((v) => v(did));
}

export function addSupportedDID(method: string, validator: (did: string) => boolean) {
validators.set(method, validator);
export function addSupportedDID(methodWithChain: string, validator: (did: string) => boolean) {
validators.set(methodWithChain, validator);
}

addSupportedDID(`${Methods.Erc1056}:ewc`, isValidErc1056EWC);
addSupportedDID(`${Methods.Erc1056}:volta`, isValidErc1056VOLTA);
addSupportedDID(`${Methods.Erc1056}:${Chain.EWC}`, isValidErc1056EWC);
addSupportedDID(`${Methods.Erc1056}:${Chain.VOLTA}`, isValidErc1056VOLTA);

0 comments on commit 03b7624

Please sign in to comment.