mirror of
https://gitee.com/openharmony/security_asset
synced 2024-12-11 10:03:45 +00:00
sdk -> service
Change-Id: If7608e745f531f6c12af1ffd56a7338d601501a0 Match-id-ae56f5c10e39c4a8f3da5795b1b730296f1e44e8
This commit is contained in:
parent
70791fe0b0
commit
36c5dd699f
@ -20,6 +20,9 @@ git clone ssh://git@szv-y.codehub.huawei.com:2222/y00522150/asset.git
|
||||
在vendor/huawei/build/component_config/system/generic_generic_arm_64only/hisi_higeneric/newphone_standard/part_config.json添加
|
||||
"security:asset":{},
|
||||
|
||||
在vendor/huawei/build/component_config/system/generic_generic_arm_64only/hisi_newbaltimore/pc_standard/part_config.json添加
|
||||
"security:asset":{},
|
||||
|
||||
```bash
|
||||
# 首次编译命令:(修改BUILD.gn时执行)
|
||||
./build_system.sh --abi-type generic_generic_arm_64only --device-type hisi_higeneric_newphone_standard --ccache --build-variant root --build-target out/generic_generic_arm_64only/hisi_higeneric_newphone_standard/build_configs/security/asset:asset --build-target out/generic_generic_arm_64only/hisi_higeneric_newphone_standard/build_configs/security/asset:asset_test
|
||||
@ -27,6 +30,9 @@ git clone ssh://git@szv-y.codehub.huawei.com:2222/y00522150/asset.git
|
||||
# 非首次编译命令:(未修改BUILD.gn时执行)
|
||||
./build_system.sh --abi-type generic_generic_arm_64only --device-type hisi_higeneric_newphone_standard --ccache --build-variant root --build-target out/generic_generic_arm_64only/hisi_higeneric_newphone_standard/build_configs/security/asset:asset --build-target out/generic_generic_arm_64only/hisi_higeneric_newphone_standard/build_configs/security/asset:asset_test --fast-rebuild
|
||||
|
||||
# PC编译命令:
|
||||
./build_system.sh --abi-type generic_generic_arm_64only --device-type hisi_newbaltimore_pc_standard --ccache --build-variant root --build-target out/generic_generic_arm_64only/hisi_newbaltimore_pc_standard/build_configs/security/asset:asset --build-target out/generic_generic_arm_64only/hisi_newbaltimore_pc_standard/build_configs/security/asset:asset_test
|
||||
|
||||
# 支持SA自启:(仅在调试设备上执行一次)
|
||||
./scripts/push_asset_cfg.bat
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//! This create implement the asset
|
||||
//! Module shared by the SDK and Service
|
||||
|
||||
#[macro_use]
|
||||
pub mod asset_hilog;
|
||||
|
@ -15,7 +15,7 @@ import("//build/ohos.gni")
|
||||
|
||||
COMPONENT_DIR = "//base/security/asset"
|
||||
|
||||
ohos_rust_static_library("asset_ipc_define_lib") {
|
||||
ohos_rust_static_library("asset_ipc") {
|
||||
sources = [ "src/lib.rs" ]
|
||||
deps = [ "$COMPONENT_DIR/frameworks/common:asset_common" ]
|
||||
external_deps = [
|
||||
@ -23,7 +23,7 @@ ohos_rust_static_library("asset_ipc_define_lib") {
|
||||
"ipc:ipc_rust",
|
||||
]
|
||||
|
||||
crate_name = "asset_ipc_define_lib"
|
||||
crate_name = "asset_ipc"
|
||||
crate_type = "rlib"
|
||||
|
||||
subsystem_name = "security"
|
||||
|
@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "asset_ipc_define_lib"
|
||||
name = "asset_ipc"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
|
@ -33,51 +33,49 @@ use asset_common::{
|
||||
impl_try_from!{
|
||||
/// Asset ipc code
|
||||
#[derive(Clone, Copy)]
|
||||
pub enum AssetIpcCode {
|
||||
pub enum IpcCode {
|
||||
/// insert data
|
||||
Insert = FIRST_CALL_TRANSACTION,
|
||||
/// add an asset
|
||||
/// IPC code for AddAsset
|
||||
Add,
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for AssetIpcCode {
|
||||
impl fmt::Display for IpcCode {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match *self {
|
||||
AssetIpcCode::Insert => write!(f, "insert"),
|
||||
AssetIpcCode::Add => write!(f, "add"),
|
||||
IpcCode::Insert => write!(f, "insert"),
|
||||
IpcCode::Add => write!(f, "add"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// SA ID for "example_asset_ipc_service"
|
||||
/// SA ID for "security_asset_service"
|
||||
pub const ASSET_SERVICE_ID: i32 = 3511;
|
||||
|
||||
/// Function between proxy and stub of AssetService
|
||||
pub trait AssetBroker: IRemoteBroker {
|
||||
pub trait IAsset: IRemoteBroker {
|
||||
/// xxx
|
||||
fn insert(&self, input: &AssetMap) -> Result<AssetMap>;
|
||||
// fn transform(&self, code: u32, input: &AssetMap) -> Result<AssetMap>;
|
||||
|
||||
/// add an assert
|
||||
fn add(&self, input: &AssetMap) -> Result<AssetMap>;
|
||||
fn add(&self, input: &AssetMap) -> Result<()>;
|
||||
}
|
||||
|
||||
fn on_asset_remote_request(
|
||||
stub: &dyn AssetBroker,
|
||||
code: u32,
|
||||
data: &BorrowedMsgParcel,
|
||||
reply: &mut BorrowedMsgParcel,
|
||||
) -> IpcResult<()> {
|
||||
/// IPC entry of the Asset service
|
||||
fn on_remote_request(stub: &dyn IAsset, code: u32, data: &BorrowedMsgParcel,
|
||||
reply: &mut BorrowedMsgParcel) -> IpcResult<()> {
|
||||
logi!("on_remote_request, calling function: {}", code);
|
||||
let input_map = AssetMap::deserialize(data);
|
||||
if input_map.is_err() {
|
||||
loge!("deserialize in on_asset_remote_request failed!");
|
||||
loge!("deserialize in on_remote_request failed!");
|
||||
return Err(IpcStatusCode::InvalidValue);
|
||||
}
|
||||
if let Ok(ipc_code) = AssetIpcCode::try_from(code) {
|
||||
if let Ok(ipc_code) = IpcCode::try_from(code) {
|
||||
match ipc_code {
|
||||
AssetIpcCode::Insert => {
|
||||
logi!("on_asset_remote_request Insert");
|
||||
IpcCode::Insert => {
|
||||
logi!("on_remote_request Insert");
|
||||
match stub.insert(input_map.as_ref().unwrap()) {
|
||||
Ok(res) => {
|
||||
reply.write::<i32>(&(ErrCode::Success as i32))?;
|
||||
@ -88,13 +86,12 @@ fn on_asset_remote_request(
|
||||
}
|
||||
}
|
||||
},
|
||||
AssetIpcCode::Add => {
|
||||
logi!("on_asset_remote_request add");
|
||||
IpcCode::Add => {
|
||||
logi!("on_remote_request add");
|
||||
|
||||
match stub.add(input_map.as_ref().unwrap()) {
|
||||
Ok(res) => {
|
||||
Ok(_) => {
|
||||
reply.write::<i32>(&(ErrCode::Success as i32))?;
|
||||
res.serialize(reply)?;
|
||||
},
|
||||
Err(e) => {
|
||||
reply.write::<i32>(&(e as i32))?;
|
||||
@ -109,52 +106,47 @@ fn on_asset_remote_request(
|
||||
}
|
||||
|
||||
define_remote_object!(
|
||||
AssetBroker["security_asset_service"] {
|
||||
stub: AssetStub(on_asset_remote_request),
|
||||
IAsset["security_asset_service"] {
|
||||
stub: AssetStub(on_remote_request),
|
||||
proxy: AssetProxy,
|
||||
}
|
||||
);
|
||||
|
||||
// Make RemoteStub<AssetStub> object can call AssetBroker function directly.
|
||||
impl AssetBroker for RemoteStub<AssetStub> {
|
||||
// Make RemoteStub<AssetStub> object can call IAsset function directly.
|
||||
impl IAsset for RemoteStub<AssetStub> {
|
||||
fn insert(&self, input: &AssetMap) -> Result<AssetMap> {
|
||||
self.0.insert(input)
|
||||
}
|
||||
|
||||
fn add(&self, input: &AssetMap) -> Result<AssetMap> {
|
||||
fn add(&self, input: &AssetMap) -> Result<()> {
|
||||
self.0.add(input)
|
||||
}
|
||||
}
|
||||
|
||||
fn transform(proxy: &AssetProxy, code: AssetIpcCode, input: &AssetMap) -> Result<AssetMap> {
|
||||
impl IAsset for AssetProxy {
|
||||
fn insert(&self, _input: &AssetMap) -> Result<AssetMap> {
|
||||
Ok(AssetMap::new())
|
||||
}
|
||||
|
||||
fn add(&self, input: &AssetMap) -> Result<()> {
|
||||
let parce_new = MsgParcel::new();
|
||||
match parce_new {
|
||||
Some(mut send_parcel) => {
|
||||
input.serialize(&mut send_parcel.borrowed())?;
|
||||
|
||||
let reply_parcel =
|
||||
proxy.remote.send_request(code as u32, &send_parcel, false);
|
||||
self.remote.send_request(IpcCode::Add as u32, &send_parcel, false);
|
||||
if let Ok(reply) = reply_parcel {
|
||||
let res_code = ErrCode::try_from(reply.read::<i32>()?)?;
|
||||
if res_code != ErrCode::Success {
|
||||
return Err(res_code);
|
||||
}
|
||||
Ok(AssetMap::deserialize(reply.borrowed_ref())?)
|
||||
Ok(())
|
||||
} else {
|
||||
loge!("AssetProxy transform {} failed!", code);
|
||||
loge!("AssetProxy transform {} failed!", IpcCode::Add);
|
||||
Err(ErrCode::Failed)
|
||||
}
|
||||
},
|
||||
None => Err(ErrCode::Failed)
|
||||
}
|
||||
}
|
||||
|
||||
impl AssetBroker for AssetProxy {
|
||||
fn insert(&self, input: &AssetMap) -> Result<AssetMap> {
|
||||
transform(self, AssetIpcCode::Insert, input)
|
||||
}
|
||||
|
||||
fn add(&self, input: &AssetMap) -> Result<AssetMap> {
|
||||
transform(self, AssetIpcCode::Add, input)
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ ohos_rust_shared_library("asset_rust_sdk") {
|
||||
|
||||
deps = [
|
||||
"$COMPONENT_DIR/frameworks/common:asset_common",
|
||||
"$COMPONENT_DIR/frameworks/ipc_define:asset_ipc_define_lib",
|
||||
"$COMPONENT_DIR/frameworks/ipc_define:asset_ipc",
|
||||
]
|
||||
|
||||
external_deps = [
|
||||
|
@ -7,4 +7,4 @@ edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
asset_common = { path = "../../../frameworks/common" }
|
||||
asset_ipc_define_lib = { path = "../../../frameworks/ipc_define" }
|
||||
asset_ipc = { path = "../../../frameworks/ipc_define" }
|
@ -15,41 +15,39 @@
|
||||
|
||||
//! This create implement the send request
|
||||
|
||||
use asset_common::{
|
||||
logi,
|
||||
definition::{AssetMap, Result, ErrCode}, loge,
|
||||
};
|
||||
|
||||
use asset_ipc_define_lib::asset_service::{AssetBroker, ASSET_SERVICE_ID};
|
||||
|
||||
use ipc_rust::RemoteObjRef;
|
||||
|
||||
use rust_samgr::get_service_proxy;
|
||||
|
||||
use hilog_rust::hilog;
|
||||
use std::ffi::{c_char, CString};
|
||||
|
||||
fn get_asset_service() -> Result<RemoteObjRef<dyn AssetBroker>> {
|
||||
let object = get_service_proxy::<dyn AssetBroker>(ASSET_SERVICE_ID);
|
||||
use hilog_rust::hilog;
|
||||
use ipc_rust::RemoteObjRef;
|
||||
use rust_samgr::get_service_proxy;
|
||||
|
||||
use asset_common::{
|
||||
logi, loge,
|
||||
definition::{AssetMap, Result, ErrCode},
|
||||
};
|
||||
use asset_ipc::asset_service::{IAsset, ASSET_SERVICE_ID};
|
||||
|
||||
fn get_asset_service() -> Result<RemoteObjRef<dyn IAsset>> {
|
||||
let object = get_service_proxy::<dyn IAsset>(ASSET_SERVICE_ID);
|
||||
match object {
|
||||
Ok(remote) => Ok(remote),
|
||||
Err(e) => {
|
||||
loge!("get_asset_service failed {}!", @public(e));
|
||||
loge!("[FATAL]get_asset_service failed {}!", @public(e));
|
||||
Err(ErrCode::ServiceUnvailable)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// sender
|
||||
pub(crate) struct AssetIpcProxy {
|
||||
proxy: RemoteObjRef<dyn AssetBroker>,
|
||||
pub(crate) struct AssetProxy {
|
||||
proxy: RemoteObjRef<dyn IAsset>,
|
||||
}
|
||||
|
||||
/// 2222
|
||||
impl AssetIpcProxy {
|
||||
impl AssetProxy {
|
||||
/// xxx
|
||||
pub(crate) fn new() -> Result<AssetIpcProxy> {
|
||||
Ok(AssetIpcProxy { proxy: get_asset_service()? })
|
||||
pub(crate) fn build() -> Result<AssetProxy> {
|
||||
Ok(AssetProxy { proxy: get_asset_service()? })
|
||||
}
|
||||
|
||||
/// xxx
|
||||
@ -59,7 +57,7 @@ impl AssetIpcProxy {
|
||||
}
|
||||
|
||||
/// add
|
||||
pub(crate) fn add(&self, input: &AssetMap) -> Result<AssetMap> {
|
||||
pub(crate) fn add(&self, input: &AssetMap) -> Result<()> {
|
||||
logi!("AssetIpcSender add");
|
||||
self.proxy.add(input)
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ use asset_common::{
|
||||
Value,
|
||||
asset_type_transform::GetType
|
||||
}};
|
||||
use asset_rust_sdk::{asset_insert, add_asset};
|
||||
use asset_rust_sdk::{asset_insert, add};
|
||||
|
||||
// asset_rust_sdk的crate名字叫asset_sdk或asset, libasset
|
||||
|
||||
@ -58,7 +58,7 @@ pub extern "C" fn AssetInsert(code: i32) -> i32
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn AddAssetC2Rust(attributes: *const AssetParam, attr_cnt: u32) -> i32 {
|
||||
loge!("[YZT] enter AddAssetC2Rust!");
|
||||
if attributes.is_null() || attr_cnt == 0 { // todo: 待确认是否需要校验
|
||||
if attributes.is_null() || attr_cnt == 0 {
|
||||
return ErrCode::InvalidArgument as i32;
|
||||
}
|
||||
|
||||
@ -87,7 +87,11 @@ pub unsafe extern "C" fn AddAssetC2Rust(attributes: *const AssetParam, attr_cnt:
|
||||
}
|
||||
}
|
||||
loge!("[YZT] end AddAssetC2Rust!");
|
||||
add_asset(map) as i32
|
||||
if let Err(e) = add(map) {
|
||||
e as i32
|
||||
} else {
|
||||
0
|
||||
}
|
||||
}
|
||||
|
||||
/// asset param from c
|
||||
|
@ -22,14 +22,14 @@ use asset_common::{
|
||||
loge, logi,
|
||||
definition::{AssetMap, Result, ErrCode, Tag, Value},
|
||||
};
|
||||
use crate::asset_request::AssetIpcProxy;
|
||||
use crate::asset_request::AssetProxy;
|
||||
use hilog_rust::hilog;
|
||||
use std::ffi::{c_char, CString};
|
||||
|
||||
/// insert data into asset
|
||||
pub fn asset_insert(_code: i32) -> Result<ErrCode> {
|
||||
logi!("enter asser insert");
|
||||
if let Ok(sender) = AssetIpcProxy::new() {
|
||||
if let Ok(sender) = AssetProxy::build() {
|
||||
let mut map = AssetMap::new();
|
||||
map.insert(Tag::AuthType, Value::NUMBER(5));
|
||||
sender.insert(&map)?; // ingore reply
|
||||
@ -49,14 +49,14 @@ pub fn asset_insert(_code: i32) -> Result<ErrCode> {
|
||||
}
|
||||
}
|
||||
|
||||
/// add an asset
|
||||
pub fn add(input: AssetMap) -> Result<AssetMap> {
|
||||
logi!("enter assert add");
|
||||
AssetIpcProxy::new()?.add(&input)
|
||||
}
|
||||
// /// add an asset
|
||||
// pub fn add(input: AssetMap) -> Result<AssetMap> {
|
||||
// logi!("enter assert add");
|
||||
// AssetProxy::new()?.add(&input)
|
||||
// }
|
||||
|
||||
/// the mock function
|
||||
pub fn add_asset(_input: AssetMap) -> ErrCode {
|
||||
logi!("enter assert add");
|
||||
ErrCode::Success
|
||||
/// add an asset
|
||||
pub fn add(input: AssetMap) -> Result<()> {
|
||||
logi!("[YZT][RUST SDK]enter asset add");
|
||||
AssetProxy::build()?.add(&input)
|
||||
}
|
@ -20,7 +20,7 @@ ohos_rust_shared_library("asset_service") {
|
||||
|
||||
deps = [
|
||||
"$COMPONENT_DIR/frameworks/common:asset_common",
|
||||
"$COMPONENT_DIR/frameworks/ipc_define:asset_ipc_define_lib",
|
||||
"$COMPONENT_DIR/frameworks/ipc_define:asset_ipc",
|
||||
"$COMPONENT_DIR/services/db_operator:db_operator",
|
||||
"$COMPONENT_DIR/services/crypto_manager:crypto_manager",
|
||||
"$COMPONENT_DIR/services/wrapper/os_account_wrapper:libasset_os_account_wrapper",
|
||||
|
@ -7,6 +7,6 @@ edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
asset_common = { path = "../../frameworks/common" }
|
||||
asset_ipc_define_lib = { path = "../../frameworks/ipc_define" }
|
||||
asset_ipc = { path = "../../frameworks/ipc_define" }
|
||||
db_operator = { path = "../../services/db_operator" }
|
||||
crypto_manager = { path = "../crypto_manager" }
|
||||
|
@ -19,7 +19,6 @@
|
||||
mod calling_owner_type;
|
||||
mod calling_owner_user_id;
|
||||
|
||||
use asset_common::definition::Result;
|
||||
use calling_owner_type::{OwnerType, get_calling_owner_type};
|
||||
use calling_owner_user_id::get_calling_user_id;
|
||||
|
||||
@ -33,14 +32,12 @@ pub(crate) struct CallingInfo {
|
||||
|
||||
impl CallingInfo {
|
||||
/// x
|
||||
pub(crate) fn new() -> Result<Self> {
|
||||
pub(crate) fn new() -> Self {
|
||||
let uid = get_calling_uid();
|
||||
Ok(
|
||||
CallingInfo {
|
||||
owner_type: get_calling_owner_type(uid)?,
|
||||
owner_type: get_calling_owner_type(uid),
|
||||
user_id: get_calling_user_id(uid)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/// x
|
||||
|
@ -16,12 +16,9 @@
|
||||
//! This create implement the asset
|
||||
#![allow(dead_code)]
|
||||
|
||||
use asset_common::definition::Result;
|
||||
|
||||
/// OwnerType
|
||||
pub(crate) enum OwnerType {
|
||||
Hap(Vec<u8>),
|
||||
Sa(Vec<u8>),
|
||||
Native(Vec<u8>)
|
||||
}
|
||||
|
||||
@ -32,11 +29,8 @@ impl OwnerType {
|
||||
Self::Hap(_) => {
|
||||
1
|
||||
},
|
||||
Self::Sa(_) => {
|
||||
2
|
||||
},
|
||||
Self::Native(_) => {
|
||||
3
|
||||
2
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -47,9 +41,6 @@ impl OwnerType {
|
||||
Self::Hap(owner_text) => {
|
||||
owner_text
|
||||
},
|
||||
Self::Sa(owner_text) => {
|
||||
owner_text
|
||||
},
|
||||
Self::Native(owner_text) => {
|
||||
owner_text
|
||||
}
|
||||
@ -57,12 +48,12 @@ impl OwnerType {
|
||||
}
|
||||
}
|
||||
|
||||
fn get_native_owner_info(uid: u64) -> Result<OwnerType>{
|
||||
Ok(OwnerType::Native(Vec::from(format!("{}", uid).as_bytes())))
|
||||
fn get_native_owner_info(uid: u64) -> OwnerType {
|
||||
OwnerType::Native(Vec::from(format!("{}", uid).as_bytes()))
|
||||
}
|
||||
|
||||
/// xxx
|
||||
pub(crate) fn get_calling_owner_type(uid: u64) -> Result<OwnerType> {
|
||||
pub(crate) fn get_calling_owner_type(uid: u64) -> OwnerType {
|
||||
// Ok(OwnerType::Native(Vec::from("123"))) // to do
|
||||
get_native_owner_info(uid)
|
||||
}
|
@ -19,7 +19,7 @@ use asset_common::{
|
||||
logi,
|
||||
definition::{AssetMap, Result, Tag, Value},
|
||||
};
|
||||
use asset_ipc_define_lib::asset_service::{AssetBroker, AssetStub, ASSET_SERVICE_ID};
|
||||
use asset_ipc::asset_service::{IAsset, AssetStub, ASSET_SERVICE_ID};
|
||||
|
||||
use ipc_rust::{IRemoteBroker, RemoteObj};
|
||||
|
||||
@ -38,17 +38,16 @@ pub struct AssetService;
|
||||
|
||||
impl IRemoteBroker for AssetService {}
|
||||
|
||||
impl AssetBroker for AssetService {
|
||||
impl IAsset for AssetService {
|
||||
fn insert(&self, _input: &AssetMap) -> Result<AssetMap> {
|
||||
let mut map = AssetMap::new();
|
||||
map.insert(Tag::AuthType, Value::NUMBER(2)); // to do
|
||||
Ok(map)
|
||||
}
|
||||
|
||||
fn add(&self, input: &AssetMap) -> Result<AssetMap> {
|
||||
fn add(&self, input: &AssetMap) -> Result<()> {
|
||||
// get calling uid userid appid etc
|
||||
let calling_info = CallingInfo::new()?;
|
||||
|
||||
let calling_info = CallingInfo::new();
|
||||
operations::add(input, &calling_info)
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ fn construct_data<'a>(input: &'a AssetMap, calling_info: &'a CallingInfo) -> Res
|
||||
Ok(data_vec)
|
||||
}
|
||||
|
||||
pub(crate) fn add(input: &AssetMap, calling_info: &CallingInfo) -> Result<AssetMap> {
|
||||
pub(crate) fn add(input: &AssetMap, calling_info: &CallingInfo) -> Result<()> {
|
||||
// arrange the table value
|
||||
let mut db_data = construct_data(input, calling_info)?;
|
||||
|
||||
@ -90,5 +90,5 @@ pub(crate) fn add(input: &AssetMap, calling_info: &CallingInfo) -> Result<AssetM
|
||||
DefaultDatabaseHelper::insert_datas_default_once(calling_info.get_user_id(), &owner_str.unwrap(), &alias, db_data)?;
|
||||
|
||||
logi!("insert {} data", @public(insert_num));
|
||||
Ok(AssetMap::new())
|
||||
Ok(())
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ pub(crate) fn get_set_attr<'a>(input: &'a AssetMap, column_name: &'a str, tag: T
|
||||
logi!("get {} {} successfully", @public(column_name), @public(tag as u32));
|
||||
return Ok(());
|
||||
}
|
||||
loge!("{} missed", @public(tag as u32));
|
||||
loge!("{:x} missed", @public(tag as u32));
|
||||
Err(ErrCode::InvalidArgument)
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
use core::panic;
|
||||
|
||||
use asset_rust_sdk::definition::{AssetMap, Accessibility, Tag, InsertAttribute, AuthType, SyncType, Value};
|
||||
use asset_rust_sdk::definition::{AssetMap, Accessibility, Tag, InsertAttribute, AuthType, SyncType};
|
||||
|
||||
#[test]
|
||||
fn test_for_add() {
|
||||
@ -27,8 +27,6 @@ fn test_for_add() {
|
||||
input.insert_attr(Tag::Accessibility, Accessibility::DeviceSecure).unwrap();
|
||||
input.insert_attr(Tag::Alias, Vec::from("alias".as_bytes())).unwrap();
|
||||
|
||||
input.insert(Tag::Accessibility, Value::NUMBER(Accessibility::DeviceSecure as u32));
|
||||
|
||||
match asset_rust_sdk::add(input) {
|
||||
Ok(_) => (),
|
||||
Err(err) => {
|
||||
|
Loading…
Reference in New Issue
Block a user