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

@corbado/nodejs

Package Overview
Dependencies
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@corbado/nodejs - npm Package Compare versions

Comparing version 1.1.3 to 1.1.4

src/entities/User.js

4

package.json
{
"name": "@corbado/nodejs",
"version": "1.1.3",
"version": "1.1.4",
"description": "",
"main": "./src/corbado.js",
"main": "./src/index.js",
"scripts": {

@@ -7,0 +7,0 @@ "test": "mocha --reporter spec"

@@ -43,5 +43,7 @@ # Corbado Node.js library

```
corbado.sessionService.verify(sessionToken, clientInfo);
corbado.session.verify(sessionToken, clientInfo);
```
In order to
### Utilities

@@ -48,0 +50,0 @@

@@ -9,4 +9,3 @@ const assert = require('assert');

#shortSessionCookieName = 'cbo_short_session';
#issuer = undefined
#jwksURI = undefined
#authenticationURL = undefined
#cacheMaxAge = 10 * 60 * 1000

@@ -26,2 +25,6 @@ #emailTemplates = {

get projectID() {
return this.#projectID;
}
set apiSecret(value) {

@@ -33,2 +36,6 @@ assert(value.length > 0, 'API is invalid')

get apiSecret() {
return this.#apiSecret;
}
set apiURL(value) {

@@ -41,10 +48,3 @@ assert(value.length > 0, 'API url is invalid')

get projectID() {
return this.#projectID;
}
get apiSecret() {
return this.#apiSecret;
}
get apiURL() {

@@ -64,23 +64,13 @@ return this.#apiURL;

get issuer() {
return this.#issuer;
get authenticationURL() {
return this.#authenticationURL;
}
set issuer(value) {
assert(value.length > 0, 'Issuer is invalid')
set authenticationURL(value) {
assert(value.length > 0, 'Authentication url is invalid')
assert(value.startsWith('http://') || value.startsWith('https://'), 'Authentication url is invalid')
this.#issuer = value;
this.#authenticationURL = value;
}
get jwksURI() {
return this.#jwksURI;
}
set jwksURI(value) {
assert(value.length > 0, 'API url is invalid')
assert(value.startsWith('http://') || value.startsWith('https://'), 'API url is invalid')
this.#jwksURI = value;
}
get cacheMaxAge() {

@@ -87,0 +77,0 @@ return this.#cacheMaxAge;

@@ -84,6 +84,4 @@ const PasskeyService = require('./services/passkey.service');

assert(this.#config.issuer !== undefined, 'Issuer undefined')
assert(this.#config.issuer.length > 0, 'Issuer is empty')
assert(this.#config.jwksURI !== undefined, 'Issuer undefined')
assert(this.#config.jwksURI.length > 0, 'JWKS uri is empty')
assert(this.#config.authenticationURL !== undefined, 'Issuer undefined')
assert(this.#config.authenticationURL.length > 0, 'Issuer is empty')
assert(this.#config.cacheMaxAge > 0, 'Cache max age is invalid')

@@ -93,4 +91,4 @@

this.#config.shortSessionCookieName,
this.#config.issuer,
this.#config.jwksURI,
this.#config.authenticationURL,
this.#config.authenticationURL + '/.well-known/jwks.json',
this.#config.cacheMaxAge,

@@ -97,0 +95,0 @@ )

const jose = require('jose');
const assert = require('assert')
const NotAuthedError = require('./NotAuthedError')
const User = require('../entities/User')

@@ -20,3 +21,8 @@ class ShortSessionService {

#getSessionToken(req) {
return req.cookies[this.#shortSessionCookieName] ?? this.#getBearerToken(req)
const token = req.cookies[this.#shortSessionCookieName] ?? this.#getBearerToken(req)
if (token !== null && token.length < 10) {
return null
}
return token
}

@@ -47,3 +53,3 @@

if (token === null) {
throw new NotAuthedError()
return new User(false)
}

@@ -53,3 +59,9 @@

return payload
return new User(
true,
payload.sub,
payload.name,
payload.email,
payload.phoneNumber
)
}

@@ -56,0 +68,0 @@ }

@@ -180,9 +180,9 @@ const Configuration = require('../src/config/configuration')

req,
).then(() => {
done(new Error('Should not happen'))
).then(usr => {
expect(usr.authenticated).equals(false)
done()
}).catch(err => {
expect(err.message === 'JWSInvalid: Invalid Compact JWS')
done()
done(err)
})
})
})
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