model

package
v0.6.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	Unpaired DeviceStatus = "unpaired"
	Paired   DeviceStatus = "paired"
	Pairable DeviceStatus = "pairable"

	DeviceClassiPhone  DeviceClass = "iPhone"
	DeviceClassiPad    DeviceClass = "iPad"
	DeviceClassAppleTV DeviceClass = "AppleTV"

	DeviceConnectionLockdown DeviceConnection = "Lockdown"
	DeviceConnectionRemote   DeviceConnection = "RPPairing"
)
View Source
const (
	MessageTypeInstall = 1
	MessageType2FA     = 2

	MessageTypeLogin = 1

	MessageTypePair        = 1
	MessageTypePairConfirm = 2
)

Message.Type

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountDevice added in v0.3.0

type AccountDevice struct {
	DeviceID       string `json:"deviceId"`
	Name           string `json:"name"`
	DeviceNumber   string `json:"deviceNumber"`
	DevicePlatform string `json:"devicePlatform"`
	Status         string `json:"status"`
	DeviceClass    string `json:"deviceClass"`
	ExpirationDate string `json:"expirationDate"`
}

type Accounts added in v0.3.0

type Accounts struct {
	Accounts map[string]AppleAccount `json:"accounts"`
}

type AppSource added in v0.6.0

type AppSource struct {
	Kind       string `json:"kind"`        // "github", "altstore" or ""
	URL        string `json:"url"`         // GitHub "owner/repo"; AltStore source URL
	Filter     string `json:"filter"`      // GitHub asset-name regexp; AltStore bundle identifier
	Prerelease bool   `json:"prerelease"`  // GitHub only: also consider pre-releases
	AutoUpdate bool   `json:"auto_update"` // install newer builds during the scheduled refresh window

	// Installed build, written when an install from the source succeeds.
	BuildID   string     `json:"build_id"`
	Version   string     `json:"version"`
	BuildName string     `json:"build_name"`
	BuildDate *time.Time `json:"build_date"`

	// Result of the last update check (server-owned).
	CheckedAt     *time.Time `json:"checked_at"`
	CheckError    string     `json:"check_error"`
	LatestBuildID string     `json:"latest_build_id"` // newer build available, "" when up to date or unresolved
	LatestVersion string     `json:"latest_version"`
	FailedBuildID string     `json:"failed_build_id"` // auto-update of this build failed; not retried automatically
}

AppSource links an installed app to the GitHub repository or AltStore source that publishes its IPA. An empty Kind means the app is not tracked.

func (AppSource) Tracked added in v0.6.0

func (s AppSource) Tracked() bool

Tracked reports whether the app is linked to a source.

func (AppSource) UpdateAvailable added in v0.6.0

func (s AppSource) UpdateAvailable() bool

UpdateAvailable reports whether the last check found a newer build.

type AppleAccount added in v0.3.0

type AppleAccount struct {
	Email  string `json:"email"`
	TeamID string `json:"team_id"`
	Status string `json:"status,omitempty"`
}

type Certificate added in v0.3.0

type Certificate struct {
	SerialNumber   string `json:"serialNumber"`
	Name           string `json:"name"`
	MachineName    string `json:"machineName"`
	Status         string `json:"status"`
	InUse          bool   `json:"inUse"`
	Type           string `json:"type"`
	ExpirationDate string `json:"expirationDate"`
	CreatedDate    string `json:"createdDate"`
}

type Device

type Device struct {
	ID                       string           `json:"id"`
	Name                     string           `json:"name"`
	ServiceName              string           `json:"service_name"`
	IP                       string           `json:"ip"`
	Port                     uint16           `json:"port,omitempty"`
	MacAddr                  string           `json:"mac_addr"`
	UDID                     string           `json:"udid"`
	Connection               DeviceConnection `json:"connection"`
	Status                   DeviceStatus     `json:"status"`
	Enable                   bool             `json:"enable"`
	Message                  string           `json:"message"`
	DeviceClass              string           `json:"device_class"`
	ProductType              string           `json:"product_type"`
	ProductVersion           string           `json:"product_version"`
	DeveloperModeStatus      bool             `json:"developer_mode_status"`
	PersonalizedImageMounted bool             `json:"personalized_image_mounted"`
	DiscoveryAt              time.Time        `json:"-"`
}

func (*Device) IsIPhone added in v0.3.0

func (d *Device) IsIPhone() bool

func (*Device) ParseDeviceClass added in v0.3.0

func (d *Device) ParseDeviceClass()

type DeviceClass added in v0.3.0

type DeviceClass string

func (DeviceClass) ProfilePlatform added in v0.6.0

func (c DeviceClass) ProfilePlatform() string

ProfilePlatform returns the provisioning profile platform ("iOS", "tvOS") required to install apps on the device class, or "" when unknown.

