
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
@bynder/bynder-js-sdk
Advanced tools
This SDK aims to help the development of integrations with Bynder that use JavaScript, providing an easy interface to communicate with Bynder's REST API.
To use this SDK, you will need:
Node installation will include NPM, which is responsible for dependency management.
npm install @bynder/bynder-js-sdk
import Bynder from '@bynder/bynder-js-sdk';
This SDK relies heavily on Promises,
making it easier to handle the asynchronous requests made to the API. The SDK
provides a Bynder
object containing several methods which map to the
calls and parameters described in
Bynder's API documentation.
The following snippet is a generic example of how to use the SDK. If you need details for a specific module, refer to the samples folder.
Before executing any request, you need to authorize the calls to the API:
const bynder = new Bynder({
baseURL: "https//portal.getbynder.com/api/",
permanentToken: "<token>",
});
const bynder = new Bynder({
baseURL: "https://portal.getbynder.com/api/",
clientId: "<your OAuth2 client id>",
clientSecret: "<your OAuth2 client secret>",
redirectUri: "<url where user will be redirected after authenticating>"
});
const authorizationURL = bynder.makeAuthorizationURL();
bynder.getToken(code);
If you already have an access token, you can also initialize Bynder with the token directly:
const bynder = new Bynder({
baseURL: "http://api-url.bynder.io/api/",
clientId: "<your OAuth2 client id>",
clientSecret: "<your OAuth2 client secret>",
redirectUri: "<url where user will be redirected after authenticating>",
token: "<OAuth2 access token>"
});
OAuth application within Bynder needs client credentials grant type. Bynder object can be instantiated without redirectUri provided:
const bynder = new Bynder({
baseURL: "http://api-url.bynder.io/api/",
clientId: "<your OAuth2 client id>",
clientSecret: "<your OAuth2 client secret>"
});
To get a token via client credentials, make a call to getTokenClientCredentials()
:
const bynder = new Bynder({
baseURL: "http://api-url.bynder.io/api/",
clientId: "<your OAuth2 client id>",
clientSecret: "<your OAuth2 client secret>"
});
const token = await bynder.getTokenClientCredentials();
Sample call can be found within samples/oauth_client_credentials.js
.
You can now use the various methods from the SDK to fetch media, metaproperties
and other data. Following the Promises notation, you should use
.then()
/.catch()
to handle the successful and failed requests,
respectively.
Most of the calls take an object as the only parameter but please refer to the API documentation to tune the query as intended.
bynder
.getMediaList({
type: "image",
limit: 9,
page: 1
})
.then(data => {
// TODO Handle data
})
.catch(error => {
// TODO Handle the error
});
makeAuthorizationURL()
getToken()
getTokenClientCredentials()
getMediaList(queryObject)
getMediaInfo(queryObject)
getAllMediaItems(queryObject)
getMediaTotal(queryObject)
editMedia(object)
deleteMedia(id)
getAssetUsage(queryObject)
saveNewAssetUsage(queryObject)
deleteAssetUsage(queryObject)
getMetaproperties(queryObject)
getMetaproperty(queryObject)
saveNewMetaproperty(object)
editMetaproperty(object)
deleteMetaproperty(object)
saveNewMetapropertyOption(object)
editMetapropertyOption(object)
deleteMetapropertyOption(object)
getCollections(queryObject)
getCollection(queryObject)
saveNewCollection(queryObject)
shareCollection(queryObject)
addMediaToCollection(queryObject)
deleteMediaFromCollection(queryObject)
getTags(queryObject)
getSmartfilters(queryObject)
getBrands()
uploadFile(fileObject)
If you wish to contribute to this repository and further extend the API coverage in the SDK, here are the steps necessary to prepare your environment:
yarn install
to install all of the dependencies.secret.json
file with the following structure:{
"baseURL": "http://api-url.bynder.io/api/",
"clientId": "<your OAuth2 client id>",
"clientSecret": "<your OAuth2 client secret>",
"redirectUri": "<url where user will be redirected after authenticating>"
}
gulp lint
- Run ESlint and check the code.gulp build
- Run webpack to bundle the code in order to run in a browser.gulp babel
- Run Babel to create a folder 'dist' with ES2015 compatible code.gulp doc
- Run JSDoc to create a 'doc' folder with automatically generated documentation for the source code.gulp webserver
- Deploy a web server from the root folder at
localhost:8080
to run the html samples (in order to avoid CORS problems).JavaScript files can be executed within a Docker container with corresponding dependencies installed.
From the root directory create a secret.json
file.
{
"baseURL": "http://api-url.bynder.io/api/",
"clientId": "<your OAuth2 client id>",
"clientSecret": "<your OAuth2 client secret>"
}
Run the command make run-docker
to start up Docker container.
With the container running, execute the command:
make executeSdkSample sample-file-name=oauth_client_credentials.js
where sample-file-name is the name of the file within samples/
. This command will execute the JavaScript file within the container.
FAQs
Bynder Javascript SDK
The npm package @bynder/bynder-js-sdk receives a total of 1,641 weekly downloads. As such, @bynder/bynder-js-sdk popularity was classified as popular.
We found that @bynder/bynder-js-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 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.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.