util/util.ts

168 lines
5.8 KiB
TypeScript
Raw Permalink Normal View History

2024-10-11 09:57:41 +08:00
// just for develop
export default {
json,
jsonP,
unJson,
yaml,
unYaml,
load,
save,
base64,
unBase64,
urlBase64,
unUrlBase64,
hex,
unHex,
aes,
unAes,
2024-11-08 16:15:32 +08:00
sm4,
unSM4,
genECDSA,
exportECDSAPrivateKey,
exportECDSAPublicKey,
importECDSAKey,
signECDSA,
verifyECDSA,
encryptECDSA,
decryptECDSA,
2024-11-09 00:13:49 +08:00
genSM2,
exportSM2PrivateKey,
exportSM2PublicKey,
importSM2Key,
signSM2,
verifySM2,
encryptSM2,
decryptSM2,
genRSA,
exportRSAPrivateKey,
exportRSAPublicKey,
importRSAKey,
signRSA,
verifyRSA,
encryptRSA,
decryptRSA,
2024-10-11 09:57:41 +08:00
gzip,
gunzip,
id,
uniqueId,
token,
md5,
sha1,
sha256,
sha512,
2024-11-08 16:15:32 +08:00
sm3,
hmacMD5,
hmacSHA1,
hmacSHA256,
hmacSHA512,
hmacSM3,
2024-10-11 09:57:41 +08:00
tpl,
sleep,
2024-11-09 00:13:49 +08:00
setTimeout,
2024-10-11 09:57:41 +08:00
shell,
2024-11-10 19:54:17 +08:00
formatDate,
timestampMS,
timestamp,
2024-10-11 09:57:41 +08:00
toDatetime,
fromDatetime,
toDate,
2024-10-12 13:45:51 +08:00
fromDate,
os,
arch,
joinPath,
getPathDir,
getPathBase,
getPathVolume,
absPath,
cleanPath,
2024-11-09 00:13:49 +08:00
isLocalPath,
string,
int,
float,
bytes,
bool,
2024-10-11 09:57:41 +08:00
}
2024-10-26 12:08:13 +08:00
function json(data: any): string { return '' }
function jsonP(data: any): string { return '' }
function unJson(data: string): any { return null }
function yaml(data: any): string { return '' }
function unYaml(data: string): any { return null }
function load(filename: string): any { return null }
function save(filename: string, data: any) { }
function base64(data: any): string { return '' }
function unBase64(data: string): any { return null }
function urlBase64(data: any): string { return '' }
function unUrlBase64(data: string): any { return null }
function hex(data: any): string { return '' }
function unHex(data: string): any { return null }
function aes(data: any, key: string, iv: string): string { return '' }
function unAes(data: string, key: string, iv: string): any { return null }
2024-11-08 16:15:32 +08:00
function sm4(data: any, key: string, iv: string): string { return '' }
function unSM4(data: string, key: string, iv: string): any { return null }
2024-11-09 00:13:49 +08:00
function genECDSA(size?: number): any[] { return ['priKey', 'pubKey'] }
function exportECDSAPrivateKey(key: any): string { return '' }
function exportECDSAPublicKey(key: any): string { return '' }
function importECDSAKey(pemKeyOrBase64: string, private_or_public_for_base64?: string): any { return '' }
function signECDSA(data: any, priKey: any): any { return '' }
function verifyECDSA(data: any, signature: any, pubKey: any): any { return '' }
function encryptECDSA(data: any, pubKey: any): any { return '' }
function decryptECDSA(data: any, priKey: any): any { return '' }
function genSM2(): any[] { return ['priKey', 'pubKey'] }
function exportSM2PrivateKey(key: any): string { return '' }
function exportSM2PublicKey(key: any): string { return '' }
function importSM2Key(pemKeyOrBase64: string, private_or_public_for_base64?: string): any { return '' }
function signSM2(data: any, priKey: any): any { return '' }
function verifySM2(data: any, signature: any, pubKey: any): any { return '' }
function encryptSM2(data: any, pubKey: any): any { return '' }
function decryptSM2(data: any, priKey: any): any { return '' }
function genRSA(size?: number): any[] { return ['priKey', 'pubKey'] }
function exportRSAPrivateKey(key: any): string { return '' }
function exportRSAPublicKey(key: any): string { return '' }
function importRSAKey(pemKeyOrBase64: string, private_or_public_for_base64?: string): any { return '' }
function signRSA(data: any, priKey: any): any { return '' }
function verifyRSA(data: any, signature: any, pubKey: any): any { return '' }
function encryptRSA(data: any, pubKey: any): any { return '' }
function decryptRSA(data: any, priKey: any): any { return '' }
2024-10-26 12:08:13 +08:00
function gzip(data: any): string { return '' }
function gunzip(data: string): any { return null }
function id(): string { return '' }
function uniqueId(): string { return '' }
2024-11-09 00:13:49 +08:00
function token(size: number): any { return '' }
function md5(...data: any[]): any { return '' }
function sha1(...data: any[]): any { return '' }
function sha256(...data: any[]): any { return '' }
function sha512(...data: any[]): any { return '' }
function sm3(...data: any[]): any { return '' }
function hmacMD5(key: any, ...data: any[]): any { return '' }
function hmacSHA1(key: any, ...data: any[]): any { return '' }
function hmacSHA256(key: any, ...data: any[]): any { return '' }
function hmacSHA512(key: any, ...data: any[]): any { return '' }
function hmacSM3(key: any, ...data: any[]): any { return '' }
2024-10-26 12:08:13 +08:00
function tpl(text: string, data: any, functions?: Object): string { return '' }
function sleep(ms: number): void { }
function setTimeout(callback: () => void, ms?: number, ...args: any): void { }
function shell(cmd: string, ...args: string[]): string[] { return [] }
2024-11-10 19:54:17 +08:00
function formatDate(format: string, timestamp?: number): string { return '' }
function timestampMS(): number { return 0 }
function timestamp(): number { return 0 }
function toDatetime(timestamp?: number): string { return '' }
2024-10-26 12:08:13 +08:00
function fromDatetime(datetimeStr: string): number { return 0 }
2024-11-10 19:54:17 +08:00
function toDate(timestamp?: number): string { return '' }
2024-10-26 12:08:13 +08:00
function fromDate(dateStr: string): number { return 0 }
function os(): string { return '' }
function arch(): string { return '' }
function joinPath(...paths: string[]): string { return '' }
function getPathDir(path: string): string { return '' }
function getPathBase(path: string): string { return '' }
function getPathVolume(path: string): string { return '' }
function absPath(path: string): string { return '' }
function cleanPath(path: string): string { return '' }
function isLocalPath(path: string): boolean { return false }
2024-11-09 00:13:49 +08:00
function string(value: any): string { return '' }
function int(value: any): number { return 0 }
function float(value: any): number { return 0 }
function bytes(value: any): any { return null }
function bool(value: any): boolean { return false }