
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
little-printer-claim-code
Advanced tools
helper utility to generate (and process) claim codes for a Berg Little Printer
Claim code encoding for Little Printer devices.
Ported from this Python implementation.
Mostly I expect this to be used to encode devices into generating a claim code (via encode
), but it also supports unpacking a claim code into parameters (unpack
), and decoding a device key from a claim code (decode
);
encode
Turn device parameters into a claim code:
// generate a device address - from MAC address, or randomly, whatever
const deviceAddress = '000d6f000273c164';
// only the last 24 bits of the device address are used
const deviceAddressInt = parseInt(deviceAddress, 16) & 0xffffff;
// secret only known to printer and claim code, randomly generate
const secret = 0xeb1ba696a0;
console.log(encode(deviceAddressInt, secret));
// → 'n5ry-p6x6-kth7-7hc4'
unpack
Extract values within a claim code:
const claimCode = 'c1zp-g2ec-sqqh-28t5';
console.log(unpack(claimCode));
// → {
// device: 74565,
// secret: 444691369455,
// crc: 22655,
// value: 417918447673048574272325n
// }
decode
Decode a claim code to extract the key:
const claimCode = 'c1zp-g2ec-sqqh-28t5';
console.log(decode(claimCode));
// → {
// device: 74565,
// key: <Buffer d5 0b 90 4f 43 7c 1d 2e 87 c3 10 57 49 40 9e 3d>
// }
If all you really want to do is create a claim code with this library, then there's a script to help with that:
./bin/generate-claim-code.sh
// → {
// device: '121745933cb16b91',
// secret: 876353015208,
// claimCode: '5rpd-r2oo-spnc-2v00'
// }
Publishing works via GitHub actions, so. Create a new version (+tag, etc), which should get pushed to GitHub automatically.
yarn version
Then open GitHub, and create (+ publish) a new release. This will trigger everything else that needs doing.
FAQs
helper utility to generate (and process) claim codes for a Berg Little Printer
The npm package little-printer-claim-code receives a total of 2 weekly downloads. As such, little-printer-claim-code popularity was classified as not popular.
We found that little-printer-claim-code 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.