From b34b3b4cd5bc82987284e200a18bc966cee1e900 Mon Sep 17 00:00:00 2001 From: Luk Lu Date: Fri, 10 Mar 2023 22:05:09 +0800 Subject: [PATCH] customize_account --- .gitignore | 2 +- seafile-ignore.txt | 2 ++ ticc.js | 14 ++++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 46bb0da..cb4fce5 100644 --- a/.gitignore +++ b/.gitignore @@ -70,7 +70,7 @@ _desktop.ini /db.json # wo -envar-*.gitignore.js +*.gitignore.* # 服务端 /_archive/* /_datastore/* diff --git a/seafile-ignore.txt b/seafile-ignore.txt index 5423f0f..16e5988 100644 --- a/seafile-ignore.txt +++ b/seafile-ignore.txt @@ -8,7 +8,9 @@ # 自定义的后缀名,凡有 sfignore 后缀的都不进行同步 *.sfignore +*.sfignore.* *.sfignore/ +*.sfignore.*/ .DS_Store */.DS_Store diff --git a/ticc.js b/ticc.js index b454d37..391a328 100644 --- a/ticc.js +++ b/ticc.js @@ -941,6 +941,20 @@ class TicCrypto { return this.secword_to_account({ secword, coin, coinFamily, world, pass, pathSeed, pathIndex, path, tool, hasher }) } + /** + * + * @param {*} param0 + * @returns + * Example: ({addressFormat:'0x.*55$', coin:'PEX', coinFamily:'ETH}) + */ + static customize_account ({ addressFormat = '^.*$', secwordFormat = '^.*$', ...rest } = {}) { + let acc = this.randomize_account(rest) + while (!new RegExp(addressFormat).test(acc.address) || !new RegExp(secwordFormat).test(acc.secword)) { + acc = this.randomize_account(rest) + } + return acc + } + /** * 生成随机的字符串 *