Files
portfolio2023/node_modules/@adonisjs/encryption/build/providers/EncryptionProvider.js
T
2023-11-24 22:35:41 +01:00

28 lines
851 B
JavaScript

"use strict";
/*
* @adonisjs/encryption
*
* (c) Harminder Virk <virk@adonisjs.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Encryption provider to binding encryption class to the container
*/
class EncryptionProvider {
constructor(app) {
this.app = app;
}
register() {
this.app.container.singleton('Adonis/Core/Encryption', () => {
const Config = this.app.container.resolveBinding('Adonis/Core/Config');
const { Encryption } = require('../src/Encryption');
return new Encryption({ secret: Config.get('app.appKey') });
});
}
}
exports.default = EncryptionProvider;
EncryptionProvider.needsApplication = true;