Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var fs = require("fs");
- function Identity(id){
- this.id = id;
- }
- Identity.prototype.serialize = function(){
- return {
- username: this.username,
- password: this.password,
- steamguard: this.steamguard,
- oauth: this.oauth,
- cookie: this.cookie,
- secrets: this.secrets,
- email: this.email
- };
- };
- Identity.prototype.set = function(fields){
- this.username = fields.username || this.username;
- this.password = fields.password || this.password;
- this.steamguard = fields.steamguard || this.steamguard;
- this.oauth = fields.oauth || this.oauth;
- this.cookie = fields.cookie || this.cookie;
- this.secrets = fields.secrets || this.secrets;
- this.email = fields.email || this.email;
- }
- Identity.prototype.load = function(callback){
- var self = this;
- fs.readFile(this.id, function(err, data) {
- if(!err){
- var fields = JSON.parse(data);
- self.set(fields);
- callback(false, fields);
- }else{
- callback("Can't load the identity");
- }
- });
- };
- Identity.prototype.create = function(details, callback){
- this.set(details);
- this.update(callback);
- };
- Identity.prototype.update = function(callback){;
- 2,0-1 Comienzo
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement