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

@brightcove/hono-sessions

Package Overview
Dependencies
Maintainers
0
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@brightcove/hono-sessions - npm Package Compare versions

Comparing version 1.0.6 to 1.0.7

6

dist/cjs/index.d.ts

@@ -83,4 +83,4 @@ import hono from 'hono';

getCookieSessionId(c: hono.Context): Promise<string | null>;
getTokenSessionId(c: hono.Context): Promise<string | null | undefined>;
getSessionId(c: hono.Context): Promise<string | null | undefined>;
getTokenSessionId(c: hono.Context, token?: string): Promise<string | null | undefined>;
getSessionId(c: hono.Context, token?: string): Promise<string | null | undefined>;
setSessionCookie(c: hono.Context, sessionId: string, cookie: CookieOptions): Promise<void>;

@@ -102,3 +102,3 @@ startCookieSession(c: hono.Context, sessionId: string, sessionKey: Record<string, string>, session?: any): Promise<{

} | undefined>;
endSession(c: hono.Context): Promise<void>;
endSession(c: hono.Context, token?: string): Promise<void>;
getSession(c: hono.Context): Promise<{

@@ -105,0 +105,0 @@ session: any;

@@ -153,6 +153,6 @@ /* eslint @typescript-eslint/no-explicit-any: 0 */

}
getTokenSessionId(c) {
getTokenSessionId(c, token) {
return __awaiter(this, void 0, void 0, function* () {
var _a, _b;
const token = c.req.query(this.token.queryParam) || ((_b = (_a = c.req.header('Authorization')) === null || _a === void 0 ? void 0 : _a.split(' ')) === null || _b === void 0 ? void 0 : _b[1]);
token = token || c.req.query(this.token.queryParam) || ((_b = (_a = c.req.header('Authorization')) === null || _a === void 0 ? void 0 : _a.split(' ')) === null || _b === void 0 ? void 0 : _b[1]);
if (token) {

@@ -169,3 +169,3 @@ try {

}
getSessionId(c) {
getSessionId(c, token) {
return __awaiter(this, void 0, void 0, function* () {

@@ -176,3 +176,3 @@ switch (this.accessor) {

case 'token':
return this.getTokenSessionId(c);
return this.getTokenSessionId(c, token);
}

@@ -231,5 +231,5 @@ });

}
endSession(c) {
endSession(c, token) {
return __awaiter(this, void 0, void 0, function* () {
const sessionId = yield this.getSessionId(c);
const sessionId = yield this.getSessionId(c, token);
if (sessionId) {

@@ -236,0 +236,0 @@ const sessionKey = this.sessionKey(sessionId);

{
"name": "@brightcove/hono-sessions",
"version": "1.0.6",
"version": "1.0.7",
"description": "A session manager for Hono that uses DynamoDB as session storage by default. Supports session retrieval by cookie or access token.",

@@ -5,0 +5,0 @@ "type": "commonjs",

@@ -171,3 +171,3 @@ # Hono Sessions

This deletes the session from the database and the session cookie in the response.
This deletes the session from the database and the session cookie in the response if there was one.

@@ -183,2 +183,11 @@ ```

If the library is configured to use `token` retrieval, the `token` can also be passed in for cases where it isn't found in the normal locations
```
app.get('/my_route', async (c, next) => {
await endSession(c, token);
...
});
```
### Getting the access token

@@ -185,0 +194,0 @@

@@ -228,4 +228,4 @@ /* eslint @typescript-eslint/no-explicit-any: 0 */

async getTokenSessionId(c: hono.Context) {
const token = c.req.query(this.token!.queryParam!) || c.req.header('Authorization')?.split(' ')?.[1];
async getTokenSessionId(c: hono.Context, token?: string) {
token = token || c.req.query(this.token!.queryParam!) || c.req.header('Authorization')?.split(' ')?.[1];

@@ -243,3 +243,3 @@ if (token) {

async getSessionId(c: hono.Context) {
async getSessionId(c: hono.Context, token?: string) {
switch (this.accessor) {

@@ -249,3 +249,3 @@ case 'cookie':

case 'token':
return this.getTokenSessionId(c);
return this.getTokenSessionId(c, token);
}

@@ -309,4 +309,4 @@ }

async endSession(c: hono.Context) {
const sessionId = await this.getSessionId(c);
async endSession(c: hono.Context, token?: string) {
const sessionId = await this.getSessionId(c, token);

@@ -313,0 +313,0 @@ if (sessionId) {

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