sitrtech 1.7.2__tar.gz → 1.7.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +1,14 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sitrtech
3
- Version: 1.7.2
4
- Summary: Encrypt & license-lock Python and PHP source (Odoo, Frappe, Django, Flask, FastAPI, Tornado, WordPress, Laravel) with AES-256 and a native runtime loader
3
+ Version: 1.7.4
4
+ Summary: Encrypt & license-lock Python, Node.js & PHP source (Odoo, Frappe, Django, Flask, FastAPI, Tornado, WordPress, Laravel) with AES-256 and a native runtime loader
5
5
  Author-email: SitrTech <info@sitrtech.com>
6
6
  License: Proprietary
7
7
  Project-URL: Homepage, https://sitrtech.com
8
8
  Project-URL: Docs, https://sitrtech.com/docs
9
9
  Project-URL: Repository, https://sitrtech.com
10
10
  Project-URL: Bug Tracker, https://sitrtech.com/support
11
- Keywords: odoo,frappe,django,flask,fastapi,tornado,php,wordpress,laravel,encryption,aes-256,licensing,license-key,code-protection,source-protection,obfuscation,anti-reverse-engineering,intellectual-property
11
+ Keywords: odoo,frappe,django,flask,fastapi,tornado,php,wordpress,laravel,nodejs,node,encryption,aes-256,licensing,license-key,code-protection,source-protection,obfuscation,anti-reverse-engineering,intellectual-property
12
12
  Classifier: Development Status :: 5 - Production/Stable
13
13
  Classifier: Environment :: Console
14
14
  Classifier: Intended Audience :: Developers
@@ -30,7 +30,7 @@ Requires-Dist: rich>=13
30
30
  Requires-Dist: click>=8
31
31
  Requires-Dist: cryptography>=41
32
32
 
33
- # SitrTech — Source Code Encryption & Licensing for Python & PHP
33
+ # SitrTech — Source Code Encryption & Licensing for Python, Node.js & PHP
34
34
 