type DeviceConnection added in v0.4.0

type DeviceConnection string

type DeviceInfo added in v0.3.0

type DeviceInfo struct {
	UniqueDeviceID           string `json:"unique_device_id"`
	DeviceName               string `json:"device_name"`
	DeviceClass              string `json:"device_class"`
	ProductName              string `json:"product_name"`
	ProductType              string `json:"product_type"`
	ProductVersion           string `json:"product_version"`
	SerialNumber             string `json:"serial_number"`
	WiFiAddress              string `json:"wifi_address"`
	DeveloperModeStatus      bool   `json:"developer_mode_status"`
	PersonalizedImageMounted bool   `json:"personalized_image_mounted"`
}

type DeviceStatus

type DeviceStatus string

type InstalledApp

type InstalledApp struct {
	gorm.Model

	IpaName          string         `json:"ipa_name"`
	IpaPath          string         `json:"ipa_path"`
	Description      string         `json:"description,omitempty"`
	Device           string         `json:"device"`
	DeviceClass      string         `json:"device_class"`
	UDID             string         `gorm:"column:udid" json:"udid"`
	Account          string         `json:"account"`
	Password         string         `json:"password"`
	InstalledDate    *time.Time     `json:"installed_date"`
	RefreshedDate    *time.Time     `json:"refreshed_date"`
	ExpirationDate   *time.Time     `json:"expiration_date"`
	RefreshedResult  bool           `json:"refreshed_result"`
	RefreshedError   RefreshedError `json:"refreshed_error"`
	Icon             string         `json:"icon"`
	BundleIdentifier string         `json:"bundle_identifier"`
	Version          string         `json:"version"`
	RemoveExtensions bool           `json:"remove_extensions"`
	CustomName       string         `json:"custom_name,omitempty"`
	Enabled          bool           `json:"enabled,omitempty"`
	Source           AppSource      `gorm:"embedded;embeddedPrefix:source_" json:"source"`

	// SigningMode is empty for records created before signing modes existed;
	// use EffectiveSigningMode to read it.
	SigningMode SigningMode `gorm:"size:32;index" json:"signing_mode"`
	// SigningIdentityID references the SigningIdentity used in SigningModeExternalCertificate.
	SigningIdentityID uint `gorm:"index" json:"signing_identity_id,omitempty"`
	// SignedBundleIdentifier is the main bundle identifier actually installed
	// on the device in SigningModeExternalCertificate: CustomIdentifier when
	// set, else the bundle identifier of the IPA.
	SignedBundleIdentifier string `json:"signed_bundle_identifier,omitempty"`
	// CustomIdentifier is the main bundle identifier requested by the user in
	// SigningModeExternalCertificate (passed to the engine as
	// --custom-identifier); empty keeps the bundle identifiers of the IPA.
	// Reinstallations reuse it.
	CustomIdentifier string `gorm:"column:custom_identifier" json:"custom_identifier,omitempty"`
	// AllowMissingEntitlements records the explicit user choice to sign even when
	// the provisioning profile does not grant every entitlement requested by the app.
	AllowMissingEntitlements bool `json:"allow_missing_entitlements"`
}

func (InstalledApp) DisplayName added in v0.6.0

func (t InstalledApp) DisplayName() string

DisplayName returns the custom name of the app, or its IPA name.

func (InstalledApp) EffectiveSigningMode added in v0.6.0

func (t InstalledApp) EffectiveSigningMode() SigningMode

EffectiveSigningMode returns the signing mode, treating historical records as Apple ID.

func (InstalledApp) IsAccountInvalid added in v0.3.1

func (t InstalledApp) IsAccountInvalid() bool

func (InstalledApp) IsExpired added in v0.3.5

func (t InstalledApp) IsExpired() bool

IsExpired checks if the app has strictly expired (ExpirationDate < now)

func (InstalledApp) IsExternalSigning added in v0.6.0

func (t InstalledApp) IsExternalSigning() bool

IsExternalSigning reports whether the app is signed with an imported signing identity.

func (InstalledApp) IsIPhoneApp added in v0.3.0

func (t InstalledApp) IsIPhoneApp() bool

func (InstalledApp) MarshalJSON

func (t InstalledApp) MarshalJSON() ([]byte, error)

输出json时,清空密码字段,提高安全性 The effective signing mode is emitted so historical records read as apple_id.

func (InstalledApp) MaskAccount added in v0.2.5

func (t InstalledApp) MaskAccount() string

func (InstalledApp) NeedRefresh added in v0.3.0

func (t InstalledApp) NeedRefresh(advanceDays int) bool

type IpaFile

type IpaFile struct {
	Name             string `json:"name"`
	Path             string `json:"path"`
	Icon             string `json:"icon"`
	BundleIdentifier string `json:"bundle_identifier"`
	Version          string `json:"version"`
}

