npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ianacaburian/generate-key-file

v1.0.1

Published

Ports juce_KeyGeneration::generateKeyFile() to node.

Downloads

125

Readme

generate-key-file

Ports juce_KeyGeneration::generateKeyFile() to node.

GitHub Actions Workflow Status NPM Version X (formerly Twitter) URL

Installation

npm i @ianacaburian/generate-key-file

Usage

generateKeyFile

  • Signature:
generateKeyFile(params: GenerateKeyFileParams, date: Date = new Date()) => string
  • Example:
import { generateKeyFile } from '@ianacaburian/generate-key-file'

const keyFileContent = generateKeyFile({
    userName: 'Ian',
    userEmail: '[email protected]',
    machineNumbers: '123',
    appName: 'app-name-or-product-id',
    privateKey: 'comma-sep-private-key'
})
  • Returns the string value to be used in the XML response for decryption by the client.
  • Throws ZodError for invalid params -- see zod.
  • From juce_KeyFileGeneration.h:
    /**
        Generates the content of a key-file which can be sent to a user's machine to
        unlock a product.

        The returned value is a block of text containing an RSA-encoded block, followed
        by some human-readable details. If you pass this block of text to
        OnlineUnlockStatus::applyKeyFile(), it will decrypt it, and if the
        key matches and the machine numbers match, it will unlock that machine.

        Typically the way you'd use this on a server would be to build a small executable
        that simply calls this method and prints the result, so that the webserver can
        use this as a reply to the product's auto-registration mechanism. The
        keyGenerationAppMain() function is an example of how to build such a function.

        @see OnlineUnlockStatus
    */

generateExpiringKeyFile

  • Signature:
generateExpiringKeyFile(params: GenerateExpiringKeyFileParams, date: Date = new Date()) => string
  • Example:
import { generateExpiringKeyFile } from '@ianacaburian/generate-key-file'

const oneDayFromNow = new Date(new Date().getTime() + 24 * 60 * 60 * 1000)
const expiringKeyFileContent = generateExpiringKeyFile({
    userName: 'Ian',
    userEmail: '[email protected]',
    machineNumbers: '123',
    appName: 'app-name-or-product-id',
    privateKey: 'comma-sep-private-key'
    expiryTime: oneDayFromNow
})
  • Returns the string value to be used in the XML response for decryption by the client.
  • Throws ZodError for invalid params -- see zod.
  • From juce_KeyFileGeneration.h:
    /** Similar to the above key file generation method but with an expiry time.
        You must supply a Time after which this key file should no longer be considered as active.

        N.B. when an app is unlocked with an expiring key file, OnlineUnlockStatus::isUnlocked will
        still return false. You must then check OnlineUnlockStatus::getExpiryTime to see if this
        expiring key file is still in date and act accordingly.

        @see OnlineUnlockStatus
    */

Development

npm run clean                   # Clean dist and test builds (inc test bins).
npm run lint                    # Lint the src dir.
npm run build                   # Lint, install tests, and build package.

Testing

npm run test                    # Start vitest to run all tests.
npm run test -- -t "divideBy"   # Start vitest to run one test.
npm run cm:clean                # Clean test build.
npm run cm:open                 # Open test/console project in Xcode.
npm run cm:install              # Build and install the test/console bins.
  • Optional: Set "FC_NUM_RUMS" (default=1) to specify how many times to run each (randomly generated) propery-based test -- see fast-check.
FC_NUM_RUNS=1000 npm run test   # Run each fc test 1000 times.
  • Optional: Set "FC_SEED" (default=1) to specify the seed for each fc test.
FC_SEED=2 npm run test   # Run each fc test with seed=2.