New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

yggdrasil

Package Overview
Dependencies
Maintainers
3
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yggdrasil - npm Package Compare versions

Comparing version 1.5.1 to 1.5.2

lib/Client.d.ts

4

HISTORY.md
## History
## 1.5.1
## 1.5.2
* Fix the release
## 1.5.0
* Add async support and typings with typescript and convert to node-fetch (thanks @Rob9315)
* Add async support and typings with typescript and convert to node-fetch (thanks @Rob9315)

@@ -9,0 +9,0 @@ ## 1.4.0

{
"name": "yggdrasil",
"version": "1.5.1",
"version": "1.5.2",
"author": "Zeke Sonxx <zeke@zekesonxx.com>",
"description": "Mojang authentication (Yggdrasil) client",
"scripts": {
"build": "tsc",
"test": "mocha -R spec",
"pretest": "npm run lint && npm run build",
"prepublish": "npm run lint && npm run build",
"lint": "ts-standard",
"fix": "ts-standard --fix",
"build": "npx tsc"
"fix": "ts-standard --fix"
},
"main": "./lib/index",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
"repository": {

@@ -16,0 +16,0 @@ "type": "git",

import uuid from 'uuid'
import * as utils from './utils.js'
import type { Agent } from 'http'

@@ -19,3 +20,3 @@ const defaultHost = 'https://authserver.mojang.com'

return await utils.call(
this?.host ?? defaultHost,
(this as any)?.host as string ?? defaultHost,
'authenticate',

@@ -32,3 +33,3 @@ {

},
this?.agent
(this as any)?.agent as Agent
)

@@ -44,3 +45,3 @@ },

refresh: async function (accessToken: string, clientToken: string, requestUser?: boolean) {
const data = await utils.call(this?.host as string ?? defaultHost, 'refresh', { accessToken, clientToken, requestUser: requestUser ?? false }, this?.agent)
const data = await utils.call((this as any)?.host as string ?? defaultHost, 'refresh', { accessToken, clientToken, requestUser: requestUser ?? false }, (this as any)?.agent as Agent)
if (data.clientToken !== clientToken) throw new Error('clientToken assertion failed')

@@ -55,3 +56,3 @@ return [data.accessToken, data]

validate: async function (accessToken: string) {
return await utils.call(this?.host as string ?? defaultHost, 'validate', { accessToken }, this?.agent)
return await utils.call((this as any)?.host as string ?? defaultHost, 'validate', { accessToken }, (this as any)?.agent as Agent)
},

@@ -66,3 +67,3 @@

signout: async function (username: string, password: string) {
return await utils.call(this?.host as string ?? defaultHost, 'signout', { username, password }, this?.agent)
return await utils.call((this as any)?.host as string ?? defaultHost, 'signout', { username, password }, (this as any)?.agent as Agent)
}

@@ -69,0 +70,0 @@ }

@@ -1,4 +0,5 @@

import crypto from 'crypto'
import { createHash } from 'crypto'
import utils from './utils.js'
import nf from 'node-fetch'
import type { Agent } from 'http'

@@ -21,3 +22,4 @@ const defaultHost = 'https://sessionserver.mojang.com'

return await utils.call(
this?.host as string ?? defaultHost,
(this as any)?.host as string ??
defaultHost,
'session/minecraft/join',

@@ -27,5 +29,5 @@ {

selectedProfile,
serverId: utils.mcHexDigest(crypto.createHash('sha1').update(serverid).update(sharedsecret).update(serverkey).digest())
serverId: utils.mcHexDigest(createHash('sha1').update(serverid).update(sharedsecret).update(serverkey).digest())
},
this?.agent
(this as any)?.agent as Agent
)

@@ -44,5 +46,5 @@ },

hasJoined: async function (username: string, serverid: string, sharedsecret: string, serverkey: string) {
const host: string = this?.host as string ?? defaultHost
const hash: string = utils.mcHexDigest(crypto.createHash('sha1').update(serverid).update(sharedsecret).update(serverkey).digest())
const data = await nf(`${host}/session/minecraft/hasJoined?username=${username}&serverId=${hash}`, { agent: this?.agent, method: 'GET' })
const host: string = (this as any)?.host as string ?? defaultHost
const hash: string = utils.mcHexDigest(createHash('sha1').update(serverid).update(sharedsecret).update(serverkey).digest())
const data = await nf(`${host}/session/minecraft/hasJoined?username=${username}&serverId=${hash}`, { agent: (this as any)?.agent as Agent, method: 'GET' })
const body = JSON.parse(await data.text())

@@ -49,0 +51,0 @@ if (body.id !== undefined) return body

{
"compilerOptions": {
"target": "es2019",
"module": "CommonJS",
"target": "ES2020",
"module": "commonjs",
"sourceMap": true,
"declaration": true,
"strict": true,
"declaration": true,
// "resolveJsonModule": true, because of ts-standard had to disable...
"moduleResolution": "node",
"resolveJsonModule": true,
"esModuleInterop": true,
"types": ["node"],
"outDir": "lib",
"noImplicitThis": false
},
"include": [
"src"
],
"exclude": [
"lib","node_modules"
]
}
"removeComments": false
},
"compileOnSave": true,
"include": [
"./src/**/*",
"./test/**/*"
],
"exclude": [
"lib",
"node_modules",
"bin",
"examples",
"scripts"
],
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc