Vue Ncoder: Laravel API Encryption Frontend Package
Vue Ncoder is a Axios Based Encryption package which encrypts API calls.
This was created to work with Laravel Framework.
Installation
npm install vuencoder
##Usage
Configuration
plugins/vue-ncoder.js
import {VueNcoder} from 'vuencoder';
import Vue from "vue";
const key = 'your base64 Encryption Key';
const enableEncryption = true; // Enable Or Disable Encryption
const axiosOptions = {
baseURL: 'api/',
};
Vue.use(VueNcoder(key, enableEncryption), axiosOptions);
app.js
window.Vue = require('vue');
Vue.config.productionTip = false;
require('~/plugins/vue-ncoder');
const app = new Vue({
el: '#app',
});
Example
Send Request
ncoder.post('auth/login', this.loginForm).then((response) => {
// Success
}).catch((error) => {
// Error
});
ncoder.get('auth/user').then((response) => {
// Success
}).catch((error) => {
// Error
});
Set Headers
ncoder.defaults.headers.common['Authorization'] = `Bearer ${token}`;
Credits
Laravel Package
License
The MIT License (MIT). Please see License File for more information.