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

remix-auth

Package Overview
Dependencies
Maintainers
0
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remix-auth - npm Package Compare versions

Comparing version 4.0.0 to 4.1.0

13

build/index.d.ts

@@ -35,2 +35,9 @@ import type { Strategy } from "./strategy.js";

/**
* Call this method with the name of a strategy you want to get.
* It returns the Strategy instance or null if the strategy is not found.
* @param name
* @returns
*/
get(name: string): Strategy<User, never> | null;
/**
* Call this to authenticate a request using some strategy. You pass the name

@@ -40,10 +47,6 @@ * of the strategy you want to use and the request to authenticate.

* async function action({ request }: ActionFunctionArgs) {
* let user = await auth.authenticate("some", request);
* let user = await auth.authenticate("strategy-name", request);
* };
* @example
* async function action({ request, context }: ActionFunctionArgs) {
* let user = await auth.authenticate("some", request, { context });
* };
*/
authenticate(strategy: string, request: Request): Promise<User>;
}

@@ -40,2 +40,11 @@ /**

/**
* Call this method with the name of a strategy you want to get.
* It returns the Strategy instance or null if the strategy is not found.
* @param name
* @returns
*/
get(name) {
return this.strategies.get(name) ?? null;
}
/**
* Call this to authenticate a request using some strategy. You pass the name

@@ -45,11 +54,7 @@ * of the strategy you want to use and the request to authenticate.

* async function action({ request }: ActionFunctionArgs) {
* let user = await auth.authenticate("some", request);
* let user = await auth.authenticate("strategy-name", request);
* };
* @example
* async function action({ request, context }: ActionFunctionArgs) {
* let user = await auth.authenticate("some", request, { context });
* };
*/
authenticate(strategy, request) {
let instance = this.strategies.get(strategy);
let instance = this.get(strategy);
if (!instance)

@@ -56,0 +61,0 @@ throw new ReferenceError(`Strategy ${strategy} not found.`);

{
"name": "remix-auth",
"version": "4.0.0",
"version": "4.1.0",
"author": {

@@ -14,9 +14,10 @@ "name": "Sergio Xalambrí",

"devDependencies": {
"@arethetypeswrong/cli": "^0.17.0",
"@arethetypeswrong/cli": "^0.17.1",
"@biomejs/biome": "^1.8.3",
"@mjackson/headers": "^0.8.0",
"@total-typescript/tsconfig": "^1.0.4",
"@types/bun": "^1.1.6",
"typedoc": "^0.26.5",
"typedoc-plugin-mdn-links": "^3.2.6",
"@types/bun": "^1.1.14",
"msw": "^2.7.0",
"typedoc": "^0.27.5",
"typedoc-plugin-mdn-links": "^4.0.5",
"typescript": "^5.5.4"

@@ -23,0 +24,0 @@ },

@@ -53,2 +53,9 @@ import { beforeEach, describe, expect, mock, test } from "bun:test";

});
test("#get", () => {
let auth = new Authenticator();
let strategy = new MockStrategy(async () => ({ id: 1 }));
expect(auth.use(strategy)).toBe(auth);
expect(auth.get("mock")).toBe(strategy);
});
});

@@ -45,2 +45,12 @@ import type { Strategy } from "./strategy.js";

/**
* Call this method with the name of a strategy you want to get.
* It returns the Strategy instance or null if the strategy is not found.
* @param name
* @returns
*/
get(name: string) {
return this.strategies.get(name) ?? null;
}
/**
* Call this to authenticate a request using some strategy. You pass the name

@@ -50,11 +60,7 @@ * of the strategy you want to use and the request to authenticate.

* async function action({ request }: ActionFunctionArgs) {
* let user = await auth.authenticate("some", request);
* let user = await auth.authenticate("strategy-name", request);
* };
* @example
* async function action({ request, context }: ActionFunctionArgs) {
* let user = await auth.authenticate("some", request, { context });
* };
*/
authenticate(strategy: string, request: Request): Promise<User> {
let instance = this.strategies.get(strategy);
let instance = this.get(strategy);
if (!instance) throw new ReferenceError(`Strategy ${strategy} not found.`);

@@ -61,0 +67,0 @@ return instance.authenticate(new Request(request.url, request));

import { describe, expect, test } from "bun:test";
import { Cookie, SetCookie } from "@mjackson/headers";
import { Cookie } from "@mjackson/headers";
import { Strategy } from "./strategy";

@@ -4,0 +4,0 @@

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