@oniroproject/core 0.15.1 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -392,11 +392,39 @@ declare function extractZipWithProgress(opts: ExtractZipOptions): Promise<void>;
392
392
  * archive path and skips the entry when it returns false.
393
393
  */
394
394
  declare function extractTarball(tarPath: string, dest: string, strip?: number, filter?: (entryPath: string) => boolean): Promise<void>;
395
+ /**
396
+ * Read-window size for opening a HAP. node-stream-zip never grows its window past
397
+ * `chunkSize` (by default about a thousandth of the file) while reading the
398
+ * central directory, and hap-sign-tool pads each signed HAP's directory records
399
+ * with kilobytes of alignment, so with the default every signed HAP fails with
400
+ * "Entries read error". The library caps the value at 128 KiB.
401
+ */
402
+ declare const SIGNED_HAP_CHUNK_SIZE: number;
403
+ /** An open ZIP's central directory: what `withHapZip` hands its callback. */
404
+ interface HapZip {
405
+ /** Every entry, by name. */
406
+ entries(): Record<string, ZipEntry>;
407
+ /** The contents of the entry called `name`. */
408
+ entryData(name: string): Buffer;
409
+ }
410
+ /**
411
+ * Open the ZIP at `zipPath` (a HAP, signed or not) for `use`, and close it again,
412
+ * whether or not it opened. Uses the callback API: on the async wrapper, `close()`
413
+ * waits for the open to succeed, so after a failed open (not a ZIP, truncated) it
414
+ * throws without closing the file, which then stays locked on Windows.
415
+ */
416
+ declare function withHapZip<T>(zipPath: string, use: (zip: HapZip) => T | Promise<T>): Promise<T>;
395
417
  /**
396
418
  * Contents of the first entry of a ZIP whose name `match` accepts, or undefined. Reads
397
419
  * only the central directory and that entry, so it is cheap on multi-hundred-MB ZIPs.
398
420
  */
399
421
  declare function readZipEntry(zipPath: string, match: (entryName: string) => boolean): Promise<Buffer | undefined>;
422
+ interface ZipEntry {
423
+ name: string;
424
+ isDirectory: boolean;
425
+ isSymbolicLink?: boolean;
426
+ attr?: number;
427
+ }
400
428
 
