import * as wmill from "https://deno.land/x/windmill@v1.85.0/mod.ts";
export async function main(client: string) {
  const encoded = new TextEncoder().encode(client);
  // key generated by https://hub.windmill.dev/scripts/helper/1509/generate-an-rsa-pss-key-pair-helper
  let privateKey = await importPrivateKey(
    (await wmill.getVariable("u/user/your_private_key"))!,
  );
  let signature = await crypto.subtle.sign(
    {
      name: "RSA-PSS",
      saltLength: 32,
    },
    privateKey,
    encoded,
  );
  // Combine the encoded data and signature to create a license key
  const licenseKey = `${btoa(client)}.${abToBase64(signature)}`;
  return licenseKey;
}
function abToBase64(arrayBuffer: ArrayBuffer) {
  return btoa(String.fromCharCode.apply(null, new Uint8Array(arrayBuffer)));
}
function importPrivateKey(pem: string) {
  const binaryDerString = window.atob(pem);
  const binaryDer = str2ab(binaryDerString);
  return window.crypto.subtle.importKey(
    "pkcs8",
    binaryDer,
    {
      name: "RSA-PSS",
      hash: "SHA-256",
    },
    true,
    ["sign"],
  );
}
function str2ab(str: string) {
  const buf = new ArrayBuffer(str.length);
  const bufView = new Uint8Array(buf);
  for (let i = 0, strLen = str.length; i < strLen; i++) {
    bufView[i] = str.charCodeAt(i);
  }
  return buf;
}
 Submitted by hugo697 181 days ago
import * as wmill from "https://deno.land/x/windmill@v1.85.0/mod.ts";
export async function main(client: string) {
  const encoded = new TextEncoder().encode(client);
  // key generated by https://hub.windmill.dev/scripts/helper/1509/generate-an-rsa-pss-key-pair-helper
  let privateKey = await importPrivateKey(
    (await wmill.getVariable("u/user/your_private_key"))!,
  );
  let signature = await crypto.subtle.sign(
    {
      name: "RSA-PSS",
      saltLength: 32,
    },
    privateKey,
    encoded,
  );
  // Combine the encoded data and signature to create a license key
  const licenseKey = `${btoa(client)}.${abToBase64(signature)}`;
  return licenseKey;
}
function abToBase64(arrayBuffer: ArrayBuffer) {
  return btoa(String.fromCharCode.apply(null, new Uint8Array(arrayBuffer)));
}
function importPrivateKey(pem: string) {
  const binaryDerString = window.atob(pem);
  const binaryDer = str2ab(binaryDerString);
  return window.crypto.subtle.importKey(
    "pkcs8",
    binaryDer,
    {
      name: "RSA-PSS",
      hash: "SHA-256",
    },
    true,
    ["sign"],
  );
}
function str2ab(str: string) {
  const buf = new ArrayBuffer(str.length);
  const bufView = new Uint8Array(buf);
  for (let i = 0, strLen = str.length; i < strLen; i++) {
    bufView[i] = str.charCodeAt(i);
  }
  return buf;
}
 Submitted by admin 814 days ago
import * as wmill from "https://deno.land/x/windmill@v1.85.0/mod.ts";
export async function main(client: string) {
  const encoded = new TextEncoder().encode(client);
  // key generated by https://hub.windmill.dev/scripts/helper/1509/generate-an-rsa-pss-key-pair-helper
  let privateKey = await importPrivateKey(
    (await wmill.getVariable("u/user/your_private_key"))!,
  );
  let signature = await crypto.subtle.sign(
    {
      name: "RSA-PSS",
      saltLength: 32,
    },
    privateKey,
    encoded,
  );
  // Combine the encoded data and signature to create a license key
  const licenseKey = `${btoa(client)}.${abToBase64(signature)}`;
  return licenseKey;
}
function abToBase64(arrayBuffer: ArrayBuffer) {
  return btoa(String.fromCharCode.apply(null, new Uint8Array(arrayBuffer)))
}
function importPrivateKey(pem: string) {
  const binaryDerString = window.atob(pem);
  const binaryDer = str2ab(binaryDerString);
  return window.crypto.subtle.importKey(
    "pkcs8",
    binaryDer,
    {
      name: "RSA-PSS",
      hash: "SHA-256",
    },
    true,
    ["sign"],
  );
}
function str2ab(str: string) {
  const buf = new ArrayBuffer(str.length);
  const bufView = new Uint8Array(buf);
  for (let i = 0, strLen = str.length; i < strLen; i++) {
    bufView[i] = str.charCodeAt(i);
  }
  return buf;
}
 Submitted by adam186 945 days ago
