From f071f99346404b527865fa5b56571d371d277f9a Mon Sep 17 00:00:00 2001 From: Sambo Chea Date: Mon, 14 Feb 2022 16:56:44 +0700 Subject: [PATCH] Updated build --- dist/crypto/core/default.crypto.d.ts | 4 +++- dist/crypto/core/default.crypto.js | 14 +++++++++++++- dist/crypto/core/default.crypto.js.map | 2 +- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/dist/crypto/core/default.crypto.d.ts b/dist/crypto/core/default.crypto.d.ts index 69ab721..af0b384 100644 --- a/dist/crypto/core/default.crypto.d.ts +++ b/dist/crypto/core/default.crypto.d.ts @@ -9,4 +9,6 @@ declare const decrypt: ( key: string | Buffer, iv?: string | Buffer | null | undefined ) => string -export { encrypt, decrypt } +declare const cryptoRandomBytes: (length: number) => Buffer +declare const cryptoRandomString: (length: number) => string +export { encrypt, decrypt, cryptoRandomBytes, cryptoRandomString } diff --git a/dist/crypto/core/default.crypto.js b/dist/crypto/core/default.crypto.js index 4d450ed..1c8ffa4 100644 --- a/dist/crypto/core/default.crypto.js +++ b/dist/crypto/core/default.crypto.js @@ -43,7 +43,11 @@ var __importStar = return result } Object.defineProperty(exports, "__esModule", { value: true }) -exports.decrypt = exports.encrypt = void 0 +exports.cryptoRandomString = + exports.cryptoRandomBytes = + exports.decrypt = + exports.encrypt = + void 0 var crypto = __importStar(require("crypto")) var config_1 = require("../../config") var util_1 = require("../../util") @@ -79,4 +83,12 @@ var decrypt = function (data, key, iv) { return decrypted } exports.decrypt = decrypt +var cryptoRandomBytes = function (length) { + return Buffer.from(crypto.randomBytes(length)) +} +exports.cryptoRandomBytes = cryptoRandomBytes +var cryptoRandomString = function (length) { + return cryptoRandomBytes(length).toString(config_1.DEFAULT_BUFFER_TYPE) +} +exports.cryptoRandomString = cryptoRandomString //# sourceMappingURL=default.crypto.js.map diff --git a/dist/crypto/core/default.crypto.js.map b/dist/crypto/core/default.crypto.js.map index be1e501..05da6b2 100644 --- a/dist/crypto/core/default.crypto.js.map +++ b/dist/crypto/core/default.crypto.js.map @@ -1 +1 @@ -{"version":3,"file":"default.crypto.js","sourceRoot":"","sources":["../../../src/crypto/core/default.crypto.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAgC;AAChC,uCAIqB;AACrB,mCAA2D;AAE3D,IAAM,OAAO,GAAG,UACZ,IAAqB,EACrB,GAAoB,EACpB,EAA2B;IAE3B,IAAM,MAAM,GAAG,MAAM,CAAC,cAAc,CAChC,8BAAqB,EACrB,IAAA,qBAAc,EAAC,GAAG,CAAC,EACnB,IAAA,qBAAc,EAAC,EAAE,IAAI,GAAG,CAAC,CAC5B,CAAA;IACD,IAAM,KAAK,GAAG,IAAA,qBAAc,EAAC,IAAI,CAAC,CAAA;IAClC,IAAI,SAAS,GAAG,MAAM,CAAC,MAAM,CACzB,KAAK,EACL,8BAAqB,EACrB,4BAAmB,CACtB,CAAA;IACD,SAAS,IAAI,MAAM,CAAC,KAAK,CAAC,4BAAmB,CAAC,CAAA;IAC9C,OAAO,SAAS,CAAA;AACpB,CAAC,CAAA;AAsBQ,0BAAO;AApBhB,IAAM,OAAO,GAAG,UACZ,IAAqB,EACrB,GAAoB,EACpB,EAA2B;IAE3B,IAAM,QAAQ,GAAG,MAAM,CAAC,gBAAgB,CACpC,8BAAqB,EACrB,IAAA,qBAAc,EAAC,GAAG,CAAC,EACnB,IAAA,qBAAc,EAAC,EAAE,IAAI,GAAG,CAAC,CAC5B,CAAA;IACD,IAAM,KAAK,GAAG,IAAA,qBAAc,EAAC,IAAI,CAAC,CAAA;IAClC,IAAI,SAAS,GAAG,QAAQ,CAAC,MAAM,CAC3B,KAAK,EACL,4BAAmB,EACnB,8BAAqB,CACxB,CAAA;IACD,SAAS,IAAI,QAAQ,CAAC,KAAK,CAAC,8BAAqB,CAAC,CAAA;IAClD,OAAO,SAAS,CAAA;AACpB,CAAC,CAAA;AAEiB,0BAAO"} \ No newline at end of file +{"version":3,"file":"default.crypto.js","sourceRoot":"","sources":["../../../src/crypto/core/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