Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
ocr - JavaScript client for ocr-sdk The OCR API 'ocr' performs Optical Character Resolution on input files. The flow is generally as follows: 1. First upload an image/file using the /ocr POST endpoint. You will get back a job response that contains a job with its associated settings. 2. Start the job from a PUT request to the /ocr/{jobid} endpoint, with the Job and Settings JSON as request body. The ocr extraction will now start. 3. Check the job status from the /ocr/{jobid} GET endpoint until the status has changed to DONE or ERROR. Messaging using a websocket will be available as an alternative in a future version 4. Retrieve the OCR result using the /ocr/{jobid}/result GET endpoint. This will return the OCR result only when the status is DONE. In other cases it will return the Job Response JSON (with http code 202 instead of 200) Interactive testing: A web based test console is available in the <a href="https://store.sphereon.com\">Sphereon API Store This SDK is automatically generated by the Swagger Codegen project:
To publish the library as a npm, please follow the procedure in "Publishing npm packages".
Then install it via:
npm install ocr-sdk --save
If the library is hosted at a git repository, e.g. https://github.com/GIT_USER_ID/GIT_REPO_ID then install it via:
npm install GIT_USER_ID/GIT_REPO_ID --save
The library also works in the browser environment via npm and browserify. After following
the above steps with Node.js and installing browserify with npm install -g browserify
,
perform the following (assuming main.js is your entry file):
browserify main.js > bundle.js
Then include bundle.js in the HTML pages.
Please follow the installation instruction and execute the following JS code:
var ocr = require('ocr-sdk');
var defaultClient = ocr.ApiClient.instance;
// Configure OAuth2 access token for authorization: oauth2schema
var oauth2schema = defaultClient.authentications['oauth2schema'];
oauth2schema.accessToken = "YOUR ACCESS TOKEN"
var api = new ocr.OcrApi()
var jobid = "jobid_example"; // {String} jobid
api.deleteJob(jobid).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});
All URIs are relative to https://gw.api.cloud.sphereon.com/
Class | Method | HTTP request | Description |
---|---|---|---|
ocr.OcrApi | deleteJob | DELETE /ocr/1.0.0/ocr/{jobid} | Delete a job manually |
ocr.OcrApi | getJob | GET /ocr/1.0.0/ocr/{jobid} | Job definition and state |
ocr.OcrApi | getJobs | GET /ocr/1.0.0/ocr | Get all jobs |
ocr.OcrApi | getResult | GET /ocr/1.0.0/ocr/{jobid}/result | Get the current ocr result |
ocr.OcrApi | submitJob | PUT /ocr/1.0.0/ocr/{jobid} | Submit OCR job for processing |
ocr.OcrApi | uploadFile | POST /ocr/1.0.0/ocr | Upload first file |
FAQs
OCR Javascript SDK
We found that ocr-sdk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.