Skip to content

Commit

Permalink
add support for new AASA schema.
Browse files Browse the repository at this point in the history
  • Loading branch information
chayev committed Feb 7, 2021
1 parent fd798a0 commit dc3928b
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions yurllib/aasa.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@ import (
"go.mozilla.org/pkcs7"
)

type component map[string]interface{}

type detail struct {
AppID string `json:"appID"`
Paths []string `json:"paths"`
AppID string `json:"appID,omitempty"`
Paths []string `json:"paths,omitempty"`
AppIDs []string `json:"appIDs,omitempty"`
Components []component `json:"components,omitempty"`
}
type appLinks struct {
Apps []string `json:"apps"`
Apps []string `json:"apps,omitempty"`
Details []detail `json:"details"`
}

Expand Down Expand Up @@ -251,9 +255,7 @@ func verifyJSONformat(content aasaFile) (bool, []error) {
}

apps := appLinks.Apps
if apps == nil {
formatErrors = append(formatErrors, errors.New("missing applinks/apps region"))
} else if len(apps) > 0 {
if len(apps) > 0 {
formatErrors = append(formatErrors, errors.New("the apps key must have its value be an empty array"))
}

Expand All @@ -280,6 +282,13 @@ func verifyBundleIdentifierIsPresent(content aasaFile, bundleIdentifier string,
if detail.AppID == matcher && len(detail.Paths) > 0 {
return true
}

var arrAppids = detail.AppIDs
for x := 0; x < len(arrAppids); x++ {
if arrAppids[x] == matcher && len(detail.Paths) > 0 {
return true
}
}
}

return false
Expand Down

0 comments on commit dc3928b

Please sign in to comment.