type LockdownDevice

type LockdownDevice struct {
	Name           string `json:"name"`
	WiFiMACAddress string `json:"wifi_mac_address"`
}

type Message added in v0.2.1

type Message struct {
	Type int    `json:"t"`
	Data string `json:"d"`
}

Message Websocket Communication data format

type MobileProvisioningProfile added in v0.3.0

type MobileProvisioningProfile struct {
	AppIDName                   string         `plist:"AppIDName"`
	ApplicationIdentifierPrefix []string       `plist:"ApplicationIdentifierPrefix"`
	CreationDate                time.Time      `plist:"CreationDate"`
	ExpirationDate              time.Time      `plist:"ExpirationDate"`
	Name                        string         `plist:"Name"`
	Platform                    []string       `plist:"Platform"`
	IsXcodeManaged              bool           `plist:"IsXcodeManaged"`
	DeveloperCertificates       [][]byte       `plist:"DeveloperCertificates"`
	Entitlements                map[string]any `plist:"Entitlements"`
	ProvisionedDevices          []string       `plist:"ProvisionedDevices"`
	ProvisionsAllDevices        bool           `plist:"ProvisionsAllDevices"`
	TeamIdentifier              []string       `plist:"TeamIdentifier"`
	TeamName                    string         `plist:"TeamName"`
	UUID                        string         `plist:"UUID"`
	Version                     int            `plist:"Version"`
}

MobileProvisioningProfile is the plist payload of a .mobileprovision file. Parsing only reads the CMS content; it does not verify the CMS signature.

func ParseMobileProvisioningProfile added in v0.3.0

func ParseMobileProvisioningProfile(data []byte) (*MobileProvisioningProfile, error)

ParseMobileProvisioningProfile decodes the plist carried by a CMS-wrapped provisioning profile. The CMS signature is NOT verified here.

func ParseMobileProvisioningProfileFile added in v0.3.0

func ParseMobileProvisioningProfileFile(path string) (*MobileProvisioningProfile, error)

func (*MobileProvisioningProfile) AppIDPrefix added in v0.6.0

func (p *MobileProvisioningProfile) AppIDPrefix() string

AppIDPrefix returns the App ID prefix that starts the application-identifier entitlement, or "" when no declared prefix matches it.

func (*MobileProvisioningProfile) ApplicationIdentifier added in v0.6.0

func (p *MobileProvisioningProfile) ApplicationIdentifier() string

ApplicationIdentifier returns the application-identifier entitlement, e.g. "TEAMID.com.example.app" or "TEAMID.*".

func (*MobileProvisioningProfile) BundleIDPattern added in v0.6.0

func (p *MobileProvisioningProfile) BundleIDPattern() string

BundleIDPattern returns the application-identifier without its App ID prefix: an explicit bundle identifier ("com.example.app") or a wildcard pattern ("com.example.*", "*"). It returns "" when the prefix is unknown.

func (*MobileProvisioningProfile) GetTaskAllow added in v0.6.0

func (p *MobileProvisioningProfile) GetTaskAllow() bool

GetTaskAllow returns the get-task-allow entitlement granted by the profile.

func (*MobileProvisioningProfile) IncludesCertificate added in v0.6.0

func (p *MobileProvisioningProfile) IncludesCertificate(der []byte) bool

IncludesCertificate reports whether the DER certificate is listed in DeveloperCertificates.

func (*MobileProvisioningProfile) Kind added in v0.6.0

Kind classifies the profile from its device provisioning and debug entitlement.

func (*MobileProvisioningProfile) ProvisionsDevice added in v0.6.0

func (p *MobileProvisioningProfile) ProvisionsDevice(udid string) bool

ProvisionsDevice reports whether the profile allows installation on the device UDID.

func (*MobileProvisioningProfile) SupportsPlatform added in v0.6.0

func (p *MobileProvisioningProfile) SupportsPlatform(platform string) bool

SupportsPlatform reports whether the profile lists the platform ("iOS", "tvOS", ...).

func (*MobileProvisioningProfile) TeamID added in v0.6.0

func (p *MobileProvisioningProfile) TeamID() string

TeamID returns the first team identifier of the profile.

type ProfileKind added in v0.6.0

type ProfileKind string

ProfileKind classifies a provisioning profile by how it provisions devices.

const (
	ProfileKindDevelopment ProfileKind = "development"
	ProfileKindAdHoc       ProfileKind = "ad_hoc"
	ProfileKindEnterprise  ProfileKind = "enterprise"
	ProfileKindAppStore    ProfileKind = "app_store"
)

type RefreshedError added in v0.3.1

