Documentation
¶
Index ¶
- Constants
- Variables
- func WritePackage(ctx context.Context, w io.Writer, pkg Package) error
- type Asset
- type AssetStore
- type Entry
- type FileAssetStore
- func (s *FileAssetStore) Close() error
- func (s *FileAssetStore) DeletePackage(_ context.Context, packageHash string) error
- func (s *FileAssetStore) PutOwnedPackage(ctx context.Context, pkg *Package) error
- func (s *FileAssetStore) ReadAsset(ctx context.Context, packageHash string, assetPath string) (Asset, error)
- func (s *FileAssetStore) ReadPackageMetadata(ctx context.Context, packageHash string) ([]Entry, error)
- type MemoryAssetStore
- func (s *MemoryAssetStore) Close() error
- func (s *MemoryAssetStore) DeletePackage(_ context.Context, packageHash string) error
- func (s *MemoryAssetStore) PutOwnedPackage(_ context.Context, pkg *Package) error
- func (s *MemoryAssetStore) ReadAsset(_ context.Context, packageHash string, assetPath string) (Asset, error)
- func (s *MemoryAssetStore) ReadPackageMetadata(_ context.Context, packageHash string) ([]Entry, error)
- type OpaqueSurfaceAsset
- type OpaqueSurfaceAssetReader
- type OpaqueSurfaceDocument
- type OpaqueSurfaceStyle
- type OpaqueSurfaceWorker
- type OpaqueSurfaceWorkerType
- type Package
- type PackageSignature
- type ReadLimits
- func (l ReadLimits) WithMaxCompressionRatio(value int64) (ReadLimits, error)
- func (l ReadLimits) WithMaxEntryBytes(value int64) (ReadLimits, error)
- func (l ReadLimits) WithMaxFiles(value int) (ReadLimits, error)
- func (l ReadLimits) WithMaxPathBytes(value int) (ReadLimits, error)
- func (l ReadLimits) WithMaxUncompressedBytes(value int64) (ReadLimits, error)
- type ValidationError
- type ValidationErrorCode
Constants ¶
View Source
const OpaqueSurfaceDocumentSchemaVersion = "redevplugin.opaque_surface_document.v3"
View Source
const PackageSignatureAlgorithmEd25519 = "ed25519"
View Source
const PackageSignaturePath = "signatures/package.sig"
View Source
const PackageSignatureSchemaVersion = "redevplugin.package_signature.v1"
Variables ¶
Functions ¶
Types ¶
type AssetStore ¶
type AssetStore interface {
// PutOwnedPackage takes ownership of pkg.Files and pkg.SignatureFiles when
// the call begins, including when the operation returns an error. Callers
// must not retain aliases to transferred byte slices.
PutOwnedPackage(ctx context.Context, pkg *Package) error
ReadPackageMetadata(ctx context.Context, packageHash string) ([]Entry, error)
ReadAsset(ctx context.Context, packageHash string, assetPath string) (Asset, error)
DeletePackage(ctx context.Context, packageHash string) error
Close() error
}
type FileAssetStore ¶
type FileAssetStore struct {
// contains filtered or unexported fields
}
func NewFileAssetStore ¶
func NewFileAssetStore(root string) (*FileAssetStore, error)
func (*FileAssetStore) Close ¶ added in v0.5.0
func (s *FileAssetStore) Close() error
func (*FileAssetStore) DeletePackage ¶
func (s *FileAssetStore) DeletePackage(_ context.Context, packageHash string) error
func (*FileAssetStore) PutOwnedPackage ¶ added in v0.5.0
func (s *FileAssetStore) PutOwnedPackage(ctx context.Context, pkg *Package) error
func (*FileAssetStore) ReadPackageMetadata ¶ added in v0.5.0
type MemoryAssetStore ¶
type MemoryAssetStore struct {
// contains filtered or unexported fields
}
func NewMemoryAssetStore ¶
func NewMemoryAssetStore() *MemoryAssetStore
func (*MemoryAssetStore) Close ¶ added in v0.5.0
func (s *MemoryAssetStore) Close() error
func (*MemoryAssetStore) DeletePackage ¶
func (s *MemoryAssetStore) DeletePackage(_ context.Context, packageHash string) error
func (*MemoryAssetStore) PutOwnedPackage ¶ added in v0.5.0
func (s *MemoryAssetStore) PutOwnedPackage(_ context.Context, pkg *Package) error
func (*MemoryAssetStore) ReadPackageMetadata ¶ added in v0.5.0
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 and SignatureFiles are owned materialized bytes. Borrowing APIs do
// not mutate them; AssetStore.PutOwnedPackage transfers and clears them.
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 ReadLimits ¶ added in v0.5.0
type ReadLimits struct {
// contains filtered or unexported fields
}
ReadLimits is an immutable set of resource limits for package archives.
Limits deliberately have no zero-value semantics: callers must start with DefaultReadLimits and use a validated With... method. This prevents a missing option from silently disabling ZIP decompression guards.
func DefaultReadLimits ¶ added in v0.5.0
func DefaultReadLimits() ReadLimits
func (ReadLimits) WithMaxCompressionRatio ¶ added in v0.5.0
func (l ReadLimits) WithMaxCompressionRatio(value int64) (ReadLimits, error)
func (ReadLimits) WithMaxEntryBytes ¶ added in v0.5.0
func (l ReadLimits) WithMaxEntryBytes(value int64) (ReadLimits, error)
func (ReadLimits) WithMaxFiles ¶ added in v0.5.0
func (l ReadLimits) WithMaxFiles(value int) (ReadLimits, error)
func (ReadLimits) WithMaxPathBytes ¶ added in v0.5.0
func (l ReadLimits) WithMaxPathBytes(value int) (ReadLimits, error)
func (ReadLimits) WithMaxUncompressedBytes ¶ added in v0.5.0
func (l ReadLimits) WithMaxUncompressedBytes(value int64) (ReadLimits, error)
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.