Skip to content
This repository was archived by the owner on Mar 27, 2024. It is now read-only.

Commit aa6e2ff

Browse files
committed
perf: reuse same parser
Signed-off-by: Stas D <stanislav.dmytryshyn@securekey.com>
1 parent 0284074 commit aa6e2ff

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/doc/presexch/definition.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1005,6 +1005,8 @@ func getLimitedDisclosures(constraints *Constraints, displaySrc []byte, credenti
10051005

10061006
var limitedDisclosures []*common.DisclosureClaim
10071007

1008+
parsedGJSON := gjson.ParseBytes(credentialSrc)
1009+
10081010
for _, f := range constraints.Fields {
10091011
jPaths, err := getJSONPaths(f.Path, displaySrc)
10101012
if err != nil {
@@ -1026,7 +1028,7 @@ func getLimitedDisclosures(constraints *Constraints, displaySrc []byte, credenti
10261028
key = pathParts[len(pathParts)-1]
10271029
}
10281030

1029-
parentObj, ok := gjson.GetBytes(credentialSrc, parentPath).Value().(map[string]interface{})
1031+
parentObj, ok := parsedGJSON.Get(parentPath).Value().(map[string]interface{})
10301032
if !ok {
10311033
// no selective disclosures at this level, so nothing to add to limited disclosures
10321034
continue

0 commit comments

Comments
 (0)