mirror of
https://github.com/aziascreations/BakaShrot.git
synced 2026-11-23 20:58:46 +01:00
488ffe4bc8
- Protocol 5: a client authenticates as a node (Node), its pushes go to the section's DefaultTopic unless they name one; old Identities refused at start with what to write instead. - Topics listed by name, ids picked and kept by the server; nodes come from client sections, [BakaShrot.Nodes] optional, AcceptNodes = * by default. - Protocol 6: every refusal carries a code, every client failure too (BakaShrot_ErrorCodes.pbi, BakaShrot_GetLastError(), ErrorCode in Python); nothing reconnects by itself, delivery is at least once. - [BakaShrot.Server] Synchronous = FULL (default) or NORMAL, benchmarked. - Schema v8: browse table and browse_messages view for database tools. - Tools renamed BakaShrot<Name>, wait for Enter when started from Explorer. - Examples/SingleServer: a server and a client with scripts (example keys, public on purpose). - Restart-Test.ps1: servers killed mid-traffic and mid-catch-up. - Docs: one server per node rule, DatabaseError() checked per thread, release notes' Compatibility section, Notes "Right now". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RwFeVQrLqMQPw9AZnsHqQH
52 lines
1.5 KiB
Plaintext
52 lines
1.5 KiB
Plaintext
; ============================================================================
|
|
; BakaShrotGenerateKeyPairs
|
|
;
|
|
; Generates a new Ed25519 keypair and prints it as two ini-style lines:
|
|
; PrivateKey = <Base64>
|
|
; PublicKey = <Base64>
|
|
;
|
|
; The private key goes in the node's own [BakaShrot] PrivateKey, the public
|
|
; key goes in the configs of whoever needs to trust that node.
|
|
;
|
|
; Compile as a console program, exits with 0 on success, 1 on failure.
|
|
; ============================================================================
|
|
|
|
EnableExplicit
|
|
|
|
XIncludeFile "../Common/ToolConsole.pbi"
|
|
XIncludeFile "../../Commons/Cryptography/Libsodium.pbi"
|
|
|
|
|
|
Define *PublicKey, *PrivateKey
|
|
|
|
OpenConsole()
|
|
|
|
If Not InitCryptography()
|
|
PrintN("Failed to initialize libsodium")
|
|
ToolConsole_End(1)
|
|
EndIf
|
|
|
|
*PublicKey = AllocateMemory(#BakaShrot_Ed25519_PublicKeySize)
|
|
If Not *PublicKey
|
|
PrintN("Failed to allocate the public key")
|
|
ToolConsole_End(1)
|
|
EndIf
|
|
|
|
*PrivateKey = AllocateMemory(#BakaShrot_Ed25519_PrivateKeySize)
|
|
If Not *PrivateKey
|
|
PrintN("Failed to allocate the private key")
|
|
ToolConsole_End(1)
|
|
EndIf
|
|
|
|
GenerateKeyPair(*PublicKey, *PrivateKey)
|
|
|
|
PrintN("PrivateKey = " + EncodeKeyToString(*PrivateKey, #BakaShrot_Ed25519_PrivateKeySize))
|
|
PrintN("PublicKey = " + EncodeKeyToString(*PublicKey, #BakaShrot_Ed25519_PublicKeySize))
|
|
|
|
; Don't leave the private key lying around in freed memory.
|
|
FillMemory(*PrivateKey, #BakaShrot_Ed25519_PrivateKeySize, 0)
|
|
FreeMemory(*PrivateKey)
|
|
FreeMemory(*PublicKey)
|
|
|
|
ToolConsole_End(0)
|