Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@ministryofjustice/fb-client
Advanced tools
Form Builder clients for Email, SMS, Submitter, User Data Store, User File Store, and JSON Web Token (for Node)
Clients for Email, SMS, Submitter, User Data Store, User File Store, and JWT.
Base client for requests to endpoints which require a JSON Web Token for authentication.
const FBJWTClient = require('@ministryofjustice/fb-client/user/jwt/client')
const jwtClient = new FBJWTClient(serviceSecret, serviceSlug, microserviceUrl, [errorClass])
A serviceSecret
is required.
The constructor will throw an error if no serviceSecret
is provided.
A serviceSlug
is required.
The constructor will throw an error if no serviceSlug
is provided.
A microserviceUrl
is required.
The constructor will throw an error if no microserviceUrl
is provided.
An errorClass
is optional.
class FBMyClient extends FBJWTClient {
constructor (serviceSecret, serviceSlug, microserviceUrl, [myVar]) {
super(serviceSecret, serviceSlug, microserviceUrl)
this.myVar = myVar // assign the optional constructor argument
}
}
const myClient = new FBMyClient('service_secret', 'myservice', 'http://myservice', ['my var'])
// a custom error class extending the base error class
class FBAnotherClientError extends FBJWTClient.prototype.ErrorClass {}
class FBAnotherClient extends FBJWTClient {
constructor (serviceSecret, serviceSlug, microserviceUrl) {
super(serviceSecret, serviceSlug, microserviceUrl, FBAnotherClientError)
}
}
generateAccessToken
Generate a JWT access token
createEndpointUrl
Create the URL for an endpoint
sendGet
Dispatch GET
requests to an endpoint
sendPost
Dispatch POST
requests to an endpoint
encrypt
Encrypt data with AES 256
decrypt
Decrypt data
encryptUserIdAndToken
Encrypt the user ID and token using the service secret
decryptUserIdAndToken
Decrypt the user ID and token using the service secret
handleRequestError
This function will be invoked with an error an argument when the transaction fails
createRequestOptions
Create request options, whether GET
or POST
throwRequestError
This function can be invoked to throw request errors
Client for requests to datastore endpoints.
const FBUserDataStoreClient = require('@ministryofjustice/fb-client/user/datastore/client')
const userDataStoreClient = new FBUserDataStoreClient(serviceSecret, serviceSlug, userDataStoreUrl)
// fetch user data
const userData = await userDataStoreClient.getData(userId, userToken)
// store user data
await userDataStoreClient.setData(userId, userToken, userData)
Client for requests to filestore endpoints.
const FBUserFileStoreClient = require('@ministryofjustice/fb-client/user/filestore/client')
const userFileStoreClient = new FBUserFileStoreClient(serviceSecret, serviceSlug, userFileStoreUrl)
// fetch user file
const userFile = await userFileStoreClient.fetch(userId, userToken, fingerprint)
Define a policy:
const policy = { [max_size], [expires], [allowed_types] }
Either:
// store user file from file data
const uploadDetails = await userFileStoreClient.store(userId, userToken, file, policy)
Or:
// store user file from file path
const uploadDetails = await userFileStoreClient.storeFromPath(userId, userToken, filePath, policy)
FAQs
Form Builder clients for Email, SMS, Submitter, User Data Store, User File Store, and JSON Web Token (for Node)
The npm package @ministryofjustice/fb-client receives a total of 1 weekly downloads. As such, @ministryofjustice/fb-client popularity was classified as not popular.
We found that @ministryofjustice/fb-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 15 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.