service

package
v0.7.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2026 License: AGPL-3.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const MaxCustomNameLength = 64

MaxCustomNameLength caps the home-screen name so an over-long value cannot reach Apple's App ID registration.

View Source
const SigningReportPrefix = "SIGNING_REPORT: "

SigningReportPrefix starts the structured lines written into the install output of an external certificate installation. Each line carries one JSON report whose "stage" is "plan", "failure" or "verified".

Variables

This section is empty.

Functions

func AddSavedSource added in v0.6.0

func AddSavedSource(location string) (*model.SavedSource, error)

AddSavedSource saves the AltStore source at location. It fetches the source to check it and to read its name; saving a URL that is already saved returns the existing entry.

func ApplyBuild added in v0.6.0

func ApplyBuild(app model.InstalledApp, b source.Build) model.InstalledApp

ApplyBuild returns app as it should be after installing b: the IPA is downloaded from b and b is recorded as the installed build.

func CheckAfcService

func CheckAfcService(ctx context.Context, id string) error

func CheckExternalInstall added in v0.6.0

func CheckExternalInstall(req ExternalCheckRequest) (*appcheck.Plan, error)

CheckExternalInstall builds the compatibility plan of an installation with an external signing identity without signing anything. The identity status issues are merged into the plan issues. Errors are *signing.Error (identity not found, IPA path rejected, device not found or unreachable, IPA invalid).

func CleanExternalUpload added in v0.6.0

func CleanExternalUpload(ipaPath, iconPath string)

CleanExternalUpload removes the uploaded IPA and icon consumed by an external certificate installation when they still are regular files inside the upload directory (<DataDir>/tmp). Anything else is left alone, notably the IPA and icon of an installed app, which SaveApp moved into its record directory. Unlike InstallManager.CleanTempFiles, it never removes files of other installations.

func CountAppsBySigningIdentity added in v0.6.0

func CountAppsBySigningIdentity(id uint) (int64, error)

CountAppsBySigningIdentity counts the installed apps signed with the identity.

func DecodeScreenshotDownload added in v0.6.0

func DecodeScreenshotDownload(encoded string) ([]byte, error)

DecodeScreenshotDownload decodes the base64 JPEG a client posts when it cannot save a client-side download, so the same request can answer with the image as an attachment. In-app WebViews (notably on iOS) only download from a real http(s) response, so the client posts the preview it is already showing and the browser saves exactly that image.

func DeleteApp

func DeleteApp(id uint) (bool, error)

func DeleteSavedSource added in v0.6.0

func DeleteSavedSource(id uint) error

DeleteSavedSource removes a saved source (hard delete). Apps tracking it are not affected.

func DeleteSigningIdentity added in v0.6.0

func DeleteSigningIdentity(id uint, force bool) error

DeleteSigningIdentity removes a signing identity and its sealed key. It fails with CodeIdentityInUse while a running task holds a lease on the identity and with CodeIdentityReferenced when installed apps use it and force is false. Apps signed with a deleted identity keep their records; reinstalling them fails with CodeIdentityNotFound.

func DownloadSourceBuild added in v0.6.0

func DownloadSourceBuild(kind, location, buildID string) (*model.IpaFile, error)

DownloadSourceBuild downloads the build buildID of a source into the upload directory (<DataDir>/tmp) like an upload, so that the external certificate check and install accept its path. The download URL always comes from the source, never from the client.

func DownloadSourceIPA added in v0.6.1

func DownloadSourceIPA(s model.AppSource, rawURL string, progressFn ipa.DownloadProgressFn) (*ipa.DownloadResult, error)

DownloadSourceIPA downloads one build of a server-validated source. GitHub authentication is derived from the configured token and source metadata; callers cannot supply arbitrary authentication headers.

func EvaluateSource added in v0.6.0

func EvaluateSource(s model.AppSource, b source.Build, err error, now time.Time) model.AppSource

EvaluateSource returns s with the check fields updated from a Latest() result.

func GetApp

func GetApp(id uint) (*model.InstalledApp, error)

func GetAppList

func GetAppList() ([]model.InstalledApp, error)

func GetEnableAppList

func GetEnableAppList() ([]model.InstalledApp, error)

func GetEnableAppListByUDID added in v0.3.0

func GetEnableAppListByUDID(udid string) ([]model.InstalledApp, error)

