oauth-sign
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
OAuth-sign is a standalone module in JavaScript that provides OAuth 1 signing facilities. Previously it functioned as a vendor library in mikeal/request, but it is now available as an independent package. The module's primary function is to facilitate signed HTTP requests via various method signatures including HMAC-SHA1, HMAC-SHA256, RSA-SHA1, and PLAINTEXT. It is used to enhance the security of data transmission between a client and server by ensuring the integrity and authenticity of the data.
To use oauth-sign, you first need to install it in your node.js project. It can be installed using the npm install command as follows:
npm install oauth-sign
After installation, require it in your JavaScript file where you're making the HTTP request:
const oauthSign = require('oauth-sign')
Although there isn't an explicit example provided in the readme, oauth-sign could generally be used in a way similar to below:
const baseString = '...'; // your base string
const secretKey = '...'; // your secret key
// For HMAC-SHA1:
const signatureHmacSha1 = oauthSign.HmacSHA1(baseString, secretKey);
console.log(signatureHmacSha1);
// For HMAC-SHA256:
const signatureHmacSha256 = oauthSign.HmacSHA256(baseString, secretKey);
console.log(signatureHmacSha256);
// For RSA-SHA1:
const signatureRsaSha1 = oauthSign.RsaSHA1(baseString, secretKey);
console.log(signatureRsaSha1);
However, keep in mind that the actual methods may differ and you should always check the source code or official documentation for more concrete usage.
OAuth-sign documentation is not directly indicated in the readme content shared above. For the most accurate and detailed documentation, it is recommended to visit the official GitHub repository for oauth-sign at https://github.com/mikeal/oauth-sign. The repo contains the source code which can give insights on how to use the package. In case of more complex use cases or issues, you might find solutions or get recommendations from the community by accessing the "Issues" section of the Github repository.