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

@base-sdk-fp/auth

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@base-sdk-fp/auth - npm Package Compare versions

Comparing version 0.1.0-2 to 0.1.0-3

dist/node/index.d.ts

5

dist/proxy/api.d.ts
import { AuthProxySessionStartRequest, AuthProxySessionStartResult, ProxyAuthResult } from "../types";
export declare function _api_newProxySession(token: string, request: AuthProxySessionStartRequest): Promise<AuthProxySessionStartResult>;
export declare function _api_checkSessionAgain(): Promise<ProxyAuthResult | null>;
export declare function _api_checkSessionAgain(p: {
token: string;
session: string;
}): Promise<ProxyAuthResult | null>;

13

dist/proxy/api.js

@@ -24,6 +24,15 @@ "use strict";

exports._api_newProxySession = _api_newProxySession;
async function _api_checkSessionAgain() {
return null;
async function _api_checkSessionAgain(p) {
try {
const resp = await authProxyClient.get(`/session/${p.session}/check`);
return {
access_token: resp.data.payload,
success: true,
};
}
catch (_) {
return null;
}
}
exports._api_checkSessionAgain = _api_checkSessionAgain;
//# sourceMappingURL=api.js.map

@@ -0,6 +1,13 @@

export * from "./url";
export * from "./ws";
import { ProxyAuthResult } from "../types";
export * from "./ws";
import { AuthProxySessionStartRequest } from "./types";
import { AuthProxySessionStartRequest, AuthProxySessionStartResult } from "./types";
export declare function openProxyAuthSession(secret: string, request: AuthProxySessionStartRequest, config?: {
autoOpen?: boolean;
openner?: (uri: string) => void;
}): Promise<AuthProxySessionStartResult>;
export declare function requesetProxyAuthWithSession(secret: string, session: AuthProxySessionStartResult, request: AuthProxySessionStartRequest): Promise<ProxyAuthResult>;
export declare function requesetProxyAuth(secret: string, request: AuthProxySessionStartRequest, config?: {
autoOpen?: boolean;
openner?: (uri: string) => void;
}): Promise<ProxyAuthResult>;

@@ -13,11 +13,13 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.requesetProxyAuth = void 0;
exports.requesetProxyAuth = exports.requesetProxyAuthWithSession = exports.openProxyAuthSession = void 0;
__exportStar(require("./url"), exports);
__exportStar(require("./ws"), exports);
const types_1 = require("../types");
const ws_1 = require("./ws");
__exportStar(require("./ws"), exports);
const otplib_1 = require("otplib");
const sse_1 = require("./sse");
const lopo_1 = require("./lopo");
const longpoll_1 = require("./longpoll");
const api_1 = require("./api");
async function requesetProxyAuth(secret, request, config) {
async function openProxyAuthSession(secret, request, config) {
var _a;
const token = otplib_1.totp.generate(secret);

@@ -27,3 +29,3 @@ const session = await api_1._api_newProxySession(token, request);

try {
open(session.authUrl);
((_a = config.openner) !== null && _a !== void 0 ? _a : open)(session.authUrl);
}

@@ -34,2 +36,9 @@ catch (e) {

}
if (!secret) {
throw "cannot request session with empty secret";
}
return session;
}
exports.openProxyAuthSession = openProxyAuthSession;
async function requesetProxyAuthWithSession(secret, session, request) {
const sessionId = session.id;

@@ -45,3 +54,4 @@ let proc;

case types_1.ProxyAuthenticationMode.long_polling:
proc = new lopo_1.LogPollingAuthProxyProc(sessionId, secret);
proc = new longpoll_1.LogPollingAuthProxyProc(sessionId, secret);
break;
default:

@@ -52,3 +62,11 @@ throw `mode "${request.mode}" is not supported yet.`;

}
exports.requesetProxyAuthWithSession = requesetProxyAuthWithSession;
async function requesetProxyAuth(secret, request, config) {
if (!secret) {
throw "cannot request session with empty secret";
}
const session = await openProxyAuthSession(secret, request, config);
return requesetProxyAuthWithSession(secret, session, request);
}
exports.requesetProxyAuth = requesetProxyAuth;
//# sourceMappingURL=index.js.map

@@ -21,6 +21,6 @@ export declare enum ProxyAuthenticationMode {

export interface ProxyAuthResult {
clientId: string;
clientId?: string;
success: boolean;
message: string;
message?: string;
access_token?: string;
}
{
"name": "@base-sdk-fp/auth",
"version": "0.1.0-2",
"version": "0.1.0-3",
"main": "dist/index.js",

@@ -5,0 +5,0 @@ "private": false,

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