diff --git a/AssetStoreKit/AssetStoreArkTS/.gitignore b/AssetStoreKit/AssetStoreArkTS/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..d2ff20141ceed86d87c0ea5d99481973005bab2b --- /dev/null +++ b/AssetStoreKit/AssetStoreArkTS/.gitignore @@ -0,0 +1,12 @@ +/node_modules +/oh_modules +/local.properties +/.idea +**/build +/.hvigor +.cxx +/.clangd +/.clang-format +/.clang-tidy +**/.test +/.appanalyzer \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreArkTS/AppScope/app.json5 b/AssetStoreKit/AssetStoreArkTS/AppScope/app.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7ce69cd85af9af5f8d3a135e4089e5911ee58339 --- /dev/null +++ b/AssetStoreKit/AssetStoreArkTS/AppScope/app.json5 @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +{ + "app": { + "bundleName": "com.samples.assetstoreproject", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name" + } +} diff --git a/AssetStoreKit/AssetStoreArkTS/AppScope/resources/base/element/string.json b/AssetStoreKit/AssetStoreArkTS/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f5ec105027da1aaaf7d29c0eb99bca11e436cf06 --- /dev/null +++ b/AssetStoreKit/AssetStoreArkTS/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AssetStoreProject" + } + ] +} diff --git a/AssetStoreKit/AssetStoreArkTS/AppScope/resources/base/media/app_icon.png b/AssetStoreKit/AssetStoreArkTS/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..a39445dc87828b76fed6d2ec470dd455c45319e3 Binary files /dev/null and b/AssetStoreKit/AssetStoreArkTS/AppScope/resources/base/media/app_icon.png differ diff --git a/AssetStoreKit/AssetStoreArkTS/README.md b/AssetStoreKit/AssetStoreArkTS/README.md new file mode 100644 index 0000000000000000000000000000000000000000..85e0d8011365095daafdeef63b177895ec6372e5 --- /dev/null +++ b/AssetStoreKit/AssetStoreArkTS/README.md @@ -0,0 +1,75 @@ +# Asset Store Kit开发指导(ArkTS) + +### 介绍 + +Asset Store Kit(关键资产存储开发套件)包含了关键资产存储服务(ASSET)开放的接口能力集合,提供了用户短敏感数据的安全存储及管理能力。其中,短敏感数据可以是密码类(账号/密码)、Token类(应用凭据)、关键明文(如银行卡号)等长度较短的用户敏感数据。 + +本示例主要展示了Asset Store Kit开发指导(ArkTS)中新增关键资产、删除关键资产、更新关键资产、查询关键资产和查询关键资产场景。该工程中展示的代码详细描述可查如下链接中业务扩展场景介绍部分。 + +- [新增关键资产(ArkTS)](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/security/AssetStoreKit/asset-js-add.md) +- [删除关键资产(ArkTS)](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/security/AssetStoreKit/asset-js-remove.md) +- [更新关键资产(ArkTS)](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/security/AssetStoreKit/asset-js-update.md) +- [查询关键资产(ArkTS)](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/security/AssetStoreKit/asset-js-query.md) +- [查询需要用户的关键资产(ArkTS)](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/security/AssetStoreKit/asset-js-query-auth.md) + +### 效果预览 + +| 首页效果图 | 执行结果图 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | +| | | + +### 使用说明 + +1. 运行Index主界面。 +2. 页面呈现上述执行结果图效果,点击文本为‘Add Critical Asset’和'Add Critical Asset Auth'的按钮可以新增资产,点击Remove Critical Asset'和'Remove Critical Asset Second'按钮可以对应删除新增资产点击'Update Critical Asset'、'QueryAll Critical Asset'、'QueryAttributes Critical Asset'、'QueryList Critical Asset'可以依次进行关键资产的更新查询,其中最后一个按钮需要具有用户关键资产点击后才可成功(可以通过设置运行设备锁屏密码后点击图中1,4按钮添加后执行成功弹出输入密码框) +3. 运行测试用例AssetStoreArkTS.test.ets文件对页面代码进行测试可以全部通过。 + +### 工程目录 + +``` +entry/src/ + ├── main + │ ├── ets + │ │ ├── entryability + │ │ ├── entrybackupability + │ │ ├── pages + │ │ ├── Index.ets // Asset Store Kit开发指导(ArkTS)示例代码 + │ ├── module.json5 + │ └── resources + ├── ohosTest + │ ├── ets + │ │ └── test + │ │ ├── Ability.test.ets + │ │ ├── AssetStoreArkTS.test.ets // 自动化测试代码 + │ │ └── List.test.ets +``` + +### 相关权限 + +ohos.permission.ACCESS_BIOMETRIC + +### 依赖 + +不涉及。 + +### 约束与限制 + +1. 本示例仅支持标准系统上运行,支持设备:华为手机。 + +2. HarmonyOS系统:HarmonyOS 5.0.2 Release及以上。 + +3. DevEco Studio版本:DevEco Studio 5.0.2 Release及以上。 + +4. HarmonyOS SDK版本:HarmonyOS 5.0.2 Release及以上。 + +### 下载 + +如需单独下载本工程,执行如下命令: + +```` +git init +git config core.sparsecheckout true +echo AssetStoreKit/AssetStoreArkTS > .git/info/sparse-checkout +git remote add origin https://gitee.com/harmonyos_samples/guide-snippets.git +git pull origin master +```` \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreArkTS/build-profile.json5 b/AssetStoreKit/AssetStoreArkTS/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..fb5a1ab654ae6715a0ab69a31900ad26dcf2487f --- /dev/null +++ b/AssetStoreKit/AssetStoreArkTS/build-profile.json5 @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +{ + "app": { + "signingConfigs": [], + "products": [ + { + "name": "default", + "signingConfig": "default", + "compatibleSdkVersion": "5.0.2(14)", + "targetSdkVersion": "5.0.2(14)", + "runtimeOS": "HarmonyOS", + "buildOption": { + "strictMode": { + "caseSensitiveCheck": true, + "useNormalizedOHMUrl": true + } + } + } + ], + "buildModeSet": [ + { + "name": "debug", + }, + { + "name": "release" + } + ] + }, + "modules": [ + { + "name": "entry", + "srcPath": "./entry", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreArkTS/code-linter.json5 b/AssetStoreKit/AssetStoreArkTS/code-linter.json5 new file mode 100644 index 0000000000000000000000000000000000000000..28586467ee7a761c737d8654a73aed6fddbc3c71 --- /dev/null +++ b/AssetStoreKit/AssetStoreArkTS/code-linter.json5 @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +{ + "files": [ + "**/*.ets" + ], + "ignore": [ + "**/src/ohosTest/**/*", + "**/src/test/**/*", + "**/src/mock/**/*", + "**/node_modules/**/*", + "**/oh_modules/**/*", + "**/build/**/*", + "**/.preview/**/*" + ], + "ruleSet": [ + "plugin:@performance/recommended", + "plugin:@typescript-eslint/recommended" + ], + "rules": { + } +} \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreArkTS/entry/.gitignore b/AssetStoreKit/AssetStoreArkTS/entry/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..e2713a2779c5a3e0eb879efe6115455592caeea5 --- /dev/null +++ b/AssetStoreKit/AssetStoreArkTS/entry/.gitignore @@ -0,0 +1,6 @@ +/node_modules +/oh_modules +/.preview +/build +/.cxx +/.test \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreArkTS/entry/build-profile.json5 b/AssetStoreKit/AssetStoreArkTS/entry/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..e7569e3056e27af38e9991b7ea73ec10f3ba8a05 --- /dev/null +++ b/AssetStoreKit/AssetStoreArkTS/entry/build-profile.json5 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +{ + "apiType": "stageMode", + "buildOption": { + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": false, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], + "targets": [ + { + "name": "default" + }, + { + "name": "ohosTest", + } + ] +} \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreArkTS/entry/hvigorfile.ts b/AssetStoreKit/AssetStoreArkTS/entry/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..e4f43d54667f8327c367c8096bd08bb8c75aff54 --- /dev/null +++ b/AssetStoreKit/AssetStoreArkTS/entry/hvigorfile.ts @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { hapTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/AssetStoreKit/AssetStoreArkTS/entry/oh-package.json5 b/AssetStoreKit/AssetStoreArkTS/entry/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..c9cb6c8174858277c9b0d465a51547dcab16d5ff --- /dev/null +++ b/AssetStoreKit/AssetStoreArkTS/entry/oh-package.json5 @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +{ + "name": "entry", + "version": "1.0.0", + "description": "Please describe the basic information.", + "main": "", + "author": "", + "license": "", + "dependencies": {} +} + diff --git a/AssetStoreKit/AssetStoreArkTS/entry/src/main/ets/entryability/EntryAbility.ets b/AssetStoreKit/AssetStoreArkTS/entry/src/main/ets/entryability/EntryAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..edc2839f203ba057c186e19b0cbbbf80c8faa8b3 --- /dev/null +++ b/AssetStoreKit/AssetStoreArkTS/entry/src/main/ets/entryability/EntryAbility.ets @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { AbilityConstant, ConfigurationConstant, UIAbility, Want } from '@kit.AbilityKit'; +import { hilog } from '@kit.PerformanceAnalysisKit'; +import { window } from '@kit.ArkUI'; + +export default class EntryAbility extends UIAbility { + onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { + this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); + } + + onDestroy(): void { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + } + + onWindowStageCreate(windowStage: window.WindowStage): void { + // Main window is created, set main page for this ability + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + + windowStage.loadContent('pages/Index', (err) => { + if (err.code) { + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content.'); + }); + } + + onWindowStageDestroy(): void { + // Main window is destroyed, release UI related resources + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); + } + + onForeground(): void { + // Ability has brought to foreground + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); + } + + onBackground(): void { + // Ability has back to background + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); + } +} \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreArkTS/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets b/AssetStoreKit/AssetStoreArkTS/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..b1e212947256c5533c7b06285a597c94f840a6e3 --- /dev/null +++ b/AssetStoreKit/AssetStoreArkTS/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { hilog } from '@kit.PerformanceAnalysisKit'; +import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit'; + +export default class EntryBackupAbility extends BackupExtensionAbility { + async onBackup() { + hilog.info(0x0000, 'testTag', 'onBackup ok'); + } + + async onRestore(bundleVersion: BundleVersion) { + hilog.info(0x0000, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion)); + } +} \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreArkTS/entry/src/main/ets/pages/Index.ets b/AssetStoreKit/AssetStoreArkTS/entry/src/main/ets/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..79f019c5ac5e71af8e27c431502b3d4278263cb4 --- /dev/null +++ b/AssetStoreKit/AssetStoreArkTS/entry/src/main/ets/pages/Index.ets @@ -0,0 +1,389 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// [Start query_user_auth_critical_asset] +import { asset } from '@kit.AssetStoreKit'; +import { util } from '@kit.ArkTS'; +import userAuth from '@ohos.userIAM.userAuth'; +import { BusinessError } from '@kit.BasicServicesKit'; + +function resourceToString(resource: Resource) { + return getContext().resourceManager.getStringSync(resource); +} + +function stringToArray(str: string): Uint8Array { + let textEncoder = new util.TextEncoder(); + return textEncoder.encodeInto(str); +} + +function arrayToString(arr: Uint8Array): string { + let textDecoder = util.TextDecoder.create('utf-8', { ignoreBOM: true }); + let str = textDecoder.decodeToString(arr, { stream: false }); + return str; +} + +async function userAuthenticate(challenge: Uint8Array): Promise { + return new Promise((resolve, reject) => { + const authParam: userAuth.AuthParam = { + challenge: challenge, + authType: [userAuth.UserAuthType.PIN], + authTrustLevel: userAuth.AuthTrustLevel.ATL1, + }; + const widgetParam: userAuth.WidgetParam = { title: resourceToString($r('app.string.pass_word')) }; + try { + let userAuthInstance = userAuth.getUserAuthInstance(authParam, widgetParam); + userAuthInstance.on('result', { + onResult(result) { + if (result.result == userAuth.UserAuthResultCode.SUCCESS) { + console.info(`User identity authentication succeeded.`); + resolve(result.token); + } else { + console.error(`User identity authentication failed.`); + reject(); + } + } + }); + userAuthInstance.start(); + } catch (error) { + let err = error as BusinessError; + console.error(`User identity authentication failed. Code is ${err.code}, message is ${err.message}`); + reject(); + } + }) +} + +function preQueryAsset(): Promise { + return new Promise((resolve, reject) => { + try { + let query: asset.AssetMap = new Map(); + query.set(asset.Tag.ALIAS, stringToArray('demo_alias2')); + asset.preQuery(query).then((challenge: Uint8Array) => { + resolve(challenge); + }).catch(() => { + reject(); + }) + } catch (error) { + let err = error as BusinessError; + console.error(`Failed to pre-query Asset. Code is ${err.code}, message is ${err.message}`); + reject(); + } + }); +} + +async function postQueryAsset(challenge: Uint8Array) { + let handle: asset.AssetMap = new Map(); + handle.set(asset.Tag.AUTH_CHALLENGE, challenge); + try { + await asset.postQuery(handle); + console.info(`Succeeded in post-querying Asset.`); + } catch (error) { + let err = error as BusinessError; + console.error(`Failed to post-query Asset. Code is ${err.code}, message is ${err.message}`); + } +} + +async function queryAsset(): Promise { + let result: string = ''; + // step1. 调用asset.preQuery获取挑战值 + await preQueryAsset().then(async (challenge: Uint8Array) => { + try { + // step2. 传入挑战值,拉起用户认证框 + let authToken: Uint8Array = await userAuthenticate(challenge); + // step3 用户认证通过后,传入挑战值和授权令牌,查询关键资产明文 + let query: asset.AssetMap = new Map(); + query.set(asset.Tag.ALIAS, stringToArray('demo_alias2')); + query.set(asset.Tag.RETURN_TYPE, asset.ReturnType.ALL); + query.set(asset.Tag.AUTH_CHALLENGE, challenge); + query.set(asset.Tag.AUTH_TOKEN, authToken); + let res: asset.AssetMap[] = await asset.query(query); + for (let i = 0; i < res.length; i++) { + // parse the secret. + let secret: Uint8Array = res[i].get(asset.Tag.SECRET) as Uint8Array; + // parse uint8array to string + let secretStr: string = arrayToString(secret); + } + // step4. 关键资产明文查询成功后,需要调用asset.postQuery进行查询的后置处理。 + postQueryAsset(challenge); + result = 'QueryUser Critical Asset Success'; + } catch (error) { + // step5. preQuery成功,后续操作失败,也需要调用asset.postQuery进行查询的后置处理。 + postQueryAsset(challenge); + result = 'QueryUser Critical Asset Failed'; + } + }).catch((err: BusinessError) => { + console.error(`Failed to pre-query Asset. Code is ${err.code}, message is ${err.message}`); + result = 'QueryUser Critical Asset Failed'; + }) + return result; +} +// [End query_user_auth_critical_asset] + +// [Start add_critical_asset] +async function addCriticalAsset(): Promise { + let result: string = ''; + let attr: asset.AssetMap = new Map(); + attr.set(asset.Tag.SECRET, stringToArray('demo_pwd')); + attr.set(asset.Tag.ALIAS, stringToArray('demo_alias')); + attr.set(asset.Tag.ACCESSIBILITY, asset.Accessibility.DEVICE_FIRST_UNLOCKED); + attr.set(asset.Tag.DATA_LABEL_NORMAL_1, stringToArray('demo_label')); + try { + await asset.add(attr).then(() => { + console.info(`Asset added successfully.`); + result = 'Add Critical Asset Success'; + }).catch((err: BusinessError) => { + console.error(`Failed to add Asset. Code is ${err.code}, message is ${err.message}`); + result = 'Add Critical Asset Failed'; + }) + } catch (error) { + let err = error as BusinessError; + console.error(`Failed to add Asset. Code is ${err.code}, message is ${err.message}`); + result = 'Add Critical Asset Failed'; + } + return result; +} +// [End add_critical_asset] + +async function addCriticalAssetAuth(): Promise { + let result: string = ''; + let attr: asset.AssetMap = new Map(); + attr.set(asset.Tag.SECRET, stringToArray('demo_pwd')); + attr.set(asset.Tag.ALIAS, stringToArray('demo_alias2')); + attr.set(asset.Tag.ACCESSIBILITY, asset.Accessibility.DEVICE_FIRST_UNLOCKED); + attr.set(asset.Tag.DATA_LABEL_NORMAL_1, stringToArray('demo_label')); + attr.set(asset.Tag.AUTH_TYPE, asset.AuthType.ANY); + try { + await asset.add(attr).then(() => { + console.info(`Asset added successfully.`); + result = 'Add Critical Asset Auth Success'; + }).catch((err: BusinessError) => { + console.error(`Failed to add Asset. Code is ${err.code}, message is ${err.message}`); + result = 'Add Critical Asset Auth Failed'; + }) + } catch (error) { + let err = error as BusinessError; + console.error(`Failed to add Asset. Code is ${err.code}, message is ${err.message}`); + result = 'Add Critical Asset Auth Failed'; + } + return result; +} + +// [Start remove_critical_asset] +async function removeCriticalAsset(): Promise { + let result: string = ''; + let attr: asset.AssetMap = new Map(); + let query: asset.AssetMap = new Map(); + query.set(asset.Tag.ALIAS, stringToArray('demo_alias')); // 此处指定别名删除单条数据,也可不指定别名删除多条数据 + try { + await asset.remove(query).then(() => { + console.info(`Asset removed successfully.`); + result = 'Remove Critical Asset Success'; + }).catch((err: BusinessError) => { + console.error(`Failed to remove Asset. Code is ${err.code}, message is ${err.message}`); + result = 'Remove Critical Asset Failed'; + }); + } catch (error) { + let err = error as BusinessError; + console.error(`Failed to remove Asset. Code is ${err.code}, message is ${err.message}`); + result = 'Remove Critical Asset Failed'; + } + return result; +} +// [End remove_critical_asset] + +async function removeCriticalAssetSecond(): Promise { + let result: string = ''; + let attr: asset.AssetMap = new Map(); + let query: asset.AssetMap = new Map(); + query.set(asset.Tag.ALIAS, stringToArray('demo_alias2')); // 此处指定别名删除单条数据,也可不指定别名删除多条数据 + try { + await asset.remove(query).then(() => { + console.info(`Asset removed successfully.`); + result = 'Remove Critical Asset Second Success'; + }).catch((err: BusinessError) => { + console.error(`Failed to remove Asset. Code is ${err.code}, message is ${err.message}`); + result = 'Remove Critical Asset Second Failed'; + }); + } catch (error) { + let err = error as BusinessError; + console.error(`Failed to remove Asset. Code is ${err.code}, message is ${err.message}`); + result = 'Remove Critical Asset Second Failed'; + } + return result; +} + +// [Start update_critical_asset] +async function updateCriticalAsset(): Promise { + let result: string = ''; + let query: asset.AssetMap = new Map(); + query.set(asset.Tag.ALIAS, stringToArray('demo_alias')); + let attrsToUpdate: asset.AssetMap = new Map(); + attrsToUpdate.set(asset.Tag.SECRET, stringToArray('demo_pwd_new')); + attrsToUpdate.set(asset.Tag.DATA_LABEL_NORMAL_1, stringToArray('demo_label_new')); + try { + await asset.update(query, attrsToUpdate).then(() => { + console.info(`Asset updated successfully.`); + result = 'Update Critical Asset Success'; + }).catch((err: BusinessError) => { + console.error(`Failed to update Asset. Code is ${err.code}, message is ${err.message}`); + result = 'Update Critical Asset Failed'; + }); + } catch (error) { + let err = error as BusinessError; + console.error(`Failed to update Asset. Code is ${err.code}, message is ${err.message}`); + result = 'Update Critical Asset Failed'; + } + return result; +} +// [End update_critical_asset] + +// [Start query_single_plaintext] +async function queryAllCriticalAsset(): Promise { + let result: string = ''; + let query: asset.AssetMap = new Map(); + query.set(asset.Tag.ALIAS, stringToArray('demo_alias')); // 指定了关键资产别名,最多查询到一条满足条件的关键资产 + query.set(asset.Tag.RETURN_TYPE, asset.ReturnType.ALL); // 此处表示需要返回关键资产的所有信息,即属性+明文 + try { + await asset.query(query).then((res: Array) => { + for (let i = 0; i < res.length; i++) { + // parse the secret. + let secret: Uint8Array = res[i].get(asset.Tag.SECRET) as Uint8Array; + // parse uint8array to string + let secretStr: string = arrayToString(secret); + } + result = 'QueryAll Critical Asset Success'; + }).catch((err: BusinessError) => { + console.error(`Failed to query Asset. Code is ${err.code}, message is ${err.message}`); + result = 'QueryAll Critical Asset Failed'; + }); + } catch (error) { + let err = error as BusinessError; + console.error(`Failed to query Asset. Code is ${err.code}, message is ${err.message}`); + result = 'QueryAll Critical Asset Failed'; + } + return result; +} +// [End query_single_plaintext] + +// [Start query_single_attribute] +async function queryAttributesCriticalAsset(): Promise { + let result: string = ''; + let query: asset.AssetMap = new Map(); + query.set(asset.Tag.ALIAS, stringToArray('demo_alias')); // 指定了关键资产别名,最多查询到一条满足条件的关键资产 + query.set(asset.Tag.RETURN_TYPE, asset.ReturnType.ATTRIBUTES); // 此处表示仅返回关键资产属性,不包含关键资产明文 + try { + await asset.query(query).then((res: Array) => { + for (let i = 0; i < res.length; i++) { + // parse the attribute. + let accessibility: number = res[i].get(asset.Tag.ACCESSIBILITY) as number; + } + result = 'QueryAttributes Critical Asset Success'; + }).catch((err: BusinessError) => { + console.error(`Failed to query Asset. Code is ${err.code}, message is ${err.message}`); + result = 'QueryAttributes Critical Asset Failed'; + }); + } catch (error) { + let err = error as BusinessError; + console.error(`Failed to query Asset. Code is ${err.code}, message is ${err.message}`); + result = 'QueryAttributes Critical Asset Failed'; + } + return result; +} +// [End query_single_attribute] + +// [Start query_list_attribute] +async function queryListCriticalAsset(): Promise { + let result: string = ''; + let query: asset.AssetMap = new Map(); + query.set(asset.Tag.RETURN_TYPE, asset.ReturnType.ATTRIBUTES); // 此处表示仅返回关键资产属性,不包含关键资产明文 + query.set(asset.Tag.DATA_LABEL_NORMAL_1, stringToArray('demo_label')); + query.set(asset.Tag.RETURN_OFFSET, 0); // 此处表示查询结果的偏移量,即从满足条件的第5条关键资产开始返回 + query.set(asset.Tag.RETURN_LIMIT, 1); // 此处表示查询10条满足条件的关键资产 + query.set(asset.Tag.RETURN_ORDERED_BY, asset.Tag.DATA_LABEL_NORMAL_1); // 此处查询结果以DATA_LABEL_NORMAL_1属性内容排序 + try { + await asset.query(query).then((res: Array) => { + for (let i = 0; i < res.length; i++) { + // parse the attribute. + let accessibility: number = res[i].get(asset.Tag.ACCESSIBILITY) as number; + } + result = 'QueryList Critical Asset Success'; + }).catch((err: BusinessError) => { + console.error(`Failed to query Asset. Code is ${err.code}, message is ${err.message}`); + result = 'QueryList Critical Asset Failed'; + }); + } catch (error) { + let err = error as BusinessError; + console.error(`Failed to query Asset. Code is ${err.code}, message is ${err.message}`); + result = 'QueryList Critical Asset Failed'; + } + return result; +} +// [End query_list_attribute] + +@Entry +@Component +struct Index { + @State message1: string = 'Add Critical Asset'; + @State message2: string = 'Remove Critical Asset'; + @State message9: string = 'Remove Critical Asset Second'; + @State message8: string = 'Add Critical Asset Auth'; + @State message3: string = 'Update Critical Asset'; + @State message4: string = 'QueryAll Critical Asset'; + @State message5: string = 'QueryAttributes Critical Asset'; + @State message6: string = 'QueryList Critical Asset'; + @State message7: string = 'QueryUser Critical Asset'; + + build() { + Column() { + Button(this.message1).width('70%').margin(20) + .onClick(async () => { + addCriticalAsset().then(str => this.message1 = str); + }) + Button(this.message2).width('70%').margin(20) + .onClick(async () => { + removeCriticalAsset().then(str => this.message2 = str); + }) + Button(this.message9).width('70%').margin(20) + .onClick(async () => { + removeCriticalAssetSecond().then(str => this.message9 = str); + }) + Button(this.message8).width('70%').margin(20) + .onClick(async () => { + addCriticalAssetAuth().then(str => this.message8 = str); + }) + Button(this.message3).width('70%').margin(20) + .onClick(async () => { + updateCriticalAsset().then(str => this.message3 = str); + }) + Button(this.message4).width('70%').margin(20) + .onClick(async () => { + queryAllCriticalAsset().then(str => this.message4 = str); + }) + Button(this.message5).width('70%').margin(20) + .onClick(async () => { + queryAttributesCriticalAsset().then(str => this.message5 = str); + }) + Button(this.message6).width('70%').margin(20) + .onClick(async () => { + queryListCriticalAsset().then(str => this.message6 = str); + }) + Button(this.message7).width('70%').margin(20) + .onClick(async () => { + queryAsset().then(str => this.message7 = str.toString()) // 需设置设备锁屏密码 + }) + } + .height('100%') + .width('100%') + } +} \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreArkTS/entry/src/main/module.json5 b/AssetStoreKit/AssetStoreArkTS/entry/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..e9819632b5c13bf1a171be3e9049eedb6425a5a5 --- /dev/null +++ b/AssetStoreKit/AssetStoreArkTS/entry/src/main/module.json5 @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +{ + "module": { + "name": "entry", + "type": "entry", + "description": "$string:module_desc", + "mainElement": "EntryAbility", + "deviceTypes": [ + "default", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "EntryAbility", + "srcEntry": "./ets/entryability/EntryAbility.ets", + "description": "$string:EntryAbility_desc", + "icon": "$media:layered_image", + "label": "$string:EntryAbility_label", + "startWindowIcon": "$media:startIcon", + "startWindowBackground": "$color:start_window_background", + "exported": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ], + "extensionAbilities": [ + { + "name": "EntryBackupAbility", + "srcEntry": "./ets/entrybackupability/EntryBackupAbility.ets", + "type": "backup", + "exported": false, + "metadata": [ + { + "name": "ohos.extension.backup", + "resource": "$profile:backup_config" + } + ] + } + ], + "requestPermissions": [ + { + "name": "ohos.permission.ACCESS_BIOMETRIC", + "reason": "$string:reason", + "usedScene": { + "when": "always" + } + } + ] + } +} \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreArkTS/entry/src/main/resources/base/element/color.json b/AssetStoreKit/AssetStoreArkTS/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02 --- /dev/null +++ b/AssetStoreKit/AssetStoreArkTS/entry/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreArkTS/entry/src/main/resources/base/element/string.json b/AssetStoreKit/AssetStoreArkTS/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f0713eec10e3619e1560eb3b05f4994127190112 --- /dev/null +++ b/AssetStoreKit/AssetStoreArkTS/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "AssetStoreProject" + }, + { + "name": "reason", + "value": "用于验证用户权限" + }, + { + "name": "pass_word", + "value": "请输入锁屏密码" + } + ] +} \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreArkTS/entry/src/main/resources/base/media/background.png b/AssetStoreKit/AssetStoreArkTS/entry/src/main/resources/base/media/background.png new file mode 100644 index 0000000000000000000000000000000000000000..f939c9fa8cc8914832e602198745f592a0dfa34d Binary files /dev/null and b/AssetStoreKit/AssetStoreArkTS/entry/src/main/resources/base/media/background.png differ diff --git a/AssetStoreKit/AssetStoreArkTS/entry/src/main/resources/base/media/foreground.png b/AssetStoreKit/AssetStoreArkTS/entry/src/main/resources/base/media/foreground.png new file mode 100644 index 0000000000000000000000000000000000000000..4483ddad1f079e1089d685bd204ee1cfe1d01902 Binary files /dev/null and b/AssetStoreKit/AssetStoreArkTS/entry/src/main/resources/base/media/foreground.png differ diff --git a/AssetStoreKit/AssetStoreArkTS/entry/src/main/resources/base/media/layered_image.json b/AssetStoreKit/AssetStoreArkTS/entry/src/main/resources/base/media/layered_image.json new file mode 100644 index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a --- /dev/null +++ b/AssetStoreKit/AssetStoreArkTS/entry/src/main/resources/base/media/layered_image.json @@ -0,0 +1,7 @@ +{ + "layered-image": + { + "background" : "$media:background", + "foreground" : "$media:foreground" + } +} \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreArkTS/entry/src/main/resources/base/media/startIcon.png b/AssetStoreKit/AssetStoreArkTS/entry/src/main/resources/base/media/startIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b Binary files /dev/null and b/AssetStoreKit/AssetStoreArkTS/entry/src/main/resources/base/media/startIcon.png differ diff --git a/AssetStoreKit/AssetStoreArkTS/entry/src/main/resources/base/profile/backup_config.json b/AssetStoreKit/AssetStoreArkTS/entry/src/main/resources/base/profile/backup_config.json new file mode 100644 index 0000000000000000000000000000000000000000..78f40ae7c494d71e2482278f359ec790ca73471a --- /dev/null +++ b/AssetStoreKit/AssetStoreArkTS/entry/src/main/resources/base/profile/backup_config.json @@ -0,0 +1,3 @@ +{ + "allowToBackupRestore": true +} \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreArkTS/entry/src/main/resources/base/profile/main_pages.json b/AssetStoreKit/AssetStoreArkTS/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce --- /dev/null +++ b/AssetStoreKit/AssetStoreArkTS/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/Index" + ] +} diff --git a/AssetStoreKit/AssetStoreArkTS/entry/src/main/resources/dark/element/color.json b/AssetStoreKit/AssetStoreArkTS/entry/src/main/resources/dark/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..79b11c2747aec33e710fd3a7b2b3c94dd9965499 --- /dev/null +++ b/AssetStoreKit/AssetStoreArkTS/entry/src/main/resources/dark/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#000000" + } + ] +} \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreArkTS/entry/src/ohosTest/ets/test/Ability.test.ets b/AssetStoreKit/AssetStoreArkTS/entry/src/ohosTest/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..0f8ce9a2c012f8fe36114cef65216ef0b6254f41 --- /dev/null +++ b/AssetStoreKit/AssetStoreArkTS/entry/src/ohosTest/ets/test/Ability.test.ets @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { hilog } from '@kit.PerformanceAnalysisKit'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; + +export default function abilityTest() { + describe('ActsAbilityTest', () => { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(() => { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. + }) + beforeEach(() => { + // Presets an action, which is performed before each unit test case starts. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: preset action function. + }) + afterEach(() => { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }) + afterAll(() => { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }) + it('assertContain', 0, () => { + // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. + hilog.info(0x0000, 'testTag', '%{public}s', 'it begin'); + let a = 'abc'; + let b = 'b'; + // Defines a variety of assertion methods, which are used to declare expected boolean conditions. + expect(a).assertContain(b); + expect(a).assertEqual(a); + }) + }) +} \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreArkTS/entry/src/ohosTest/ets/test/AssetStoreArkTS.test.ets b/AssetStoreKit/AssetStoreArkTS/entry/src/ohosTest/ets/test/AssetStoreArkTS.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..654b441b3dca6623c33e590eb8646538c56e0a80 --- /dev/null +++ b/AssetStoreKit/AssetStoreArkTS/entry/src/ohosTest/ets/test/AssetStoreArkTS.test.ets @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { describe, it, expect, beforeAll } from '@ohos/hypium'; +// 导入测试依赖kit +import { abilityDelegatorRegistry, Driver, ON } from '@kit.TestKit'; +import { UIAbility, Want } from '@kit.AbilityKit'; + +const delegator: abilityDelegatorRegistry.AbilityDelegator = abilityDelegatorRegistry.getAbilityDelegator(); +const bundleName = abilityDelegatorRegistry.getArguments().bundleName; +let want: Want; + +export default function assetStoreArkTSTest() { + describe('assetStoreArkTSTest', () => { + /** + * 打开应用 + */ + beforeAll(async () => { + want = { + bundleName: bundleName, + abilityName: 'EntryAbility' + }; + await delegator.startAbility(want); + const driver = Driver.create(); + await driver.delayMs(1000); + const ability: UIAbility = await delegator.getCurrentTopAbility(); + console.info('get top ability'); + await driver.delayMs(1000); + expect(ability.context.abilityInfo.name).assertEqual('EntryAbility'); + }) + + /** + * 点击按钮,添加关键资产 + */ + it('testAssetStoreArkTS001', 0, async () => { + console.info('uitest: testAssetStoreArkTS001 begin'); + const driver = Driver.create(); + const button1 = await driver.findComponent(ON.text('Add Critical Asset')); + await driver.delayMs(1000); + await button1.click(); + await driver.delayMs(1000); + await driver.assertComponentExist(ON.text('Add Critical Asset Success')); + console.info('uitest: testAssetStoreArkTS001 end'); + }) + + /** + * 点击按钮,添加关键资产 + */ + it('testAssetStoreArkTS002', 0, async () => { + console.info('uitest: testAssetStoreArkTS002 begin'); + const driver = Driver.create(); + const button1 = await driver.findComponent(ON.text('Add Critical Asset Auth')); + await driver.delayMs(1000); + await button1.click(); + await driver.delayMs(1000); + await driver.assertComponentExist(ON.text('Add Critical Asset Auth Success')); + console.info('uitest: testAssetStoreArkTS002 end'); + }) + + /** + * 点击按钮,更新查询关键资产 + */ + it('testAssetStoreArkTS003', 0, async () => { + console.info('uitest: testAssetStoreArkTS003 begin'); + const driver = Driver.create(); + const button1 = await driver.findComponent(ON.text('Update Critical Asset')); + const button2 = await driver.findComponent(ON.text('QueryAll Critical Asset')); + const button3 = await driver.findComponent(ON.text('QueryAttributes Critical Asset')); + const button4 = await driver.findComponent(ON.text('QueryList Critical Asset')); + await button1.click(); + await button2.click(); + await button3.click(); + await button4.click(); + await driver.delayMs(1000); + await driver.assertComponentExist(ON.text('Update Critical Asset Success')); + await driver.assertComponentExist(ON.text('QueryAll Critical Asset Success')); + await driver.assertComponentExist(ON.text('QueryAttributes Critical Asset Success')); + await driver.assertComponentExist(ON.text('QueryList Critical Asset Success')); + console.info('uitest: testAssetStoreArkTS003 end'); + }) + + /** + * 点击按钮,删除关键资产 + */ + it('testAssetStoreArkTS004', 0, async () => { + console.info('uitest: testAssetStoreArkTS004 begin'); + const driver = Driver.create(); + const button1 = await driver.findComponent(ON.text('Remove Critical Asset')); + const button2 = await driver.findComponent(ON.text('Remove Critical Asset Second')); + await button1.click(); + await button2.click(); + await driver.delayMs(1000); + await driver.assertComponentExist(ON.text('Remove Critical Asset Success')); + await driver.assertComponentExist(ON.text('Remove Critical Asset Second Success')); + console.info('uitest: testAssetStoreArkTS004 end'); + await driver.pressBack(); + }) + }) +} \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreArkTS/entry/src/ohosTest/ets/test/List.test.ets b/AssetStoreKit/AssetStoreArkTS/entry/src/ohosTest/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..0fcbb2e2ff0059548c756961b471e4634b65ebfb --- /dev/null +++ b/AssetStoreKit/AssetStoreArkTS/entry/src/ohosTest/ets/test/List.test.ets @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import abilityTest from './Ability.test'; +import assetStoreArkTSTest from './AssetStoreArkTS.test'; + +export default function testsuite() { + abilityTest(); + assetStoreArkTSTest(); +} \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreArkTS/entry/src/ohosTest/module.json5 b/AssetStoreKit/AssetStoreArkTS/entry/src/ohosTest/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..c3fd9dda3040d888d9d8b0b62bcb5d3b6fbeb614 --- /dev/null +++ b/AssetStoreKit/AssetStoreArkTS/entry/src/ohosTest/module.json5 @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +{ + "module": { + "name": "entry_test", + "type": "feature", + "deviceTypes": [ + "default", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false + } +} diff --git a/AssetStoreKit/AssetStoreArkTS/entry/src/test/List.test.ets b/AssetStoreKit/AssetStoreArkTS/entry/src/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f1186b1f53c3a70930921c5dbd1417332bec56c9 --- /dev/null +++ b/AssetStoreKit/AssetStoreArkTS/entry/src/test/List.test.ets @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import localUnitTest from './LocalUnit.test'; + +export default function testsuite() { + localUnitTest(); +} \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreArkTS/entry/src/test/LocalUnit.test.ets b/AssetStoreKit/AssetStoreArkTS/entry/src/test/LocalUnit.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..7fc57c77dbf76d8df08a2b802a55b948e3fcf968 --- /dev/null +++ b/AssetStoreKit/AssetStoreArkTS/entry/src/test/LocalUnit.test.ets @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; + +export default function localUnitTest() { + describe('localUnitTest', () => { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(() => { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. + }); + beforeEach(() => { + // Presets an action, which is performed before each unit test case starts. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: preset action function. + }); + afterEach(() => { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }); + afterAll(() => { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }); + it('assertContain', 0, () => { + // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. + let a = 'abc'; + let b = 'b'; + // Defines a variety of assertion methods, which are used to declare expected boolean conditions. + expect(a).assertContain(b); + expect(a).assertEqual(a); + }); + }); +} \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreArkTS/hvigor/hvigor-config.json5 b/AssetStoreKit/AssetStoreArkTS/hvigor/hvigor-config.json5 new file mode 100644 index 0000000000000000000000000000000000000000..d584c19c247db9a7caee4b606bb931aa9279c637 --- /dev/null +++ b/AssetStoreKit/AssetStoreArkTS/hvigor/hvigor-config.json5 @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +{ + "modelVersion": "5.0.1", + "dependencies": { + }, + "execution": { + // "analyze": "normal", /* Define the build analyze mode. Value: [ "normal" | "advanced" | false ]. Default: "normal" */ + // "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */ + // "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */ + // "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */ + // "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */ + }, + "logging": { + // "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */ + }, + "debugging": { + // "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */ + }, + "nodeOptions": { + // "maxOldSpaceSize": 8192 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process. Default: 8192*/ + // "exposeGC": true /* Enable to trigger garbage collection explicitly. Default: true*/ + } +} diff --git a/AssetStoreKit/AssetStoreArkTS/hvigorfile.ts b/AssetStoreKit/AssetStoreArkTS/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..2a5e543f190732c159beb574dfc9fa37bc94e156 --- /dev/null +++ b/AssetStoreKit/AssetStoreArkTS/hvigorfile.ts @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { appTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/AssetStoreKit/AssetStoreArkTS/oh-package.json5 b/AssetStoreKit/AssetStoreArkTS/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..e41bae026aab3b50d0abb42fece08ba43b4a772b --- /dev/null +++ b/AssetStoreKit/AssetStoreArkTS/oh-package.json5 @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +{ + "modelVersion": "5.0.1", + "description": "Please describe the basic information.", + "dependencies": { + }, + "devDependencies": { + "@ohos/hypium": "1.0.19", + "@ohos/hamock": "1.0.0" + } +} diff --git a/AssetStoreKit/AssetStoreArkTS/ohosTest.md b/AssetStoreKit/AssetStoreArkTS/ohosTest.md new file mode 100644 index 0000000000000000000000000000000000000000..f2c9d18d6f01ac1929a0e87c19391cfbdd6f3018 --- /dev/null +++ b/AssetStoreKit/AssetStoreArkTS/ohosTest.md @@ -0,0 +1,11 @@ +# Asset Store Kit(ArkTS)测试用例归档 + +## 用例表 + +| 测试功能 | 预置条件 | 输入 | 预期输出 | 是否自动 | 测试结果 | +| -------------------------- | ------------ | ---- | ---------------------- | -------- | -------- | +| 拉起应用 | 设备正常运行 | | 成功拉起应用 | 是 | Pass | +| 点击按钮新增关键资产 | 成功拉起应用 | | 成功新增输出日志 | 是 | Pass | +| 点击按钮新增关键资产 | 成功拉起应用 | | 成功新增输出日志 | 是 | Pass | +| 点击按钮更新并查询关键资产 | 成功拉起应用 | | 成功更新查询并输出日志 | 是 | Pass | +| 点击按钮移除关键资产 | 成功拉起应用 | | 成功移除并输出日志 | 是 | Pass | \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreArkTS/screenshots/AssetStoreArkTS1.png b/AssetStoreKit/AssetStoreArkTS/screenshots/AssetStoreArkTS1.png new file mode 100644 index 0000000000000000000000000000000000000000..f66fccf0b452d82058b8dd6dd49fa285b01fff4c Binary files /dev/null and b/AssetStoreKit/AssetStoreArkTS/screenshots/AssetStoreArkTS1.png differ diff --git a/AssetStoreKit/AssetStoreArkTS/screenshots/AssetStoreArkTS2.png b/AssetStoreKit/AssetStoreArkTS/screenshots/AssetStoreArkTS2.png new file mode 100644 index 0000000000000000000000000000000000000000..6e8b9bc9fd64fc5e89529f98f5fcf1eadd35ed30 Binary files /dev/null and b/AssetStoreKit/AssetStoreArkTS/screenshots/AssetStoreArkTS2.png differ diff --git a/AssetStoreKit/AssetStoreNdk/.gitignore b/AssetStoreKit/AssetStoreNdk/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..d2ff20141ceed86d87c0ea5d99481973005bab2b --- /dev/null +++ b/AssetStoreKit/AssetStoreNdk/.gitignore @@ -0,0 +1,12 @@ +/node_modules +/oh_modules +/local.properties +/.idea +**/build +/.hvigor +.cxx +/.clangd +/.clang-format +/.clang-tidy +**/.test +/.appanalyzer \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreNdk/AppScope/app.json5 b/AssetStoreKit/AssetStoreNdk/AppScope/app.json5 new file mode 100644 index 0000000000000000000000000000000000000000..bcf7c42f7ee30ea3c8b43d76f8a544fa0b778bb9 --- /dev/null +++ b/AssetStoreKit/AssetStoreNdk/AppScope/app.json5 @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +{ + "app": { + "bundleName": "com.samples.assetstorendk", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name" + } +} diff --git a/AssetStoreKit/AssetStoreNdk/AppScope/resources/base/element/string.json b/AssetStoreKit/AssetStoreNdk/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..7122455547eac86f79b9f6d3dbfd73d76356d412 --- /dev/null +++ b/AssetStoreKit/AssetStoreNdk/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AssetStoreNdk" + } + ] +} diff --git a/AssetStoreKit/AssetStoreNdk/AppScope/resources/base/media/app_icon.png b/AssetStoreKit/AssetStoreNdk/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..a39445dc87828b76fed6d2ec470dd455c45319e3 Binary files /dev/null and b/AssetStoreKit/AssetStoreNdk/AppScope/resources/base/media/app_icon.png differ diff --git a/AssetStoreKit/AssetStoreNdk/README.md b/AssetStoreKit/AssetStoreNdk/README.md new file mode 100644 index 0000000000000000000000000000000000000000..7b9b400267840be272bfd0bedfcfb596fdcc8788 --- /dev/null +++ b/AssetStoreKit/AssetStoreNdk/README.md @@ -0,0 +1,80 @@ +# Asset Store Kit开发指导(C/C++) + +### 介绍 + +Asset Store Kit(关键资产存储开发套件)包含了关键资产存储服务(ASSET)开放的接口能力集合,提供了用户短敏感数据的安全存储及管理能力。其中,短敏感数据可以是密码类(账号/密码)、Token类(应用凭据)、关键明文(如银行卡号)等长度较短的用户敏感数据。 + +本示例主要展示了Asset Store Kit开发指导(C/C++)中新增关键资产、删除关键资产、更新关键资产、查询关键资产场景。该工程中展示的代码详细描述可查如下链接中业务扩展场景介绍部分。 + +- [新增关键资产(C/C++)](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/security/AssetStoreKit/asset-native-add.md) +- [删除关键资产(C/C++)](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/security/AssetStoreKit/asset-native-remove.md) +- [更新关键资产(C/C++)](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/security/AssetStoreKit/asset-native-update.md) +- [查询关键资产(C/C++)](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/security/AssetStoreKit/asset-native-query.md) + +### 效果预览 + +| 首页效果图 | 执行结果图 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | +| | | + +### 使用说明 + +1. 运行Index主界面。 +2. 页面呈现上述执行结果图效果,点击文本为‘AddAsset’的按钮可以新增资产,点击'RemoveAsset'按钮可以删除新增资产,点击'UpdateAsset'、'QueryAsset'、'QueryAttributesAsset'、'BatchQuary'可以依次进行关键资产的更新查询,其中最后一个按钮需要先在添加后直接查询可成功,更新后会导致失败。 +3. 运行测试用例AssetStoreNdk.test.ets文件对页面代码进行测试可以全部通过。 + +### 工程目录 + +``` +entry/src/ + ├── main + │ ├── cpp + │ │ ├── types + │ │ ├── libentry + │ │ | ├── index.d.ts + │ │ ├── CMakeLists.txt + │ │ ├── napi_init.cpp + │ ├── ets + │ │ ├── entryability + │ │ ├── entrybackupability + │ │ ├── pages + │ │ ├── Index.ets // Asset Store Kit开发指导(C/C++)示例代码 + │ ├── module.json5 + │ └── resources + ├── ohosTest + │ ├── ets + │ │ └── test + │ │ ├── Ability.test.ets + │ │ ├── AssetStoreNdk.test.ets // 自动化测试代码 + │ │ └── List.test.ets +``` + +### 相关权限 + +不涉及。 + +### 依赖 + +不涉及。 + +### 约束与限制 + +1. 本示例仅支持标准系统上运行,支持设备:华为手机。 + +2. HarmonyOS系统:HarmonyOS 5.0.2 Release及以上。 + +3. DevEco Studio版本:DevEco Studio 5.0.2 Release及以上。 + +4. HarmonyOS SDK版本:HarmonyOS 5.0.2 Release及以上。 + +### 下载 + +如需单独下载本工程,执行如下命令: + +```` +git init +git config core.sparsecheckout true +echo AssetStoreKit/AssetStoreNdk > .git/info/sparse-checkout +git remote add origin https://gitee.com/harmonyos_samples/guide-snippets.git +git pull origin master +```` \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreNdk/build-profile.json5 b/AssetStoreKit/AssetStoreNdk/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..fb5a1ab654ae6715a0ab69a31900ad26dcf2487f --- /dev/null +++ b/AssetStoreKit/AssetStoreNdk/build-profile.json5 @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +{ + "app": { + "signingConfigs": [], + "products": [ + { + "name": "default", + "signingConfig": "default", + "compatibleSdkVersion": "5.0.2(14)", + "targetSdkVersion": "5.0.2(14)", + "runtimeOS": "HarmonyOS", + "buildOption": { + "strictMode": { + "caseSensitiveCheck": true, + "useNormalizedOHMUrl": true + } + } + } + ], + "buildModeSet": [ + { + "name": "debug", + }, + { + "name": "release" + } + ] + }, + "modules": [ + { + "name": "entry", + "srcPath": "./entry", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreNdk/code-linter.json5 b/AssetStoreKit/AssetStoreNdk/code-linter.json5 new file mode 100644 index 0000000000000000000000000000000000000000..28586467ee7a761c737d8654a73aed6fddbc3c71 --- /dev/null +++ b/AssetStoreKit/AssetStoreNdk/code-linter.json5 @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +{ + "files": [ + "**/*.ets" + ], + "ignore": [ + "**/src/ohosTest/**/*", + "**/src/test/**/*", + "**/src/mock/**/*", + "**/node_modules/**/*", + "**/oh_modules/**/*", + "**/build/**/*", + "**/.preview/**/*" + ], + "ruleSet": [ + "plugin:@performance/recommended", + "plugin:@typescript-eslint/recommended" + ], + "rules": { + } +} \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreNdk/entry/.gitignore b/AssetStoreKit/AssetStoreNdk/entry/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..e2713a2779c5a3e0eb879efe6115455592caeea5 --- /dev/null +++ b/AssetStoreKit/AssetStoreNdk/entry/.gitignore @@ -0,0 +1,6 @@ +/node_modules +/oh_modules +/.preview +/build +/.cxx +/.test \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreNdk/entry/build-profile.json5 b/AssetStoreKit/AssetStoreNdk/entry/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..2d8b081b615348a99aa197f90186f3d8891b7dc1 --- /dev/null +++ b/AssetStoreKit/AssetStoreNdk/entry/build-profile.json5 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +{ + "apiType": "stageMode", + "buildOption": { + "externalNativeOptions": { + "path": "./src/main/cpp/CMakeLists.txt", + "arguments": "", + "cppFlags": "", + "abiFilters": [ + "arm64-v8a", + "x86_64" + ] + } + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": false, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + }, + "nativeLib": { + "debugSymbol": { + "strip": true, + "exclude": [] + } + } + }, + ], + "targets": [ + { + "name": "default" + }, + { + "name": "ohosTest", + } + ] +} \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreNdk/entry/hvigorfile.ts b/AssetStoreKit/AssetStoreNdk/entry/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..e4f43d54667f8327c367c8096bd08bb8c75aff54 --- /dev/null +++ b/AssetStoreKit/AssetStoreNdk/entry/hvigorfile.ts @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { hapTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/AssetStoreKit/AssetStoreNdk/entry/oh-package.json5 b/AssetStoreKit/AssetStoreNdk/entry/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..118bdd4fe7699368a010e04c24f5bfc887cf1298 --- /dev/null +++ b/AssetStoreKit/AssetStoreNdk/entry/oh-package.json5 @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +{ + "name": "entry", + "version": "1.0.0", + "description": "Please describe the basic information.", + "main": "", + "author": "", + "license": "", + "dependencies": { + "libentry.so": "file:./src/main/cpp/types/libentry" + } +} \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreNdk/entry/src/main/cpp/CMakeLists.txt b/AssetStoreKit/AssetStoreNdk/entry/src/main/cpp/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..5995f4dc00f5ec592db1b5e7d68b5e94e85e76d3 --- /dev/null +++ b/AssetStoreKit/AssetStoreNdk/entry/src/main/cpp/CMakeLists.txt @@ -0,0 +1,15 @@ +# the minimum version of CMake. +cmake_minimum_required(VERSION 3.5.0) +project(AssetStoreNdk) + +set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}) + +if(DEFINED PACKAGE_FIND_FILE) + include(${PACKAGE_FIND_FILE}) +endif() + +include_directories(${NATIVERENDER_ROOT_PATH} + ${NATIVERENDER_ROOT_PATH}/include) + +add_library(entry SHARED napi_init.cpp) +target_link_libraries(entry PUBLIC libace_napi.z.so libasset_ndk.z.so) \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreNdk/entry/src/main/cpp/napi_init.cpp b/AssetStoreKit/AssetStoreNdk/entry/src/main/cpp/napi_init.cpp new file mode 100644 index 0000000000000000000000000000000000000000..57229813509d7d179cec402f76799a19f7ecb532 --- /dev/null +++ b/AssetStoreKit/AssetStoreNdk/entry/src/main/cpp/napi_init.cpp @@ -0,0 +1,223 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "napi/native_api.h" +#include +#include "asset/asset_api.h" + +static constexpr int INT_ARG_7 = 7; // 入参索引 +static constexpr int INT_ARG_6 = 6; // 入参索引 + +// [Start add_critical_asset] +static napi_value NAPI_Global_AddAsset(napi_env env, napi_callback_info info) +{ + static const char *secretContent = "demo_pwd"; + static const char *aliasContent = "demo_alias"; + static const char *labelContent = "demo_label"; + + Asset_Blob secret = {(uint32_t)(strlen(secretContent)), (uint8_t *)secretContent}; + Asset_Blob alias = {(uint32_t)(strlen(aliasContent)), (uint8_t *)aliasContent}; + Asset_Blob label = {(uint32_t)(strlen(labelContent)), (uint8_t *)labelContent}; + Asset_Attr attr[] = { + {.tag = ASSET_TAG_ACCESSIBILITY, .value.u32 = ASSET_ACCESSIBILITY_DEVICE_FIRST_UNLOCKED}, + {.tag = ASSET_TAG_SECRET, .value.blob = secret}, + {.tag = ASSET_TAG_ALIAS, .value.blob = alias}, + {.tag = ASSET_TAG_DATA_LABEL_NORMAL_1, .value.blob = label}, + }; + + int32_t ret = OH_Asset_Add(attr, sizeof(attr) / sizeof(attr[0])); + napi_value result; + if (ret == ASSET_SUCCESS) { + // Asset added successfully. + napi_create_string_utf8(env, "success", INT_ARG_7, &result); + } else { + // Failed to add Asset. + napi_create_string_utf8(env, "failed", INT_ARG_6, &result); + } + return result; +} +// [End add_critical_asset] + +// [Start remove_critical_asset] +static napi_value RemoveAsset(napi_env env, napi_callback_info info) +{ + static const char *aliasContent = "demo_alias"; + Asset_Blob alias = {(uint32_t)(strlen(aliasContent)), (uint8_t *)aliasContent}; + + Asset_Attr attr[] = { + {.tag = ASSET_TAG_ALIAS, .value.blob = alias}, // 此处指定别名删除,也可不指定别名删除多条数据 + }; + + int32_t ret = OH_Asset_Remove(attr, sizeof(attr) / sizeof(attr[0])); + napi_value result; + if (ret == ASSET_SUCCESS) { + // Asset added successfully. + napi_create_string_utf8(env, "success", INT_ARG_7, &result); + } else { + // Failed to add Asset. + napi_create_string_utf8(env, "failed", INT_ARG_6, &result); + } + return result; +} +// [End remove_critical_asset] + +// [Start update_critical_asset] +static napi_value NAPI_Global_UpdateAsset(napi_env env, napi_callback_info info) +{ + static const char *aliasContent = "demo_alias"; + static const char *secretContent = "demo_pwd_new"; + static const char *labelContent = "demo_label_new"; + + Asset_Blob alias = {(uint32_t)(strlen(aliasContent)), (uint8_t *)aliasContent}; + Asset_Blob new_secret = {(uint32_t)(strlen(secretContent)), (uint8_t *)secretContent}; + Asset_Blob new_label = {(uint32_t)(strlen(labelContent)), (uint8_t *)labelContent}; + Asset_Attr query[] = {{.tag = ASSET_TAG_ALIAS, .value.blob = alias}}; + Asset_Attr attributesToUpdate[] = { + {.tag = ASSET_TAG_SECRET, .value.blob = new_secret}, + {.tag = ASSET_TAG_DATA_LABEL_NORMAL_1, .value.blob = new_label}, + }; + + int32_t ret = OH_Asset_Update(query, sizeof(query) / sizeof(query[0]), attributesToUpdate, + sizeof(attributesToUpdate) / sizeof(attributesToUpdate[0])); + napi_value result; + if (ret == ASSET_SUCCESS) { + // Asset added successfully. + napi_create_string_utf8(env, "success", INT_ARG_7, &result); + } else { + // Failed to add Asset. + napi_create_string_utf8(env, "failed", INT_ARG_6, &result); + } + return result; +} +// [End update_critical_asset] + +// [Start query_single_plaintext] +static napi_value NAPI_Global_QueryAsset(napi_env env, napi_callback_info info) +{ + static const char *aliasContent = "demo_alias"; + Asset_Blob alias = {(uint32_t)(strlen(aliasContent)), (uint8_t *)aliasContent}; + Asset_Attr attr[] = { + {.tag = ASSET_TAG_ALIAS, .value.blob = alias}, // 指定了关键资产别名,最多查询到一条满足条件的关键资产 + {.tag = ASSET_TAG_RETURN_TYPE, + .value.u32 = ASSET_RETURN_ALL}, // 此处表示需要返回关键资产的所有信息,即属性+明文 + }; + + Asset_ResultSet resultSet = {0}; + napi_value result; + int32_t ret = OH_Asset_Query(attr, sizeof(attr) / sizeof(attr[0]), &resultSet); + if (ret == ASSET_SUCCESS) { + // Parse the resultSet. + for (uint32_t i = 0; i < resultSet.count; i++) { + // Parse the secret: the data is secret->blob.data, the size is secret->blob.size. + Asset_Attr *secret = OH_Asset_ParseAttr(resultSet.results + i, ASSET_TAG_SECRET); + } + napi_create_string_utf8(env, "success", INT_ARG_7, &result); + } else { + napi_create_string_utf8(env, "failed", INT_ARG_6, &result); + } + OH_Asset_FreeResultSet(&resultSet); + return result; +} +// [End query_single_plaintext] + +// [Start query_single_attribute] +static napi_value NAPI_Global_QueryAttributes(napi_env env, napi_callback_info info) +{ + static const char *aliasContent = "demo_alias"; + Asset_Blob alias = {(uint32_t)(strlen(aliasContent)), (uint8_t *)aliasContent}; + Asset_Attr attr[] = { + {.tag = ASSET_TAG_ALIAS, .value.blob = alias}, // 指定了关键资产别名,最多查询到一条满足条件的关键资产 + {.tag = ASSET_TAG_RETURN_TYPE, + .value.u32 = ASSET_RETURN_ATTRIBUTES}, // 此处表示仅返回关键资产属性,不包含关键资产明文 + }; + + Asset_ResultSet resultSet = {0}; + int32_t ret = OH_Asset_Query(attr, sizeof(attr) / sizeof(attr[0]), &resultSet); + napi_value result; + if (ret == ASSET_SUCCESS) { + // Parse the result. + for (uint32_t i = 0; i < resultSet.count; i++) { + // Parse the data label: the data is label->blob.data, the size is label->blob.size. + Asset_Attr *label = OH_Asset_ParseAttr(resultSet.results + i, ASSET_TAG_DATA_LABEL_NORMAL_1); + } + napi_create_string_utf8(env, "success", INT_ARG_7, &result); + } else { + napi_create_string_utf8(env, "failed", INT_ARG_6, &result); + } + OH_Asset_FreeResultSet(&resultSet); + return result; +} +// [End query_single_attribute] + +// [Start query_list_attribute] +static napi_value NAPI_Global_BatchQuery(napi_env env, napi_callback_info info) +{ + static const char *labelContent = "demo_label"; + Asset_Blob label = {(uint32_t)(strlen(labelContent)), (uint8_t *)labelContent}; + static const char *aliasContent = "demo_alias"; + Asset_Blob alias = {(uint32_t)(strlen(aliasContent)), (uint8_t *)aliasContent}; + + Asset_Attr attr[] = { + {.tag = ASSET_TAG_RETURN_TYPE, .value.u32 = ASSET_RETURN_ATTRIBUTES}, + {.tag = ASSET_TAG_DATA_LABEL_NORMAL_1, .value.blob = label}, + {.tag = ASSET_TAG_RETURN_OFFSET, .value.u32 = 0}, + {.tag = ASSET_TAG_RETURN_LIMIT, .value.u32 = 1}, + {.tag = ASSET_TAG_RETURN_ORDERED_BY, .value.u32 = ASSET_TAG_DATA_LABEL_NORMAL_1}, + }; + + Asset_ResultSet resultSet = {0}; + int32_t ret = OH_Asset_Query(attr, sizeof(attr) / sizeof(attr[0]), &resultSet); + napi_value result; + if (ret == ASSET_SUCCESS) { + // Parse the result. + for (uint32_t i = 0; i < resultSet.count; i++) { + // Parse the data alias: the data is alias->blob.data, the size is alias->blob.size.. + Asset_Attr *alias = OH_Asset_ParseAttr(resultSet.results + i, ASSET_TAG_ALIAS); + } + napi_create_string_utf8(env, "success", INT_ARG_7, &result); + } else { + napi_create_string_utf8(env, "failed", INT_ARG_6, &result); + } + OH_Asset_FreeResultSet(&resultSet); + return result; +} +// [End query_list_attribute] + +EXTERN_C_START +static napi_value Init(napi_env env, napi_value exports) +{ + napi_property_descriptor desc[] = { + {"AddAsset", nullptr, NAPI_Global_AddAsset, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"RemoveAsset", nullptr, RemoveAsset, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"UpdateAsset", nullptr, NAPI_Global_UpdateAsset, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"QueryAsset", nullptr, NAPI_Global_QueryAsset, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"QueryAttributes", nullptr, NAPI_Global_QueryAttributes, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"BatchQuery", nullptr, NAPI_Global_BatchQuery, nullptr, nullptr, nullptr, napi_default, nullptr}}; + napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc); + return exports; +} +EXTERN_C_END + +static napi_module demoModule = { + .nm_version = 1, + .nm_flags = 0, + .nm_filename = nullptr, + .nm_register_func = Init, + .nm_modname = "entry", + .nm_priv = ((void *)0), + .reserved = {0}, +}; + +extern "C" __attribute__((constructor)) void RegisterEntryModule(void) { napi_module_register(&demoModule); } \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreNdk/entry/src/main/cpp/types/libentry/Index.d.ts b/AssetStoreKit/AssetStoreNdk/entry/src/main/cpp/types/libentry/Index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..67a55cce53700314c3b977c7ba96b623714fa56a --- /dev/null +++ b/AssetStoreKit/AssetStoreNdk/entry/src/main/cpp/types/libentry/Index.d.ts @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export const AddAsset: () => string; + +export const RemoveAsset: () => string; + +export const UpdateAsset: () => string; + +export const QueryAsset: () => string; + +export const QueryAttributes: () => string; + +export const BatchQuery: () => string; \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreNdk/entry/src/main/cpp/types/libentry/oh-package.json5 b/AssetStoreKit/AssetStoreNdk/entry/src/main/cpp/types/libentry/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..6abf3b7c20f22c62aaac6a995a25cae672f73f35 --- /dev/null +++ b/AssetStoreKit/AssetStoreNdk/entry/src/main/cpp/types/libentry/oh-package.json5 @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +{ + "name": "libentry.so", + "types": "./Index.d.ts", + "version": "1.0.0", + "description": "Please describe the basic information." +} \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreNdk/entry/src/main/ets/entryability/EntryAbility.ets b/AssetStoreKit/AssetStoreNdk/entry/src/main/ets/entryability/EntryAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..965554bb3a331e2418180b86da1993baf5e8d536 --- /dev/null +++ b/AssetStoreKit/AssetStoreNdk/entry/src/main/ets/entryability/EntryAbility.ets @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { AbilityConstant, ConfigurationConstant, UIAbility, Want } from '@kit.AbilityKit'; +import { hilog } from '@kit.PerformanceAnalysisKit'; +import { window } from '@kit.ArkUI'; + +export default class EntryAbility extends UIAbility { + onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { + this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); + } + + onDestroy(): void { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + } + + onWindowStageCreate(windowStage: window.WindowStage): void { + // Main window is created, set main page for this ability + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + + windowStage.loadContent('pages/Index', (err) => { + if (err.code) { + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content.'); + }); + } + + onWindowStageDestroy(): void { + // Main window is destroyed, release UI related resources + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); + } + + onForeground(): void { + // Ability has brought to foreground + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); + } + + onBackground(): void { + // Ability has back to background + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); + } +}; \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreNdk/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets b/AssetStoreKit/AssetStoreNdk/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..b1e212947256c5533c7b06285a597c94f840a6e3 --- /dev/null +++ b/AssetStoreKit/AssetStoreNdk/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { hilog } from '@kit.PerformanceAnalysisKit'; +import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit'; + +export default class EntryBackupAbility extends BackupExtensionAbility { + async onBackup() { + hilog.info(0x0000, 'testTag', 'onBackup ok'); + } + + async onRestore(bundleVersion: BundleVersion) { + hilog.info(0x0000, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion)); + } +} \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreNdk/entry/src/main/ets/pages/Index.ets b/AssetStoreKit/AssetStoreNdk/entry/src/main/ets/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..bf6003c3e12ed1a11575039b9ebfe19e5ab34ce3 --- /dev/null +++ b/AssetStoreKit/AssetStoreNdk/entry/src/main/ets/pages/Index.ets @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { hilog } from '@kit.PerformanceAnalysisKit'; +import testNapi from 'libentry.so'; + +@Entry +@Component +struct Index { + @State message: string = 'AssetStoreNdk'; + + build() { + Column({ space: 5 }) { + Text(this.message) + .fontSize(20) + .fontWeight(FontWeight.Bold) + .textAlign(TextAlign.Center) + Button('AddAsset') + .width('70%') + .onClick(() => { + hilog.info(0x0000, 'testTag', 'GenerateKey %{public}s', testNapi.AddAsset()) // 新增 + this.message = 'AddAsset success'; + }) + Button('RemoveAsset') + .width('70%') + .onClick(() => { + hilog.info(0x0000, 'testTag', 'GenerateKey %{public}s', testNapi.RemoveAsset()) // 删除 + this.message = 'RemoveAsset success'; + }) + Button('UpdateAsset') + .width('70%') + .onClick(() => { + hilog.info(0x0000, 'testTag', 'GenerateKey %{public}s', testNapi.UpdateAsset()) //更新 + this.message = 'UpdateAsset success'; + }) + Button('QueryAsset') + .width('70%') + .onClick(() => { + hilog.info(0x0000, 'testTag', 'GenerateKey %{public}s', testNapi.QueryAsset()) + this.message = 'QueryAsset success'; + }) + Button('QueryAttributes') + .width('70%') + .onClick(() => { + hilog.info(0x0000, 'testTag', 'GenerateKey %{public}s', testNapi.QueryAttributes()) + this.message = 'QueryAttributes success'; + }) + Button('BatchQuery') + .width('70%') + .onClick(() => { + hilog.info(0x0000, 'testTag', 'GenerateKey %{public}s', testNapi.BatchQuery()) // 更新前进行查询成功 更新后会失败 + this.message = 'BatchQuery success'; + }) + } + .height('100%') + .width('100%') + .alignItems(HorizontalAlign.Center) + .justifyContent(FlexAlign.Center) + } +} \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreNdk/entry/src/main/module.json5 b/AssetStoreKit/AssetStoreNdk/entry/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..4144486d1af4c03b0d767cce1cda86fc0d697f91 --- /dev/null +++ b/AssetStoreKit/AssetStoreNdk/entry/src/main/module.json5 @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +{ + "module": { + "name": "entry", + "type": "entry", + "description": "$string:module_desc", + "mainElement": "EntryAbility", + "deviceTypes": [ + "default", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "EntryAbility", + "srcEntry": "./ets/entryability/EntryAbility.ets", + "description": "$string:EntryAbility_desc", + "icon": "$media:layered_image", + "label": "$string:EntryAbility_label", + "startWindowIcon": "$media:startIcon", + "startWindowBackground": "$color:start_window_background", + "exported": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ], + "extensionAbilities": [ + { + "name": "EntryBackupAbility", + "srcEntry": "./ets/entrybackupability/EntryBackupAbility.ets", + "type": "backup", + "exported": false, + "metadata": [ + { + "name": "ohos.extension.backup", + "resource": "$profile:backup_config" + } + ] + } + ] + } +} \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreNdk/entry/src/main/resources/base/element/color.json b/AssetStoreKit/AssetStoreNdk/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02 --- /dev/null +++ b/AssetStoreKit/AssetStoreNdk/entry/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreNdk/entry/src/main/resources/base/element/string.json b/AssetStoreKit/AssetStoreNdk/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..3e9c0e3317c3684f264438833e0409872ed88005 --- /dev/null +++ b/AssetStoreKit/AssetStoreNdk/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "AssetStoreNdk" + } + ] +} \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreNdk/entry/src/main/resources/base/media/background.png b/AssetStoreKit/AssetStoreNdk/entry/src/main/resources/base/media/background.png new file mode 100644 index 0000000000000000000000000000000000000000..f939c9fa8cc8914832e602198745f592a0dfa34d Binary files /dev/null and b/AssetStoreKit/AssetStoreNdk/entry/src/main/resources/base/media/background.png differ diff --git a/AssetStoreKit/AssetStoreNdk/entry/src/main/resources/base/media/foreground.png b/AssetStoreKit/AssetStoreNdk/entry/src/main/resources/base/media/foreground.png new file mode 100644 index 0000000000000000000000000000000000000000..4483ddad1f079e1089d685bd204ee1cfe1d01902 Binary files /dev/null and b/AssetStoreKit/AssetStoreNdk/entry/src/main/resources/base/media/foreground.png differ diff --git a/AssetStoreKit/AssetStoreNdk/entry/src/main/resources/base/media/layered_image.json b/AssetStoreKit/AssetStoreNdk/entry/src/main/resources/base/media/layered_image.json new file mode 100644 index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a --- /dev/null +++ b/AssetStoreKit/AssetStoreNdk/entry/src/main/resources/base/media/layered_image.json @@ -0,0 +1,7 @@ +{ + "layered-image": + { + "background" : "$media:background", + "foreground" : "$media:foreground" + } +} \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreNdk/entry/src/main/resources/base/media/startIcon.png b/AssetStoreKit/AssetStoreNdk/entry/src/main/resources/base/media/startIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b Binary files /dev/null and b/AssetStoreKit/AssetStoreNdk/entry/src/main/resources/base/media/startIcon.png differ diff --git a/AssetStoreKit/AssetStoreNdk/entry/src/main/resources/base/profile/backup_config.json b/AssetStoreKit/AssetStoreNdk/entry/src/main/resources/base/profile/backup_config.json new file mode 100644 index 0000000000000000000000000000000000000000..78f40ae7c494d71e2482278f359ec790ca73471a --- /dev/null +++ b/AssetStoreKit/AssetStoreNdk/entry/src/main/resources/base/profile/backup_config.json @@ -0,0 +1,3 @@ +{ + "allowToBackupRestore": true +} \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreNdk/entry/src/main/resources/base/profile/main_pages.json b/AssetStoreKit/AssetStoreNdk/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce --- /dev/null +++ b/AssetStoreKit/AssetStoreNdk/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/Index" + ] +} diff --git a/AssetStoreKit/AssetStoreNdk/entry/src/main/resources/dark/element/color.json b/AssetStoreKit/AssetStoreNdk/entry/src/main/resources/dark/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..79b11c2747aec33e710fd3a7b2b3c94dd9965499 --- /dev/null +++ b/AssetStoreKit/AssetStoreNdk/entry/src/main/resources/dark/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#000000" + } + ] +} \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreNdk/entry/src/ohosTest/ets/test/Ability.test.ets b/AssetStoreKit/AssetStoreNdk/entry/src/ohosTest/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..0f8ce9a2c012f8fe36114cef65216ef0b6254f41 --- /dev/null +++ b/AssetStoreKit/AssetStoreNdk/entry/src/ohosTest/ets/test/Ability.test.ets @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { hilog } from '@kit.PerformanceAnalysisKit'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; + +export default function abilityTest() { + describe('ActsAbilityTest', () => { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(() => { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. + }) + beforeEach(() => { + // Presets an action, which is performed before each unit test case starts. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: preset action function. + }) + afterEach(() => { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }) + afterAll(() => { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }) + it('assertContain', 0, () => { + // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. + hilog.info(0x0000, 'testTag', '%{public}s', 'it begin'); + let a = 'abc'; + let b = 'b'; + // Defines a variety of assertion methods, which are used to declare expected boolean conditions. + expect(a).assertContain(b); + expect(a).assertEqual(a); + }) + }) +} \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreNdk/entry/src/ohosTest/ets/test/AssetStoreNdk.test.ets b/AssetStoreKit/AssetStoreNdk/entry/src/ohosTest/ets/test/AssetStoreNdk.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..50f1d72df28ce2f30779af7d26df367bd3acddd5 --- /dev/null +++ b/AssetStoreKit/AssetStoreNdk/entry/src/ohosTest/ets/test/AssetStoreNdk.test.ets @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { describe, it, expect, beforeAll } from '@ohos/hypium'; +// 导入测试依赖kit +import { abilityDelegatorRegistry, Driver, ON } from '@kit.TestKit'; +import { UIAbility, Want } from '@kit.AbilityKit'; + +const delegator: abilityDelegatorRegistry.AbilityDelegator = abilityDelegatorRegistry.getAbilityDelegator(); +const bundleName = abilityDelegatorRegistry.getArguments().bundleName; +let want: Want; + +export default function assetStoreNdkTest() { + describe('assetStoreNdkTest', () => { + + beforeAll(async () => { + want = { + bundleName: bundleName, + abilityName: 'EntryAbility' + }; + await delegator.startAbility(want); + const driver = Driver.create(); + await driver.delayMs(1000); + const ability: UIAbility = await delegator.getCurrentTopAbility(); + console.info('get top ability'); + await driver.delayMs(1000); + expect(ability.context.abilityInfo.name).assertEqual('EntryAbility'); + }) + + it('testAssetStoreNdk001', 0, async () => { + console.info('uitest: testAssetStoreNdk001 begin'); + const driver = Driver.create(); + const button1 = await driver.findComponent(ON.text('AddAsset')); + const button2 = await driver.findComponent(ON.text('RemoveAsset')); + await driver.delayMs(1000); + await button1.click(); + await driver.delayMs(1000); + await driver.assertComponentExist(ON.text('AddAsset success')); + await button2.click(); + await driver.delayMs(1000); + await driver.assertComponentExist(ON.text('RemoveAsset success')); + await button1.click(); + console.info('uitest: testAssetStoreNdk001 end'); + }) + + it('testAssetStoreNdk002', 0, async () => { + console.info('uitest: testAssetStoreNdk002 begin'); + const driver = Driver.create(); + const button1 = await driver.findComponent(ON.text('BatchQuery')); + const button2 = await driver.findComponent(ON.text('UpdateAsset')); + const button3 = await driver.findComponent(ON.text('QueryAsset')); + const button4 = await driver.findComponent(ON.text('QueryAttributes')); + await button1.click(); + await driver.delayMs(1000); + await driver.assertComponentExist(ON.text('BatchQuery success')); + await button2.click(); + await driver.delayMs(1000); + await driver.assertComponentExist(ON.text('UpdateAsset success')); + await button3.click(); + await driver.delayMs(1000); + await driver.assertComponentExist(ON.text('QueryAsset success')); + await button4.click(); + await driver.delayMs(1000); + await driver.assertComponentExist(ON.text('QueryAttributes success')); + console.info('uitest: testAssetStoreNdk002 end'); + }) + }) +} \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreNdk/entry/src/ohosTest/ets/test/List.test.ets b/AssetStoreKit/AssetStoreNdk/entry/src/ohosTest/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..85f713e2c6be73b19e7e11ada42def746eeb568a --- /dev/null +++ b/AssetStoreKit/AssetStoreNdk/entry/src/ohosTest/ets/test/List.test.ets @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import abilityTest from './Ability.test'; +import assetStoreNdkTest from './AssetStoreNdk.test'; + +export default function testsuite() { + abilityTest(); + assetStoreNdkTest(); +} \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreNdk/entry/src/ohosTest/module.json5 b/AssetStoreKit/AssetStoreNdk/entry/src/ohosTest/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..c3fd9dda3040d888d9d8b0b62bcb5d3b6fbeb614 --- /dev/null +++ b/AssetStoreKit/AssetStoreNdk/entry/src/ohosTest/module.json5 @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +{ + "module": { + "name": "entry_test", + "type": "feature", + "deviceTypes": [ + "default", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false + } +} diff --git a/AssetStoreKit/AssetStoreNdk/entry/src/test/List.test.ets b/AssetStoreKit/AssetStoreNdk/entry/src/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f1186b1f53c3a70930921c5dbd1417332bec56c9 --- /dev/null +++ b/AssetStoreKit/AssetStoreNdk/entry/src/test/List.test.ets @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import localUnitTest from './LocalUnit.test'; + +export default function testsuite() { + localUnitTest(); +} \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreNdk/entry/src/test/LocalUnit.test.ets b/AssetStoreKit/AssetStoreNdk/entry/src/test/LocalUnit.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..7fc57c77dbf76d8df08a2b802a55b948e3fcf968 --- /dev/null +++ b/AssetStoreKit/AssetStoreNdk/entry/src/test/LocalUnit.test.ets @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; + +export default function localUnitTest() { + describe('localUnitTest', () => { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(() => { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. + }); + beforeEach(() => { + // Presets an action, which is performed before each unit test case starts. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: preset action function. + }); + afterEach(() => { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }); + afterAll(() => { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }); + it('assertContain', 0, () => { + // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. + let a = 'abc'; + let b = 'b'; + // Defines a variety of assertion methods, which are used to declare expected boolean conditions. + expect(a).assertContain(b); + expect(a).assertEqual(a); + }); + }); +} \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreNdk/hvigor/hvigor-config.json5 b/AssetStoreKit/AssetStoreNdk/hvigor/hvigor-config.json5 new file mode 100644 index 0000000000000000000000000000000000000000..d584c19c247db9a7caee4b606bb931aa9279c637 --- /dev/null +++ b/AssetStoreKit/AssetStoreNdk/hvigor/hvigor-config.json5 @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +{ + "modelVersion": "5.0.1", + "dependencies": { + }, + "execution": { + // "analyze": "normal", /* Define the build analyze mode. Value: [ "normal" | "advanced" | false ]. Default: "normal" */ + // "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */ + // "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */ + // "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */ + // "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */ + }, + "logging": { + // "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */ + }, + "debugging": { + // "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */ + }, + "nodeOptions": { + // "maxOldSpaceSize": 8192 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process. Default: 8192*/ + // "exposeGC": true /* Enable to trigger garbage collection explicitly. Default: true*/ + } +} diff --git a/AssetStoreKit/AssetStoreNdk/hvigorfile.ts b/AssetStoreKit/AssetStoreNdk/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..2a5e543f190732c159beb574dfc9fa37bc94e156 --- /dev/null +++ b/AssetStoreKit/AssetStoreNdk/hvigorfile.ts @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { appTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/AssetStoreKit/AssetStoreNdk/oh-package.json5 b/AssetStoreKit/AssetStoreNdk/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..e41bae026aab3b50d0abb42fece08ba43b4a772b --- /dev/null +++ b/AssetStoreKit/AssetStoreNdk/oh-package.json5 @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +{ + "modelVersion": "5.0.1", + "description": "Please describe the basic information.", + "dependencies": { + }, + "devDependencies": { + "@ohos/hypium": "1.0.19", + "@ohos/hamock": "1.0.0" + } +} diff --git a/AssetStoreKit/AssetStoreNdk/ohosTest.md b/AssetStoreKit/AssetStoreNdk/ohosTest.md new file mode 100644 index 0000000000000000000000000000000000000000..e0aec39739f784731cc756a47e3041b0356baad0 --- /dev/null +++ b/AssetStoreKit/AssetStoreNdk/ohosTest.md @@ -0,0 +1,10 @@ +# Asset Store Kit(C/C++)测试用例归档 + +## 用例表 + +| 测试功能 | 预置条件 | 输入 | 预期输出 | 是否自动 | 测试结果 | +| -------------------------- | ------------ | ---- | ---------------------- | -------- | -------- | +| 拉起应用 | 设备正常运行 | | 成功拉起应用 | 是 | Pass | +| 点击按钮新增关键资产 | 成功拉起应用 | | 成功新增输出日志 | 是 | Pass | +| 点击按钮移除关键资产 | 成功拉起应用 | | 成功移除并输出日志 | 是 | Pass | +| 点击按钮更新并查询关键资产 | 成功拉起应用 | | 成功更新查询并输出日志 | 是 | Pass | \ No newline at end of file diff --git a/AssetStoreKit/AssetStoreNdk/screenshots/AssetStoreNdk1.png b/AssetStoreKit/AssetStoreNdk/screenshots/AssetStoreNdk1.png new file mode 100644 index 0000000000000000000000000000000000000000..38bbdf7c5268b135b65d1e5dddaa842d362cdcc3 Binary files /dev/null and b/AssetStoreKit/AssetStoreNdk/screenshots/AssetStoreNdk1.png differ diff --git a/AssetStoreKit/AssetStoreNdk/screenshots/AssetStoreNdk2.png b/AssetStoreKit/AssetStoreNdk/screenshots/AssetStoreNdk2.png new file mode 100644 index 0000000000000000000000000000000000000000..329e78a20759f37bef827074afbebdb8ba16be4b Binary files /dev/null and b/AssetStoreKit/AssetStoreNdk/screenshots/AssetStoreNdk2.png differ