code-canvas-server

2.3.6 Not latest — view latest

Local server for v2.codecanvas.app — real-time file watching, TypeScript LSP, and MCP agent interface

License
Unknown license
Published
March 21, 2026
127d ago
Package Registry
README badge Customize →
License Sources
SourceLicenseClass
Licensie (detected)
Pending-
npm (reported)
Not reported-

License detection is still in progress for this version.

Loading dependencies…
License File
export type LicensePayload = {
  githubId: string;
  plan: "pro";
  generation: "new" | "legacy";
  canUseV2: boolean;
  canUseLegacy: boolean;
  issuedAt: number; // epoch seconds
  expiresAt: number; // epoch seconds (issuedAt + 14 days)
  tokenId: string; // UUID
};

export const LICENSE_TOKEN_COOKIE_NAME = "cc_license_token";
export const LICENSE_TTL_SECONDS = 14 * 24 * 60 * 60; // 14 days
export const LICENSE_GRACE_SECONDS = 3 * 24 * 60 * 60; // 3 days

export const LICENSE_PUBLIC_KEY_PEM = `-----BEGIN PUBLIC KEY-----
MCowBQYDK2VwAyEAausrQ9PqJtbbKXd5RcYYF1oRWtu3p38GXqNDF3r5FVk=
-----END PUBLIC KEY-----`;

function base64UrlDecode(str: string): Uint8Array {
  // Convert base64url to base64
  let base64 = str.replace(/-/g, "+").replace(/_/g, "/");
  while (base64.length % 4 !== 0) {
    base64 += "=";
  }
  const binary = atob(base64);
  const bytes = new Uint8Array(binary.length);
  for (let i = 0; i < binary.length; i++) {
    bytes[i] = binary.charCodeAt(i);
  }
  return bytes;
}

export function base64UrlEncode(bytes: Uint8Array): string {
  let binary = "";
  for (let i = 0; i < bytes.length; i++) {
    binary += String.fromCharCode(bytes[i]!);
  }
  return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
}

export function parseLicenseToken(
  token: string
): {
  payload: LicensePayload;
  payloadRaw: Uint8Array;
  signature: Uint8Array;
} | null {
  const dotIndex = token.indexOf(".");
  if (dotIndex < 0) return null;
  const payloadB64 = token.slice(0, dotIndex);
  const signatureB64 = token.slice(dotIndex + 1);
  try {
    const payloadBytes = base64UrlDecode(payloadB64);
    const signatureBytes = base64UrlDecode(signatureB64);
    const payload = JSON.parse(
      new TextDecoder().decode(payloadBytes)
    ) as LicensePayload;
    return { payload, payloadRaw: payloadBytes, signature: signatureBytes };
  } catch {
    return null;
  }
}
Versions
15 versions
VersionLicensePublishedStatus
2.4.0 Latest -Jul 26, 2026 Pending
2.3.6 Viewing-Mar 21, 2026 Pending
2.3.5 -Mar 21, 2026 Pending
2.3.4 -Mar 21, 2026 Pending
2.3.3 -Mar 21, 2026 Pending
2.3.0 -Mar 16, 2026 Pending
2.2.0 -Mar 13, 2026 Pending
2.1.0 -Mar 4, 2026 Pending
2.0.141 -Feb 25, 2026 Pending
2.0.140 -Feb 23, 2026 Pending
2.0.139 -Feb 23, 2026 Pending
2.0.138 -Feb 23, 2026 Pending
2.0.137 -Feb 23, 2026 Pending
2.0.136 -Feb 23, 2026 Pending
2.0.135 -Feb 23, 2026 Pending