func GetSavedSources added in v0.6.0

func GetSavedSources() ([]model.SavedSource, error)

GetSavedSources returns the saved AltStore sources, oldest first.

func GetServiceStatus

func GetServiceStatus() []model.ServiceStatus

func GetSigningIdentity added in v0.6.0

func GetSigningIdentity(id uint) (*model.SigningIdentity, error)

GetSigningIdentity loads one signing identity including its sealed material. A missing identity is a *signing.Error with CodeIdentityNotFound.

func GetTrackedAppList added in v0.6.0

func GetTrackedAppList() ([]model.InstalledApp, error)

GetTrackedAppList returns the apps linked to a source.

func GetValidName

func GetValidName(name string) string

func HandleInstallMessage added in v0.2.1

func HandleInstallMessage(c *websocket.Conn)

func HandleLoginMessage added in v0.3.0

func HandleLoginMessage(c *websocket.Conn)

func HandlePairMessage added in v0.2.1

func HandlePairMessage(c *websocket.Conn)

func HandleScanMessage added in v0.3.0

func HandleScanMessage(c *websocket.Conn)

func HasExpiredApps added in v0.3.5

func HasExpiredApps() (bool, error)

HasExpiredApps checks if there are any enabled apps that have expired

func ImportPairingFile added in v0.4.1

func ImportPairingFile(ip string, port string, data []byte) error

func LinkSource added in v0.6.0

func LinkSource(id uint, in SourceInput) (*model.InstalledApp, error)

LinkSource links app id to a source (or changes its settings), then checks it for updates.

func ListSigningIdentities added in v0.6.0

func ListSigningIdentities() ([]model.SigningIdentity, error)

ListSigningIdentities returns every signing identity, newest first.

func MarkSourceUpdateFailed added in v0.6.0

func MarkSourceUpdateFailed(id uint, buildID, msg string) error

MarkSourceUpdateFailed records that installing build buildID of app id failed, so it is not retried automatically.

func MountDeveloperDiskImage

func MountDeveloperDiskImage(ctx context.Context, id string) error

MountDeveloperDiskImage mounts the personalized developer disk image on the target device. The operation is idempotent within the lifetime of the process — subsequent calls for the same device are no-ops.

func PrepareSourceUpdate added in v0.6.0

func PrepareSourceUpdate(id uint, buildID, filter string) (model.InstalledApp, error)

PrepareSourceUpdate returns app id as it should be after installing the build buildID of its source, or the latest build when buildID is empty. A non-empty filter replaces the stored one once the update is installed, so a failed switch to another variant keeps tracking the installed one.

func PreviewSource added in v0.6.0

func PreviewSource(kind, location, deviceClass string, prerelease bool) (*source.Preview, error)

PreviewSource lists the builds of a source the user can install on a device of deviceClass.

func RefreshedErrorOf added in v0.6.0

func RefreshedErrorOf(err error) model.RefreshedError

RefreshedErrorOf maps an installation failure to the error recorded on the installed app.

func RemoveStaleTempFiles added in v0.6.0

func RemoveStaleTempFiles() (int, error)

RemoveStaleTempFiles removes the regular files directly under <DataDir>/tmp last modified more than 24 hours ago and returns how many were removed. The install page stages uploads, source downloads and their icons there and releases them itself; a closed tab or a client timeout leaves them behind. Directories and symbolic links are kept, a missing directory is nothing to do. Files that cannot be removed are reported in the error, after the others were removed.

func ResetAnisette added in v0.7.0

func ResetAnisette() error

ResetAnisette removes the Anisette provisioning state so the next login or install provisions it again. It mirrors upstream impactor ResetAnisetteData which deletes the provisioning files under <data_path> (see claration/impactor@321eac4).

func ResolveAppIconPath added in v0.6.0

func ResolveAppIconPath(icon string) (string, error)

ResolveAppIconPath returns the symlink-free path of the recorded icon of an installed app when it is a regular file inside the installed apps directory (<DataDir>/ipa); anything else is an error.

func ResolveClientIPAPath added in v0.6.0

func ResolveClientIPAPath(path string) (string, error)

ResolveClientIPAPath resolves a client provided IPA path, following symbolic links, and accepts it only when it designates a regular file inside the upload directory (<DataDir>/tmp) or the installed apps directory (<DataDir>/ipa). Other paths are a *signing.Error with CodeIPAPathRejected.

