🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@tugou/baimahu

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tugou/baimahu - npm Package Compare versions

Comparing version
2.1.1
to
2.2.0
+2
dist/configuration.d.ts
export declare class BaimahuConfiguration {
}
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.BaimahuConfiguration = void 0;
const decorator_1 = require("@midwayjs/decorator");
let BaimahuConfiguration = class BaimahuConfiguration {
};
BaimahuConfiguration = __decorate([
decorator_1.Configuration({
namespace: 'baimahu'
})
], BaimahuConfiguration);
exports.BaimahuConfiguration = BaimahuConfiguration;
export declare class Crypto {
private config;
encrypt(value: any): any;
decrypt(value: any): any;
md5(value: any): any;
md5Salt(value: any): any;
}
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Crypto = void 0;
const decorator_1 = require("@midwayjs/decorator");
const crypto = require('crypto');
let Crypto = class Crypto {
encrypt(value) {
const { aes } = this.config;
const cipher = crypto.createCipheriv(aes.algorithm, aes.key, aes.iv);
let crypted = cipher.update(JSON.stringify(value), 'binary', 'base64');
crypted += cipher.final('base64');
return crypted;
}
decrypt(value) {
const { aes } = this.config;
const decipher = crypto.createDecipheriv(aes.algorithm, aes.key, aes.iv);
let decrypted = decipher.update(value, 'base64', 'binary');
decrypted += decipher.final('binary');
decrypted = JSON.parse(decrypted);
return decrypted;
}
md5(value) {
return crypto.createHash('md5').update(value).digest('hex');
}
md5Salt(value) {
const { salt } = this.config;
return this.md5(value + salt);
}
};
__decorate([
decorator_1.Config('crypto'),
__metadata("design:type", Object)
], Crypto.prototype, "config", void 0);
Crypto = __decorate([
decorator_1.Provide(),
decorator_1.Scope(decorator_1.ScopeEnum.Singleton)
], Crypto);
exports.Crypto = Crypto;
+2
-0

@@ -0,3 +1,5 @@

export { BaimahuConfiguration as Configuration } from './configuration';
export * from './lib/string';
export * from './lib/moment';
export * from './lib/param';
export * from './lib/crypto';

@@ -13,4 +13,8 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.Configuration = void 0;
var configuration_1 = require("./configuration");
Object.defineProperty(exports, "Configuration", { enumerable: true, get: function () { return configuration_1.BaimahuConfiguration; } });
__exportStar(require("./lib/string"), exports);
__exportStar(require("./lib/moment"), exports);
__exportStar(require("./lib/param"), exports);
__exportStar(require("./lib/crypto"), exports);
+3
-3
{
"name": "@tugou/baimahu",
"version": "2.1.1",
"version": "2.2.0",
"description": "标准函数扩展-前后端通用",

@@ -19,6 +19,6 @@ "main": "dist/index",

"license": "MIT",
"gitHead": "17f9cc3e888e5eae579318dc255a323f6ed43b5e",
"gitHead": "033b8d47ea17d605eb31eb0b320f671685d3e019",
"dependencies": {
"axios": "^0.21.1"
"crypto": "^1.0.1"
}
}