Skip to content

Repository files navigation

NexKeyRuntime

NexKeyRuntime is a native C/C++14 SDK for update discovery, product notices, and offline license verification in desktop plugins and applications backed by Nexus.

It exposes two independent handles:

  • NexKeyRuntimeHandle — update checks and product notices (both profiles, always available).
  • NexKeyRuntimeLicenseHandle — offline license verification and self-service activation.

About Nexus

Nexus is infrastructure for licensing, distributing, and updating native software that has to keep working offline. MCNexus is its macOS and Windows client: it activates licenses and installs, updates, and rolls back the products a workstation uses. This SDK is the piece that ships inside those products.

Profile A vs. Profile B

  • Profile A: the host application (MCNexus) activates the license; the plugin only loads a ProductData blob and a locally cached receipt, then makes a fast, read-only ALLOW/DENY decision on the render thread.
  • Profile B: the product itself activates and syncs a license, with no host application in the loop. Since 0.2.0, nexkeyruntime_license_activate, _deactivate, _request_sync, and _publish_receipt perform real activation, deactivation, and background synchronization against the licensing backend.

Both profiles work, and the public API is stable as of 1.0.0 — see docs/ABI_POLICY.md for the compatibility guarantees. Third-party use of the compiled binaries is licensed under BINARY_LICENSE.md. What is not open yet is self-service onboarding: obtaining a tenant and a ProductData blob still goes through a per-project setup conversation.

Minimal integration (Profile A)

#include <nexkeyruntime/nexkeyruntime.h>

static NexKeyRuntimeLicenseHandle *g_license = NULL;

// Generated by the MCNexus backoffice for this tenant. Contains only a
// public keyring and a base URL — no secret. Safe to embed in source that
// ships in a public repository.
static const char *NEXKEYRUNTIME_PRODUCT_DATA =
    "eyJmb3JtYXQiOiJuZXhrZXlydW50aW1lLXByb2R1Y3RkYXRhLXYxIiwi...";

void pluginLoad(void) {
    g_license = nexkeyruntime_license_create();
    nexkeyruntime_license_set_product_data(g_license, NEXKEYRUNTIME_PRODUCT_DATA);
    nexkeyruntime_license_set_tenant_id(g_license, "your-tenant-id");
    nexkeyruntime_license_set_variant(g_license, "download:your-entitlement");
    nexkeyruntime_license_load_local(g_license);
}

// Render thread: no network, no file I/O, no JSON parsing — a single
// atomic read.
int render(void) {
    return nexkeyruntime_license_render_decision(g_license) == NEXKEYRUNTIME_RENDER_ALLOW;
}

void pluginUnload(void) {
    nexkeyruntime_license_destroy(g_license);
    g_license = NULL;
}

set_tenant_id and set_variant are separate calls, not fields inside the ProductData blob — a certificate is checked against whichever tenant and variant the plugin declares at runtime, not against values baked into the blob at generation time.

Documentation

  • docs/INTEGRATION.md — the license handle end to end: both profiles, UI status reporting, and how activation elsewhere reaches your plugin.
  • docs/UPDATES_AND_NOTICES.md — the update handle: release checks, product notices, audience and the actions you can offer.
  • docs/OFFLINE.md — activating a machine that cannot reach the network, and releasing its seat afterwards.
  • docs/ABI_POLICY.md — what may change between versions and what may not.
  • examples/ — one directory per integration: Profile A, Profile B, updates and notices, and offline activation.
  • schemas/ — the wire formats: ProductData, the activation certificate, and the update manifest. Published so an integrator can verify what the SDK accepts, and reproduce it without us.

Build

There is nothing to compile in this repository. It ships the public contract only — headers, JSON schemas, and non-buildable example code. Compiled static libraries for macOS (universal) and Windows x64 are published as GitHub Releases against this repository, with checksums; examples/cmake-consumer documents the intended consumption pattern.

Windows: link with the static CRT (/MT)

The published nexkeyruntime.lib is built against the static C runtime, so anything you link it into must use the same one. This is what cl does with no runtime flag at all, so an ordinary build already matches — but a build that asks for /MD, or a CMake project that takes CMake's own default, will not:

error LNK2038: mismatch detected for 'RuntimeLibrary':
  value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease'

followed by a wall of LNK2005 duplicate-CRT symbols. Two fixes exist and only one is right:

cl /MT ...                          :: compiling directly
# CMake: CMP0091 is NEW from 3.15, and its default is the dynamic CRT.
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")

If your build also compiles CUDA, nvcc does not inherit your compiler flags — pass -Xcompiler /MT as well, or that one object lands on the other runtime and produces the same error somewhere less obvious.

The static CRT is deliberate: this library is linked into other people's binaries with a build configuration we cannot know, and it already ships self-contained.

Public and private boundaries

This repository contains only the redistributable contract: the public C header, protocol schemas, and consumer documentation and examples. The license and update engine's implementation, MCNexus backend code, tenant configuration, and internal roadmaps are not part of this repository and never will be — CI in the private monorepo rejects any push here that adds implementation source.

License

The contents of this repository (headers, schemas, docs, examples) are licensed under the Apache License, Version 2.0 — see LICENSE. Compiled binary releases are governed separately by BINARY_LICENSE.md.

About

No description, website, or topics provided.

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages