Skip to content

Class MojangClient

The mojang api client. Please referece https://wiki.vg/Mojang_API.

All the apis need user to authenticate the access token from microsoft.

🏭 Constructors

constructor

ts
new MojangClient(dispatcher: Dispatcher): MojangClient

Parameters

  • dispatcher: Dispatcher

Return Type

  • MojangClient

Defined in: packages/user/mojang.ts:211

🏷️ Properties

dispatcher

ts
dispatcher: Dispatcher

Defined in: packages/user/mojang.ts:211

🔧 Methods

checkGameOwnership

ts
checkGameOwnership(token: string, signal: AbortSignal): Promise<MinecraftOwnershipResponse>

Return the owner ship list of the player with those token.

Parameters

  • token: string
  • signal: AbortSignal

Return Type

  • Promise<MinecraftOwnershipResponse>

Defined in: packages/user/mojang.ts:413

checkNameAvailability

ts
checkNameAvailability(name: string, token: string, signal: AbortSignal): Promise<NameAvailability>

Parameters

  • name: string
  • token: string
  • signal: AbortSignal

Return Type

  • Promise<NameAvailability>

Defined in: packages/user/mojang.ts:244

getNameChangeInformation

ts
getNameChangeInformation(token: string): Promise<NameChangeInformation>

Parameters

  • token: string

Return Type

  • Promise<NameChangeInformation>

Defined in: packages/user/mojang.ts:233

getProfile

ts
getProfile(token: string, signal: AbortSignal): Promise<MicrosoftMinecraftProfile>

Parameters

  • token: string
  • signal: AbortSignal

Return Type

  • Promise<MicrosoftMinecraftProfile>

Defined in: packages/user/mojang.ts:257

getSecurityChallenges

ts
getSecurityChallenges(token: string): Promise<MojangChallenge[]>

Parameters

  • token: string

Return Type

  • Promise<MojangChallenge[]>

Defined in: packages/user/mojang.ts:375

hideCape

ts
hideCape(token: string, signal: AbortSignal): Promise<void>

Parameters

  • token: string
  • signal: AbortSignal

Return Type

  • Promise<void>

Defined in: packages/user/mojang.ts:324

resetSkin

ts
resetSkin(token: string, signal: AbortSignal): Promise<void>

Parameters

  • token: string
  • signal: AbortSignal

Return Type

  • Promise<void>

Defined in: packages/user/mojang.ts:310

setName

ts
setName(name: string, token: string, signal: AbortSignal): Promise<MicrosoftMinecraftProfile>

Parameters

  • name: string
  • token: string
  • signal: AbortSignal

Return Type

  • Promise<MicrosoftMinecraftProfile>

Defined in: packages/user/mojang.ts:213

setSkin

ts
setSkin(fileName: string, skin: string | Buffer, variant: "slim" | "classic", token: string, signal: AbortSignal): Promise<MinecraftProfileResponse>

Parameters

  • fileName: string
  • skin: string | Buffer
  • variant: "slim" | "classic"
  • token: string
  • signal: AbortSignal

Return Type

  • Promise<MinecraftProfileResponse>

Defined in: packages/user/mojang.ts:280

showCape

ts
showCape(capeId: string, token: string, signal: AbortSignal): Promise<MicrosoftMinecraftProfile>

Parameters

  • capeId: string
  • token: string
  • signal: AbortSignal

Return Type

  • Promise<MicrosoftMinecraftProfile>

Defined in: packages/user/mojang.ts:338

submitSecurityChallenges

ts
submitSecurityChallenges(answers: MojangChallengeResponse[], token: string): Promise<void>

Parameters

  • answers: MojangChallengeResponse[]
  • token: string

Return Type

  • Promise<void>

Defined in: packages/user/mojang.ts:390

verifySecurityLocation

ts
verifySecurityLocation(token: string, signal: AbortSignal): Promise<boolean>

Parameters

  • token: string
  • signal: AbortSignal

Return Type

  • Promise<boolean>

Defined in: packages/user/mojang.ts:359

Released under the MIT License.