@@ -20,7 +20,7 @@ func documentIdentifier(docType string) string {
2020}
2121
2222func returnVersionNumIdx (namespace string ) int {
23- if namespace == "mainnet " {
23+ if namespace == "" {
2424 return 3
2525 } else {
2626 return 4
@@ -71,18 +71,32 @@ func IsValidID(Id string, namespace string, docType string) error {
7171
7272 // Mainnet Chain namespace check. If the document is registered on the mainnet chain,
7373 // the namespace should be empty
74+ var expectedLength int
7475 if namespace == "" {
75- if len (docElements ) != 3 {
76- return fmt .Errorf ("expected number of did id elements for mainnet to be 3, got %s" , fmt .Sprint (len (docElements )))
76+ if docIdentifier == "sch" {
77+ expectedLength = 4
78+ } else {
79+ expectedLength = 3
7780 }
7881 docMethodSpecificId = 2
7982 } else {
83+ if docIdentifier == "sch" {
84+ expectedLength = 5
85+ } else {
86+ expectedLength = 4
87+ }
88+ docMethodSpecificId = 3
89+
8090 docNamespace := docElements [docNamespaceIndex ]
8191 if namespace != docNamespace {
8292 return fmt .Errorf ("expected did namespace %s, got %s" , namespace , docNamespace )
8393 }
8494 }
8595
96+ if len (docElements ) != expectedLength {
97+ return fmt .Errorf ("expected %s id elements, got %s" , fmt .Sprintf ("%d" , expectedLength ), fmt .Sprintf ("%d" , len (docElements )))
98+ }
99+
86100 // Check if method-specific-id string is alphanumeric and
87101 // has the minimum required character length of 32
88102 isProperMethodSpecificId , err := regexp .MatchString (
0 commit comments