HarmonyOS 鸿蒙Next:怎么用@ohos.util的TextDecoder将BASE32编码转为字节数组
HarmonyOS 鸿蒙Next:怎么用@ohos.util的TextDecoder将BASE32编码转为字节数组啊?
2 回复
static generateTOTP(base32: string): string { try { // 将密钥从Base32解码为字节数组 let base32Helper = new util.Base32Helper(base32, util.Base32Mode.DEFAULT); let base64 = base32Helper.decodeToString(); let base64Helper = new util.Base64Helper(); let uint8Array = base64Helper.decodeSync(base64); return uint8Array; } 例如这段 提示Use explicit types instead of "any", "unknown" (arkts-no-any-unknown) <ArkTSCheck> <button id="copyCode" style="position: absolute; padding: 4px 8px 0px; cursor: pointer; top: 4px; width: 62px; right: 7px; font-size: 14px; display: none;">复制</button>