35
35
  [![PyPI](https://img.shields.io/pypi/v/sitrtech.svg)](https://pypi.org/project/sitrtech/)
36
36
  [![CLI](https://img.shields.io/badge/CLI-Python%203.8%2B-blue.svg)](https://pypi.org/project/sitrtech/)
@@ -38,7 +38,7 @@ Requires-Dist: cryptography>=41
38
38
  [![Frameworks](https://img.shields.io/badge/frameworks-11%20supported-brightgreen.svg)](https://sitrtech.com/docs)
39
39
  [![Platforms](https://img.shields.io/badge/platforms-Linux%20%C2%B7%20macOS%20%C2%B7%20Windows-lightgrey.svg)](https://sitrtech.com/docs)
40
40
 
41
- Encrypt and license-lock your **Python or PHP** project, then ship it as code that runs
41
+ Encrypt and license-lock your **Python, Node.js or PHP** project, then ship it as code that runs
42
42
  at native speed — while your source stays unreadable, license-bound, and optionally
43
43
  locked to a machine, network, or time window. One command, in your CI or on your laptop.
44
44
 
@@ -58,8 +58,8 @@ sitr encrypt ./my-plugin --framework wordpress --secret sk-... # PHP
58
58
  - **Real encryption, not obfuscation.** Each Python `.py` becomes a `.pye` (and each PHP
59
59
  file its encrypted counterpart) sealed with **AES-256-GCM** under a per-file key. There
60
60
  is no de-obfuscator to reverse — without the key, the bytes are ciphertext.
61
- - **Python *and* PHP.** One CLI protects 6 Python frameworks and 3 PHP stacks
62
- (WordPress, Laravel, plain PHP) — each with a matching native runtime loader.
61
+ - **Python, Node.js *and* PHP.** One CLI protects 6 Python frameworks, Node.js, and 3 PHP
62
+ stacks (WordPress, Laravel, plain PHP) — each with a matching native runtime loader.
63
63
  - **A compiled native loader does the unwrapping.** Decryption keys live only inside a
64
64
  compiled C extension, never in readable Python. The master secret is **never** present
65
65
  in this package or on your machine.
@@ -194,6 +194,9 @@ sitr encrypt <PATH> [OPTIONS] # PATH = Python project .zip, or a PHP directo
194
194
  -v, --version TEXT Framework version (e.g. 17.0 for Odoo)
195
195
  -o, --output PATH Output file [default: <input>_encrypted.zip]
196
196
  --local Encrypt locally — source is never uploaded
197
+ --license CODE Build for a customer license (LIC-XXXX-XXXX): applies its
198
+ framework, term & restrictions, and records the build
199
+ [env: SITR_LICENSE]
197
200
  -s, --secret TEXT API secret key [env: SITR_SECRET]
198
201
  -b, --base URL Override API base URL [env: SITR_BASE]
199
202
 
@@ -432,6 +435,7 @@ docker run --rm -e SITR_SECRET -v "$PWD/addons:/src:ro" -v "$PWD/dist:/out" \
432
435
  | Variable | Description |
433
436
  |----------|-------------|
434
437
  | `SITR_SECRET` | API secret key (so you don't pass `--secret` each time) |
438
+ | `SITR_LICENSE` | Default customer-license code for `sitr encrypt --license` |
435
439
  | `SITR_BASE` | Override the API base URL (default: `https://sitrtech.com`) |
436
440
 
437
441
  ---
@@ -1,4 +1,4 @@
1
- # SitrTech — Source Code Encryption & Licensing for Python & PHP
1
+ # SitrTech — Source Code Encryption & Licensing for Python, Node.js & PHP
2
2
 
3
3
  [![PyPI](https://img.shields.io/pypi/v/sitrtech.svg)](https://pypi.org/project/sitrtech/)
4
4
  [![CLI](https://img.shields.io/badge/CLI-Python%203.8%2B-blue.svg)](https://pypi.org/project/sitrtech/)
@@ -6,7 +6,7 @@
6
6
  [![Frameworks](https://img.shields.io/badge/frameworks-11%20supported-brightgreen.svg)](https://sitrtech.com/docs)
7
7
  [![Platforms](https://img.shields.io/badge/platforms-Linux%20%C2%B7%20macOS%20%C2%B7%20Windows-lightgrey.svg)](https://sitrtech.com/docs)
8
8
 
9
- Encrypt and license-lock your **Python or PHP** project, then ship it as code that runs
9
+ Encrypt and license-lock your **Python, Node.js or PHP** project, then ship it as code that runs
10
10
  at native speed — while your source stays unreadable, license-bound, and optionally
11
11
  locked to a machine, network, or time window. One command, in your CI or on your laptop.
12
12
 
@@ -26,8 +26,8 @@ sitr encrypt ./my-plugin --framework wordpress --secret sk-... # PHP
26
26
  - **Real encryption, not obfuscation.** Each Python `.py` becomes a `.pye` (and each PHP
27
27
  file its encrypted counterpart) sealed with **AES-256-GCM** under a per-file key. There
28
28
  is no de-obfuscator to reverse — without the key, the bytes are ciphertext.
29
- - **Python *and* PHP.** One CLI protects 6 Python frameworks and 3 PHP stacks
30
- (WordPress, Laravel, plain PHP) — each with a matching native runtime loader.
29
+ - **Python, Node.js *and* PHP.** One CLI protects 6 Python frameworks, Node.js, and 3 PHP
30
+ stacks (WordPress, Laravel, plain PHP) — each with a matching native runtime loader.
31
31
  - **A compiled native loader does the unwrapping.** Decryption keys live only inside a
32
32
  compiled C extension, never in readable Python. The master secret is **never** present
33
33
  in this package or on your machine.
@@ -162,6 +162,9 @@ sitr encrypt <PATH> [OPTIONS] # PATH = Python project .zip, or a PHP directo
162
162
  -v, --version TEXT Framework version (e.g. 17.0 for Odoo)
163
163
  -o, --output PATH Output file [default: <input>_encrypted.zip]
164
164
  --local Encrypt locally — source is never uploaded
165
+ --license CODE Build for a customer license (LIC-XXXX-XXXX): applies its
166
+ framework, term & restrictions, and records the build
167
+ [env: SITR_LICENSE]
165
168
  -s, --secret TEXT API secret key [env: SITR_SECRET]
166
169
  -b, --base URL Override API base URL [env: SITR_BASE]
167
170
 
@@ -400,6 +403,7 @@ docker run --rm -e SITR_SECRET -v "$PWD/addons:/src:ro" -v "$PWD/dist:/out" \
400
403
  | Variable | Description |
401
404
  |----------|-------------|
402
405
  | `SITR_SECRET` | API secret key (so you don't pass `--secret` each time) |
406
+ | `SITR_LICENSE` | Default customer-license code for `sitr encrypt --license` |
403
407
  | `SITR_BASE` | Override the API base URL (default: `https://sitrtech.com`) |
404
408
 
405
409
  ---
@@ -4,15 +4,15 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "sitrtech"
7
- version = "1.7.2"
8
- description = "Encrypt & license-lock Python and PHP source (Odoo, Frappe, Django, Flask, FastAPI, Tornado, WordPress, Laravel) with AES-256 and a native runtime loader"
7
+ version = "1.7.4"
8
+ description = "Encrypt & license-lock Python, Node.js & PHP source (Odoo, Frappe, Django, Flask, FastAPI, Tornado, WordPress, Laravel) with AES-256 and a native runtime loader"
9
9
  readme = "README.md"
10
10
  license = { text = "Proprietary" }
11
11
  requires-python = ">=3.8"
12
12
  authors = [{ name = "SitrTech", email = "info@sitrtech.com" }]
13
13
  keywords = [
14
14
  "odoo", "frappe", "django", "flask", "fastapi", "tornado",
15
- "php", "wordpress", "laravel",
15
+ "php", "wordpress", "laravel", "nodejs", "node",
16
16
  "encryption", "aes-256", "licensing", "license-key",
17
17
  "code-protection", "source-protection", "obfuscation",
18
18
  "anti-reverse-engineering", "intellectual-property",
@@ -28,7 +28,7 @@ classifiers = [
28
28
  "Programming Language :: Python :: 3.11",
29
29
  "Programming Language :: Python :: 3.12",
30
30
  "Programming Language :: Python :: 3.13",
31
- "Programming Language :: Python :: 3.14",
31
+ "Programming Language :: Python :: 3.14",
32
32
  "Programming Language :: PHP",
33
33
  "Topic :: Security :: Cryptography",
34
34
  "Topic :: Software Development :: Build Tools",
@@ -1,5 +1,5 @@
1
1
  """SitrTech — Python code encryption SDK."""
2
- __version__ = "1.7.2"
2
+ __version__ = "1.7.4"
3
3
  __all__ = ["encrypt", "balance", "encrypt_local", "encrypt_dir_local"]
4
4
 
5
5
  import warnings as _warnings
@@ -938,6 +938,15 @@ def encrypt_dir(ctx, source, framework, output, jobs, full, only, exclude, exclu
938
938
  if res.get("charged") is not None:
939
939
  console.print(f"[dim]{res['lines']:,} lines · charged {res['charged']:,} lines · "
940
940
  f"{res.get('tokens_left','?'):,} left[/]")
941
+ elif res.get("committed") is False:
942
+ # The modules are encrypted locally, but the server did not record the
943
+ # usage — make that loud instead of exiting 0 as if all was well.
944
+ err_console.print(
945
+ "[red]! Encrypted locally, but billing was NOT recorded[/] "
946
+ f"(commit failed: {res.get('commit_error') or 'unknown'}).\n"
947
+ " Nothing was charged and it will not show in your dashboard. "
948
+ "Re-run once resolved.")
949
+ sys.exit(5)
941
950
  console.print()
942
951
 
943
952
 
@@ -166,6 +166,38 @@ def _attest_lines(ldir: str, job_id: str, root: str, wrapped: Dict[str, Any]):
166
166
  return None
167
167
 
168
168
 
169
+ def _attest_lines_multi(ldir: str, job_id: str, roots, wrapped: Dict[str, Any]):
170
+ """Signed line-count over the .pye outputs of a whole BATCH of modules.
171
+
172
+ Same scheme as _attest_lines, but gathers every .pye across all `roots`
173
+ (the modules encrypt-dir just produced) and signs the total once, so the
174
+ batch path can attest its real line count under SITR_REQUIRE_ATTESTATION.
175
+ Returns {"lines": int, "sig": hex} or None if the loader predates attest.
176
+ """
177
+ try:
178
+ from .runtime import load_native
179
+ nat = load_native(ldir)
180
+ is_v7 = isinstance(wrapped, dict) and wrapped.get("v") == 7
181
+ attest = None
182
+ if is_v7:
183
+ attest = getattr(nat, "_native_attest_v7", None)
184
+ if attest is None:
185
+ attest = getattr(nat, "_native_attest", None)
186
+ if attest is None:
187
+ return None
188
+ texts = []
189
+ for root in roots:
190
+ for p in Path(root).rglob("*.pye"):
191
+ try:
192
+ texts.append(p.read_text(encoding="utf-8", errors="ignore"))
193
+ except Exception:
194
+ continue
195
+ lines, sig = attest(str(job_id), texts, wrapped)
196
+ return {"lines": int(lines), "sig": str(sig)}
197
+ except Exception:
198
+ return None
199
+
200
+
169
201
  class LocalError(RuntimeError):
170
202
  pass
171
203
 
@@ -775,7 +807,8 @@ def encrypt_dir_local(
775
807
  engine.verify_grant(auth["grant"], auth["signature"], None)
776
808
  job_kek = engine.unwrap_job_key(auth, client_priv)
777
809
  meta = engine.build_license_meta(protection)
778
- inj = native_injector(_resolve_loaders(base_url, secret, loaders_dir))
810
+ ldir = _resolve_loaders(base_url, secret, loaders_dir)
811
+ inj = native_injector(ldir)
779
812
 
780
813
  def _do(item):
781
814
  name, mdir = item
@@ -788,14 +821,22 @@ def encrypt_dir_local(
788
821
  _fast_copytree(mdir, dst)
789
822
  stats = engine.encrypt_project(dst, framework, job_kek, auth["wrapped_job_key"], meta, inj,
790
823
  exclude_globs=exclude_globs)
791
- return name, stats["lines"]
824
+ return name, stats["lines"], dst
792
825
 
793
826
  say("encrypt")
794
827
  actual = 0
828
+ enc_dirs = []
795
829
  with ThreadPoolExecutor(max_workers=jobs or (os.cpu_count() or 4)) as ex:
796
830
  for fut in as_completed([ex.submit(_do, it) for it in changed]):
797
- _name, lines = fut.result()
831
+ _name, lines, _dst = fut.result()
798
832
  actual += lines
833
+ enc_dirs.append(_dst)
834
+
835
+ # Signed proof of the real line count over EVERY .pye just produced, so
836
+ # encrypt-dir bills correctly under SITR_REQUIRE_ATTESTATION. The native
837
+ # loader (the only local holder of the master seed) counts and signs it;
838
+ # without this the server rejects the commit and nothing is charged.
839
+ attestation = _attest_lines_multi(ldir, job_id, enc_dirs, auth["wrapped_job_key"])
799
840
  except Exception as e:
800
841
  try:
801
842
  _post_signed(base_url, "/api/cancel", secret, {"job_id": job_id}, 15)
@@ -804,12 +845,15 @@ def encrypt_dir_local(
804
845
  raise LocalError(f"Local encryption failed: {e}")
805
846
 
806
847
  say("commit")
807
- c = _post_signed(base_url, "/api/commit", secret,
808
- {"job_id": job_id, "actual_lines": actual,
809
- "module_name": os.path.basename(source_dir.rstrip("/")),
810
- "framework": framework, "version": version, "modules": len(changed)})
848
+ commit_body = {"job_id": job_id, "actual_lines": actual,
849
+ "module_name": os.path.basename(source_dir.rstrip("/")),
850
+ "framework": framework, "version": version, "modules": len(changed)}
851
+ if attestation:
852
+ commit_body["attestation"] = attestation
853
+ c = _post_signed(base_url, "/api/commit", secret, commit_body)
811
854
  charged = c.json().get("charged") if c.ok else None
812
855
  tokens_left = c.json().get("tokens") if c.ok else None
856
+ commit_error = None if c.ok else f"HTTP {c.status_code}: {c.text[:200]}"
813
857
 
814
858
  if not in_place and state_path:
815
859
  names = {n for n, _ in mods}
@@ -821,5 +865,6 @@ def encrypt_dir_local(
821
865
 
822
866
  return {"total": total, "encrypted": len(changed), "skipped": total - len(changed),
823
867
  "lines": actual, "charged": charged, "tokens_left": tokens_left,
868
+ "committed": bool(c.ok), "commit_error": commit_error,
824
869
  "output": (source_dir if in_place else output_dir), "up_to_date": False,
825
870
  "in_place": in_place, "missing": missing}
@@ -1,14 +1,14 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sitrtech
3
- Version: 1.7.2
4
- Summary: Encrypt & license-lock Python and PHP source (Odoo, Frappe, Django, Flask, FastAPI, Tornado, WordPress, Laravel) with AES-256 and a native runtime loader
3
+ Version: 1.7.4
4
+ Summary: Encrypt & license-lock Python, Node.js & PHP source (Odoo, Frappe, Django, Flask, FastAPI, Tornado, WordPress, Laravel) with AES-256 and a native runtime loader
5
5
  Author-email: SitrTech <info@sitrtech.com>
6
6
  License: Proprietary
7
7
  Project-URL: Homepage, https://sitrtech.com
8
8
  Project-URL: Docs, https://sitrtech.com/docs
9
9
  Project-URL: Repository, https://sitrtech.com
10
10
  Project-URL: Bug Tracker, https://sitrtech.com/support
11
- Keywords: odoo,frappe,django,flask,fastapi,tornado,php,wordpress,laravel,encryption,aes-256,licensing,license-key,code-protection,source-protection,obfuscation,anti-reverse-engineering,intellectual-property
11
+ Keywords: odoo,frappe,django,flask,fastapi,tornado,php,wordpress,laravel,nodejs,node,encryption,aes-256,licensing,license-key,code-protection,source-protection,obfuscation,anti-reverse-engineering,intellectual-property
12
12
  Classifier: Development Status :: 5 - Production/Stable
13
13
  Classifier: Environment :: Console
14
14
  Classifier: Intended Audience :: Developers
@@ -30,7 +30,7 @@ Requires-Dist: rich>=13
30
30
  Requires-Dist: click>=8
31
31
  Requires-Dist: cryptography>=41
32
32
 
33
- # SitrTech — Source Code Encryption & Licensing for Python & PHP
33
+ # SitrTech — Source Code Encryption & Licensing for Python, Node.js & PHP
34
34
 
35
35
  [![PyPI](https://img.shields.io/pypi/v/sitrtech.svg)](https://pypi.org/project/sitrtech/)
36
36
  [![CLI](https://img.shields.io/badge/CLI-Python%203.8%2B-blue.svg)](https://pypi.org/project/sitrtech/)
@@ -38,7 +38,7 @@ Requires-Dist: cryptography>=41
38
38
  [![Frameworks](https://img.shields.io/badge/frameworks-11%20supported-brightgreen.svg)](https://sitrtech.com/docs)
39
39
  [![Platforms](https://img.shields.io/badge/platforms-Linux%20%C2%B7%20macOS%20%C2%B7%20Windows-lightgrey.svg)](https://sitrtech.com/docs)
40
40
 
41
- Encrypt and license-lock your **Python or PHP** project, then ship it as code that runs
41
+ Encrypt and license-lock your **Python, Node.js or PHP** project, then ship it as code that runs
42
42
  at native speed — while your source stays unreadable, license-bound, and optionally
43
43
  locked to a machine, network, or time window. One command, in your CI or on your laptop.
44
44
 
@@ -58,8 +58,8 @@ sitr encrypt ./my-plugin --framework wordpress --secret sk-... # PHP
58
58
  - **Real encryption, not obfuscation.** Each Python `.py` becomes a `.pye` (and each PHP
59
59
  file its encrypted counterpart) sealed with **AES-256-GCM** under a per-file key. There
60
60
  is no de-obfuscator to reverse — without the key, the bytes are ciphertext.
61
- - **Python *and* PHP.** One CLI protects 6 Python frameworks and 3 PHP stacks
62
- (WordPress, Laravel, plain PHP) — each with a matching native runtime loader.
61
+ - **Python, Node.js *and* PHP.** One CLI protects 6 Python frameworks, Node.js, and 3 PHP
62
+ stacks (WordPress, Laravel, plain PHP) — each with a matching native runtime loader.
63
63
  - **A compiled native loader does the unwrapping.** Decryption keys live only inside a
64
64
  compiled C extension, never in readable Python. The master secret is **never** present
65
65
  in this package or on your machine.
@@ -194,6 +194,9 @@ sitr encrypt <PATH> [OPTIONS] # PATH = Python project .zip, or a PHP directo
194
194
  -v, --version TEXT Framework version (e.g. 17.0 for Odoo)
195
195
  -o, --output PATH Output file [default: <input>_encrypted.zip]
196
196
  --local Encrypt locally — source is never uploaded
197
+ --license CODE Build for a customer license (LIC-XXXX-XXXX): applies its
198
+ framework, term & restrictions, and records the build
199
+ [env: SITR_LICENSE]
197
200
  -s, --secret TEXT API secret key [env: SITR_SECRET]
198
201
  -b, --base URL Override API base URL [env: SITR_BASE]
199
202
 
@@ -432,6 +435,7 @@ docker run --rm -e SITR_SECRET -v "$PWD/addons:/src:ro" -v "$PWD/dist:/out" \
432
435
  | Variable | Description |
433
436
  |----------|-------------|
434
437
  | `SITR_SECRET` | API secret key (so you don't pass `--secret` each time) |
438
+ | `SITR_LICENSE` | Default customer-license code for `sitr encrypt --license` |
435
439
  | `SITR_BASE` | Override the API base URL (default: `https://sitrtech.com`) |
436
440
 
437
441
  ---
File without changes
File without changes