func ResolveSourceInstall added in v0.6.0

func ResolveSourceInstall(v *model.InstalledApp) error

ResolveSourceInstall resolves the build the user picked for a first install from a source: v.Source holds the link settings and the picked BuildID. The download URL always comes from the source, never from the client. An external certificate install with a local IPA path signs that file: the install page downloaded the build through DownloadSourceBuild and checked it, and validateInstallRequest confined the path to the upload and installed apps directories. It only records the build as installed.

func SaveApp

func SaveApp(app model.InstalledApp) (*model.InstalledApp, error)

SaveApp records a successful installation, updating the previous record of the same app when there is one (see findInstalledApp). The IPA and the icon are moved into the directory of the record; the client provided icon only when it is a regular file of the upload or installed apps directories (see storeAppIcon).

func SetLanguage

func SetLanguage(lang string)

func TakeDeviceScreenshot added in v0.4.3

func TakeDeviceScreenshot(ctx context.Context, id string) (string, error)

TakeDeviceScreenshot captures a screenshot of the target device and returns it base64-encoded so it can be embedded directly in JSON.

func UntrackSource added in v0.6.0

func UntrackSource(id uint) error

UntrackSource unlinks app id from its source.

func UpdateAppRefreshResult

func UpdateAppRefreshResult(app model.InstalledApp) error

UpdateAppRefreshResult records the outcome of a refresh or reinstallation.

func UpdateCoreADI added in v0.3.2

func UpdateCoreADI() error

UpdateCoreADI downloads the latest Apple Music APK and saves it to DataDir/PlumeImpactor/lib

func ValidateCustomName added in v0.4.7

func ValidateCustomName(name string) error

