Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

aspxauth

Package Overview
Dependencies
Maintainers
3
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aspxauth - npm Package Compare versions

Comparing version 1.1.2 to 2.0.0-node-12.0

21

package.json
{
"name": "aspxauth",
"version": "1.1.2",
"version": "2.0.0-node-12.0",
"description": "Verify and decrypt .NET's .ASPXAUTH cookie from node",

@@ -10,5 +10,4 @@ "main": "src/index.js",

"scripts": {
"format": "jscs --fix ./",
"lint": "eslint --fix ./",
"pretest": "npm run format && npm run lint",
"pretest": "npm run lint",
"test": "npm run cover",

@@ -48,13 +47,9 @@ "test:only": "mocha spec/*.spec.js",

"license": "MIT",
"dependencies": {
"bignum": "^0.12.5"
},
"devDependencies": {
"chai": "^3.5.0",
"eslint": "^3.7.0",
"eslint-config-leankit": "^3.0.0",
"jscs": "^3.0.7",
"mocha": "^3.1.2",
"nyc": "^8.3.0",
"sinon": "^1.17.6"
"chai": "^4.2.0",
"eslint": "^6.8.0",
"eslint-config-leankit": "^5.1.0",
"mocha": "^6.2.2",
"nyc": "^15.0.0",
"sinon": "^8.0.1"
},

@@ -61,0 +56,0 @@ "nyc": {

"use strict";
const assert = require( "assert" );
const bignum = require( "bignum" );

@@ -34,8 +33,5 @@ const BYTES_PER_CHAR = 2;

readInt64() {
let val = bignum.fromBuffer( this.buffer.slice( this.offset, this.offset + 8 ), {
endian: "little",
size: 8
} );
let val = this.buffer.slice( this.offset, this.offset + 8 ).readBigInt64LE();
this.offset += 8;
return val.toNumber();
return Number( val );
},

@@ -42,0 +38,0 @@

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

/* global BigInt */
"use strict";
const bignum = require( "bignum" );
const BYTES_PER_CHAR = 2;

@@ -10,3 +9,3 @@ const TICKS_IN_MILLISECOND = 10000;

function BufferWriter( size ) {
this.buffer = new Buffer( size );
this.buffer = Buffer.alloc( size );
this.offset = 0;

@@ -33,3 +32,5 @@ }

writeInt64( val ) {
this.writeBuffer( bignum( val ).toBuffer( { endian: "little", size: 8 } ) );
let buf = Buffer.alloc( 8 );
buf.writeBigInt64LE( BigInt( val ) );
this.writeBuffer( buf );
return this;

@@ -39,3 +40,3 @@ },

writeDate( val ) {
this.writeInt64( bignum( val.getTime() ).add( MILLISECONDS_EPOCH_OFFSET ).mul( TICKS_IN_MILLISECOND ) );
this.writeInt64( BigInt( ( val.getTime() + MILLISECONDS_EPOCH_OFFSET ) * TICKS_IN_MILLISECOND ) );
return this;

@@ -42,0 +43,0 @@ },

"use strict";
const assert = require( "assert" );
const crypto = require( "crypto" );
const { createCipheriv, createDecipheriv, createHmac, randomBytes } = require( "crypto" );
const BufferReader = require( "./buffer-reader" );

@@ -53,5 +53,5 @@ const BufferWriter = require( "./buffer-writer" );

const VALIDATION_KEY = new Buffer( config.validationKey, "hex" );
const DECRYPTION_KEY = new Buffer( config.decryptionKey, "hex" );
const DECRYPTION_IV = config.decryptionIV ? new Buffer( config.decryptionIV, "hex" ) : Buffer.alloc( DECRYPTION_METHOD.ivSize );
const VALIDATION_KEY = Buffer.from( config.validationKey, "hex" );
const DECRYPTION_KEY = Buffer.from( config.decryptionKey, "hex" );
const DECRYPTION_IV = config.decryptionIV ? Buffer.from( config.decryptionIV, "hex" ) : Buffer.alloc( DECRYPTION_METHOD.ivSize );

@@ -72,3 +72,3 @@ const REQUIRED_VERSION = config.ticketVersion || false;

const hash = crypto.createHmac( VALIDATION_METHOD.algorithm, VALIDATION_KEY );
const hash = createHmac( VALIDATION_METHOD.algorithm, VALIDATION_KEY );
hash.update( payload );

@@ -81,3 +81,3 @@

try {
const bytes = cookie instanceof Buffer ? cookie : new Buffer( cookie, "hex" );
const bytes = cookie instanceof Buffer ? cookie : Buffer.from( cookie, "hex" );

@@ -88,3 +88,3 @@ if ( !validate( bytes ) ) {

const decryptor = crypto.createDecipheriv( DECRYPTION_METHOD.cipher, DECRYPTION_KEY, DECRYPTION_IV );
const decryptor = createDecipheriv( DECRYPTION_METHOD.cipher, DECRYPTION_KEY, DECRYPTION_IV );
const payload = bytes.slice( 0, -VALIDATION_METHOD.signatureSize );

@@ -130,3 +130,3 @@ const decryptedBytes = Buffer.concat( [ decryptor.update( payload ), decryptor.final() ] );

// Write a random header to serve as a salt
writer.writeBuffer( crypto.randomBytes( DECRYPTION_METHOD.headerSize ) );
writer.writeBuffer( randomBytes( DECRYPTION_METHOD.headerSize ) );
writer.writeByte( FORMAT_VERSION );

@@ -154,6 +154,6 @@

const encryptor = crypto.createCipheriv( DECRYPTION_METHOD.cipher, DECRYPTION_KEY, DECRYPTION_IV );
const encryptor = createCipheriv( DECRYPTION_METHOD.cipher, DECRYPTION_KEY, DECRYPTION_IV );
const encryptedBytes = Buffer.concat( [ encryptor.update( writer.buffer ), encryptor.final() ] );
const hash = crypto.createHmac( "sha1", VALIDATION_KEY );
const hash = createHmac( "sha1", VALIDATION_KEY );
hash.update( encryptedBytes );

@@ -160,0 +160,0 @@

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