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

@koopjs/auth-direct-file

Package Overview
Dependencies
Maintainers
7
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@koopjs/auth-direct-file - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2

3

CHANGELOG.md

@@ -5,2 +5,5 @@ # Change Log

## 2.0.2
* patch - invalidate with user not found
## 2.0.1

@@ -7,0 +10,0 @@ * migrate to jest

2

package.json
{
"name": "@koopjs/auth-direct-file",
"version": "2.0.1",
"version": "2.0.2",
"description": "Module for implementing a direct authentication pattern with file-based user-store in Koop",

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

@@ -19,2 +19,6 @@ const fs = require('fs-extra');

if (!user) {
return false;
}
return user?.password === password;

@@ -21,0 +25,0 @@ } catch (err) {

@@ -10,3 +10,3 @@ const fs = require('fs-extra');

return Buffer.from(JSON.stringify([
{ username: 'foo', 'password': 'bar' }
{ username: 'foo', password: 'bar' }
]));

@@ -19,2 +19,24 @@ });

test('should invalidate if user not found', async () => {
fs.readFile.mockImplementationOnce(() => {
return Buffer.from(JSON.stringify([
{ username: 'fooz', password: 'bar' }
]));
});
const result = await validateCredentials('foo', 'bar');
expect(result).toEqual(false);
});
test('should invalidate if password does not match', async () => {
fs.readFile.mockImplementationOnce(() => {
return Buffer.from(JSON.stringify([
{ username: 'foo', password: 'baz' }
]));
});
const result = await validateCredentials('foo', 'bar');
expect(result).toEqual(false);
});
test('should throw error reading store', async () => {

@@ -21,0 +43,0 @@ fs.readFile.mockImplementationOnce(() => {

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