你的位置:Trust钱包安卓版下载 > TrustWallet官网 >
发布日期:2025-05-27 04:46 点击次数:64
当下数字化发展得很快。移动应用如何更高效地颁发和出示可验证凭据,且这些凭据要用已验证ID。这成了众多开发者关注的要点。下面会详细说明移动应用怎样靠Microsoft Entra电子钱包库达成这个目的。
低门槛上手
任何人都不必是专业移动开发人员。任何人都可按本教程操作。能让演示应用启动并运行。这大幅降低了技术门槛。且不用加入Microsoft Entra验证ID租户。利用公共端到端演示网站就能测试演示应用。简单便捷。2024年起,验证ID开始采用符合NIST的P - 256曲线只要使用最新可用的电子钱包库,就能获得支持。
适用多平台
Microsoft Entra电子钱包库在iOS和安卓系统上都适用。它功能十分强大。能使移动应用借助它开始使用Microsoft Entra验证ID平台。依据行业标准。使用该电子钱包库的移动应用能够颁发可验证凭据。也能够出示可验证凭据。这使得移动应用的功能边界得到了拓宽。要是不能用Microsoft Authenticator。移动应用可以选择电子钱包库。接着继续进行相关操作。
兼容性出色
target "YourApp" do use_frameworks! pod "WalletLibrary", "~> 1.0.1" end
要注意,在同一移动设备里,Microsoft Authenticator和使用电子钱包库的移动应用可同时使用。不过,要是安装了Authenticator,它就是已注册openid://协议处理程序的应用。在这种情形下, Trust钱包app下载移动应用要确保颁发和出示请求能找到自己。这会致使Microsoft Authenticator启动
dependencies { implementation 'com.microsoft.entra.verifiedid:walletlibrary:1.0.1' }
功能发展目标
/// Create a verifiedIdClient. let verifiedIdClient = VerifiedIdClientBuilder().build() /// Create a VerifiedIdRequestInput using a OpenId Request Uri. let input = VerifiedIdRequestURL(url: URL(string: "openid-vc://...")!) let result = await verifiedIdClient.createRequest(from: input) /// Every external method's return value is wrapped in a Result object to ensure proper error handling. switch (result) { case .success(let request): /// A request created from the method above could be an issuance or a presentation request. /// In this example,TrustWallet钱包官网地址 it is a presentation request, so we can cast it to a VerifiedIdPresentationRequest. let presentationRequest = request as? VerifiedIdPresentationRequest case .failure(let error): /// If an error occurs, its value can be accessed here. print(error) }
某些功能或许最先在Authenticator里出现。不过开发者打算在电子钱包库中也给出这些功能。这样一来,使用电子钱包库的移动应用就能渐渐拥有更齐全的功能。从而给用户提供更好的体验。并且能满足更多应用场景的需要。
// Create a verifiedIdClient val verifiedIdClient = VerifiedIdClientBuilder(context).build() // Create a VerifiedIdRequestInput using a OpenId Request Uri. val verifiedIdRequestUrl = VerifiedIdRequestURL(Uri.parse("openid-vc://...")) val verifiedIdRequestResult: Result> = verifiedIdClient.createRequest(verifiedIdRequestUrl) // Every external method's return value is wrapped in a Result object to ensure proper error handling. if (verifiedIdRequestResult.isSuccess) { val verifiedIdRequest = verifiedIdRequestResult.getOrNull() val presentationRequest = verifiedIdRequest?.let { verifiedIdRequest as VerifiedIdPresentationRequest } } else { // If an exception occurs, its value can be accessed here. val exception = verifiedIdRequestResult.exceptionOrNull() }
添加库步骤
往移动应用项目里添加Microsoft Entra电子钱包库并不困难。在Android系统里,添加maven依赖项。把WalletLibrary Pod添加到应用的build.gradle中。如此就能将电子钱包库作为依赖项添加。在iOS系统中,添加cocoapod依赖项即可。这样,移动应用就具备了使用电子钱包库的基础条件。
测试与使用
电子钱包库在GitHub存储库附带了演示应用,无需修改即可使用。若想快速开始测试,先用二维码读取器应用扫描二维码。然后,将显示的完整URL复制粘贴到演示应用中。示例应用会把颁发的凭据存储在内存里,颁发后便可用来出示。操作的关键步骤是在测试设备上扫描二维码并复制URL。完成此步骤后,应用会发起下载请求。之后,屏幕会发生相应变化。
现在有个问题。你认为移动应用会使用可验证凭据。那未来在哪些行业会有更广泛的应用?欢迎在评论区留言交流。同时,也别忘了点赞并分享本文。