Skip to content

Generated API reference

A sanitized, typed error. Secret input values are never included in its fields.

  • Error

new UdidToolsError(code, message, options?): UdidToolsError

UdidToolsErrorCode

string

UdidToolsErrorOptions = {}

UdidToolsError

Error.constructor

optional cause?: unknown

Error.cause

readonly code: UdidToolsErrorCode

readonly details: Readonly<Record<string, unknown>> | undefined

message: string

Error.message

name: string

Error.name

optional stack?: string

Error.stack

static stackTraceLimit: number

The Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)).

The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed.

If set to a non-number value, or set to a negative number, stack traces will not capture any frames.

Error.stackTraceLimit

static captureStackTrace(targetObject, constructorOpt?): void

Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.

const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack; // Similar to `new Error().stack`

The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.

The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.

The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:

function a() {
b();
}
function b() {
c();
}
function c() {
// Create an error without stack trace to avoid calculating the stack trace twice.
const { stackTraceLimit } = Error;
Error.stackTraceLimit = 0;
const error = new Error();
Error.stackTraceLimit = stackTraceLimit;
// Capture the stack trace above function b
Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
throw error;
}
a();

object

Function

void

Error.captureStackTrace

static prepareStackTrace(err, stackTraces): any

Error

CallSite[]

any

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Error.prepareStackTrace

Sanitized public metadata for an embedded CMS signer certificate.

readonly issuer: string

readonly notAfter: Date

readonly notBefore: Date

readonly serialNumber: string

readonly sha256Fingerprint: string

readonly subject: string


A textual binary container with an explicit, strict decoding rule.

readonly encoding: "base64" | "pem"

readonly value: string


Generated XML or CMS profile bytes and format metadata.

readonly contentType: "application/x-apple-aspen-config"

readonly data: Uint8Array

readonly profile: object

readonly identifier: string

readonly kind: "profile-service"

readonly uuid: string

readonly protection: object

readonly encrypted: false

readonly signed: boolean


Controls response acceptance, correlation, normalization, and resource limits.

readonly optional allowUnsigned?: boolean

readonly optional expectedAttributes?: readonly ("UDID" | "VERSION" | "PRODUCT" | "SERIAL" | "IMEI" | "MEID" | "ICCID" | "MAC_ADDRESS_EN0")[]

readonly optional expectedChallenge?: ProfileServiceChallenge

readonly optional limits?: Partial<ResourceLimits>

readonly optional requiredAttributes?: readonly ("UDID" | "VERSION" | "PRODUCT" | "SERIAL" | "IMEI" | "MEID" | "ICCID" | "MAC_ADDRESS_EN0")[]

readonly optional verification?: ResponseVerificationOptions


PKCS#12/PFX signing identity supported by the beta cryptographic profile.

readonly data: BinaryInput

readonly optional passphrase?: string

readonly type: "pkcs12"


A lossless property-list dictionary. Decoded dictionaries have a null prototype.

[key: string]: PlistValue


Input to generateProfile.

readonly optional limits?: Partial<ResourceLimits>

readonly profile: ProfileServiceDefinition

readonly optional signing?: SigningOptions


Known Apple response fields normalized to JavaScript naming.

readonly optional iccid?: string

readonly optional imei?: string

readonly optional macAddressEn0?: string

readonly optional meid?: string

readonly optional product?: string

readonly optional serialNumber?: string

readonly optional udid?: string

readonly optional version?: string


Complete typed definition of Apple’s special Profile Service profile.

readonly optional description?: string

readonly displayName: string

readonly optional extensions?: Readonly<Record<string, PlistValue>>

Additional top-level fields retained for forwards compatibility.

readonly identifier: string

readonly kind: "profile-service"

readonly optional organization?: string

readonly service: object

readonly optional challenge?: ProfileServiceChallenge

readonly deviceAttributes: readonly DeviceAttribute[]

readonly optional extensions?: Readonly<Record<string, PlistValue>>

readonly responseUrl: string

readonly optional uuid?: string


Verified and decoded Apple Profile Service device response.

readonly attributes: ProfileServiceAttributes

readonly optional challenge?: string | Uint8Array<ArrayBufferLike>

readonly raw: Readonly<Record<string, PlistValue>>

readonly signature: object

readonly present: boolean

readonly signers: readonly CertificateInfo[]

readonly trusted: boolean | null

readonly valid: boolean | null


Bounded-work policy applied before and during parsing, encoding, and crypto.

readonly maxArrayItems: number

readonly maxAsn1Depth: number

readonly maxAsn1Nodes: number

readonly maxCertificateBytes: number

readonly maxCertificates: number

readonly maxDictionaryKeys: number

readonly maxInputBytes: number

readonly maxOutputBytes: number

readonly maxPlistDepth: number

readonly maxStringBytes: number


Optional signing configuration. Its presence requests signed output.

readonly optional certificateChain?: readonly BinaryInput[]

readonly optional digestAlgorithm?: "sha256"

readonly identity: Pkcs12SigningIdentity


