Reframe lede + integrate code sample around creator empowerment
This commit is contained in:
+16
-15
@@ -53,7 +53,7 @@
|
||||
<main class="prose">
|
||||
<div class="crumb">Get started · Integrate the SDK</div>
|
||||
<h1>Integrate the SDK.</h1>
|
||||
<p class="lead">Wire Keysat licenses into your software in under an afternoon. The verifier is pure-function, offline, and ships in five lines.</p>
|
||||
<p class="lead">Wire Keysat licenses into your software in under an afternoon. The verifier is pure-function, offline, and ships in five lines. What you do with the result — refuse to start without a license, unlock specific features, just show a "supporter" badge — is your call. The SDK is the primitive; the business model is yours.</p>
|
||||
|
||||
<h2 id="prereq">Prerequisites</h2>
|
||||
<p>Before you start, you should have:</p>
|
||||
@@ -117,11 +117,13 @@ MCowBQYDK2VwAyEAmz7q8r4t1v…h3k2pXq9wL
|
||||
|
||||
<span class="k">const</span> result = verifier.<span class="f">verify</span>(licenseKeyFromUser);
|
||||
|
||||
<span class="k">if</span> (!result.valid) {
|
||||
<span class="f">exitUnlicensed</span>();
|
||||
}
|
||||
<span class="k">if</span> (!result.entitlements.<span class="f">has</span>(<span class="s">'export'</span>)) {
|
||||
<span class="f">disableExport</span>();
|
||||
<span class="c">// Now decide what to do with the result, based on YOUR business model.
|
||||
// One-time purchase to use the app at all? Refuse to start unless valid.
|
||||
// Free + paid features? Check entitlements per feature.
|
||||
// Supporter badge only? Just render differently when valid.</span>
|
||||
<span class="k">if</span> (result.valid) {
|
||||
app.licensed = <span class="k">true</span>;
|
||||
app.entitlements = result.entitlements;
|
||||
}</pre>
|
||||
<pre class="code lang-pane" data-lang="rs" style="display:none"><span class="k">use</span> licensing_client::{<span class="f">Verifier</span>, <span class="f">PublicKeyPem</span>};
|
||||
|
||||
@@ -129,21 +131,20 @@ MCowBQYDK2VwAyEAmz7q8r4t1v…h3k2pXq9wL
|
||||
<span class="k">let</span> verifier = <span class="f">Verifier</span>::new(pk);
|
||||
<span class="k">let</span> result = verifier.verify(&license_key)<span class="p">?</span>;
|
||||
|
||||
<span class="k">if</span> !result.valid {
|
||||
exit_unlicensed();
|
||||
}
|
||||
<span class="k">if</span> !result.entitlements.contains(<span class="s">"export"</span>) {
|
||||
disable_export();
|
||||
<span class="c">// What you do next is up to your business model.</span>
|
||||
<span class="k">if</span> result.valid {
|
||||
app.licensed = <span class="k">true</span>;
|
||||
app.entitlements = result.entitlements;
|
||||
}</pre>
|
||||
<pre class="code lang-pane" data-lang="py" style="display:none"><span class="k">from</span> keysat_licensing_client <span class="k">import</span> Verifier, PublicKey
|
||||
|
||||
verifier = <span class="f">Verifier</span>(<span class="f">PublicKey</span>.<span class="f">from_pem</span>(ISSUER_PEM))
|
||||
result = verifier.<span class="f">verify</span>(license_key_from_user)
|
||||
|
||||
<span class="k">if</span> <span class="k">not</span> result.valid:
|
||||
exit_unlicensed()
|
||||
<span class="k">if</span> <span class="s">"export"</span> <span class="k">not in</span> result.entitlements:
|
||||
disable_export()</pre>
|
||||
<span class="c"># What you do with the result is your choice.</span>
|
||||
<span class="k">if</span> result.valid:
|
||||
app.licensed = <span class="k">True</span>
|
||||
app.entitlements = result.entitlements</pre>
|
||||
|
||||
<p>The verifier returns a result object with the following fields:</p>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user