ValidateCustomName checks a user-supplied app name. Apple rejects characters such as underscores in the App ID name derived from the app name (see issue #21, "An invalid value 'tv_shelf' was provided for the parameter 'appIdName'"), so reject them here instead of failing during signing. Letters and digits of any script are allowed, so non-Latin app names work.

Types

type CatalogSource added in v0.6.0

type CatalogSource struct {
	ID     uint           `json:"id"`
	URL    string         `json:"url"`
	Name   string         `json:"name"`   // name read from the source, or the saved name when it could not be read
	Error  string         `json:"error"`  // why the source could not be read ("" on success)
	Builds []source.Build `json:"builds"` // newest version of each app (Feed.Preview builds), [] on error
}

CatalogSource is the apps of one saved source for the catalog.

func GetSourceCatalog added in v0.6.0

func GetSourceCatalog(deviceClass string) ([]CatalogSource, error)

GetSourceCatalog fetches every saved source concurrently (one request each) and returns their apps for a device of deviceClass, in saved order. A failing source is reported in Error and does not fail the others.

type ExternalCheckRequest added in v0.6.0

type ExternalCheckRequest struct {
	IdentityID uint
	// IpaPath is client provided; it must resolve inside the upload or
	// installed-app directories (*signing.Error CodeIPAPathRejected otherwise).
	IpaPath string
	// UDID identifies the target device as listed by the device manager.
	UDID                     string
	RemoveExtensions         bool
	AllowMissingEntitlements bool
	// CustomIdentifier is the main bundle identifier requested by the user,
	// surrounding spaces ignored; an invalid value is reported by the plan.
	CustomIdentifier string
}

ExternalCheckRequest is the input of the compatibility check run before an installation with an external signing identity.

type ExternalInstall added in v0.6.0

type ExternalInstall struct {
	// Identity is the snapshot of the signing identity used by this installation.
	Identity model.SigningIdentity
	Plan     *appcheck.Plan
	// IpaPath is the resolved path of the IPA to sign.
	IpaPath string
	// contains filtered or unexported fields
}

ExternalInstall is an installation with an external signing identity, prepared and checked but not yet signed. It holds a lease on the identity, the identity snapshot used for the whole installation and the private workspace with the materialized signing files. Close releases everything.

func PrepareExternalInstall added in v0.6.0

func PrepareExternalInstall(app model.InstalledApp, dev *model.Device, emit func(string)) (*ExternalInstall, error)

PrepareExternalInstall leases the signing identity of app, checks the IPA against the identity and the device, and materializes the signing files. The plan is reported through emit as a SIGNING_REPORT line. Every blocking finding is refused here, before anything is signed. Errors are *signing.Error; the caller must Close the returned installation.

func (*ExternalInstall) Close added in v0.6.0

func (e *ExternalInstall) Close()

Close removes the workspace and releases the identity lease. It is safe to call more than once.

func (*ExternalInstall) Signing added in v0.6.0

func (e *ExternalInstall) Signing() *manager.ExternalSigning

Signing returns the engine signing material of the installation.

func (*ExternalInstall) Verify added in v0.6.0

func (e *ExternalInstall) Verify() error

Verify audits the signed IPA written by the engine against the plan and the identity snapshot. The engine writes it after installing, so a failure means an app that does not match the plan may already be on the device.

type ExternalInstallResult added in v0.6.0

type ExternalInstallResult struct {
	// ExpiresAt is the signing deadline of the identity snapshot used.
	ExpiresAt time.Time
	// SignedBundleIdentifier is the main bundle identifier installed on the device.
	SignedBundleIdentifier string
}

ExternalInstallResult is what an installed app record keeps from a successful external certificate installation.

func RunExternalInstall added in v0.6.0

func RunExternalInstall(ctx context.Context, installMgr *manager.InstallManager, app model.InstalledApp, dev *model.Device, retry bool) (*ExternalInstallResult, error)

RunExternalInstall signs and installs app on dev with its external signing identity: prepare, engine run (TryStart with the transport retry when retry is set, Start otherwise), verification of the signed IPA and cleanup. The install output of installMgr is reset first; SIGNING_REPORT lines are written into it next to the engine output. Errors are *signing.Error.

type SigningIdentityView added in v0.6.0

type SigningIdentityView struct {
	model.SigningIdentity
	ExpiresAt time.Time       `json:"expires_at"`
	Status    []signing.Issue `json:"status"`
	AppCount  int64           `json:"app_count"`
	InUse     bool            `json:"in_use"`
}

SigningIdentityView is the API representation of a signing identity: its metadata (secret material stays excluded by the json:"-" tags of the model) plus the effective expiry, the current findings and its usage.

func ImportSigningIdentity added in v0.6.0

func ImportSigningIdentity(req signing.ImportRequest) (*SigningIdentityView, []signing.Issue, error)

ImportSigningIdentity decodes, validates and stores a new signing identity. It returns the view of the stored identity and the non-blocking findings of the import. Blocking findings, a duplicate (same certificate and profile) and sealing failures are returned as *signing.Error.

func ListSigningIdentityViews added in v0.6.0

func ListSigningIdentityViews() ([]*SigningIdentityView, error)

ListSigningIdentityViews returns the view of every signing identity, newest first.

func ReplaceSigningIdentityProfile added in v0.6.0

func ReplaceSigningIdentityProfile(id uint, profileData []byte) (*SigningIdentityView, []signing.Issue, error)

ReplaceSigningIdentityProfile validates a new provisioning profile against the identity certificate and stores it atomically, incrementing Revision. It fails with CodeIdentityInUse while a running task holds a lease on the identity or when the identity changed concurrently.

type SourceCheckResult added in v0.6.0

type SourceCheckResult struct {
	Updates []model.InstalledApp // ApplyBuild target states for every tracked app that has a newer build
	Notices []SourceNotice
}

SourceCheckResult is what an update check found.

func CheckSourceUpdates added in v0.6.0

func CheckSourceUpdates(apps []model.InstalledApp) SourceCheckResult

CheckSourceUpdates checks every tracked app in apps, persists the check fields and reports what changed. Each distinct source is fetched once.

type SourceInput added in v0.6.0

type SourceInput struct {
	Kind             string `json:"kind"`
	URL              string `json:"url"`
	Filter           string `json:"filter"`
	Prerelease       bool   `json:"prerelease"`
	AutoUpdate       bool   `json:"auto_update"`
	InstalledBuildID string `json:"installed_build_id"` // optional: "the installed version is already this build"
}

SourceInput links an installed app to a source.

type SourceNotice added in v0.6.0

type SourceNotice struct {
	AppName string // custom name or ipa name
	Version string
	Error   string // empty for "update available"
}

SourceNotice is a change found by an update check that the user should know.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL