New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ministryofjustice/fb-jwt-client-node

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ministryofjustice/fb-jwt-client-node - npm Package Compare versions

Comparing version 0.0.11 to 0.0.12

index.js

4

lib/fb-jwt-client-with-secret.js

@@ -43,3 +43,3 @@ const FBJWTClient = require('./fb-jwt-client')

/**
* Encrypt user ID and token using service token
* Encrypt user ID and token using service secret
*

@@ -64,3 +64,3 @@ * Guaranteed to return the same value

/**
* Decrypt user ID and token using service token
* Decrypt user ID and token using service secret
*

@@ -67,0 +67,0 @@ * @param {string} encryptedData

{
"name": "@ministryofjustice/fb-jwt-client-node",
"version": "0.0.11",
"version": "0.0.12",
"description": "Form Builder JSON Web Token Client (Node)",
"main": "lib/fb-jwt-client.js",
"main": "index.js",
"repository": {

@@ -7,0 +7,0 @@ "type": "git",

@@ -15,25 +15,29 @@ # Form Builder JSON Web Token client (Node)

### Loading and initialising
### Loading and initialising basic client
``` javascript
// load client class
const FBJWTClient = require('@ministryofjustice/fb-jwt-client-node')
const {FBJWTClient} = require('@ministryofjustice/fb-jwt-client-node')
// initialise client
const jwtClient = new FBJWTClient(serviceToken, serviceUrl, [errorClass])
const jwtClient = new FBJWTClient(serviceToken, serviceSlug, microserviceUrl, [errorClass])
```
### `serviceToken`
#### `serviceToken`
Constructor will throw an error if no service token is passed
### `serviceUrl`
#### `serviceSlug`
Constructor will throw an error if no service slug is passed
#### `microserviceUrl`
Constructor will throw an error if no service url is passed
### `errorClass`
#### `errorClass`
By default, uses FB
By default, uses FBJWTClientError
## Extending
### Extending

@@ -43,4 +47,4 @@ ``` javascript

class FBMyClient extends FBJWTClient {
constructor (serviceToken, serviceUrl, myVar) {
super(serviceToken)
constructor (serviceToken, serviceSlug, microserviceUrl, myVar) {
super(serviceToken, serviceSlug, microserviceUrl)
// do something with additional constructor argument

@@ -51,3 +55,3 @@ this.myVar = myVar

const myClient = new FBMyClient('service token', 'http://myservice', 'my var')
const myClient = new FBMyClient('service token', 'myservice', 'http://myservice', 'my var')
```

@@ -58,7 +62,6 @@

class FBAnotherClient extends FBJWTClient {
constructor (serviceToken, serviceUrl) {
constructor (serviceToken, serviceSlug, microserviceUrl) {
// create custom error class
class FBAnotherClientError extends FBJWTClient.prototype.ErrorClass {}
super(serviceToken, serviceUrl, FBAnotherClientError)
super(serviceToken)
super(serviceToken, serviceSlug, microserviceUrl, FBAnotherClientError)
}

@@ -68,3 +71,3 @@ }

## Methods
### Methods

@@ -107,2 +110,24 @@ - generateAccessToken

### Loading and initialising client with secret and associated methods
``` javascript
// load client class
const {FBJWTClientWithSecret} = require('@ministryofjustice/fb-jwt-client-node')
// initialise client
const jwtClientWithSecret = new FBJWTClientWithSecret(serviceSecret, serviceToken, serviceSlug, microserviceUrl, [errorClass])
```
#### Methods
- encryptUserIdAndToken
Encrypt user ID and token using service secret
- decryptUserIdAndToken
Decrypt user ID and token using service secret
## Further details
See documentation in code for further details and `fb-user-datastore-client-node` and `fb-submitter-client-node` for examples.
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