type RefreshedError int
const (
	RefreshedErrorNone           RefreshedError = 0
	RefreshedErrorInvalidAccount RefreshedError = 1
	// RefreshedErrorSigningIdentity: external certificate, key or profile is invalid or incompatible.
	RefreshedErrorSigningIdentity RefreshedError = 2
	// RefreshedErrorSigning: signing failed or the signed output did not pass verification.
	RefreshedErrorSigning RefreshedError = 3
	// RefreshedErrorTransport: the device could not be reached or the installation failed on it.
	RefreshedErrorTransport    RefreshedError = 4
	RefreshedErrorInvalidOther RefreshedError = 99
)

type RemoteDevice added in v0.4.0

type RemoteDevice struct {
	ID                string `json:"id"`
	AccountID         string `json:"account_id"`
	Model             string `json:"model"`
	Name              string `json:"name"`
	RemotePairingUDID string `json:"remotepairing_udid"`
}

func (*RemoteDevice) GetDeviceClass added in v0.4.0

func (d *RemoteDevice) GetDeviceClass() string

type SavedSource added in v0.6.0

type SavedSource struct {
	ID        uint      `gorm:"primarykey" json:"id"`
	CreatedAt time.Time `json:"created_at"`
	URL       string    `gorm:"uniqueIndex" json:"url"` // normalized source URL
	Name      string    `json:"name"`                   // source name when it was saved
}

SavedSource is an AltStore source the user saved to browse and search its apps.

type ServiceStatus

type ServiceStatus struct {
	Name    string `json:"name"`
	Running bool   `json:"running"`
}

type SigningIdentity added in v0.6.0

type SigningIdentity struct {
	ID        uint      `gorm:"primarykey" json:"id"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`

	Name string `json:"name"`

	CertificateSHA1         string    `gorm:"size:40;index" json:"certificate_sha1"`
	CertificateSHA256       string    `gorm:"size:64;uniqueIndex:idx_signing_identity_cert_profile" json:"certificate_sha256"`
	CertificateCommonName   string    `json:"certificate_common_name"`
	CertificateSerialNumber string    `json:"certificate_serial_number"`
	CertificateNotBefore    time.Time `json:"certificate_not_before"`
	CertificateNotAfter     time.Time `json:"certificate_not_after"`
	TeamID                  string    `gorm:"size:16;index" json:"team_id"`
	TeamName                string    `json:"team_name"`

	ProfileUUID                  string      `gorm:"size:64;uniqueIndex:idx_signing_identity_cert_profile" json:"profile_uuid"`
	ProfileName                  string      `json:"profile_name"`
	ProfileAppIDName             string      `json:"profile_app_id_name"`
	ProfileApplicationIdentifier string      `json:"profile_application_identifier"`
	ProfileKind                  ProfileKind `gorm:"size:32" json:"profile_kind"`
	ProfilePlatforms             []string    `gorm:"serializer:json" json:"profile_platforms"`
	ProfileDeviceCount           int         `json:"profile_device_count"`
	ProfileProvisionsAllDevices  bool        `json:"profile_provisions_all_devices"`
	ProfileCreationDate          time.Time   `json:"profile_creation_date"`
	ProfileExpirationDate        time.Time   `json:"profile_expiration_date"`

	// Revision starts at 1 and increases each time the profile is replaced.
	Revision int `json:"revision"`

	CertificateDER   []byte `json:"-"`
	SealedPrivateKey []byte `json:"-"`
	ProfileData      []byte `json:"-"`
}

SigningIdentity is an imported certificate and private key together with the provisioning profile used to sign apps in SigningModeExternalCertificate.

The private key is persisted only in sealed (authenticated encryption) form. Raw material is excluded from JSON. The model has no soft-delete column so a delete really removes the sealed key from the database.

func (SigningIdentity) ExpiresAt added in v0.6.0

func (s SigningIdentity) ExpiresAt() time.Time

ExpiresAt returns the effective signing deadline: the earlier of the certificate and provisioning profile expirations.

type SigningMode added in v0.6.0

type SigningMode string

SigningMode selects how an app is signed before installation.

const (
	// SigningModeAppleID signs through PlumeImpactor with an Apple ID session.
	SigningModeAppleID SigningMode = "apple_id"
	// SigningModeExternalCertificate signs with an imported P12 identity and its
	// provisioning profile, without any Apple ID session.
	SigningModeExternalCertificate SigningMode = "external_certificate"
)

func (SigningMode) IsValid added in v0.6.0

func (m SigningMode) IsValid() bool

IsValid reports whether m is a known signing mode. The empty mode is not valid.

func (SigningMode) OrDefault added in v0.6.0

func (m SigningMode) OrDefault() SigningMode

OrDefault maps the empty mode of historical records and legacy clients to SigningModeAppleID.

Jump to

Keyboard shortcuts

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