import { bundleManager } from '@kit.AbilityKit'
import { VHSaaSDK, VHCallBack } from '@vhall/vhall_live'
@Entry
@Component
struct Index {
@State app_key: string = '312ffdajkdlsa89031e39934';
@State app_secret_key: string = 'b0902b84e0c64125211a72d2718261d3';
@State signature: string = '';
@State packageName: string = '';
//私钥 注意需要去掉-----BEGIN PUBLIC KEY-----与 -----END PUBLIC KEY----- 仅保留字符串值
@State priKeyStr: string = "MIIEvAIBADANBgkEfKKwGwYYBNaAB8......Ii0xU20o0Emccr5OEai8g==";
aboutToAppear(): void {
VHSaaSDK.getInstance().getVersion();
VHSaaSDK.getInstance().setRSAPrivateKey(this.priKeyStr);//在初始化之前使用,如果使用RSA进行参数加密时需要设置私钥
//如果包名(package)或签名(sign)为空,SDK内部会自行获取应用信息进行接口请求校验VHSaaSDK.getInstance().init(this.getUIContext().getHostContext()?.getApplicationContext()! as Context, this.app_key,
this.app_secret_key, this.sign, this.package,{
// 成功
onSuccess: (data: string | object) => {},
// 失败
onFailure: (errorCode: number, errorMsg: string) => {
}
});
build() {
Navigation(this.pathStack) {
}
.hideToolBar(true)
.hideTitleBar(true)
.width('100%')
.height('100%')
.mode(NavigationMode.Stack)
.id('Login')
}
}