File size: 1,755 Bytes
179ad50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
% Sovereign Node Key — SnapKitty execution gate (Prolog)
% Without a valid key, agent routing refuses to compute.
%
% Get your key: licensing@snapkittywest.dev
% Copyright (C) 2026 Bel Esprit D'Accord Irrevocable Trust

:- module(sovereign_node_key, [
    require_node_key/0,
    verify_node_key/1
]).

:- use_module(library(process)).
:- use_module(library(lists)).

sovereign_wall('
  +==================================================+
  |     SOVEREIGN NODE KEY REQUIRED                  |
  |                                                  |
  |  This software requires a valid SnapKitty       |
  |  node key to activate agent routing.            |
  |                                                  |
  |  Get your key:                                   |
  |  licensing@snapkittywest.dev                     |
  |  https://github.com/SNAPKITTYWEST               |
  |                                                  |
  |  Copyright (C) 2026 Bel Esprit D Accord         |
  |  Irrevocable Trust (EIN 42-697643)               |
  +==================================================+
').

% Verify key format: SNK-{payload}-{signature}
verify_node_key(Key) :-
    atom(Key),
    atom_string(Key, KeyStr),
    string_concat("SNK-", Rest, KeyStr),
    getenv('SNAPKITTY_NODE_SECRET', Secret),
    Secret \= '',
    split_string(Rest, "-", "", Parts),
    length(Parts, Len), Len >= 2,
    !.
verify_node_key(_) :- fail.

% Require valid key or throw
require_node_key :-
    (   getenv('SNAPKITTY_NODE_KEY', Key)
    ->  true
    ;   Key = ''
    ),
    (   verify_node_key(Key)
    ->  true
    ;   sovereign_wall(Wall),
        format(atom(Msg), '~w', [Wall]),
        throw(error(permission_error(node_key, sovereign, routing), Msg))
    ).