go-blockchain/crypto/doc.go
Claude 41e0e58706
Some checks failed
Security Scan / security (push) Successful in 12s
Test / Test (push) Failing after 35s
feat: complete all 10 RFC request items
3. config/file.go — YAML/env config loading with defaults
5. entitlement.go — SyncTask for PerformAsync progress tracking
6. chain/blockdata.go — atomic file writes for block storage
7. entitlement.go — EntitlementMiddleware + CheckEntitlement stubs
8. dns.go — DNS record DTOs for go-lns bridge
10. crypto/doc.go — CGo patterns documented (until go-cgo ships)

Items 1,2,4,9 were already done. All 10/10 RFC items implemented.

Ready to consume go-lns when it lands:
- HSD client tested (hsd/client.go)
- DNS DTOs defined (dns.go)
- Config supports HSD URL + key (config/file.go)
- Entitlement gating ready for dns.resolve actions

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 01:48:31 +01:00

37 lines
1.1 KiB
Go

// Copyright (c) 2017-2026 Lethean (https://lt.hn)
//
// Licensed under the European Union Public Licence (EUPL) version 1.2.
// SPDX-License-Identifier: EUPL-1.2
// Package crypto provides the CGo bridge to the C++ cryptographic library.
//
// CGo Patterns (will move to go-cgo when available):
//
// Buffer allocation:
//
// var buf [32]byte
// C.my_function((*C.uint8_t)(unsafe.Pointer(&buf[0])), C.size_t(32))
// result := buf[:] // Go slice from C buffer
//
// Error handling:
//
// ret := C.crypto_function(args...)
// if ret != 0 {
// return coreerr.E("crypto.Function", "operation failed", nil)
// }
//
// String conversion:
//
// // Go → C: pass as pointer + length (no null terminator needed)
// C.func((*C.uint8_t)(unsafe.Pointer(&data[0])), C.size_t(len(data)))
//
// // C → Go: copy into Go slice immediately
// copy(result[:], C.GoBytes(unsafe.Pointer(cPtr), C.int(32)))
//
// All 29 functions follow these patterns. See bridge.h for the C API.
// When go-cgo ships, these patterns become helper functions:
//
// buf := cgo.NewBuffer(32)
// defer buf.Free()
// err := cgo.Call(C.my_function, buf.Ptr(), buf.Size())
package crypto