little-printer-claim-code
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
);
Library Usage
encode
Turn device parameters into a claim code:
const deviceAddress = bigInt('46dbd1efebe85023', 16);
const xor = hardwareXorFromDeviceAddress(deviceAddress);
const secret = bigInt('bd38b46918', 16);
console.log(encode(xor, secret));
unpack
Extract values within a claim code:
const claimCode = 'c1zp-g2ec-sqqh-28t5';
console.log(unpack(claimCode));
decode
Decode a claim code to extract the key:
const claimCode = 'c1zp-g2ec-sqqh-28t5';
console.log(decode(claimCode));
Generate a Claim Code
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-printer.sh
// →
// address: 5f297a46f118187
// secret: da156dc11d
// xor: 11541520
// claim code: 7p6x-n5ce-r4fv-070h
Maintenance: Releasing a Version
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.