readonly optional details?: Readonly<Record<string, unknown>>


readonly code: UdidToolsWarningCode

readonly optional details?: Readonly<Record<string, unknown>>

readonly message: string

BinaryInput = EncodedBinaryInput | Uint8Array

Binary bytes or their explicit base64/PEM representation.


CertificateInput = BinaryInput

X.509 certificate input in DER bytes, canonical base64, or PEM.


CustomDeviceAttribute = string & object

Deliberately opted-in, forward-compatible uppercase device attribute.

readonly [customDeviceAttributeBrand]: true


DeviceAttribute = CustomDeviceAttribute | KnownDeviceAttribute

A known or explicitly branded custom Profile Service attribute name.


KnownDeviceAttribute = typeof KNOWN_DEVICE_ATTRIBUTES[number]

A device attribute currently normalized by the public response API.


PlistPrimitive = boolean | Date | number | string | Uint8Array

Scalar values supported by the XML property-list codec.


PlistValue = PlistPrimitive | readonly PlistValue[] | PlistDictionary

Any value representable by the library’s bounded XML property-list codec.


ProfileServiceChallenge = { type: "data"; value: Uint8Array; } | { type: "string"; value: string; }

Opaque correlation value included in the request profile and device response.


ProfileServiceResponseInput = ArrayBuffer | string | Uint8Array

Raw CMS/XML input accepted by the response parser.


ResourceLimitsInput = Partial<ResourceLimits>

Per-call resource-limit overrides.


ResponseVerificationOptions = { mode: "none"; } | { mode: "signature"; } | { intermediates?: readonly CertificateInput[]; mode: "trust-chain"; trustAnchors: readonly CertificateInput[]; }

Explicit response verification policy; no system trust is used.


Result<T> = { ok: true; value: T; warnings: readonly UdidToolsWarning[]; } | { error: UdidToolsError; ok: false; }

Non-throwing operation result. Successful values may include actionable, non-fatal warnings; failures contain one sanitized typed error.

T


UdidToolsErrorCode = "CERTIFICATE_KEY_MISMATCH" | "CHALLENGE_MISMATCH" | "INCORRECT_PASSPHRASE" | "INPUT_TOO_LARGE" | "INTERNAL_ERROR" | "INVALID_CERTIFICATE" | "INVALID_CONFIGURATION" | "INVALID_PKCS12" | "INVALID_PRIVATE_KEY" | "INVALID_PROFILE_IDENTIFIER" | "INVALID_RESPONSE_URL" | "INVALID_SIGNATURE" | "MALFORMED_CMS" | "MALFORMED_PLIST" | "MISSING_CHALLENGE" | "MISSING_REQUIRED_ATTRIBUTE" | "MISSING_SIGNING_MATERIAL" | "OUTPUT_TOO_LARGE" | "PROFILE_SIGNING_FAILED" | "UNSUPPORTED_ALGORITHM" | "UNTRUSTED_SIGNER"

Stable machine-readable error codes returned by the public API.


UdidToolsWarningCode = "CERTIFICATE_EXPIRES_SOON" | "CERTIFICATE_NOT_YET_VALID" | "DUPLICATE_CERTIFICATE_IGNORED" | "INSECURE_RESPONSE_URL" | "OPTIONAL_ATTRIBUTE_MISSING" | "SIGNER_TRUST_NOT_CHECKED" | "UNKNOWN_RESPONSE_ATTRIBUTE"

const DEFAULT_LIMITS: Readonly<ResourceLimits>

Security-oriented defaults used independently for every operation.


const KNOWN_DEVICE_ATTRIBUTES: readonly ["UDID", "VERSION", "PRODUCT", "SERIAL", "IMEI", "MEID", "ICCID", "MAC_ADDRESS_EN0"]

Attribute names documented across Apple’s Profile Service examples.

customDeviceAttribute(value): CustomDeviceAttribute

Opt into a future or vendor-specific Profile Service attribute while keeping accidental arbitrary strings out of the normal typed configuration path.

string

CustomDeviceAttribute


generateProfile(options): Promise<Result<GeneratedProfile>>

Generate unsigned XML or signed CMS profile bytes without throwing.

ProfileGenerationOptions

Promise<Result<GeneratedProfile>>


generateProfileOrThrow(options): Promise<GeneratedProfile>

Generate a profile and throw UdidToolsError on failure.

ProfileGenerationOptions

Promise<GeneratedProfile>


parseProfileServiceResponse(input, options?): Promise<Result<ProfileServiceResponse>>

Verify, correlate, and parse a Profile Service response without throwing.

ProfileServiceResponseInput

ParseProfileServiceResponseOptions = {}

Promise<Result<ProfileServiceResponse>>


parseProfileServiceResponseOrThrow(input, options?): Promise<ProfileServiceResponse>

Parse a Profile Service response and throw UdidToolsError on failure.

ProfileServiceResponseInput

ParseProfileServiceResponseOptions = {}

Promise<ProfileServiceResponse>