// // Autogenerated by Thrift Compiler (0.10.0) // // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING // "use strict"; var thrift = require('thrift'); var Thrift = thrift.Thrift; var Q = thrift.Q; var ttypes = require('./line_types'); //HELPER FUNCTIONS AND STRUCTURES var AuthService_normalizePhoneNumber_args = function(args) { this.countryCode = null; this.phoneNumber = null; this.countryCodeHint = null; if (args) { if (args.countryCode !== undefined && args.countryCode !== null) { this.countryCode = args.countryCode; } if (args.phoneNumber !== undefined && args.phoneNumber !== null) { this.phoneNumber = args.phoneNumber; } if (args.countryCodeHint !== undefined && args.countryCodeHint !== null) { this.countryCodeHint = args.countryCodeHint; } } }; AuthService_normalizePhoneNumber_args.prototype = {}; AuthService_normalizePhoneNumber_args.prototype.read = function(input) { input.readStructBegin(); while (true) { var ret = input.readFieldBegin(); var fname = ret.fname; var ftype = ret.ftype; var fid = ret.fid; if (ftype == Thrift.Type.STOP) { break; } switch (fid) { case 2: if (ftype == Thrift.Type.STRING) { this.countryCode = input.readString(); } else { input.skip(ftype); } break; case 3: if (ftype == Thrift.Type.STRING) { this.phoneNumber = input.readString(); } else { input.skip(ftype); } break; case 4: if (ftype == Thrift.Type.STRING) { this.countryCodeHint = input.readString(); } else { input.skip(ftype); } break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; }; AuthService_normalizePhoneNumber_args.prototype.write = function(output) { output.writeStructBegin('AuthService_normalizePhoneNumber_args'); if (this.countryCode !== null && this.countryCode !== undefined) { output.writeFieldBegin('countryCode', Thrift.Type.STRING, 2); output.writeString(this.countryCode); output.writeFieldEnd(); } if (this.phoneNumber !== null && this.phoneNumber !== undefined) { output.writeFieldBegin('phoneNumber', Thrift.Type.STRING, 3); output.writeString(this.phoneNumber); output.writeFieldEnd(); } if (this.countryCodeHint !== null && this.countryCodeHint !== undefined) { output.writeFieldBegin('countryCodeHint', Thrift.Type.STRING, 4); output.writeString(this.countryCodeHint); output.writeFieldEnd(); } output.writeFieldStop(); output.writeStructEnd(); return; }; var AuthService_normalizePhoneNumber_result = function(args) { this.success = null; this.e = null; if (args instanceof ttypes.TalkException) { this.e = args; return; } if (args) { if (args.success !== undefined && args.success !== null) { this.success = args.success; } if (args.e !== undefined && args.e !== null) { this.e = args.e; } } }; AuthService_normalizePhoneNumber_result.prototype = {}; AuthService_normalizePhoneNumber_result.prototype.read = function(input) { input.readStructBegin(); while (true) { var ret = input.readFieldBegin(); var fname = ret.fname; var ftype = ret.ftype; var fid = ret.fid; if (ftype == Thrift.Type.STOP) { break; } switch (fid) { case 0: if (ftype == Thrift.Type.STRING) { this.success = input.readString(); } else { input.skip(ftype); } break; case 1: if (ftype == Thrift.Type.STRUCT) { this.e = new ttypes.TalkException(); this.e.read(input); } else { input.skip(ftype); } break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; }; AuthService_normalizePhoneNumber_result.prototype.write = function(output) { output.writeStructBegin('AuthService_normalizePhoneNumber_result'); if (this.success !== null && this.success !== undefined) { output.writeFieldBegin('success', Thrift.Type.STRING, 0); output.writeString(this.success); output.writeFieldEnd(); } if (this.e !== null && this.e !== undefined) { output.writeFieldBegin('e', Thrift.Type.STRUCT, 1); this.e.write(output); output.writeFieldEnd(); } output.writeFieldStop(); output.writeStructEnd(); return; }; var AuthService_respondE2EELoginRequest_args = function(args) { this.verifier = null; this.publicKey = null; this.encryptedKeyChain = null; this.hashKeyChain = null; this.errorCode = null; if (args) { if (args.verifier !== undefined && args.verifier !== null) { this.verifier = args.verifier; } if (args.publicKey !== undefined && args.publicKey !== null) { this.publicKey = new ttypes.E2EEPublicKey(args.publicKey); } if (args.encryptedKeyChain !== undefined && args.encryptedKeyChain !== null) { this.encryptedKeyChain = args.encryptedKeyChain; } if (args.hashKeyChain !== undefined && args.hashKeyChain !== null) { this.hashKeyChain = args.hashKeyChain; } if (args.errorCode !== undefined && args.errorCode !== null) { this.errorCode = args.errorCode; } } }; AuthService_respondE2EELoginRequest_args.prototype = {}; AuthService_respondE2EELoginRequest_args.prototype.read = function(input) { input.readStructBegin(); while (true) { var ret = input.readFieldBegin(); var fname = ret.fname; var ftype = ret.ftype; var fid = ret.fid; if (ftype == Thrift.Type.STOP) { break; } switch (fid) { case 1: if (ftype == Thrift.Type.STRING) { this.verifier = input.readString(); } else { input.skip(ftype); } break; case 2: if (ftype == Thrift.Type.STRUCT) { this.publicKey = new ttypes.E2EEPublicKey(); this.publicKey.read(input); } else { input.skip(ftype); } break; case 3: if (ftype == Thrift.Type.STRING) { this.encryptedKeyChain = input.readBinary(); } else { input.skip(ftype); } break; case 4: if (ftype == Thrift.Type.STRING) { this.hashKeyChain = input.readBinary(); } else { input.skip(ftype); } break; case 5: if (ftype == Thrift.Type.I32) { this.errorCode = input.readI32(); } else { input.skip(ftype); } break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; }; AuthService_respondE2EELoginRequest_args.prototype.write = function(output) { output.writeStructBegin('AuthService_respondE2EELoginRequest_args'); if (this.verifier !== null && this.verifier !== undefined) { output.writeFieldBegin('verifier', Thrift.Type.STRING, 1); output.writeString(this.verifier); output.writeFieldEnd(); } if (this.publicKey !== null && this.publicKey !== undefined) { output.writeFieldBegin('publicKey', Thrift.Type.STRUCT, 2); this.publicKey.write(output); output.writeFieldEnd(); } if (this.encryptedKeyChain !== null && this.encryptedKeyChain !== undefined) { output.writeFieldBegin('encryptedKeyChain', Thrift.Type.STRING, 3); output.writeBinary(this.encryptedKeyChain); output.writeFieldEnd(); } if (this.hashKeyChain !== null && this.hashKeyChain !== undefined) { output.writeFieldBegin('hashKeyChain', Thrift.Type.STRING, 4); output.writeBinary(this.hashKeyChain); output.writeFieldEnd(); } if (this.errorCode !== null && this.errorCode !== undefined) { output.writeFieldBegin('errorCode', Thrift.Type.I32, 5); output.writeI32(this.errorCode); output.writeFieldEnd(); } output.writeFieldStop(); output.writeStructEnd(); return; }; var AuthService_respondE2EELoginRequest_result = function(args) { this.e = null; if (args instanceof ttypes.TalkException) { this.e = args; return; } if (args) { if (args.e !== undefined && args.e !== null) { this.e = args.e; } } }; AuthService_respondE2EELoginRequest_result.prototype = {}; AuthService_respondE2EELoginRequest_result.prototype.read = function(input) { input.readStructBegin(); while (true) { var ret = input.readFieldBegin(); var fname = ret.fname; var ftype = ret.ftype; var fid = ret.fid; if (ftype == Thrift.Type.STOP) { break; } switch (fid) { case 1: if (ftype == Thrift.Type.STRUCT) { this.e = new ttypes.TalkException(); this.e.read(input); } else { input.skip(ftype); } break; case 0: input.skip(ftype); break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; }; AuthService_respondE2EELoginRequest_result.prototype.write = function(output) { output.writeStructBegin('AuthService_respondE2EELoginRequest_result'); if (this.e !== null && this.e !== undefined) { output.writeFieldBegin('e', Thrift.Type.STRUCT, 1); this.e.write(output); output.writeFieldEnd(); } output.writeFieldStop(); output.writeStructEnd(); return; }; var AuthService_confirmE2EELogin_args = function(args) { this.verifier = null; this.deviceSecret = null; if (args) { if (args.verifier !== undefined && args.verifier !== null) { this.verifier = args.verifier; } if (args.deviceSecret !== undefined && args.deviceSecret !== null) { this.deviceSecret = args.deviceSecret; } } }; AuthService_confirmE2EELogin_args.prototype = {}; AuthService_confirmE2EELogin_args.prototype.read = function(input) { input.readStructBegin(); while (true) { var ret = input.readFieldBegin(); var fname = ret.fname; var ftype = ret.ftype; var fid = ret.fid; if (ftype == Thrift.Type.STOP) { break; } switch (fid) { case 1: if (ftype == Thrift.Type.STRING) { this.verifier = input.readString(); } else { input.skip(ftype); } break; case 2: if (ftype == Thrift.Type.STRING) { this.deviceSecret = input.readBinary(); } else { input.skip(ftype); } break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; }; AuthService_confirmE2EELogin_args.prototype.write = function(output) { output.writeStructBegin('AuthService_confirmE2EELogin_args'); if (this.verifier !== null && this.verifier !== undefined) { output.writeFieldBegin('verifier', Thrift.Type.STRING, 1); output.writeString(this.verifier); output.writeFieldEnd(); } if (this.deviceSecret !== null && this.deviceSecret !== undefined) { output.writeFieldBegin('deviceSecret', Thrift.Type.STRING, 2); output.writeBinary(this.deviceSecret); output.writeFieldEnd(); } output.writeFieldStop(); output.writeStructEnd(); return; }; var AuthService_confirmE2EELogin_result = function(args) { this.success = null; this.e = null; if (args instanceof ttypes.TalkException) { this.e = args; return; } if (args) { if (args.success !== undefined && args.success !== null) { this.success = args.success; } if (args.e !== undefined && args.e !== null) { this.e = args.e; } } }; AuthService_confirmE2EELogin_result.prototype = {}; AuthService_confirmE2EELogin_result.prototype.read = function(input) { input.readStructBegin(); while (true) { var ret = input.readFieldBegin(); var fname = ret.fname; var ftype = ret.ftype; var fid = ret.fid; if (ftype == Thrift.Type.STOP) { break; } switch (fid) { case 0: if (ftype == Thrift.Type.STRING) { this.success = input.readString(); } else { input.skip(ftype); } break; case 1: if (ftype == Thrift.Type.STRUCT) { this.e = new ttypes.TalkException(); this.e.read(input); } else { input.skip(ftype); } break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; }; AuthService_confirmE2EELogin_result.prototype.write = function(output) { output.writeStructBegin('AuthService_confirmE2EELogin_result'); if (this.success !== null && this.success !== undefined) { output.writeFieldBegin('success', Thrift.Type.STRING, 0); output.writeString(this.success); output.writeFieldEnd(); } if (this.e !== null && this.e !== undefined) { output.writeFieldBegin('e', Thrift.Type.STRUCT, 1); this.e.write(output); output.writeFieldEnd(); } output.writeFieldStop(); output.writeStructEnd(); return; }; var AuthService_logoutZ_args = function(args) { }; AuthService_logoutZ_args.prototype = {}; AuthService_logoutZ_args.prototype.read = function(input) { input.readStructBegin(); while (true) { var ret = input.readFieldBegin(); var fname = ret.fname; var ftype = ret.ftype; var fid = ret.fid; if (ftype == Thrift.Type.STOP) { break; } input.skip(ftype); input.readFieldEnd(); } input.readStructEnd(); return; }; AuthService_logoutZ_args.prototype.write = function(output) { output.writeStructBegin('AuthService_logoutZ_args'); output.writeFieldStop(); output.writeStructEnd(); return; }; var AuthService_logoutZ_result = function(args) { this.e = null; if (args instanceof ttypes.TalkException) { this.e = args; return; } if (args) { if (args.e !== undefined && args.e !== null) { this.e = args.e; } } }; AuthService_logoutZ_result.prototype = {}; AuthService_logoutZ_result.prototype.read = function(input) { input.readStructBegin(); while (true) { var ret = input.readFieldBegin(); var fname = ret.fname; var ftype = ret.ftype; var fid = ret.fid; if (ftype == Thrift.Type.STOP) { break; } switch (fid) { case 1: if (ftype == Thrift.Type.STRUCT) { this.e = new ttypes.TalkException(); this.e.read(input); } else { input.skip(ftype); } break; case 0: input.skip(ftype); break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; }; AuthService_logoutZ_result.prototype.write = function(output) { output.writeStructBegin('AuthService_logoutZ_result'); if (this.e !== null && this.e !== undefined) { output.writeFieldBegin('e', Thrift.Type.STRUCT, 1); this.e.write(output); output.writeFieldEnd(); } output.writeFieldStop(); output.writeStructEnd(); return; }; var AuthService_loginZ_args = function(args) { this.loginRequest = null; if (args) { if (args.loginRequest !== undefined && args.loginRequest !== null) { this.loginRequest = new ttypes.LoginRequest(args.loginRequest); } } }; AuthService_loginZ_args.prototype = {}; AuthService_loginZ_args.prototype.read = function(input) { input.readStructBegin(); while (true) { var ret = input.readFieldBegin(); var fname = ret.fname; var ftype = ret.ftype; var fid = ret.fid; if (ftype == Thrift.Type.STOP) { break; } switch (fid) { case 2: if (ftype == Thrift.Type.STRUCT) { this.loginRequest = new ttypes.LoginRequest(); this.loginRequest.read(input); } else { input.skip(ftype); } break; case 0: input.skip(ftype); break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; }; AuthService_loginZ_args.prototype.write = function(output) { output.writeStructBegin('AuthService_loginZ_args'); if (this.loginRequest !== null && this.loginRequest !== undefined) { output.writeFieldBegin('loginRequest', Thrift.Type.STRUCT, 2); this.loginRequest.write(output); output.writeFieldEnd(); } output.writeFieldStop(); output.writeStructEnd(); return; }; var AuthService_loginZ_result = function(args) { this.success = null; this.e = null; if (args instanceof ttypes.TalkException) { this.e = args; return; } if (args) { if (args.success !== undefined && args.success !== null) { this.success = new ttypes.LoginResult(args.success); } if (args.e !== undefined && args.e !== null) { this.e = args.e; } } }; AuthService_loginZ_result.prototype = {}; AuthService_loginZ_result.prototype.read = function(input) { input.readStructBegin(); while (true) { var ret = input.readFieldBegin(); var fname = ret.fname; var ftype = ret.ftype; var fid = ret.fid; if (ftype == Thrift.Type.STOP) { break; } switch (fid) { case 0: if (ftype == Thrift.Type.STRUCT) { this.success = new ttypes.LoginResult(); this.success.read(input); } else { input.skip(ftype); } break; case 1: if (ftype == Thrift.Type.STRUCT) { this.e = new ttypes.TalkException(); this.e.read(input); } else { input.skip(ftype); } break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; }; AuthService_loginZ_result.prototype.write = function(output) { output.writeStructBegin('AuthService_loginZ_result'); if (this.success !== null && this.success !== undefined) { output.writeFieldBegin('success', Thrift.Type.STRUCT, 0); this.success.write(output); output.writeFieldEnd(); } if (this.e !== null && this.e !== undefined) { output.writeFieldBegin('e', Thrift.Type.STRUCT, 1); this.e.write(output); output.writeFieldEnd(); } output.writeFieldStop(); output.writeStructEnd(); return; }; var AuthService_issueTokenForAccountMigrationSettings_args = function(args) { this.enforce = null; if (args) { if (args.enforce !== undefined && args.enforce !== null) { this.enforce = args.enforce; } } }; AuthService_issueTokenForAccountMigrationSettings_args.prototype = {}; AuthService_issueTokenForAccountMigrationSettings_args.prototype.read = function(input) { input.readStructBegin(); while (true) { var ret = input.readFieldBegin(); var fname = ret.fname; var ftype = ret.ftype; var fid = ret.fid; if (ftype == Thrift.Type.STOP) { break; } switch (fid) { case 2: if (ftype == Thrift.Type.BOOL) { this.enforce = input.readBool(); } else { input.skip(ftype); } break; case 0: input.skip(ftype); break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; }; AuthService_issueTokenForAccountMigrationSettings_args.prototype.write = function(output) { output.writeStructBegin('AuthService_issueTokenForAccountMigrationSettings_args'); if (this.enforce !== null && this.enforce !== undefined) { output.writeFieldBegin('enforce', Thrift.Type.BOOL, 2); output.writeBool(this.enforce); output.writeFieldEnd(); } output.writeFieldStop(); output.writeStructEnd(); return; }; var AuthService_issueTokenForAccountMigrationSettings_result = function(args) { this.success = null; this.e = null; if (args instanceof ttypes.TalkException) { this.e = args; return; } if (args) { if (args.success !== undefined && args.success !== null) { this.success = new ttypes.SecurityCenterResult(args.success); } if (args.e !== undefined && args.e !== null) { this.e = args.e; } } }; AuthService_issueTokenForAccountMigrationSettings_result.prototype = {}; AuthService_issueTokenForAccountMigrationSettings_result.prototype.read = function(input) { input.readStructBegin(); while (true) { var ret = input.readFieldBegin(); var fname = ret.fname; var ftype = ret.ftype; var fid = ret.fid; if (ftype == Thrift.Type.STOP) { break; } switch (fid) { case 0: if (ftype == Thrift.Type.STRUCT) { this.success = new ttypes.SecurityCenterResult(); this.success.read(input); } else { input.skip(ftype); } break; case 1: if (ftype == Thrift.Type.STRUCT) { this.e = new ttypes.TalkException(); this.e.read(input); } else { input.skip(ftype); } break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; }; AuthService_issueTokenForAccountMigrationSettings_result.prototype.write = function(output) { output.writeStructBegin('AuthService_issueTokenForAccountMigrationSettings_result'); if (this.success !== null && this.success !== undefined) { output.writeFieldBegin('success', Thrift.Type.STRUCT, 0); this.success.write(output); output.writeFieldEnd(); } if (this.e !== null && this.e !== undefined) { output.writeFieldBegin('e', Thrift.Type.STRUCT, 1); this.e.write(output); output.writeFieldEnd(); } output.writeFieldStop(); output.writeStructEnd(); return; }; var AuthService_issueTokenForAccountMigration_args = function(args) { this.migrationSessionId = null; if (args) { if (args.migrationSessionId !== undefined && args.migrationSessionId !== null) { this.migrationSessionId = args.migrationSessionId; } } }; AuthService_issueTokenForAccountMigration_args.prototype = {}; AuthService_issueTokenForAccountMigration_args.prototype.read = function(input) { input.readStructBegin(); while (true) { var ret = input.readFieldBegin(); var fname = ret.fname; var ftype = ret.ftype; var fid = ret.fid; if (ftype == Thrift.Type.STOP) { break; } switch (fid) { case 2: if (ftype == Thrift.Type.STRING) { this.migrationSessionId = input.readString(); } else { input.skip(ftype); } break; case 0: input.skip(ftype); break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; }; AuthService_issueTokenForAccountMigration_args.prototype.write = function(output) { output.writeStructBegin('AuthService_issueTokenForAccountMigration_args'); if (this.migrationSessionId !== null && this.migrationSessionId !== undefined) { output.writeFieldBegin('migrationSessionId', Thrift.Type.STRING, 2); output.writeString(this.migrationSessionId); output.writeFieldEnd(); } output.writeFieldStop(); output.writeStructEnd(); return; }; var AuthService_issueTokenForAccountMigration_result = function(args) { this.success = null; this.e = null; if (args instanceof ttypes.TalkException) { this.e = args; return; } if (args) { if (args.success !== undefined && args.success !== null) { this.success = new ttypes.SecurityCenterResult(args.success); } if (args.e !== undefined && args.e !== null) { this.e = args.e; } } }; AuthService_issueTokenForAccountMigration_result.prototype = {}; AuthService_issueTokenForAccountMigration_result.prototype.read = function(input) { input.readStructBegin(); while (true) { var ret = input.readFieldBegin(); var fname = ret.fname; var ftype = ret.ftype; var fid = ret.fid; if (ftype == Thrift.Type.STOP) { break; } switch (fid) { case 0: if (ftype == Thrift.Type.STRUCT) { this.success = new ttypes.SecurityCenterResult(); this.success.read(input); } else { input.skip(ftype); } break; case 1: if (ftype == Thrift.Type.STRUCT) { this.e = new ttypes.TalkException(); this.e.read(input); } else { input.skip(ftype); } break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; }; AuthService_issueTokenForAccountMigration_result.prototype.write = function(output) { output.writeStructBegin('AuthService_issueTokenForAccountMigration_result'); if (this.success !== null && this.success !== undefined) { output.writeFieldBegin('success', Thrift.Type.STRUCT, 0); this.success.write(output); output.writeFieldEnd(); } if (this.e !== null && this.e !== undefined) { output.writeFieldBegin('e', Thrift.Type.STRUCT, 1); this.e.write(output); output.writeFieldEnd(); } output.writeFieldStop(); output.writeStructEnd(); return; }; var AuthService_verifyQrcodeWithE2EE_args = function(args) { this.verifier = null; this.pinCode = null; this.errorCode = null; this.publicKey = null; this.encryptedKeyChain = null; this.hashKeyChain = null; if (args) { if (args.verifier !== undefined && args.verifier !== null) { this.verifier = args.verifier; } if (args.pinCode !== undefined && args.pinCode !== null) { this.pinCode = args.pinCode; } if (args.errorCode !== undefined && args.errorCode !== null) { this.errorCode = args.errorCode; } if (args.publicKey !== undefined && args.publicKey !== null) { this.publicKey = new ttypes.E2EEPublicKey(args.publicKey); } if (args.encryptedKeyChain !== undefined && args.encryptedKeyChain !== null) { this.encryptedKeyChain = args.encryptedKeyChain; } if (args.hashKeyChain !== undefined && args.hashKeyChain !== null) { this.hashKeyChain = args.hashKeyChain; } } }; AuthService_verifyQrcodeWithE2EE_args.prototype = {}; AuthService_verifyQrcodeWithE2EE_args.prototype.read = function(input) { input.readStructBegin(); while (true) { var ret = input.readFieldBegin(); var fname = ret.fname; var ftype = ret.ftype; var fid = ret.fid; if (ftype == Thrift.Type.STOP) { break; } switch (fid) { case 2: if (ftype == Thrift.Type.STRING) { this.verifier = input.readString(); } else { input.skip(ftype); } break; case 3: if (ftype == Thrift.Type.STRING) { this.pinCode = input.readString(); } else { input.skip(ftype); } break; case 4: if (ftype == Thrift.Type.I32) { this.errorCode = input.readI32(); } else { input.skip(ftype); } break; case 5: if (ftype == Thrift.Type.STRUCT) { this.publicKey = new ttypes.E2EEPublicKey(); this.publicKey.read(input); } else { input.skip(ftype); } break; case 6: if (ftype == Thrift.Type.STRING) { this.encryptedKeyChain = input.readBinary(); } else { input.skip(ftype); } break; case 7: if (ftype == Thrift.Type.STRING) { this.hashKeyChain = input.readBinary(); } else { input.skip(ftype); } break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; }; AuthService_verifyQrcodeWithE2EE_args.prototype.write = function(output) { output.writeStructBegin('AuthService_verifyQrcodeWithE2EE_args'); if (this.verifier !== null && this.verifier !== undefined) { output.writeFieldBegin('verifier', Thrift.Type.STRING, 2); output.writeString(this.verifier); output.writeFieldEnd(); } if (this.pinCode !== null && this.pinCode !== undefined) { output.writeFieldBegin('pinCode', Thrift.Type.STRING, 3); output.writeString(this.pinCode); output.writeFieldEnd(); } if (this.errorCode !== null && this.errorCode !== undefined) { output.writeFieldBegin('errorCode', Thrift.Type.I32, 4); output.writeI32(this.errorCode); output.writeFieldEnd(); } if (this.publicKey !== null && this.publicKey !== undefined) { output.writeFieldBegin('publicKey', Thrift.Type.STRUCT, 5); this.publicKey.write(output); output.writeFieldEnd(); } if (this.encryptedKeyChain !== null && this.encryptedKeyChain !== undefined) { output.writeFieldBegin('encryptedKeyChain', Thrift.Type.STRING, 6); output.writeBinary(this.encryptedKeyChain); output.writeFieldEnd(); } if (this.hashKeyChain !== null && this.hashKeyChain !== undefined) { output.writeFieldBegin('hashKeyChain', Thrift.Type.STRING, 7); output.writeBinary(this.hashKeyChain); output.writeFieldEnd(); } output.writeFieldStop(); output.writeStructEnd(); return; }; var AuthService_verifyQrcodeWithE2EE_result = function(args) { this.success = null; this.e = null; if (args instanceof ttypes.TalkException) { this.e = args; return; } if (args) { if (args.success !== undefined && args.success !== null) { this.success = args.success; } if (args.e !== undefined && args.e !== null) { this.e = args.e; } } }; AuthService_verifyQrcodeWithE2EE_result.prototype = {}; AuthService_verifyQrcodeWithE2EE_result.prototype.read = function(input) { input.readStructBegin(); while (true) { var ret = input.readFieldBegin(); var fname = ret.fname; var ftype = ret.ftype; var fid = ret.fid; if (ftype == Thrift.Type.STOP) { break; } switch (fid) { case 0: if (ftype == Thrift.Type.STRING) { this.success = input.readString(); } else { input.skip(ftype); } break; case 1: if (ftype == Thrift.Type.STRUCT) { this.e = new ttypes.TalkException(); this.e.read(input); } else { input.skip(ftype); } break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; }; AuthService_verifyQrcodeWithE2EE_result.prototype.write = function(output) { output.writeStructBegin('AuthService_verifyQrcodeWithE2EE_result'); if (this.success !== null && this.success !== undefined) { output.writeFieldBegin('success', Thrift.Type.STRING, 0); output.writeString(this.success); output.writeFieldEnd(); } if (this.e !== null && this.e !== undefined) { output.writeFieldBegin('e', Thrift.Type.STRUCT, 1); this.e.write(output); output.writeFieldEnd(); } output.writeFieldStop(); output.writeStructEnd(); return; }; var AuthServiceClient = exports.Client = function(output, pClass) { this.output = output; this.pClass = pClass; this._seqid = 0; this._reqs = {}; }; AuthServiceClient.prototype = {}; AuthServiceClient.prototype.seqid = function() { return this._seqid; }; AuthServiceClient.prototype.new_seqid = function() { return this._seqid += 1; }; AuthServiceClient.prototype.normalizePhoneNumber = function(countryCode, phoneNumber, countryCodeHint, callback) { this._seqid = this.new_seqid(); if (callback === undefined) { var _defer = Q.defer(); this._reqs[this.seqid()] = function(error, result) { if (error) { _defer.reject(error); } else { _defer.resolve(result); } }; this.send_normalizePhoneNumber(countryCode, phoneNumber, countryCodeHint); return _defer.promise; } else { this._reqs[this.seqid()] = callback; this.send_normalizePhoneNumber(countryCode, phoneNumber, countryCodeHint); } }; AuthServiceClient.prototype.send_normalizePhoneNumber = function(countryCode, phoneNumber, countryCodeHint) { var output = new this.pClass(this.output); output.writeMessageBegin('normalizePhoneNumber', Thrift.MessageType.CALL, this.seqid()); var args = new AuthService_normalizePhoneNumber_args(); args.countryCode = countryCode; args.phoneNumber = phoneNumber; args.countryCodeHint = countryCodeHint; args.write(output); output.writeMessageEnd(); return this.output.flush(); }; AuthServiceClient.prototype.recv_normalizePhoneNumber = function(input,mtype,rseqid) { var callback = this._reqs[rseqid] || function() {}; delete this._reqs[rseqid]; if (mtype == Thrift.MessageType.EXCEPTION) { var x = new Thrift.TApplicationException(); x.read(input); input.readMessageEnd(); return callback(x); } var result = new AuthService_normalizePhoneNumber_result(); result.read(input); input.readMessageEnd(); if (null !== result.e) { return callback(result.e); } if (null !== result.success) { return callback(null, result.success); } return callback('normalizePhoneNumber failed: unknown result'); }; AuthServiceClient.prototype.respondE2EELoginRequest = function(verifier, publicKey, encryptedKeyChain, hashKeyChain, errorCode, callback) { this._seqid = this.new_seqid(); if (callback === undefined) { var _defer = Q.defer(); this._reqs[this.seqid()] = function(error, result) { if (error) { _defer.reject(error); } else { _defer.resolve(result); } }; this.send_respondE2EELoginRequest(verifier, publicKey, encryptedKeyChain, hashKeyChain, errorCode); return _defer.promise; } else { this._reqs[this.seqid()] = callback; this.send_respondE2EELoginRequest(verifier, publicKey, encryptedKeyChain, hashKeyChain, errorCode); } }; AuthServiceClient.prototype.send_respondE2EELoginRequest = function(verifier, publicKey, encryptedKeyChain, hashKeyChain, errorCode) { var output = new this.pClass(this.output); output.writeMessageBegin('respondE2EELoginRequest', Thrift.MessageType.CALL, this.seqid()); var args = new AuthService_respondE2EELoginRequest_args(); args.verifier = verifier; args.publicKey = publicKey; args.encryptedKeyChain = encryptedKeyChain; args.hashKeyChain = hashKeyChain; args.errorCode = errorCode; args.write(output); output.writeMessageEnd(); return this.output.flush(); }; AuthServiceClient.prototype.recv_respondE2EELoginRequest = function(input,mtype,rseqid) { var callback = this._reqs[rseqid] || function() {}; delete this._reqs[rseqid]; if (mtype == Thrift.MessageType.EXCEPTION) { var x = new Thrift.TApplicationException(); x.read(input); input.readMessageEnd(); return callback(x); } var result = new AuthService_respondE2EELoginRequest_result(); result.read(input); input.readMessageEnd(); if (null !== result.e) { return callback(result.e); } callback(null); }; AuthServiceClient.prototype.confirmE2EELogin = function(verifier, deviceSecret, callback) { this._seqid = this.new_seqid(); if (callback === undefined) { var _defer = Q.defer(); this._reqs[this.seqid()] = function(error, result) { if (error) { _defer.reject(error); } else { _defer.resolve(result); } }; this.send_confirmE2EELogin(verifier, deviceSecret); return _defer.promise; } else { this._reqs[this.seqid()] = callback; this.send_confirmE2EELogin(verifier, deviceSecret); } }; AuthServiceClient.prototype.send_confirmE2EELogin = function(verifier, deviceSecret) { var output = new this.pClass(this.output); output.writeMessageBegin('confirmE2EELogin', Thrift.MessageType.CALL, this.seqid()); var args = new AuthService_confirmE2EELogin_args(); args.verifier = verifier; args.deviceSecret = deviceSecret; args.write(output); output.writeMessageEnd(); return this.output.flush(); }; AuthServiceClient.prototype.recv_confirmE2EELogin = function(input,mtype,rseqid) { var callback = this._reqs[rseqid] || function() {}; delete this._reqs[rseqid]; if (mtype == Thrift.MessageType.EXCEPTION) { var x = new Thrift.TApplicationException(); x.read(input); input.readMessageEnd(); return callback(x); } var result = new AuthService_confirmE2EELogin_result(); result.read(input); input.readMessageEnd(); if (null !== result.e) { return callback(result.e); } if (null !== result.success) { return callback(null, result.success); } return callback('confirmE2EELogin failed: unknown result'); }; AuthServiceClient.prototype.logoutZ = function(callback) { this._seqid = this.new_seqid(); if (callback === undefined) { var _defer = Q.defer(); this._reqs[this.seqid()] = function(error, result) { if (error) { _defer.reject(error); } else { _defer.resolve(result); } }; this.send_logoutZ(); return _defer.promise; } else { this._reqs[this.seqid()] = callback; this.send_logoutZ(); } }; AuthServiceClient.prototype.send_logoutZ = function() { var output = new this.pClass(this.output); output.writeMessageBegin('logoutZ', Thrift.MessageType.CALL, this.seqid()); var args = new AuthService_logoutZ_args(); args.write(output); output.writeMessageEnd(); return this.output.flush(); }; AuthServiceClient.prototype.recv_logoutZ = function(input,mtype,rseqid) { var callback = this._reqs[rseqid] || function() {}; delete this._reqs[rseqid]; if (mtype == Thrift.MessageType.EXCEPTION) { var x = new Thrift.TApplicationException(); x.read(input); input.readMessageEnd(); return callback(x); } var result = new AuthService_logoutZ_result(); result.read(input); input.readMessageEnd(); if (null !== result.e) { return callback(result.e); } callback(null); }; AuthServiceClient.prototype.loginZ = function(loginRequest, callback) { this._seqid = this.new_seqid(); if (callback === undefined) { var _defer = Q.defer(); this._reqs[this.seqid()] = function(error, result) { if (error) { _defer.reject(error); } else { _defer.resolve(result); } }; this.send_loginZ(loginRequest); return _defer.promise; } else { this._reqs[this.seqid()] = callback; this.send_loginZ(loginRequest); } }; AuthServiceClient.prototype.send_loginZ = function(loginRequest) { var output = new this.pClass(this.output); output.writeMessageBegin('loginZ', Thrift.MessageType.CALL, this.seqid()); var args = new AuthService_loginZ_args(); args.loginRequest = loginRequest; args.write(output); output.writeMessageEnd(); return this.output.flush(); }; AuthServiceClient.prototype.recv_loginZ = function(input,mtype,rseqid) { var callback = this._reqs[rseqid] || function() {}; delete this._reqs[rseqid]; if (mtype == Thrift.MessageType.EXCEPTION) { var x = new Thrift.TApplicationException(); x.read(input); input.readMessageEnd(); return callback(x); } var result = new AuthService_loginZ_result(); result.read(input); input.readMessageEnd(); if (null !== result.e) { return callback(result.e); } if (null !== result.success) { return callback(null, result.success); } return callback('loginZ failed: unknown result'); }; AuthServiceClient.prototype.issueTokenForAccountMigrationSettings = function(enforce, callback) { this._seqid = this.new_seqid(); if (callback === undefined) { var _defer = Q.defer(); this._reqs[this.seqid()] = function(error, result) { if (error) { _defer.reject(error); } else { _defer.resolve(result); } }; this.send_issueTokenForAccountMigrationSettings(enforce); return _defer.promise; } else { this._reqs[this.seqid()] = callback; this.send_issueTokenForAccountMigrationSettings(enforce); } }; AuthServiceClient.prototype.send_issueTokenForAccountMigrationSettings = function(enforce) { var output = new this.pClass(this.output); output.writeMessageBegin('issueTokenForAccountMigrationSettings', Thrift.MessageType.CALL, this.seqid()); var args = new AuthService_issueTokenForAccountMigrationSettings_args(); args.enforce = enforce; args.write(output); output.writeMessageEnd(); return this.output.flush(); }; AuthServiceClient.prototype.recv_issueTokenForAccountMigrationSettings = function(input,mtype,rseqid) { var callback = this._reqs[rseqid] || function() {}; delete this._reqs[rseqid]; if (mtype == Thrift.MessageType.EXCEPTION) { var x = new Thrift.TApplicationException(); x.read(input); input.readMessageEnd(); return callback(x); } var result = new AuthService_issueTokenForAccountMigrationSettings_result(); result.read(input); input.readMessageEnd(); if (null !== result.e) { return callback(result.e); } if (null !== result.success) { return callback(null, result.success); } return callback('issueTokenForAccountMigrationSettings failed: unknown result'); }; AuthServiceClient.prototype.issueTokenForAccountMigration = function(migrationSessionId, callback) { this._seqid = this.new_seqid(); if (callback === undefined) { var _defer = Q.defer(); this._reqs[this.seqid()] = function(error, result) { if (error) { _defer.reject(error); } else { _defer.resolve(result); } }; this.send_issueTokenForAccountMigration(migrationSessionId); return _defer.promise; } else { this._reqs[this.seqid()] = callback; this.send_issueTokenForAccountMigration(migrationSessionId); } }; AuthServiceClient.prototype.send_issueTokenForAccountMigration = function(migrationSessionId) { var output = new this.pClass(this.output); output.writeMessageBegin('issueTokenForAccountMigration', Thrift.MessageType.CALL, this.seqid()); var args = new AuthService_issueTokenForAccountMigration_args(); args.migrationSessionId = migrationSessionId; args.write(output); output.writeMessageEnd(); return this.output.flush(); }; AuthServiceClient.prototype.recv_issueTokenForAccountMigration = function(input,mtype,rseqid) { var callback = this._reqs[rseqid] || function() {}; delete this._reqs[rseqid]; if (mtype == Thrift.MessageType.EXCEPTION) { var x = new Thrift.TApplicationException(); x.read(input); input.readMessageEnd(); return callback(x); } var result = new AuthService_issueTokenForAccountMigration_result(); result.read(input); input.readMessageEnd(); if (null !== result.e) { return callback(result.e); } if (null !== result.success) { return callback(null, result.success); } return callback('issueTokenForAccountMigration failed: unknown result'); }; AuthServiceClient.prototype.verifyQrcodeWithE2EE = function(verifier, pinCode, errorCode, publicKey, encryptedKeyChain, hashKeyChain, callback) { this._seqid = this.new_seqid(); if (callback === undefined) { var _defer = Q.defer(); this._reqs[this.seqid()] = function(error, result) { if (error) { _defer.reject(error); } else { _defer.resolve(result); } }; this.send_verifyQrcodeWithE2EE(verifier, pinCode, errorCode, publicKey, encryptedKeyChain, hashKeyChain); return _defer.promise; } else { this._reqs[this.seqid()] = callback; this.send_verifyQrcodeWithE2EE(verifier, pinCode, errorCode, publicKey, encryptedKeyChain, hashKeyChain); } }; AuthServiceClient.prototype.send_verifyQrcodeWithE2EE = function(verifier, pinCode, errorCode, publicKey, encryptedKeyChain, hashKeyChain) { var output = new this.pClass(this.output); output.writeMessageBegin('verifyQrcodeWithE2EE', Thrift.MessageType.CALL, this.seqid()); var args = new AuthService_verifyQrcodeWithE2EE_args(); args.verifier = verifier; args.pinCode = pinCode; args.errorCode = errorCode; args.publicKey = publicKey; args.encryptedKeyChain = encryptedKeyChain; args.hashKeyChain = hashKeyChain; args.write(output); output.writeMessageEnd(); return this.output.flush(); }; AuthServiceClient.prototype.recv_verifyQrcodeWithE2EE = function(input,mtype,rseqid) { var callback = this._reqs[rseqid] || function() {}; delete this._reqs[rseqid]; if (mtype == Thrift.MessageType.EXCEPTION) { var x = new Thrift.TApplicationException(); x.read(input); input.readMessageEnd(); return callback(x); } var result = new AuthService_verifyQrcodeWithE2EE_result(); result.read(input); input.readMessageEnd(); if (null !== result.e) { return callback(result.e); } if (null !== result.success) { return callback(null, result.success); } return callback('verifyQrcodeWithE2EE failed: unknown result'); }; var AuthServiceProcessor = exports.Processor = function(handler) { this._handler = handler; } ; AuthServiceProcessor.prototype.process = function(input, output) { var r = input.readMessageBegin(); if (this['process_' + r.fname]) { return this['process_' + r.fname].call(this, r.rseqid, input, output); } else { input.skip(Thrift.Type.STRUCT); input.readMessageEnd(); var x = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN_METHOD, 'Unknown function ' + r.fname); output.writeMessageBegin(r.fname, Thrift.MessageType.EXCEPTION, r.rseqid); x.write(output); output.writeMessageEnd(); output.flush(); } } ; AuthServiceProcessor.prototype.process_normalizePhoneNumber = function(seqid, input, output) { var args = new AuthService_normalizePhoneNumber_args(); args.read(input); input.readMessageEnd(); if (this._handler.normalizePhoneNumber.length === 3) { Q.fcall(this._handler.normalizePhoneNumber, args.countryCode, args.phoneNumber, args.countryCodeHint) .then(function(result) { var result_obj = new AuthService_normalizePhoneNumber_result({success: result}); output.writeMessageBegin("normalizePhoneNumber", Thrift.MessageType.REPLY, seqid); result_obj.write(output); output.writeMessageEnd(); output.flush(); }, function (err) { var result; if (err instanceof ttypes.TalkException) { result = new AuthService_normalizePhoneNumber_result(err); output.writeMessageBegin("normalizePhoneNumber", Thrift.MessageType.REPLY, seqid); } else { result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("normalizePhoneNumber", Thrift.MessageType.EXCEPTION, seqid); } result.write(output); output.writeMessageEnd(); output.flush(); }); } else { this._handler.normalizePhoneNumber(args.countryCode, args.phoneNumber, args.countryCodeHint, function (err, result) { var result_obj; if ((err === null || typeof err === 'undefined') || err instanceof ttypes.TalkException) { result_obj = new AuthService_normalizePhoneNumber_result((err !== null || typeof err === 'undefined') ? err : {success: result}); output.writeMessageBegin("normalizePhoneNumber", Thrift.MessageType.REPLY, seqid); } else { result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("normalizePhoneNumber", Thrift.MessageType.EXCEPTION, seqid); } result_obj.write(output); output.writeMessageEnd(); output.flush(); }); } }; AuthServiceProcessor.prototype.process_respondE2EELoginRequest = function(seqid, input, output) { var args = new AuthService_respondE2EELoginRequest_args(); args.read(input); input.readMessageEnd(); if (this._handler.respondE2EELoginRequest.length === 5) { Q.fcall(this._handler.respondE2EELoginRequest, args.verifier, args.publicKey, args.encryptedKeyChain, args.hashKeyChain, args.errorCode) .then(function(result) { var result_obj = new AuthService_respondE2EELoginRequest_result({success: result}); output.writeMessageBegin("respondE2EELoginRequest", Thrift.MessageType.REPLY, seqid); result_obj.write(output); output.writeMessageEnd(); output.flush(); }, function (err) { var result; if (err instanceof ttypes.TalkException) { result = new AuthService_respondE2EELoginRequest_result(err); output.writeMessageBegin("respondE2EELoginRequest", Thrift.MessageType.REPLY, seqid); } else { result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("respondE2EELoginRequest", Thrift.MessageType.EXCEPTION, seqid); } result.write(output); output.writeMessageEnd(); output.flush(); }); } else { this._handler.respondE2EELoginRequest(args.verifier, args.publicKey, args.encryptedKeyChain, args.hashKeyChain, args.errorCode, function (err, result) { var result_obj; if ((err === null || typeof err === 'undefined') || err instanceof ttypes.TalkException) { result_obj = new AuthService_respondE2EELoginRequest_result((err !== null || typeof err === 'undefined') ? err : {success: result}); output.writeMessageBegin("respondE2EELoginRequest", Thrift.MessageType.REPLY, seqid); } else { result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("respondE2EELoginRequest", Thrift.MessageType.EXCEPTION, seqid); } result_obj.write(output); output.writeMessageEnd(); output.flush(); }); } }; AuthServiceProcessor.prototype.process_confirmE2EELogin = function(seqid, input, output) { var args = new AuthService_confirmE2EELogin_args(); args.read(input); input.readMessageEnd(); if (this._handler.confirmE2EELogin.length === 2) { Q.fcall(this._handler.confirmE2EELogin, args.verifier, args.deviceSecret) .then(function(result) { var result_obj = new AuthService_confirmE2EELogin_result({success: result}); output.writeMessageBegin("confirmE2EELogin", Thrift.MessageType.REPLY, seqid); result_obj.write(output); output.writeMessageEnd(); output.flush(); }, function (err) { var result; if (err instanceof ttypes.TalkException) { result = new AuthService_confirmE2EELogin_result(err); output.writeMessageBegin("confirmE2EELogin", Thrift.MessageType.REPLY, seqid); } else { result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("confirmE2EELogin", Thrift.MessageType.EXCEPTION, seqid); } result.write(output); output.writeMessageEnd(); output.flush(); }); } else { this._handler.confirmE2EELogin(args.verifier, args.deviceSecret, function (err, result) { var result_obj; if ((err === null || typeof err === 'undefined') || err instanceof ttypes.TalkException) { result_obj = new AuthService_confirmE2EELogin_result((err !== null || typeof err === 'undefined') ? err : {success: result}); output.writeMessageBegin("confirmE2EELogin", Thrift.MessageType.REPLY, seqid); } else { result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("confirmE2EELogin", Thrift.MessageType.EXCEPTION, seqid); } result_obj.write(output); output.writeMessageEnd(); output.flush(); }); } }; AuthServiceProcessor.prototype.process_logoutZ = function(seqid, input, output) { var args = new AuthService_logoutZ_args(); args.read(input); input.readMessageEnd(); if (this._handler.logoutZ.length === 0) { Q.fcall(this._handler.logoutZ) .then(function(result) { var result_obj = new AuthService_logoutZ_result({success: result}); output.writeMessageBegin("logoutZ", Thrift.MessageType.REPLY, seqid); result_obj.write(output); output.writeMessageEnd(); output.flush(); }, function (err) { var result; if (err instanceof ttypes.TalkException) { result = new AuthService_logoutZ_result(err); output.writeMessageBegin("logoutZ", Thrift.MessageType.REPLY, seqid); } else { result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("logoutZ", Thrift.MessageType.EXCEPTION, seqid); } result.write(output); output.writeMessageEnd(); output.flush(); }); } else { this._handler.logoutZ(function (err, result) { var result_obj; if ((err === null || typeof err === 'undefined') || err instanceof ttypes.TalkException) { result_obj = new AuthService_logoutZ_result((err !== null || typeof err === 'undefined') ? err : {success: result}); output.writeMessageBegin("logoutZ", Thrift.MessageType.REPLY, seqid); } else { result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("logoutZ", Thrift.MessageType.EXCEPTION, seqid); } result_obj.write(output); output.writeMessageEnd(); output.flush(); }); } }; AuthServiceProcessor.prototype.process_loginZ = function(seqid, input, output) { var args = new AuthService_loginZ_args(); args.read(input); input.readMessageEnd(); if (this._handler.loginZ.length === 1) { Q.fcall(this._handler.loginZ, args.loginRequest) .then(function(result) { var result_obj = new AuthService_loginZ_result({success: result}); output.writeMessageBegin("loginZ", Thrift.MessageType.REPLY, seqid); result_obj.write(output); output.writeMessageEnd(); output.flush(); }, function (err) { var result; if (err instanceof ttypes.TalkException) { result = new AuthService_loginZ_result(err); output.writeMessageBegin("loginZ", Thrift.MessageType.REPLY, seqid); } else { result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("loginZ", Thrift.MessageType.EXCEPTION, seqid); } result.write(output); output.writeMessageEnd(); output.flush(); }); } else { this._handler.loginZ(args.loginRequest, function (err, result) { var result_obj; if ((err === null || typeof err === 'undefined') || err instanceof ttypes.TalkException) { result_obj = new AuthService_loginZ_result((err !== null || typeof err === 'undefined') ? err : {success: result}); output.writeMessageBegin("loginZ", Thrift.MessageType.REPLY, seqid); } else { result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("loginZ", Thrift.MessageType.EXCEPTION, seqid); } result_obj.write(output); output.writeMessageEnd(); output.flush(); }); } }; AuthServiceProcessor.prototype.process_issueTokenForAccountMigrationSettings = function(seqid, input, output) { var args = new AuthService_issueTokenForAccountMigrationSettings_args(); args.read(input); input.readMessageEnd(); if (this._handler.issueTokenForAccountMigrationSettings.length === 1) { Q.fcall(this._handler.issueTokenForAccountMigrationSettings, args.enforce) .then(function(result) { var result_obj = new AuthService_issueTokenForAccountMigrationSettings_result({success: result}); output.writeMessageBegin("issueTokenForAccountMigrationSettings", Thrift.MessageType.REPLY, seqid); result_obj.write(output); output.writeMessageEnd(); output.flush(); }, function (err) { var result; if (err instanceof ttypes.TalkException) { result = new AuthService_issueTokenForAccountMigrationSettings_result(err); output.writeMessageBegin("issueTokenForAccountMigrationSettings", Thrift.MessageType.REPLY, seqid); } else { result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("issueTokenForAccountMigrationSettings", Thrift.MessageType.EXCEPTION, seqid); } result.write(output); output.writeMessageEnd(); output.flush(); }); } else { this._handler.issueTokenForAccountMigrationSettings(args.enforce, function (err, result) { var result_obj; if ((err === null || typeof err === 'undefined') || err instanceof ttypes.TalkException) { result_obj = new AuthService_issueTokenForAccountMigrationSettings_result((err !== null || typeof err === 'undefined') ? err : {success: result}); output.writeMessageBegin("issueTokenForAccountMigrationSettings", Thrift.MessageType.REPLY, seqid); } else { result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("issueTokenForAccountMigrationSettings", Thrift.MessageType.EXCEPTION, seqid); } result_obj.write(output); output.writeMessageEnd(); output.flush(); }); } }; AuthServiceProcessor.prototype.process_issueTokenForAccountMigration = function(seqid, input, output) { var args = new AuthService_issueTokenForAccountMigration_args(); args.read(input); input.readMessageEnd(); if (this._handler.issueTokenForAccountMigration.length === 1) { Q.fcall(this._handler.issueTokenForAccountMigration, args.migrationSessionId) .then(function(result) { var result_obj = new AuthService_issueTokenForAccountMigration_result({success: result}); output.writeMessageBegin("issueTokenForAccountMigration", Thrift.MessageType.REPLY, seqid); result_obj.write(output); output.writeMessageEnd(); output.flush(); }, function (err) { var result; if (err instanceof ttypes.TalkException) { result = new AuthService_issueTokenForAccountMigration_result(err); output.writeMessageBegin("issueTokenForAccountMigration", Thrift.MessageType.REPLY, seqid); } else { result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("issueTokenForAccountMigration", Thrift.MessageType.EXCEPTION, seqid); } result.write(output); output.writeMessageEnd(); output.flush(); }); } else { this._handler.issueTokenForAccountMigration(args.migrationSessionId, function (err, result) { var result_obj; if ((err === null || typeof err === 'undefined') || err instanceof ttypes.TalkException) { result_obj = new AuthService_issueTokenForAccountMigration_result((err !== null || typeof err === 'undefined') ? err : {success: result}); output.writeMessageBegin("issueTokenForAccountMigration", Thrift.MessageType.REPLY, seqid); } else { result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("issueTokenForAccountMigration", Thrift.MessageType.EXCEPTION, seqid); } result_obj.write(output); output.writeMessageEnd(); output.flush(); }); } }; AuthServiceProcessor.prototype.process_verifyQrcodeWithE2EE = function(seqid, input, output) { var args = new AuthService_verifyQrcodeWithE2EE_args(); args.read(input); input.readMessageEnd(); if (this._handler.verifyQrcodeWithE2EE.length === 6) { Q.fcall(this._handler.verifyQrcodeWithE2EE, args.verifier, args.pinCode, args.errorCode, args.publicKey, args.encryptedKeyChain, args.hashKeyChain) .then(function(result) { var result_obj = new AuthService_verifyQrcodeWithE2EE_result({success: result}); output.writeMessageBegin("verifyQrcodeWithE2EE", Thrift.MessageType.REPLY, seqid); result_obj.write(output); output.writeMessageEnd(); output.flush(); }, function (err) { var result; if (err instanceof ttypes.TalkException) { result = new AuthService_verifyQrcodeWithE2EE_result(err); output.writeMessageBegin("verifyQrcodeWithE2EE", Thrift.MessageType.REPLY, seqid); } else { result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("verifyQrcodeWithE2EE", Thrift.MessageType.EXCEPTION, seqid); } result.write(output); output.writeMessageEnd(); output.flush(); }); } else { this._handler.verifyQrcodeWithE2EE(args.verifier, args.pinCode, args.errorCode, args.publicKey, args.encryptedKeyChain, args.hashKeyChain, function (err, result) { var result_obj; if ((err === null || typeof err === 'undefined') || err instanceof ttypes.TalkException) { result_obj = new AuthService_verifyQrcodeWithE2EE_result((err !== null || typeof err === 'undefined') ? err : {success: result}); output.writeMessageBegin("verifyQrcodeWithE2EE", Thrift.MessageType.REPLY, seqid); } else { result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message); output.writeMessageBegin("verifyQrcodeWithE2EE", Thrift.MessageType.EXCEPTION, seqid); } result_obj.write(output); output.writeMessageEnd(); output.flush(); }); } };