Skip to content

HarmonyOS OHPM repositories and HAR distribution ​

Arka stores HAR archives and serves package-version metadata and downloads. The official OHPM 5.0.2 client can publish using an RSA-signed login or an Arka API token and can install a pinned version.

Create repositories ​

Run these Bash commands with an authenticated administrator arkactl profile and jq. Replace the example address with your HTTPS endpoint. Publish to Hosted. Group looks in Hosted first, then in Proxy. Grant the publishing account write access to Hosted and the consuming account read access to Group and the relevant members.

For each consuming or publishing identity, sign in with its profile and run arkactl --json tokens create --name ohpm-ci --expires-in-days 30 | jq -er .plaintext. Send the output directly to the CI secret store. Use a separate read and write token for the examples below.

bash
export ARKA_URL=https://packages.example.org
hosted=$(arkactl --json repo create --name ohpm-hosted --type hosted --format ohpm | jq -er .id)
proxy=$(arkactl --json repo create --name ohpm-proxy --type proxy --format ohpm \
  --upstream-url https://ohpm.openharmony.cn/ohpm/ | jq -er .id)
arkactl repo create --name ohpm-group --type group --format ohpm --member "$hosted,$proxy"
WRITE="$ARKA_URL/repository/ohpm-hosted"
READ="$ARKA_URL/repository/ohpm-group"

Configure the OHPM client ​

Install the official ohpm from Huawei Command Line Tools and run ohpm --version. Add the settings to ~/.ohpm/.ohpmrc or give ohpm install an explicit target. Publish to Hosted and install from Group.

ini
registry=https://packages.example.org/repository/ohpm-group/
publish_registry=https://packages.example.org/repository/ohpm-hosted/
strict_ssl=true
bash
ohpm info widget --registry "$READ/"
ohpm install widget@1.2.3 --registry "$READ/"

Signed login and publishing ​

Create a dedicated Arka member for each publisher. Grant write access to Hosted and the intended package path. A platform administrator registers the publishing ID, member UUID, and RSA public key. Use a distinct ID per identity and keep the private key on the publishing client, encrypted with a non-empty passphrase.

bash
ssh-keygen -t rsa -b 3072 -m PEM -f ohpm-publisher
jq -n --arg userId "$PUBLISHER_USER_ID" --rawfile publicKey ohpm-publisher.pub \
  '{ohpmPublishKeys:[{publishId:"project-a-publisher",userId:$userId,publicKey:$publicKey}]}' \
  > ohpm-format.json
arkactl repo update "$HOSTED_REPO_ID" --format-config ohpm-format.json
ohpm publish widget.har --publish_registry "$WRITE/" --publish_id project-a-publisher \
  --key_path "$PWD/ohpm-publisher"

Updating formatConfig.ohpmPublishKeys replaces the bindings list. An empty array clears it. Signed login uses the native RSA-SHA256 v1 request. Arka verifies the timestamp and enforces single-use nonces in PostgreSQL. The five-minute token can only publish to the bound repository. RBAC and content selectors still apply on every request. Disabling the member or revoking write access stops further publishing.

For automated publishing, set //packages.example.org/repository/ohpm-hosted/:_auth in a private configuration file to a write-capable Arka API token. For private installations, scope :_read_auth to the Group path and set it to the consumer token.

Upload and verify a HAR directly ​

bash
curl -fsS -H "Authorization: Bearer $ARKA_WRITE_TOKEN" \
  -T widget-1.2.3.har "$WRITE/widget/-/widget-1.2.3.har"
curl -fsS -H "Authorization: Bearer $ARKA_READ_TOKEN" "$READ/widget" \
  | jq '.versions["1.2.3"].dist'
curl -fsS -H "Authorization: Bearer $ARKA_READ_TOKEN" \
  "$READ/widget/-/widget-1.2.3.har" -o received.har
cmp widget-1.2.3.har received.har

The driver also accepts a package-root PUT containing versions, dist-tags, and _attachments. On direct HAR uploads, Arka reads metadata from the archive’s oh-package.json5 that matches the package name and version. Package metadata responses include package-type: ohpm. When versions come only from archives, Arka generates latest from visible versions, preferring the most recent stable release.

SymptomWhat to check
Metadata loads, then the client reports tool does not support this registryVerify the package response and reverse proxy preserve package-type: ohpm.
HAR is downloadable but no version appears by nameVerify the version in <name>/-/<name>-<version>.har, then inspect versions, dist-tags, and Group member visibility.
Private registry authentication failsCheck the HTTPS data endpoint with an Arka token from the same account. Record the OHPM version, request path, and authentication method.

Huawei CLI installation · OHPM client configuration

Released under the Apache 2.0 License.