mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-18 00:34:28 +08:00
support use face id/touch id for application lock
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import CryptoJS from "crypto-js";
|
||||
import uaParser from 'ua-parser-js';
|
||||
import accountConstants from '../consts/account.js';
|
||||
|
||||
@@ -29,6 +30,27 @@ function isBoolean(val) {
|
||||
return typeof(val) === 'boolean';
|
||||
}
|
||||
|
||||
function base64encode(arrayBuffer) {
|
||||
if (!arrayBuffer || arrayBuffer.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return btoa(String.fromCharCode.apply(null, new Uint8Array(arrayBuffer)));
|
||||
}
|
||||
|
||||
function arrayBufferToString(arrayBuffer) {
|
||||
return String.fromCharCode.apply(null, new Uint8Array(arrayBuffer));
|
||||
}
|
||||
|
||||
function stringToArrayBuffer(str){
|
||||
return Uint8Array.from(str, c => c.charCodeAt(0)).buffer;
|
||||
}
|
||||
|
||||
function generateRandomString() {
|
||||
const baseString = 'lab_' + Math.round(new Date().getTime() / 1000) + '_' + Math.random();
|
||||
return CryptoJS.SHA256(baseString).toString();
|
||||
}
|
||||
|
||||
function parseUserAgent(ua) {
|
||||
const uaParseRet = uaParser(ua);
|
||||
|
||||
@@ -129,6 +151,10 @@ export default {
|
||||
isString,
|
||||
isNumber,
|
||||
isBoolean,
|
||||
base64encode,
|
||||
arrayBufferToString,
|
||||
stringToArrayBuffer,
|
||||
generateRandomString,
|
||||
parseUserAgent,
|
||||
getCategorizedAccounts,
|
||||
getAccountByAccountId,
|
||||
|
||||
Reference in New Issue
Block a user