Skip to content

Commit

Permalink
5.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Hanro50 committed Jan 31, 2024
1 parent b58c1fa commit 3f8367a
Show file tree
Hide file tree
Showing 10 changed files with 564 additions and 18 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "msmc",
"version": "5.0.3",
"version": "5.0.4",
"description": "A bare bones login library for Minecraft based projects to authenticate individuals with a Microsoft account.",
"license": "MIT",
"exports": {
Expand Down
11 changes: 5 additions & 6 deletions src/auth/minecraft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ export class Minecraft {
profile: MCProfile,
parent: Auth,
refreshTkn: string,
exp: number,
exp: number
);
constructor(
mcToken: string,
profile: MCProfile,
parent: Xbox | Auth,
refreshTkn?: string,
exp = new Date().getTime() + 1000 * 60 * 60 * 23,
exp = new Date().getTime() + 1000 * 60 * 60 * 23
) {
this.parent = parent;
this.mcToken = mcToken;
Expand All @@ -62,14 +62,14 @@ export class Minecraft {
}
async entitlements() {
var r998 = await fetch(
"https://api.minecraftservices.com/minecraft/profile",
"https://api.minecraftservices.com/entitlements/mcstore",
{
headers: {
"Content-Type": "application/json",
Accept: "application/json",
Authorization: `Bearer ${this.mcToken}`,
},
},
}
);
errorResponse(r998, "error.auth.minecraft.entitlements");
const json = (await r998.json()) as {
Expand Down Expand Up @@ -149,7 +149,7 @@ export class Minecraft {
.map(function (c) {
return "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2);
})
.join(""),
.join("")
);
return JSON.parse(jsonPayload) as MCJWTDecoded;
}
Expand All @@ -163,4 +163,3 @@ function getUUID() {
}
return result;
}
module.exports.default = Minecraft;
3 changes: 1 addition & 2 deletions src/auth/social.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fetch from "node-fetch";
import { XPlayer } from "../util/xPlayer";
import { XPlayer } from "../util/xPlayer.js";

export class Social {
auth: string;
Expand Down Expand Up @@ -39,4 +39,3 @@ export class Social {
return await profileRaw.json();
}
}
module.exports.default = Social;
1 change: 0 additions & 1 deletion src/auth/xbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,3 @@ export class Xbox {
return this.msToken.refresh_token;
}
}
module.exports.default = Xbox;
2 changes: 1 addition & 1 deletion src/gui/common.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { WindowProperties } from "../types";
import { getCode } from "../util/lexicon";
import { getCode } from "../util/lexicon.js";
import { error } from "../util/lexicon.js";

import type { Auth } from "../auth/auth.js";
Expand Down
4 changes: 2 additions & 2 deletions src/util/tokens.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { Auth } from "../auth/auth.js";
import type { MCToken, MclcUser } from "../types";

import { Minecraft } from "../auth/minecraft";
import { validate } from "./validate";
import { Minecraft } from "../auth/minecraft.js";
import { validate } from "./validate.js";
/**Validates MC tokens to check if they're valid. */

/**
Expand Down
1 change: 0 additions & 1 deletion src/util/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ export function validate(token: MCToken | Minecraft | MclcUser) {
return typeof token.meta.exp == "number" && token.meta.exp > Date.now();
return false;
}
exports.default = validate;
Loading

0 comments on commit 3f8367a

Please sign in to comment.