Skip to content

Commit

Permalink
[preprocessor/folder] add function comment
Browse files Browse the repository at this point in the history
  • Loading branch information
williamchong committed Jun 11, 2024
1 parent 00e3154 commit 51b348b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions preprocessor/folder/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ func getFileMetadata(filePath string, mediaType string) (map[string]any, error)
}, nil
}

// checkFileType checks if the file is a zip based special file type
// that we will handle differently
func checkFileType(filePath string) (string, string, error) {
fileType := "generic" // default is generic
file, err := os.Open(filePath)
Expand Down
4 changes: 4 additions & 0 deletions util/proofmode.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ func validateAndParseProofModeFileSignatures(fileMap map[string]*zip.File, fileN
if err != nil {
return nil, err
}
// TODO: check key against db https://github.com/starlinglab/integrity-v2/issues/25
keyRing, err := openpgp.ReadArmoredKeyRing(bytes.NewReader(keyFileBytes))
if err != nil {
return nil, err
Expand Down Expand Up @@ -178,6 +179,8 @@ func validateAndParseProofModeFileSignatures(fileMap map[string]*zip.File, fileN
return &fileData, nil
}

// parseProofModeBundleAssetInfo reads the files in the zip
// and returns a map of files and the json metadata files
func parseProofModeBundleAssetInfo(zipReader *zip.ReadCloser) (map[string]*zip.File, [][]byte, error) {
var jsonFilesBytes [][]byte
fileMap := map[string]*zip.File{}
Expand All @@ -200,6 +203,7 @@ func parseProofModeBundleAssetInfo(zipReader *zip.ReadCloser) (map[string]*zip.F
return fileMap, jsonFilesBytes, nil
}

// CheckIsProofModeFile checks if the file is a proofmode file
func CheckIsProofModeFile(filePath string) bool {
if filepath.Ext(filePath) != ".zip" {
return false
Expand Down

0 comments on commit 51b348b

Please sign in to comment.