1/* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file 18 * @kit UserAuthenticationKit 19 */ 20 21import userAuth from '@ohos.userIAM.userAuth'; 22 23/** 24 * Declare UserAuthIcon, use for user authentication. 25 * 26 * @syscap SystemCapability.UserIAM.UserAuth.Core 27 * @atomicservice 28 * @since 12 29 */ 30@Component 31export default struct UserAuthIcon { 32 /** 33 * Set user auth parameter. 34 * 35 * @type { userAuth.AuthParam } 36 * @syscap SystemCapability.UserIAM.UserAuth.Core 37 * @atomicservice 38 * @since 12 39 */ 40 authParam: userAuth.AuthParam; 41 42 /** 43 * Set auth widget parameter. 44 * 45 * @type { userAuth.WidgetParam } 46 * @syscap SystemCapability.UserIAM.UserAuth.Core 47 * @atomicservice 48 * @since 12 49 */ 50 widgetParam: userAuth.WidgetParam; 51 52 /** 53 * Set the height of the icon, width and height ratio 1:1. 54 * 55 * @type { ?Dimension } 56 * @default 64 57 * @syscap SystemCapability.UserIAM.UserAuth.Core 58 * @atomicservice 59 * @since 12 60 */ 61 iconHeight?: Dimension; 62 63 /** 64 * Set the color of the icon. 65 * 66 * @type { ?ResourceColor } 67 * @default $r('sys.color.ohos_id_color_activated') 68 * @syscap SystemCapability.UserIAM.UserAuth.Core 69 * @atomicservice 70 * @since 12 71 */ 72 iconColor?: ResourceColor; 73 74 /** 75 * The authentication result code is returned through the callback. 76 * If the authentication is passed, the authentication token and auth type will be returned. 77 * You need to apply for permission:ohos.permission.ACCESS_BIOMETRIC to use user authentication ability. 78 * 79 * @param { userAuth.UserAuthResult } result - Authentication result information. 80 * @syscap SystemCapability.UserIAM.UserAuth.Core 81 * @atomicservice 82 * @since 12 83 */ 84 onAuthResult: (result: userAuth.UserAuthResult) => void; 85 86 /** 87 * When user click the icon, it will be returned through this callback. 88 * 89 * @syscap SystemCapability.UserIAM.UserAuth.Core 90 * @atomicservice 91 * @since 12 92 */ 93 onIconClick?: () => void; 94} 95