Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Envelop big blob of data into frames that can be displayed in series of QR Codes
Envelop big blob of data into frames that can be displayed in series of QR Codes.
NB. this library is generic enough to not even be used with QR Codes but still take optimization decision in regard to how QR code works and from empirical tests.
yarn add qrloop
yarn add qrloop
yarn add buffer # required
There are 2 parts of the library, the "exporter" that want to export the data via QR codes and the "importer" that will scan these QR codes and accumulate the frames until it reaches the final result.
The exporter only have 1 function to use: dataToFrames
.
import { dataToFrames } from "qrloop/exporter";
// examples
const frames: string[] = dataToFrames("hello world");
const frames = dataToFrames(Buffer.from([ 0x00, 0x01, ... ]));
const frames = dataToFrames(data, 140, 2);
// dataToFrames( data[, dataSize, replicas ])
// data: the complete data to encode in a series of QR code frames
// dataSize: the number of bytes to use from data for each frame
// replicas: (>= 1) the total number of loops to repeat the frames with varying a nonce. More there is, better the chance to not be stuck on a frame. Experience has shown some QR Code are harder to read.
You can find an implementation example in examples/web-text-exporter
.
There are a few functions you can use to be able to consume and accumulate the frames over time.
The main function is parseFramesReducer
that you feed with each QR Code data and will accumulate a state. Consider that state a black box and prefer using the utility functions to extract out information.
import {
parseFramesReducer,
areFramesComplete,
framesToData,
progressOfFrames
} from "qrloop/importer";
const onResult = finalResult => console.log({ finalResult });
let frames = null;
const onBarCodeScanned = (data: string) => {
try {
frames = parseFramesReducer(this.frames, data);
if (areFramesComplete(frames)) {
onResult(framesToData(frames).toString());
} else {
console.log("Progress:", progressOfFrames(frames));
}
} catch (e) {
console.warn(e); // a qrcode might fail. maybe the data is corrupted or you scan something that is not relevant.
}
};
You can find an implementation example in examples/rn-text-importer
.
FAQs
Envelop big blob of data into frames that can be displayed in series of QR Codes
The npm package qrloop receives a total of 1,114 weekly downloads. As such, qrloop popularity was classified as popular.
We found that qrloop 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.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.