Documentation
¶
Index ¶
- Constants
- Variables
- func WritePackage(ctx context.Context, w io.Writer, pkg Package) error
- type Asset
- type AssetStore
- type Entry
- type FileAssetStore
- type MemoryAssetStore
- type OpaqueSurfaceAsset
- type OpaqueSurfaceAssetReader
- type OpaqueSurfaceDocument
- type OpaqueSurfaceStyle
- type OpaqueSurfaceWorker
- type OpaqueSurfaceWorkerType
- type Package
- type PackageSignature
- type ReadOptions
- type Reader
- type ValidationError
- type ValidationErrorCode
- type Writer
Constants ¶
View Source
const OpaqueSurfaceDocumentSchemaVersion = "redevplugin.opaque_surface_document.v1"
View Source
const PackageSignatureAlgorithmEd25519 = "ed25519"
View Source
const PackageSignaturePath = "signatures/package.sig"
View Source
const PackageSignatureSchemaVersion = "redevplugin.package_signature.v1"
Variables ¶
View Source
var ( ErrPackageAssetNotFound = errors.New("package asset not found") ErrInvalidAssetPath = errors.New("package asset path is invalid") )
Functions ¶
Types ¶
type AssetStore ¶
type FileAssetStore ¶
type FileAssetStore struct {
// contains filtered or unexported fields
}
func NewFileAssetStore ¶
func NewFileAssetStore(root string) (*FileAssetStore, error)
func (*FileAssetStore) DeletePackage ¶
func (s *FileAssetStore) DeletePackage(_ context.Context, packageHash string) error
func (*FileAssetStore) PutPackage ¶
func (s *FileAssetStore) PutPackage(ctx context.Context, pkg Package) error
type MemoryAssetStore ¶
type MemoryAssetStore struct {
// contains filtered or unexported fields
}
func NewMemoryAssetStore ¶
func NewMemoryAssetStore() *MemoryAssetStore
func (*MemoryAssetStore) DeletePackage ¶
func (s *MemoryAssetStore) DeletePackage(_ context.Context, packageHash string) error
func (*MemoryAssetStore) PutPackage ¶
func (s *MemoryAssetStore) PutPackage(_ context.Context, pkg Package) error
type OpaqueSurfaceAsset ¶
type OpaqueSurfaceDocument ¶
type OpaqueSurfaceDocument struct {
SchemaVersion string `json:"schema_version"`
EntryPath string `json:"entry_path"`
EntrySHA256 string `json:"entry_sha256"`
Title string `json:"title,omitempty"`
Language string `json:"language,omitempty"`
Direction string `json:"direction,omitempty"`
BodyHTML string `json:"body_html"`
Styles []OpaqueSurfaceStyle `json:"styles"`
Worker OpaqueSurfaceWorker `json:"worker"`
Assets []OpaqueSurfaceAsset `json:"assets"`
CriticalBytes int64 `json:"critical_bytes"`
}
func BuildOpaqueSurfaceDocument ¶
func BuildOpaqueSurfaceDocument(entryPath string, readAsset OpaqueSurfaceAssetReader) (OpaqueSurfaceDocument, error)
type OpaqueSurfaceStyle ¶
type OpaqueSurfaceWorker ¶
type OpaqueSurfaceWorker struct {
Path string `json:"path"`
SHA256 string `json:"sha256"`
Type OpaqueSurfaceWorkerType `json:"type"`
Content string `json:"content"`
}
type OpaqueSurfaceWorkerType ¶
type OpaqueSurfaceWorkerType string
const OpaqueSurfaceWorkerClassic OpaqueSurfaceWorkerType = "classic"
type Package ¶
type Package struct {
Manifest manifest.Manifest `json:"manifest"`
PackageHash string `json:"package_hash"`
ManifestHash string `json:"manifest_hash"`
CanonicalManifest string `json:"canonical_manifest"`
Entries []Entry `json:"entries"`
EntriesHash string `json:"entries_hash"`
PackageSignature *PackageSignature `json:"package_signature,omitempty"`
Files map[string][]byte `json:"-"`
SignatureFiles map[string][]byte `json:"-"`
}
func BuildFromDir ¶
type PackageSignature ¶
type PackageSignature struct {
SchemaVersion string `json:"schema_version"`
Algorithm string `json:"algorithm"`
KeyID string `json:"key_id"`
PublisherID string `json:"publisher_id,omitempty"`
PluginID string `json:"plugin_id,omitempty"`
PackageHash string `json:"package_hash"`
ManifestHash string `json:"manifest_hash"`
EntriesHash string `json:"entries_hash"`
Signature string `json:"signature"`
SignedAt string `json:"signed_at,omitempty"`
}
type ReadOptions ¶
type ReadOptions struct {
MaxUncompressedBytes int64 `json:"max_uncompressed_bytes"`
MaxFiles int `json:"max_files"`
MaxEntryBytes int64 `json:"max_entry_bytes"`
MaxPathBytes int `json:"max_path_bytes"`
MaxCompressionRatio int64 `json:"max_compression_ratio"`
}
func DefaultReadOptions ¶
func DefaultReadOptions() ReadOptions
type ValidationError ¶
type ValidationError struct {
Code ValidationErrorCode
Reason string
Path string
Pointer string
Message string
Cause error
}
func (*ValidationError) Details ¶
func (e *ValidationError) Details() map[string]any
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
func (*ValidationError) Unwrap ¶
func (e *ValidationError) Unwrap() error
type ValidationErrorCode ¶
type ValidationErrorCode string
const ( ValidationCodeManifestInvalid ValidationErrorCode = "PLUGIN_MANIFEST_INVALID" ValidationCodePackageInvalid ValidationErrorCode = "PLUGIN_PACKAGE_INVALID" ValidationCodePackageTooLarge ValidationErrorCode = "PLUGIN_PACKAGE_TOO_LARGE" ValidationCodePackagePathForbidden ValidationErrorCode = "PLUGIN_PACKAGE_PATH_FORBIDDEN" )
Click to show internal directories.
Click to hide internal directories.