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

@bedrock/account-http

Package Overview
Dependencies
Maintainers
5
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bedrock/account-http - npm Package Compare versions

Comparing version 7.1.2 to 8.0.0

lib/authorizations.js

12

CHANGELOG.md
# bedrock-account-http ChangeLog
## 8.0.0 - 2023-10-24
### Added
- Add optional `authorization` value when registering an account and
define first instance of it that uses a captcha via the Cloudflare
Turnstile service.
### Changed
- **BREAKING**: Drop support for Node.js < 18.
- Add `@bedrock/turnstile` peer dependency. This module requires Node.js 18+ and
must be installed by top-level applications.
## 7.1.2 - 2023-10-24

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

10

lib/config.js
/*!
* Copyright (c) 2019-2022 Digital Bazaar, Inc. All rights reserved.
* Copyright (c) 2019-2023 Digital Bazaar, Inc. All rights reserved.
*/

@@ -10,3 +10,9 @@ import {config} from '@bedrock/core';

const cfg = config['account-http'] = {};
const cfg = config['account-http'] = {
// account registration options
registration: {
// default to false, set name of service as string
authorizationRequired: false
}
};

@@ -13,0 +19,0 @@ cfg.routes = {

6

lib/index.js

@@ -9,2 +9,3 @@ /*!

import {asyncHandler} from '@bedrock/express';
import {authorizeRegistration} from './authorizations.js';
import boolParser from 'express-query-boolean';

@@ -46,2 +47,6 @@ import {createValidateMiddleware} from '@bedrock/validation';

if(cfg.registration.authorizationRequired.length > 0) {
await authorizeRegistration({req});
}
// anyone may create a new account; must be rate limited via another

@@ -221,2 +226,1 @@ // means if necessary

}
{
"name": "@bedrock/account-http",
"version": "7.1.2",
"version": "8.0.0",
"type": "module",

@@ -30,2 +30,3 @@ "description": "HTTP API for Bedrock User Accounts",

"express-query-int": "^3.0.0",
"forwarded": "^0.2.0",
"uuid": "^9.0.0"

@@ -38,2 +39,3 @@ },

"@bedrock/passport": "^11.0.0",
"@bedrock/turnstile": "^1.0.2",
"@bedrock/validation": "^7.0.0"

@@ -45,7 +47,10 @@ },

"devDependencies": {
"eslint": "^8.32.0",
"eslint-config-digitalbazaar": "^4.2.0",
"eslint-plugin-jsdoc": "^39.6.8",
"eslint": "^8.52.0",
"eslint-config-digitalbazaar": "^5.0.1",
"eslint-plugin-jsdoc": "^46.8.2",
"jsdoc-to-markdown": "^8.0.0"
},
"engines": {
"node": ">=18"
}
}

@@ -13,3 +13,17 @@ /*!

properties: {
email: schemas.email()
email: schemas.email(),
authorization: {
type: 'object',
additionalProperties: false,
required: ['type', 'token'],
properties: {
type: {
type: 'string',
enum: ['turnstile']
},
token: {
type: 'string'
}
}
}
}

@@ -16,0 +30,0 @@ };

@@ -88,2 +88,18 @@ /*!

describe('post /', function() {
it('should create account with authorization', async function() {
config['account-http'].registration.authorizationRequired = 'turnstile';
const authorization = {
token: 'XXXX.DUMMY.TOKEN.XXXX',
type: 'turnstile'
};
const email = {email: 'auth@digitalbazaar.com', authorization};
const result = await api.post('/', email);
result.status.should.equal(201);
config['account-http'].registration.authorizationRequired = false;
});
it('should create account without authorization', async function() {
const email = {email: 'noauth@digitalbazaar.com'};
const result = await api.post('/', email);
result.status.should.equal(201);
});
it('should return 400 if there is no email', async function() {

@@ -95,3 +111,5 @@ const result = await api.post('/');

it('should return 201 if there is an email', async function() {
const result = await api.post('/', {email: 'newuser@digitalbazaar.com'});
const result = await api.post('/', {
email: 'newuser@digitalbazaar.com'
});
result.status.should.equal(201);

@@ -98,0 +116,0 @@ });

@@ -34,2 +34,3 @@ {

"@bedrock/test": "^8.0.0",
"@bedrock/turnstile": "^1.0.2",
"@bedrock/validation": "^7.0.0",

@@ -39,3 +40,4 @@ "apisauce": "^2.0.0",

"cross-env": "^7.0.2",
"sinon": "^9.0.2"
"sinon": "^17.0.0",
"uuid": "^9.0.0"
},

@@ -42,0 +44,0 @@ "c8": {

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