401
429
  interface SdkInfo {
402
430
  version: string;
@@ -665,6 +693,59 @@ declare function detectSigningConfigNames(projectDir: string): string[];
665
693
  */
666
694
  declare function generateSigningConfigs(options: GenerateSigningConfigsOptions): void;
667
695
 
696
+ /** What signing needs to know about a built HAP. */
697
+ interface HapSigningInfo {
698
+ bundleName: string;
699
+ /** Every `module.requestPermissions[].name` the HAP declares. */
700
+ requestedPermissions: string[];
701
+ /** `app.compileSdkType`: `OpenHarmony` or `HarmonyOS`; older toolchains do not write it. */
702
+ compileSdkType?: string;
703
+ /** `app.targetAPIVersion`, e.g. 23. */
704
+ targetApiVersion?: number;
705
+ }
706
+ /** Read a HAP's bundle name and requested permissions from the `module.json` packed in it. */
707
+ declare function readHapSigningInfo(hapPath: string): Promise<HapSigningInfo>;
708
+ /**
709
+ * Where the signed copy of `hapPath` goes by default: next to it, as hvigor names
710
+ * its outputs (`entry-default-unsigned.hap` → `entry-default-signed.hap`,
711
+ * `app.hap` → `app-signed.hap`). Never the input itself: `entry-default-signed.hap`
712
+ * becomes `entry-default-resigned.hap`, so re-signing in place takes an explicit `--out`.
713
+ */
714
+ declare function defaultSignedHapPath(hapPath: string): string;
715
+
716
+ interface SignOpenHarmonyHapOptions {
717
+ /** The HAP to sign: unsigned, or signed with other material. */
718
+ hapPath: string;
719
+ /** Where to write the signed HAP. Default {@link defaultSignedHapPath}. May equal `hapPath`. */
720
+ outPath?: string;
721
+ /** The OS-specific SDK home (the folder holding API-version subfolders). */
722
+ sdkHome: string;
723
+ /** As for {@link generateSigningConfigs}. Default `normal`. */
724
+ apl?: Apl;
725
+ appFeature?: AppFeature;
726
+ acls?: string[];
727
+ appPrivilegeCapabilities?: string[];
728
+ passwords?: SigningPasswords;
729
+ /** Override the bundled application cert chain (application-release kind only). */
730
+ applicationCertPath?: string;
731
+ logger?: Logger;
732
+ }
733
+ interface SignOpenHarmonyHapResult {
734
+ bundleName: string;
735
+ outPath: string;
736
+ /** API level of the SDK whose signing material was used. */
737
+ sdkApi: string;
738
+ kind: SigningKind;
739
+ }
740
+ /**
741
+ * Sign a prebuilt HAP, with no project, for OpenHarmony devices: the SDK's
742
+ * development certificate, as `generateSigningConfigs` sets up for a project,
743
+ * and a profile for the HAP's own bundle name. Fully offline; the material is
744
+ * generated in a temporary directory and removed afterwards, since it costs
745
+ * nothing to make again. Requires `java` on PATH.
746
+ */
747
+ declare function signOpenHarmonyHap(opts: SignOpenHarmonyHapOptions): Promise<SignOpenHarmonyHapResult>;
748
+
668
749
  interface InstallEmulatorOptions {
669
750
  config: ConfigProvider;
670
751
  progress?: ProgressReporter;
@@ -2610,6 +2691,31 @@ interface HarmonyOsSigningResult {
2610
2691
  */
2611
2692
  declare function harmonyOsAutoSign(opts: HarmonyOsAutoSignOptions): Promise<HarmonyOsSigningResult>;
2612
2693
 
2694
+ interface HarmonyOsSignHapOptions {
2695
+ config: ConfigProvider;
2696
+ session: HarmonyOsSession;
2697
+ /** The HAP to sign: unsigned, or signed with other material. */
2698
+ hapPath: string;
2699
+ /** Where to write the signed HAP. Default {@link defaultSignedHapPath}. May equal `hapPath`. */
2700
+ outPath?: string;
2701
+ /** AGC team. Defaults to the signed-in account's own id. */
2702
+ teamId?: string;
2703
+ /** Regenerate the material even when the existing material is still valid. */
2704
+ force?: boolean;
2705
+ http?: HarmonyOsHttpClient;
2706
+ logger?: Logger;
2707
+ }
2708
+ interface HarmonyOsSignHapResult extends HarmonyOsSigningResult {
2709
+ /** The signed HAP. */
2710
+ outPath: string;
2711
+ }
2712
+ /**
2713
+ * Sign a prebuilt HAP, with no project, for HarmonyOS devices: the bundle name and
2714
+ * ACL permissions come from its `module.json`, AGC issues (or the previous run
2715
+ * left) a debug certificate and profile, and hap-sign-tool signs a copy.
2716
+ */
2717
+ declare function harmonyOsSignHap(opts: HarmonyOsSignHapOptions): Promise<HarmonyOsSignHapResult>;
2718
+
2613
2719
  declare const VERSION: string;
2614
2720
 
2615
- export { ALL_SDKS, APL_VALUES, APP_FEATURE_VALUES, type AbilityInfo, type AgcAuthInfo, AgcError, type Apl, type AppFeature, type ApplyChangesOptions, type ApplyChangesResult, type BuildHapOptions, type BuildHapResult, type BundleOptions, CancelledError, type CaptureBurstOptions, type CaptureLogOptions, type CaptureLogResult, ChecksumMismatchError, type CmdToolsFlavour, CmdToolsNotInstalledError, type CmdToolsStatus, type CmdWrapper, type CodelinterFinding, type CodelinterReport, type CodelinterResult, type CodelinterSummary, CommandFailedError, type ConfigKey, type ConfigProvider, type CreateScaffoldOptions, type CreateScaffoldResult, type DeveloperAgreementStatus, type DeviceFullInfo, type DeviceInfo, type DiscoverHapsOptions, type DisplaySize, type DisplaySizeOptions, type DownloadOptions, type DumpLayoutOptions, type DumpLayoutResult, type DumpLogOptions, type EmulatorStatus, type ExtractZipOptions, type FlatLayoutNode, type GenerateSigningConfigsOptions, type GestureUitestOptions, type GetDeviceInfoOptions, HARMONYOS_SDK_VERSIONS, HUAWEI_SITES, type HapAssetDiff, type HarmonyOsAutoSignOptions, type HarmonyOsSdk, type HarmonyOsSession, type HarmonyOsSessionOptions, type HarmonyOsSigningResult, type HdcExecOptions, type HdcExecResult, type HdcShellOptions, type HidumperOptions, type HilogEntry, type HilogLevel, type HuaweiSite, type HuaweiSiteCode, type HuaweiTeam, type HuaweiUserInfo, INSTALL_TMP_DIRNAME, type InputType, type InstallAppOptions, type InstallAppResult, type InstallCandidate, type InstallCmdToolsOptions, type InstallEmulatorOptions, type InstallMethod, type InstallSdkFromArchiveOptions, type InstallSdkOptions, type InstallTempDir, type InstallTempDirOptions, type InstalledSdk, InsufficientSpaceError, type KeyboardState, type LaunchAppOptions, type LayoutNode, type LayoutSelector, type LocateTargetOptions, type LocatedTarget, type Logger, type ModuleHaps, OHOS_DAILY_BUILDS_URL, OHOS_URL_BASE, type OniroContext, OniroError, type OsFolder, type OutputSink, type ParamOptions, type PerformInputOptions, type PerformInputResult, type PickTargetFailure, type PickedHap, type PrepareSigningOptions, type PrepareSigningResult, type ProgressReporter, type ProgressUpdate, type ProjectModule, type Prompter, type ProvisionProfileInfo, type RawLayoutNode, type RawTouchEvent, type RebootDecision, type RebootOptions, type RecvFileOptions, type RunCodelinterOptions, type RunHvigorwOptions, type RunHvigorwResult, type RunOhpmOptions, type RunProcessOptions, type RunningProcess, type RuntimeOs, SIGNING_ERRORS, type ScreenDump, type Screenshot, type ScreenshotOptions, type SdkArchiveInfo, type SdkInfo, SdkNotInstalledError, type SdkRelease, type SendFileOptions, type SendGestureOptions, type SendInputOptions, type SendRawTouchOptions, type SetHilogLevelOptions, type SigningKind, type SigningMaterialPaths, type SigningPasswords, type StartEmulatorOptions, type StoredSession, type StreamHilogOptions, TMP_DIR_HINT, TargetNotFoundError, type TemplateOption, type TokenStore, type UiInputType, UnsupportedPlatformError, VERSION, type WaitForBootOptions, type WaitForBundleOptions, type WaitForConditionOptions, type WaitForLogOptions, type WaitForTargetOptions, type WatchLogOptions, type Waypoint, appSandboxDir, applyChanges, assertDevicePath, assertLayoutSelector, attemptHdcConnection, buildCmdWrapper, buildGestureCommands, buildGestureUitestCommand, buildHap, buildHvigorwArgs, buildInputCommand, buildRawTouchCommand, bundleNameFromHapConfig, captureBurst, captureLog, cleanCodelinterOutput, consoleLogger, createHarmonyOsSession, createInstallTempDir, createMaterial, createScaffold, createTempWorkDir, createTokenStore, decideInstallMethod, decideReboot, decryptPwd, dedupEntries, defaultContext, defaultPaths, describeLayoutNode, detectAaStartFailure, detectCmdToolsFlavour, detectInstallFailure, detectProjectSdkVersion, detectRuntimeOs, detectSigningConfigNames, diagnoseBuildFailure, diffEntryNames, diffHapAssets, discoverHaps, downloadAndInstallSdk, downloadFile, dumpLayout, dumpLog, dumpRenderService, dumpScreen, dumpWindow, encryptPwd, ensureFreeSpace, ensureInstallOk, ensureOhModules, ensureOk, ensureRemoteOk, escapeCmdArgument, escapeCmdCommand, existingHapOrUnsigned, extractTarball, extractZipWithProgress, findAppProcessId, findCmdToolsSourceDir, findCoveredNodes, findHarmonyOsSdk, findKeyboardWindow, findLayoutNodes, findMissingProjectSdk, findRunningProcess, findSdkOsDir, flattenLayout, forceStop, formatBytes, generateSigningConfigs, getBundleName, getCmdToolsBin, getCmdToolsDownloadUrl, getCmdToolsPath, getCmdToolsStatus, getDeviceInfo, getDisplaySize, getEmulatorDir, getEmulatorStatus, getFreeSpaceBytes, getHdcPath, getHvigorwPath, getImeBundles, getInstalledSdks, getKey, getMainAbility, getOhosBaseSdkHome, getOhpmPath, getOsFolder, getSdkFilename, getSdkRootDir, getSupportedSdksForUi, harmonyOsAutoSign, harmonyOsSdkLabelForApi, hdcClientFailure, hdcExec, hdcTargetArgs, hdcTargetArgsFor, hideKeyboard, hilogTimeMs, installApp, installCmdTools, installEmulator, installFailureReason, installSdkFromArchive, isBundleInstalled, isCmdToolsInstalled, isEmulatorInstalled, isOutOfSpaceError, isRamBackedPath, isUnsignedHap, isUsableDevice, isValidBundleName, isValidProjectName, killProcessTree, launchApp, listAbilities, listDevices, listModules, listRunningProcesses, listTemplates, locateTarget, missingProjectRootFiles, needsCmdWrapper, nonInteractivePrompter, noopLogger, noopProgress, normaliseLocalPath, paramGet, paramGetMany, paramSet, parseBounds, parseCodelinterFindings, parseCodelinterReport, parseDeviceList, parseHilogLine, parseImeBundles, parseMainAbilityFromBmDump, parseParamValues, parseRemoteExit, performInput, pickHap, pickSigningKind, pickTarget, prepareSigning, pruneLayout, readHapBundleName, readJson5File, readJsonFile, readProvisionProfile, readZipEntry, reboot, recvFile, removeCmdTools, removeEmulator, removeSdk, removeTempWorkDir, requireHarmonyOsSdk, resolveDeviceSerial, resolveKeyEvent, resolveTmpRoot, runCodelinter, runHvigorw, runOhpm, runProcess, scopedLogger, selectDevice, sendFile, sendGesture, sendInput, sendRawTouch, setHilogLevel, shell, shellChecked, spawnCompat, startEmulator, staticConfig, stopEmulator, streamHilog, takeScreenshot, toLongPath, toSpaceError, uninstallApp, unsignedHapRejection, validateTemplateLayout, verifySha256, waitForBoot, waitForBundle, waitForCondition, waitForLog, waitForTarget, watchLog, waypointsToRawEvents, withoutWindow, writeJson5File, writeJsonFile };
2721
+ export { ALL_SDKS, APL_VALUES, APP_FEATURE_VALUES, type AbilityInfo, type AgcAuthInfo, AgcError, type Apl, type AppFeature, type ApplyChangesOptions, type ApplyChangesResult, type BuildHapOptions, type BuildHapResult, type BundleOptions, CancelledError, type CaptureBurstOptions, type CaptureLogOptions, type CaptureLogResult, ChecksumMismatchError, type CmdToolsFlavour, CmdToolsNotInstalledError, type CmdToolsStatus, type CmdWrapper, type CodelinterFinding, type CodelinterReport, type CodelinterResult, type CodelinterSummary, CommandFailedError, type ConfigKey, type ConfigProvider, type CreateScaffoldOptions, type CreateScaffoldResult, type DeveloperAgreementStatus, type DeviceFullInfo, type DeviceInfo, type DiscoverHapsOptions, type DisplaySize, type DisplaySizeOptions, type DownloadOptions, type DumpLayoutOptions, type DumpLayoutResult, type DumpLogOptions, type EmulatorStatus, type ExtractZipOptions, type FlatLayoutNode, type GenerateSigningConfigsOptions, type GestureUitestOptions, type GetDeviceInfoOptions, HARMONYOS_SDK_VERSIONS, HUAWEI_SITES, type HapAssetDiff, type HapSigningInfo, type HapZip, type HarmonyOsAutoSignOptions, type HarmonyOsSdk, type HarmonyOsSession, type HarmonyOsSessionOptions, type HarmonyOsSignHapOptions, type HarmonyOsSignHapResult, type HarmonyOsSigningResult, type HdcExecOptions, type HdcExecResult, type HdcShellOptions, type HidumperOptions, type HilogEntry, type HilogLevel, type HuaweiSite, type HuaweiSiteCode, type HuaweiTeam, type HuaweiUserInfo, INSTALL_TMP_DIRNAME, type InputType, type InstallAppOptions, type InstallAppResult, type InstallCandidate, type InstallCmdToolsOptions, type InstallEmulatorOptions, type InstallMethod, type InstallSdkFromArchiveOptions, type InstallSdkOptions, type InstallTempDir, type InstallTempDirOptions, type InstalledSdk, InsufficientSpaceError, type KeyboardState, type LaunchAppOptions, type LayoutNode, type LayoutSelector, type LocateTargetOptions, type LocatedTarget, type Logger, type ModuleHaps, OHOS_DAILY_BUILDS_URL, OHOS_URL_BASE, type OniroContext, OniroError, type OsFolder, type OutputSink, type ParamOptions, type PerformInputOptions, type PerformInputResult, type PickTargetFailure, type PickedHap, type PrepareSigningOptions, type PrepareSigningResult, type ProgressReporter, type ProgressUpdate, type ProjectModule, type Prompter, type ProvisionProfileInfo, type RawLayoutNode, type RawTouchEvent, type RebootDecision, type RebootOptions, type RecvFileOptions, type RunCodelinterOptions, type RunHvigorwOptions, type RunHvigorwResult, type RunOhpmOptions, type RunProcessOptions, type RunningProcess, type RuntimeOs, SIGNED_HAP_CHUNK_SIZE, SIGNING_ERRORS, type ScreenDump, type Screenshot, type ScreenshotOptions, type SdkArchiveInfo, type SdkInfo, SdkNotInstalledError, type SdkRelease, type SendFileOptions, type SendGestureOptions, type SendInputOptions, type SendRawTouchOptions, type SetHilogLevelOptions, type SignOpenHarmonyHapOptions, type SignOpenHarmonyHapResult, type SigningKind, type SigningMaterialPaths, type SigningPasswords, type StartEmulatorOptions, type StoredSession, type StreamHilogOptions, TMP_DIR_HINT, TargetNotFoundError, type TemplateOption, type TokenStore, type UiInputType, UnsupportedPlatformError, VERSION, type WaitForBootOptions, type WaitForBundleOptions, type WaitForConditionOptions, type WaitForLogOptions, type WaitForTargetOptions, type WatchLogOptions, type Waypoint, appSandboxDir, applyChanges, assertDevicePath, assertLayoutSelector, attemptHdcConnection, buildCmdWrapper, buildGestureCommands, buildGestureUitestCommand, buildHap, buildHvigorwArgs, buildInputCommand, buildRawTouchCommand, bundleNameFromHapConfig, captureBurst, captureLog, cleanCodelinterOutput, consoleLogger, createHarmonyOsSession, createInstallTempDir, createMaterial, createScaffold, createTempWorkDir, createTokenStore, decideInstallMethod, decideReboot, decryptPwd, dedupEntries, defaultContext, defaultPaths, defaultSignedHapPath, describeLayoutNode, detectAaStartFailure, detectCmdToolsFlavour, detectInstallFailure, detectProjectSdkVersion, detectRuntimeOs, detectSigningConfigNames, diagnoseBuildFailure, diffEntryNames, diffHapAssets, discoverHaps, downloadAndInstallSdk, downloadFile, dumpLayout, dumpLog, dumpRenderService, dumpScreen, dumpWindow, encryptPwd, ensureFreeSpace, ensureInstallOk, ensureOhModules, ensureOk, ensureRemoteOk, escapeCmdArgument, escapeCmdCommand, existingHapOrUnsigned, extractTarball, extractZipWithProgress, findAppProcessId, findCmdToolsSourceDir, findCoveredNodes, findHarmonyOsSdk, findKeyboardWindow, findLayoutNodes, findMissingProjectSdk, findRunningProcess, findSdkOsDir, flattenLayout, forceStop, formatBytes, generateSigningConfigs, getBundleName, getCmdToolsBin, getCmdToolsDownloadUrl, getCmdToolsPath, getCmdToolsStatus, getDeviceInfo, getDisplaySize, getEmulatorDir, getEmulatorStatus, getFreeSpaceBytes, getHdcPath, getHvigorwPath, getImeBundles, getInstalledSdks, getKey, getMainAbility, getOhosBaseSdkHome, getOhpmPath, getOsFolder, getSdkFilename, getSdkRootDir, getSupportedSdksForUi, harmonyOsAutoSign, harmonyOsSdkLabelForApi, harmonyOsSignHap, hdcClientFailure, hdcExec, hdcTargetArgs, hdcTargetArgsFor, hideKeyboard, hilogTimeMs, installApp, installCmdTools, installEmulator, installFailureReason, installSdkFromArchive, isBundleInstalled, isCmdToolsInstalled, isEmulatorInstalled, isOutOfSpaceError, isRamBackedPath, isUnsignedHap, isUsableDevice, isValidBundleName, isValidProjectName, killProcessTree, launchApp, listAbilities, listDevices, listModules, listRunningProcesses, listTemplates, locateTarget, missingProjectRootFiles, needsCmdWrapper, nonInteractivePrompter, noopLogger, noopProgress, normaliseLocalPath, paramGet, paramGetMany, paramSet, parseBounds, parseCodelinterFindings, parseCodelinterReport, parseDeviceList, parseHilogLine, parseImeBundles, parseMainAbilityFromBmDump, parseParamValues, parseRemoteExit, performInput, pickHap, pickSigningKind, pickTarget, prepareSigning, pruneLayout, readHapBundleName, readHapSigningInfo, readJson5File, readJsonFile, readProvisionProfile, readZipEntry, reboot, recvFile, removeCmdTools, removeEmulator, removeSdk, removeTempWorkDir, requireHarmonyOsSdk, resolveDeviceSerial, resolveKeyEvent, resolveTmpRoot, runCodelinter, runHvigorw, runOhpm, runProcess, scopedLogger, selectDevice, sendFile, sendGesture, sendInput, sendRawTouch, setHilogLevel, shell, shellChecked, signOpenHarmonyHap, spawnCompat, startEmulator, staticConfig, stopEmulator, streamHilog, takeScreenshot, toLongPath, toSpaceError, uninstallApp, unsignedHapRejection, validateTemplateLayout, verifySha256, waitForBoot, waitForBundle, waitForCondition, waitForLog, waitForTarget, watchLog, waypointsToRawEvents, withHapZip, withoutWindow, writeJson5File, writeJsonFile };
package/dist/index.d.ts CHANGED
@@ -392,11 +392,39 @@ declare function extractZipWithProgress(opts: ExtractZipOptions): Promise<void>;
392
392
  * archive path and skips the entry when it returns false.
393
393
  */
394
394
  declare function extractTarball(tarPath: string, dest: string, strip?: number, filter?: (entryPath: string) => boolean): Promise<void>;
395
+ /**
396
+ * Read-window size for opening a HAP. node-stream-zip never grows its window past
397
+ * `chunkSize` (by default about a thousandth of the file) while reading the
398
+ * central directory, and hap-sign-tool pads each signed HAP's directory records
399
+ * with kilobytes of alignment, so with the default every signed HAP fails with
400
+ * "Entries read error". The library caps the value at 128 KiB.
401
+ */
402
+ declare const SIGNED_HAP_CHUNK_SIZE: number;
403
+ /** An open ZIP's central directory: what `withHapZip` hands its callback. */
404
+ interface HapZip {
405
+ /** Every entry, by name. */
406
+ entries(): Record<string, ZipEntry>;
407
+ /** The contents of the entry called `name`. */
408
+ entryData(name: string): Buffer;
409
+ }
410
+ /**
411
+ * Open the ZIP at `zipPath` (a HAP, signed or not) for `use`, and close it again,
412
+ * whether or not it opened. Uses the callback API: on the async wrapper, `close()`
413
+ * waits for the open to succeed, so after a failed open (not a ZIP, truncated) it
414
+ * throws without closing the file, which then stays locked on Windows.
415
+ */
416
+ declare function withHapZip<T>(zipPath: string, use: (zip: HapZip) => T | Promise<T>): Promise<T>;
395
417
  /**
396
418
  * Contents of the first entry of a ZIP whose name `match` accepts, or undefined. Reads
397
419
  * only the central directory and that entry, so it is cheap on multi-hundred-MB ZIPs.
398
420
  */
399
421
  declare function readZipEntry(zipPath: string, match: (entryName: string) => boolean): Promise<Buffer | undefined>;
422
+ interface ZipEntry {
423
+ name: string;
424
+ isDirectory: boolean;
425
+ isSymbolicLink?: boolean;
426
+ attr?: number;
427
+ }
400
428
 
401
429
  interface SdkInfo {
402
430
  version: string;
@@ -665,6 +693,59 @@ declare function detectSigningConfigNames(projectDir: string): string[];
665
693
  */
666
694
  declare function generateSigningConfigs(options: GenerateSigningConfigsOptions): void;
667
695
 
696
+ /** What signing needs to know about a built HAP. */
697
+ interface HapSigningInfo {
698
+ bundleName: string;
699
+ /** Every `module.requestPermissions[].name` the HAP declares. */
700
+ requestedPermissions: string[];
701
+ /** `app.compileSdkType`: `OpenHarmony` or `HarmonyOS`; older toolchains do not write it. */
702
+ compileSdkType?: string;
703
+ /** `app.targetAPIVersion`, e.g. 23. */
704
+ targetApiVersion?: number;
705
+ }
706
+ /** Read a HAP's bundle name and requested permissions from the `module.json` packed in it. */
707
+ declare function readHapSigningInfo(hapPath: string): Promise<HapSigningInfo>;
708
+ /**
709
+ * Where the signed copy of `hapPath` goes by default: next to it, as hvigor names
710
+ * its outputs (`entry-default-unsigned.hap` → `entry-default-signed.hap`,
711
+ * `app.hap` → `app-signed.hap`). Never the input itself: `entry-default-signed.hap`
712
+ * becomes `entry-default-resigned.hap`, so re-signing in place takes an explicit `--out`.
713
+ */
714
+ declare function defaultSignedHapPath(hapPath: string): string;
715
+
716
+ interface SignOpenHarmonyHapOptions {
717
+ /** The HAP to sign: unsigned, or signed with other material. */
718
+ hapPath: string;
719
+ /** Where to write the signed HAP. Default {@link defaultSignedHapPath}. May equal `hapPath`. */
720
+ outPath?: string;
721
+ /** The OS-specific SDK home (the folder holding API-version subfolders). */
722
+ sdkHome: string;
723
+ /** As for {@link generateSigningConfigs}. Default `normal`. */
724
+ apl?: Apl;
725
+ appFeature?: AppFeature;
726
+ acls?: string[];
727
+ appPrivilegeCapabilities?: string[];
728
+ passwords?: SigningPasswords;
729
+ /** Override the bundled application cert chain (application-release kind only). */
730
+ applicationCertPath?: string;
731
+ logger?: Logger;
732
+ }
733
+ interface SignOpenHarmonyHapResult {
734
+ bundleName: string;
735
+ outPath: string;
736
+ /** API level of the SDK whose signing material was used. */
737
+ sdkApi: string;
738
+ kind: SigningKind;
739
+ }
740
+ /**
741
+ * Sign a prebuilt HAP, with no project, for OpenHarmony devices: the SDK's
742
+ * development certificate, as `generateSigningConfigs` sets up for a project,
743
+ * and a profile for the HAP's own bundle name. Fully offline; the material is
744
+ * generated in a temporary directory and removed afterwards, since it costs
745
+ * nothing to make again. Requires `java` on PATH.
746
+ */
747
+ declare function signOpenHarmonyHap(opts: SignOpenHarmonyHapOptions): Promise<SignOpenHarmonyHapResult>;
748
+
668
749
  interface InstallEmulatorOptions {
669
750
  config: ConfigProvider;
670
751
  progress?: ProgressReporter;
@@ -2610,6 +2691,31 @@ interface HarmonyOsSigningResult {
2610
2691
  */
2611
2692
  declare function harmonyOsAutoSign(opts: HarmonyOsAutoSignOptions): Promise<HarmonyOsSigningResult>;
2612
2693
 
2694
+ interface HarmonyOsSignHapOptions {
2695
+ config: ConfigProvider;
2696
+ session: HarmonyOsSession;
2697
+ /** The HAP to sign: unsigned, or signed with other material. */
2698
+ hapPath: string;
2699
+ /** Where to write the signed HAP. Default {@link defaultSignedHapPath}. May equal `hapPath`. */
2700
+ outPath?: string;
2701
+ /** AGC team. Defaults to the signed-in account's own id. */
2702
+ teamId?: string;
2703
+ /** Regenerate the material even when the existing material is still valid. */
2704
+ force?: boolean;
2705
+ http?: HarmonyOsHttpClient;
2706
+ logger?: Logger;
2707
+ }
2708
+ interface HarmonyOsSignHapResult extends HarmonyOsSigningResult {
2709
+ /** The signed HAP. */
2710
+ outPath: string;
2711
+ }
2712
+ /**
2713
+ * Sign a prebuilt HAP, with no project, for HarmonyOS devices: the bundle name and
2714
+ * ACL permissions come from its `module.json`, AGC issues (or the previous run
2715
+ * left) a debug certificate and profile, and hap-sign-tool signs a copy.
2716
+ */
2717
+ declare function harmonyOsSignHap(opts: HarmonyOsSignHapOptions): Promise<HarmonyOsSignHapResult>;
2718
+
2613
2719
  declare const VERSION: string;
2614
2720
 
2615
- export { ALL_SDKS, APL_VALUES, APP_FEATURE_VALUES, type AbilityInfo, type AgcAuthInfo, AgcError, type Apl, type AppFeature, type ApplyChangesOptions, type ApplyChangesResult, type BuildHapOptions, type BuildHapResult, type BundleOptions, CancelledError, type CaptureBurstOptions, type CaptureLogOptions, type CaptureLogResult, ChecksumMismatchError, type CmdToolsFlavour, CmdToolsNotInstalledError, type CmdToolsStatus, type CmdWrapper, type CodelinterFinding, type CodelinterReport, type CodelinterResult, type CodelinterSummary, CommandFailedError, type ConfigKey, type ConfigProvider, type CreateScaffoldOptions, type CreateScaffoldResult, type DeveloperAgreementStatus, type DeviceFullInfo, type DeviceInfo, type DiscoverHapsOptions, type DisplaySize, type DisplaySizeOptions, type DownloadOptions, type DumpLayoutOptions, type DumpLayoutResult, type DumpLogOptions, type EmulatorStatus, type ExtractZipOptions, type FlatLayoutNode, type GenerateSigningConfigsOptions, type GestureUitestOptions, type GetDeviceInfoOptions, HARMONYOS_SDK_VERSIONS, HUAWEI_SITES, type HapAssetDiff, type HarmonyOsAutoSignOptions, type HarmonyOsSdk, type HarmonyOsSession, type HarmonyOsSessionOptions, type HarmonyOsSigningResult, type HdcExecOptions, type HdcExecResult, type HdcShellOptions, type HidumperOptions, type HilogEntry, type HilogLevel, type HuaweiSite, type HuaweiSiteCode, type HuaweiTeam, type HuaweiUserInfo, INSTALL_TMP_DIRNAME, type InputType, type InstallAppOptions, type InstallAppResult, type InstallCandidate, type InstallCmdToolsOptions, type InstallEmulatorOptions, type InstallMethod, type InstallSdkFromArchiveOptions, type InstallSdkOptions, type InstallTempDir, type InstallTempDirOptions, type InstalledSdk, InsufficientSpaceError, type KeyboardState, type LaunchAppOptions, type LayoutNode, type LayoutSelector, type LocateTargetOptions, type LocatedTarget, type Logger, type ModuleHaps, OHOS_DAILY_BUILDS_URL, OHOS_URL_BASE, type OniroContext, OniroError, type OsFolder, type OutputSink, type ParamOptions, type PerformInputOptions, type PerformInputResult, type PickTargetFailure, type PickedHap, type PrepareSigningOptions, type PrepareSigningResult, type ProgressReporter, type ProgressUpdate, type ProjectModule, type Prompter, type ProvisionProfileInfo, type RawLayoutNode, type RawTouchEvent, type RebootDecision, type RebootOptions, type RecvFileOptions, type RunCodelinterOptions, type RunHvigorwOptions, type RunHvigorwResult, type RunOhpmOptions, type RunProcessOptions, type RunningProcess, type RuntimeOs, SIGNING_ERRORS, type ScreenDump, type Screenshot, type ScreenshotOptions, type SdkArchiveInfo, type SdkInfo, SdkNotInstalledError, type SdkRelease, type SendFileOptions, type SendGestureOptions, type SendInputOptions, type SendRawTouchOptions, type SetHilogLevelOptions, type SigningKind, type SigningMaterialPaths, type SigningPasswords, type StartEmulatorOptions, type StoredSession, type StreamHilogOptions, TMP_DIR_HINT, TargetNotFoundError, type TemplateOption, type TokenStore, type UiInputType, UnsupportedPlatformError, VERSION, type WaitForBootOptions, type WaitForBundleOptions, type WaitForConditionOptions, type WaitForLogOptions, type WaitForTargetOptions, type WatchLogOptions, type Waypoint, appSandboxDir, applyChanges, assertDevicePath, assertLayoutSelector, attemptHdcConnection, buildCmdWrapper, buildGestureCommands, buildGestureUitestCommand, buildHap, buildHvigorwArgs, buildInputCommand, buildRawTouchCommand, bundleNameFromHapConfig, captureBurst, captureLog, cleanCodelinterOutput, consoleLogger, createHarmonyOsSession, createInstallTempDir, createMaterial, createScaffold, createTempWorkDir, createTokenStore, decideInstallMethod, decideReboot, decryptPwd, dedupEntries, defaultContext, defaultPaths, describeLayoutNode, detectAaStartFailure, detectCmdToolsFlavour, detectInstallFailure, detectProjectSdkVersion, detectRuntimeOs, detectSigningConfigNames, diagnoseBuildFailure, diffEntryNames, diffHapAssets, discoverHaps, downloadAndInstallSdk, downloadFile, dumpLayout, dumpLog, dumpRenderService, dumpScreen, dumpWindow, encryptPwd, ensureFreeSpace, ensureInstallOk, ensureOhModules, ensureOk, ensureRemoteOk, escapeCmdArgument, escapeCmdCommand, existingHapOrUnsigned, extractTarball, extractZipWithProgress, findAppProcessId, findCmdToolsSourceDir, findCoveredNodes, findHarmonyOsSdk, findKeyboardWindow, findLayoutNodes, findMissingProjectSdk, findRunningProcess, findSdkOsDir, flattenLayout, forceStop, formatBytes, generateSigningConfigs, getBundleName, getCmdToolsBin, getCmdToolsDownloadUrl, getCmdToolsPath, getCmdToolsStatus, getDeviceInfo, getDisplaySize, getEmulatorDir, getEmulatorStatus, getFreeSpaceBytes, getHdcPath, getHvigorwPath, getImeBundles, getInstalledSdks, getKey, getMainAbility, getOhosBaseSdkHome, getOhpmPath, getOsFolder, getSdkFilename, getSdkRootDir, getSupportedSdksForUi, harmonyOsAutoSign, harmonyOsSdkLabelForApi, hdcClientFailure, hdcExec, hdcTargetArgs, hdcTargetArgsFor, hideKeyboard, hilogTimeMs, installApp, installCmdTools, installEmulator, installFailureReason, installSdkFromArchive, isBundleInstalled, isCmdToolsInstalled, isEmulatorInstalled, isOutOfSpaceError, isRamBackedPath, isUnsignedHap, isUsableDevice, isValidBundleName, isValidProjectName, killProcessTree, launchApp, listAbilities, listDevices, listModules, listRunningProcesses, listTemplates, locateTarget, missingProjectRootFiles, needsCmdWrapper, nonInteractivePrompter, noopLogger, noopProgress, normaliseLocalPath, paramGet, paramGetMany, paramSet, parseBounds, parseCodelinterFindings, parseCodelinterReport, parseDeviceList, parseHilogLine, parseImeBundles, parseMainAbilityFromBmDump, parseParamValues, parseRemoteExit, performInput, pickHap, pickSigningKind, pickTarget, prepareSigning, pruneLayout, readHapBundleName, readJson5File, readJsonFile, readProvisionProfile, readZipEntry, reboot, recvFile, removeCmdTools, removeEmulator, removeSdk, removeTempWorkDir, requireHarmonyOsSdk, resolveDeviceSerial, resolveKeyEvent, resolveTmpRoot, runCodelinter, runHvigorw, runOhpm, runProcess, scopedLogger, selectDevice, sendFile, sendGesture, sendInput, sendRawTouch, setHilogLevel, shell, shellChecked, spawnCompat, startEmulator, staticConfig, stopEmulator, streamHilog, takeScreenshot, toLongPath, toSpaceError, uninstallApp, unsignedHapRejection, validateTemplateLayout, verifySha256, waitForBoot, waitForBundle, waitForCondition, waitForLog, waitForTarget, watchLog, waypointsToRawEvents, withoutWindow, writeJson5File, writeJsonFile };
2721
+ export { ALL_SDKS, APL_VALUES, APP_FEATURE_VALUES, type AbilityInfo, type AgcAuthInfo, AgcError, type Apl, type AppFeature, type ApplyChangesOptions, type ApplyChangesResult, type BuildHapOptions, type BuildHapResult, type BundleOptions, CancelledError, type CaptureBurstOptions, type CaptureLogOptions, type CaptureLogResult, ChecksumMismatchError, type CmdToolsFlavour, CmdToolsNotInstalledError, type CmdToolsStatus, type CmdWrapper, type CodelinterFinding, type CodelinterReport, type CodelinterResult, type CodelinterSummary, CommandFailedError, type ConfigKey, type ConfigProvider, type CreateScaffoldOptions, type CreateScaffoldResult, type DeveloperAgreementStatus, type DeviceFullInfo, type DeviceInfo, type DiscoverHapsOptions, type DisplaySize, type DisplaySizeOptions, type DownloadOptions, type DumpLayoutOptions, type DumpLayoutResult, type DumpLogOptions, type EmulatorStatus, type ExtractZipOptions, type FlatLayoutNode, type GenerateSigningConfigsOptions, type GestureUitestOptions, type GetDeviceInfoOptions, HARMONYOS_SDK_VERSIONS, HUAWEI_SITES, type HapAssetDiff, type HapSigningInfo, type HapZip, type HarmonyOsAutoSignOptions, type HarmonyOsSdk, type HarmonyOsSession, type HarmonyOsSessionOptions, type HarmonyOsSignHapOptions, type HarmonyOsSignHapResult, type HarmonyOsSigningResult, type HdcExecOptions, type HdcExecResult, type HdcShellOptions, type HidumperOptions, type HilogEntry, type HilogLevel, type HuaweiSite, type HuaweiSiteCode, type HuaweiTeam, type HuaweiUserInfo, INSTALL_TMP_DIRNAME, type InputType, type InstallAppOptions, type InstallAppResult, type InstallCandidate, type InstallCmdToolsOptions, type InstallEmulatorOptions, type InstallMethod, type InstallSdkFromArchiveOptions, type InstallSdkOptions, type InstallTempDir, type InstallTempDirOptions, type InstalledSdk, InsufficientSpaceError, type KeyboardState, type LaunchAppOptions, type LayoutNode, type LayoutSelector, type LocateTargetOptions, type LocatedTarget, type Logger, type ModuleHaps, OHOS_DAILY_BUILDS_URL, OHOS_URL_BASE, type OniroContext, OniroError, type OsFolder, type OutputSink, type ParamOptions, type PerformInputOptions, type PerformInputResult, type PickTargetFailure, type PickedHap, type PrepareSigningOptions, type PrepareSigningResult, type ProgressReporter, type ProgressUpdate, type ProjectModule, type Prompter, type ProvisionProfileInfo, type RawLayoutNode, type RawTouchEvent, type RebootDecision, type RebootOptions, type RecvFileOptions, type RunCodelinterOptions, type RunHvigorwOptions, type RunHvigorwResult, type RunOhpmOptions, type RunProcessOptions, type RunningProcess, type RuntimeOs, SIGNED_HAP_CHUNK_SIZE, SIGNING_ERRORS, type ScreenDump, type Screenshot, type ScreenshotOptions, type SdkArchiveInfo, type SdkInfo, SdkNotInstalledError, type SdkRelease, type SendFileOptions, type SendGestureOptions, type SendInputOptions, type SendRawTouchOptions, type SetHilogLevelOptions, type SignOpenHarmonyHapOptions, type SignOpenHarmonyHapResult, type SigningKind, type SigningMaterialPaths, type SigningPasswords, type StartEmulatorOptions, type StoredSession, type StreamHilogOptions, TMP_DIR_HINT, TargetNotFoundError, type TemplateOption, type TokenStore, type UiInputType, UnsupportedPlatformError, VERSION, type WaitForBootOptions, type WaitForBundleOptions, type WaitForConditionOptions, type WaitForLogOptions, type WaitForTargetOptions, type WatchLogOptions, type Waypoint, appSandboxDir, applyChanges, assertDevicePath, assertLayoutSelector, attemptHdcConnection, buildCmdWrapper, buildGestureCommands, buildGestureUitestCommand, buildHap, buildHvigorwArgs, buildInputCommand, buildRawTouchCommand, bundleNameFromHapConfig, captureBurst, captureLog, cleanCodelinterOutput, consoleLogger, createHarmonyOsSession, createInstallTempDir, createMaterial, createScaffold, createTempWorkDir, createTokenStore, decideInstallMethod, decideReboot, decryptPwd, dedupEntries, defaultContext, defaultPaths, defaultSignedHapPath, describeLayoutNode, detectAaStartFailure, detectCmdToolsFlavour, detectInstallFailure, detectProjectSdkVersion, detectRuntimeOs, detectSigningConfigNames, diagnoseBuildFailure, diffEntryNames, diffHapAssets, discoverHaps, downloadAndInstallSdk, downloadFile, dumpLayout, dumpLog, dumpRenderService, dumpScreen, dumpWindow, encryptPwd, ensureFreeSpace, ensureInstallOk, ensureOhModules, ensureOk, ensureRemoteOk, escapeCmdArgument, escapeCmdCommand, existingHapOrUnsigned, extractTarball, extractZipWithProgress, findAppProcessId, findCmdToolsSourceDir, findCoveredNodes, findHarmonyOsSdk, findKeyboardWindow, findLayoutNodes, findMissingProjectSdk, findRunningProcess, findSdkOsDir, flattenLayout, forceStop, formatBytes, generateSigningConfigs, getBundleName, getCmdToolsBin, getCmdToolsDownloadUrl, getCmdToolsPath, getCmdToolsStatus, getDeviceInfo, getDisplaySize, getEmulatorDir, getEmulatorStatus, getFreeSpaceBytes, getHdcPath, getHvigorwPath, getImeBundles, getInstalledSdks, getKey, getMainAbility, getOhosBaseSdkHome, getOhpmPath, getOsFolder, getSdkFilename, getSdkRootDir, getSupportedSdksForUi, harmonyOsAutoSign, harmonyOsSdkLabelForApi, harmonyOsSignHap, hdcClientFailure, hdcExec, hdcTargetArgs, hdcTargetArgsFor, hideKeyboard, hilogTimeMs, installApp, installCmdTools, installEmulator, installFailureReason, installSdkFromArchive, isBundleInstalled, isCmdToolsInstalled, isEmulatorInstalled, isOutOfSpaceError, isRamBackedPath, isUnsignedHap, isUsableDevice, isValidBundleName, isValidProjectName, killProcessTree, launchApp, listAbilities, listDevices, listModules, listRunningProcesses, listTemplates, locateTarget, missingProjectRootFiles, needsCmdWrapper, nonInteractivePrompter, noopLogger, noopProgress, normaliseLocalPath, paramGet, paramGetMany, paramSet, parseBounds, parseCodelinterFindings, parseCodelinterReport, parseDeviceList, parseHilogLine, parseImeBundles, parseMainAbilityFromBmDump, parseParamValues, parseRemoteExit, performInput, pickHap, pickSigningKind, pickTarget, prepareSigning, pruneLayout, readHapBundleName, readHapSigningInfo, readJson5File, readJsonFile, readProvisionProfile, readZipEntry, reboot, recvFile, removeCmdTools, removeEmulator, removeSdk, removeTempWorkDir, requireHarmonyOsSdk, resolveDeviceSerial, resolveKeyEvent, resolveTmpRoot, runCodelinter, runHvigorw, runOhpm, runProcess, scopedLogger, selectDevice, sendFile, sendGesture, sendInput, sendRawTouch, setHilogLevel, shell, shellChecked, signOpenHarmonyHap, spawnCompat, startEmulator, staticConfig, stopEmulator, streamHilog, takeScreenshot, toLongPath, toSpaceError, uninstallApp, unsignedHapRejection, validateTemplateLayout, verifySha256, waitForBoot, waitForBundle, waitForCondition, waitForLog, waitForTarget, watchLog, waypointsToRawEvents, withHapZip, withoutWindow, writeJson5File, writeJsonFile };