minecraft-auth
Advanced tools
Comparing version 1.0.14 to 1.0.15
export declare function XHR_GET(url: any, headers?: {}): Promise<any>; | ||
export declare function XHR_DELETE(url: any, headers?: {}): Promise<any>; | ||
export declare function XHR_CUSTOM(method: any, url: any, body?: string, headers?: {}): Promise<any>; | ||
export declare function XHR_POST(url: any, data: string, headers?: {}): Promise<any>; |
@@ -39,17 +39,10 @@ "use strict"; | ||
exports.__esModule = true; | ||
exports.XHR_POST = exports.XHR_DELETE = exports.XHR_GET = void 0; | ||
exports.XHR_POST = exports.XHR_CUSTOM = exports.XHR_GET = void 0; | ||
var fetch = require('node-fetch'); | ||
function XHR_GET(url, headers) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var res; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, fetch(url, { | ||
method: 'get', | ||
headers: headers | ||
})]; | ||
case 1: | ||
res = _a.sent(); | ||
return [4 /*yield*/, res.text()]; | ||
case 2: return [2 /*return*/, _a.sent()]; | ||
case 0: return [4 /*yield*/, XHR_CUSTOM("get", url, undefined, headers)]; | ||
case 1: return [2 /*return*/, _a.sent()]; | ||
} | ||
@@ -60,11 +53,15 @@ }); | ||
exports.XHR_GET = XHR_GET; | ||
function XHR_DELETE(url, headers) { | ||
function XHR_CUSTOM(method, url, body, headers) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var res; | ||
var req, res; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, fetch(url, { | ||
method: 'delete', | ||
case 0: | ||
req = { | ||
method: method, | ||
headers: headers | ||
})]; | ||
}; | ||
if (body) | ||
req["body"] = body; | ||
return [4 /*yield*/, fetch(url, req)]; | ||
case 1: | ||
@@ -78,17 +75,9 @@ res = _a.sent(); | ||
} | ||
exports.XHR_DELETE = XHR_DELETE; | ||
exports.XHR_CUSTOM = XHR_CUSTOM; | ||
function XHR_POST(url, data, headers) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var res; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, fetch(url, { | ||
method: 'post', | ||
body: data, | ||
headers: headers | ||
})]; | ||
case 1: | ||
res = _a.sent(); | ||
return [4 /*yield*/, res.text()]; | ||
case 2: return [2 /*return*/, _a.sent()]; | ||
case 0: return [4 /*yield*/, XHR_CUSTOM("post", url, data, headers)]; | ||
case 1: return [2 /*return*/, _a.sent()]; | ||
} | ||
@@ -95,0 +84,0 @@ }); |
@@ -250,5 +250,2 @@ import 'reflect-metadata'; | ||
} | ||
export declare function XHR_GET_BEARER(url: any, token: any, headers?: {}): Promise<any>; | ||
export declare function XHR_DELETE_BEARER(url: any, token: any, headers?: {}): Promise<any>; | ||
export declare function XHR_POST_BEARER(url: any, body: string, token: any, headers?: {}): Promise<any>; | ||
export declare class account { | ||
@@ -267,3 +264,3 @@ accessToken: string; | ||
checkNameAvailability(name: any): Promise<boolean>; | ||
canChangeName(): Promise<false | MojangAPI.NameChangeInfoResponse>; | ||
canChangeName(): Promise<boolean>; | ||
} | ||
@@ -301,1 +298,4 @@ export declare class mojangAccount extends account { | ||
} | ||
export declare function XHR_GET_BEARER(url: any, token: any, headers?: {}): Promise<any>; | ||
export declare function XHR_CUSTOM_BEARER(method: any, url: any, token: any, body?: string, headers?: {}): Promise<any>; | ||
export declare function XHR_POST_BEARER(url: any, data: string, token: any, headers?: {}): Promise<any>; |
@@ -57,3 +57,3 @@ "use strict"; | ||
exports.__esModule = true; | ||
exports.accountsStorage = exports.crackedAccount = exports.microsoftAccount = exports.mojangAccount = exports.account = exports.XHR_POST_BEARER = exports.XHR_DELETE_BEARER = exports.XHR_GET_BEARER = exports.AuthenticationError = exports.MojangAPI = exports.CrackedAuth = exports.MojangAuth = exports.MicrosoftAuth = void 0; | ||
exports.XHR_POST_BEARER = exports.XHR_CUSTOM_BEARER = exports.XHR_GET_BEARER = exports.accountsStorage = exports.crackedAccount = exports.microsoftAccount = exports.mojangAccount = exports.account = exports.AuthenticationError = exports.MojangAPI = exports.CrackedAuth = exports.MojangAuth = exports.MicrosoftAuth = void 0; | ||
var httpMethods_1 = require("./httpMethods"); | ||
@@ -533,3 +533,3 @@ require("reflect-metadata"); | ||
url = "https://api.mojang.com/user/profile/" + uuid + "/skin"; | ||
return [4 /*yield*/, XHR_DELETE_BEARER(url, token)]; | ||
return [4 /*yield*/, XHR_CUSTOM_BEARER("delete", url, token)]; | ||
case 1: | ||
@@ -589,35 +589,2 @@ response = _a.sent(); | ||
exports.AuthenticationError = AuthenticationError; | ||
function XHR_GET_BEARER(url, token, headers) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
if (!headers) | ||
headers = {}; | ||
headers["Authorization"] = "Bearer " + token; | ||
return [2 /*return*/, httpMethods_1.XHR_GET(url, headers)]; | ||
}); | ||
}); | ||
} | ||
exports.XHR_GET_BEARER = XHR_GET_BEARER; | ||
function XHR_DELETE_BEARER(url, token, headers) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
if (!headers) | ||
headers = {}; | ||
headers["Authorization"] = "Bearer " + token; | ||
return [2 /*return*/, httpMethods_1.XHR_DELETE(url, headers)]; | ||
}); | ||
}); | ||
} | ||
exports.XHR_DELETE_BEARER = XHR_DELETE_BEARER; | ||
function XHR_POST_BEARER(url, body, token, headers) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
if (!headers) | ||
headers = {}; | ||
headers["Authorization"] = "Bearer " + token; | ||
return [2 /*return*/, httpMethods_1.XHR_POST(url, body, headers)]; | ||
}); | ||
}); | ||
} | ||
exports.XHR_POST_BEARER = XHR_POST_BEARER; | ||
var account = /** @class */ (function () { | ||
@@ -718,3 +685,3 @@ function account(token, type) { | ||
return [4 /*yield*/, MojangAPI.nameChangeInfo(this.accessToken)]; | ||
case 1: return [2 /*return*/, _a.sent()]; | ||
case 1: return [2 /*return*/, (_a.sent()).nameChangeAllowed]; | ||
} | ||
@@ -916,2 +883,35 @@ }); | ||
exports.accountsStorage = accountsStorage; | ||
function XHR_GET_BEARER(url, token, headers) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, XHR_CUSTOM_BEARER("get", url, token, undefined, headers)]; | ||
case 1: return [2 /*return*/, _a.sent()]; | ||
} | ||
}); | ||
}); | ||
} | ||
exports.XHR_GET_BEARER = XHR_GET_BEARER; | ||
function XHR_CUSTOM_BEARER(method, url, token, body, headers) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
if (!headers) | ||
headers = {}; | ||
headers["Authorization"] = "Bearer " + token; | ||
return [2 /*return*/, httpMethods_1.XHR_CUSTOM(method, url, body, headers)]; | ||
}); | ||
}); | ||
} | ||
exports.XHR_CUSTOM_BEARER = XHR_CUSTOM_BEARER; | ||
function XHR_POST_BEARER(url, data, token, headers) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, XHR_CUSTOM_BEARER("post", url, token, data, headers)]; | ||
case 1: return [2 /*return*/, _a.sent()]; | ||
} | ||
}); | ||
}); | ||
} | ||
exports.XHR_POST_BEARER = XHR_POST_BEARER; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "minecraft-auth", | ||
"version": "1.0.14", | ||
"version": "1.0.15", | ||
"description": "", | ||
"main": "dist/index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"test": "jest", | ||
"debug": "nodemon src/index.ts", | ||
@@ -12,3 +12,10 @@ "build": "tsc", | ||
}, | ||
"keywords": [], | ||
"keywords": [ | ||
"minecraft", | ||
"minecraft auth", | ||
"authentication", | ||
"yggdrasil", | ||
"mojang", | ||
"microsoft oauth" | ||
], | ||
"author": "dommilosz", | ||
@@ -35,5 +42,8 @@ "license": "ISC", | ||
"devDependencies": { | ||
"@types/jest": "^26.0.23", | ||
"jest": "^26.6.3", | ||
"nodemon": "^2.0.7", | ||
"ts-jest": "^26.5.6", | ||
"typescript": "^4.2.4" | ||
} | ||
} |
@@ -88,3 +88,3 @@ # Minecraft-auth package | ||
###### Removing accounts: | ||
You can add new account with `accountsStorage::removeAccount(account)` | ||
You can remove account with `accountsStorage::removeAccount(account)` | ||
@@ -91,0 +91,0 @@ ###### Getting accounts: |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
0
1
75947
5
1297