import * as wmill from "https://deno.land/x/windmill@v1.70.1/mod.ts";
export async function main(client: string) {
  const encoded = new TextEncoder().encode(client);
  // key generated by https://hub.windmill.dev/scripts/helper/1509/generate-an-rsa-pss-key-pair-helper
  let privateKey = await importPrivateKey(
    (await wmill.getVariable("u/user/your_private_key"))!,
  );
  let signature = await crypto.subtle.sign(
    {
      name: "RSA-PSS",
      saltLength: 32,
    },
    privateKey,
    encoded,
  );
  // Combine the encoded data and signature to create a license key
  const licenseKey = `${btoa(client)}.${abToBase64(signature)}`;
  return licenseKey;
}
function abToBase64(arrayBuffer: ArrayBuffer) {
  return btoa(String.fromCharCode.apply(null, new Uint8Array(arrayBuffer)))
}
function importPrivateKey(pem: string) {
  const binaryDerString = window.atob(pem);
  const binaryDer = str2ab(binaryDerString);
  return window.crypto.subtle.importKey(
    "pkcs8",
    binaryDer,
    {
      name: "RSA-PSS",
      hash: "SHA-256",
    },
    true,
    ["sign"],
  );
}
function str2ab(str: string) {
  const buf = new ArrayBuffer(str.length);
  const bufView = new Uint8Array(buf);
  for (let i = 0, strLen = str.length; i < strLen; i++) {
    bufView[i] = str.charCodeAt(i);
  }
  return buf;
}
 Submitted by adam186 980 days ago
import * as wmill from "https://deno.land/x/windmill@v1.60.0/mod.ts";
export async function main(client: string) {
  const encoded = new TextEncoder().encode(client);
  // key generated by https://hub.windmill.dev/scripts/helper/1509/generate-an-rsa-pss-key-pair-helper
  let privateKey = await importPrivateKey(
    (await wmill.getVariable("u/user/your_private_key"))!,
  );
  let signature = await crypto.subtle.sign(
    {
      name: "RSA-PSS",
      saltLength: 32,
    },
    privateKey,
    encoded,
  );
  // Combine the encoded data and signature to create a license key
  const licenseKey = `${btoa(client)}.${abToBase64(signature)}`;
  return licenseKey;
}
function abToBase64(arrayBuffer: ArrayBuffer) {
  return btoa(String.fromCharCode.apply(null, new Uint8Array(arrayBuffer)))
}
function importPrivateKey(pem: string) {
  const binaryDerString = window.atob(pem);
  const binaryDer = str2ab(binaryDerString);
  return window.crypto.subtle.importKey(
    "pkcs8",
    binaryDer,
    {
      name: "RSA-PSS",
      hash: "SHA-256",
    },
    true,
    ["sign"],
  );
}
function str2ab(str: string) {
  const buf = new ArrayBuffer(str.length);
  const bufView = new Uint8Array(buf);
  for (let i = 0, strLen = str.length; i < strLen; i++) {
    bufView[i] = str.charCodeAt(i);
  }
  return buf;
}
 Submitted by admin 1024 days ago
import * as wmill from "https://deno.land/x/windmill@v1.60.0/mod.ts";
export async function main(client: string) {
  const encoded = new TextEncoder().encode(client);
  // key generated by https://hub.windmill.dev/scripts/helper/1507/generate-an-rsa-key-pair-helper
  let privateKey = await importPrivateKey(
    (await wmill.getVariable("u/user/your_private_key"))!,
  );
  let signature = await crypto.subtle.sign(
    {
      name: "RSA-PSS",
      saltLength: 32,
    },
    privateKey,
    encoded,
  );
  // Combine the encoded data and signature to create a license key
  const licenseKey = `${btoa(client)}.${abToBase64(signature)}`;
  return licenseKey;
}
function abToBase64(arrayBuffer: ArrayBuffer) {
  return btoa(String.fromCharCode.apply(null, new Uint8Array(arrayBuffer)))
}
function importPrivateKey(pem: string) {
  const binaryDerString = window.atob(pem);
  const binaryDer = str2ab(binaryDerString);
  return window.crypto.subtle.importKey(
    "pkcs8",
    binaryDer,
    {
      name: "RSA-PSS",
      hash: "SHA-256",
    },
    true,
    ["sign"],
  );
}
function str2ab(str: string) {
  const buf = new ArrayBuffer(str.length);
  const bufView = new Uint8Array(buf);
  for (let i = 0, strLen = str.length; i < strLen; i++) {
    bufView[i] = str.charCodeAt(i);
  }
  return buf;
}
 Submitted by admin 1024 days ago