Skip to content

Commit

Permalink
Add did url utils
Browse files Browse the repository at this point in the history
  • Loading branch information
Toktar committed Jun 27, 2022
1 parent 9bb5beb commit 6d9bb4b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions utils/did_url.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package utils

import (
"regexp"
)

var ResourcePath, _ = regexp.Compile(`resource\\\[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}`)

func GetResourceId(didUrlPath string) (id string) {
if !ResourcePath.Match([]byte(didUrlPath)) {
return ""
}

match := ResourcePath.FindStringSubmatch(didUrlPath)
return match[1]
}

0 comments on commit 6d9bb4b

Please sign in to comment.