Skip to content

Commit

Permalink
check mtls test
Browse files Browse the repository at this point in the history
  • Loading branch information
chkp-omerma committed Dec 5, 2024
1 parent 3917d68 commit 4406581
Show file tree
Hide file tree
Showing 5 changed files with 1,177 additions and 3 deletions.
33 changes: 33 additions & 0 deletions internal/models/web-app-asset/schema.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
package models

import (
"encoding/base64"
"fmt"
"path/filepath"
)

const (
SourceIdentifierValueIDSeparator = ";;;"
FileDataFilenameFormat = "%s;"
FileDataFormat = "data:;base64,%s"
)

// SchemaPracticeMode represents a PracticeMode field of a practice field of a
Expand Down Expand Up @@ -36,3 +44,28 @@ type SchemaTag struct {
Key string `json:"key"`
Value string `json:"value"`
}

type FileSchema struct {
FilenameID string `json:"filename_id,omitempty"`
Filename string `json:"filename,omitempty"`
DataID string `json:"data_id,omitempty"`
Data string `json:"data"`
Type string `json:"type,omitempty"`
EnableID string `json:"enable_id,omitempty"`
Enable bool `json:"enable,omitempty"`
}

type FileSchemas []FileSchema

func NewFileSchemaEncode(filename, fileData, fileType string, fileEnable bool) FileSchema {
b64Data := base64.StdEncoding.EncodeToString([]byte(fileData))
data := fmt.Sprintf(FileDataFormat, b64Data)
filenameFmt := fmt.Sprintf(FileDataFilenameFormat, filepath.Base(filename))

return FileSchema{
Filename: filename,
Data: filenameFmt + data,
Type: fileType,
Enable: fileEnable,
}
}
Loading

0 comments on commit 4406581

Please sign in to comment.