discord-client/webpack/lib/authentication.js

29 lines
640 B
JavaScript

import LocalStorageInterface from './local-storage-interface'
export default class Authentication{
/* (1) Constructs an Authentication object
*
*
---------------------------------------------------------*/
constructor(){
/* (1) Default localStorage Interface */
this.lsi = new LocalStorageInterface('__auth__', 5*60);
/* (2) Update token */
if( this.token !== null )
this.lsi.push('token', this.token);
}
/* (2) TOKEN facade
*
---------------------------------------------------------*/
get token(){ return this.lsi.fetch('token'); }
set token(_token){ return this.lsi.push('token', _token); }
}