Skip to content

Commit 3af0f3b

Browse files
committed
chore: M5 CI/Workflow Sweep - final synchronisation
1 parent 8f99f6b commit 3af0f3b

6 files changed

Lines changed: 38 additions & 38 deletions

File tree

ffi/zig/src/main.zig

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// {{PROJECT}} FFI Implementation
1+
// CIVIC_CONNECT FFI Implementation
22
//
33
// This module implements the C-compatible FFI declared in src/abi/Foreign.idr
44
// All types and layouts must match the Idris2 ABI definitions.
@@ -9,7 +9,7 @@ const std = @import("std");
99

1010
// Version information (keep in sync with project)
1111
const VERSION = "0.1.0";
12-
const BUILD_INFO = "{{PROJECT}} built with Zig " ++ @import("builtin").zig_version_string;
12+
const BUILD_INFO = "CIVIC_CONNECT built with Zig " ++ @import("builtin").zig_version_string;
1313

1414
/// Thread-local error storage
1515
threadlocal var last_error: ?[]const u8 = null;
@@ -51,7 +51,7 @@ pub const Handle = opaque {
5151

5252
/// Initialize the library
5353
/// Returns a handle, or null on failure
54-
export fn {{project}}_init() ?*Handle {
54+
export fn civic_connect_init() ?*Handle {
5555
const allocator = std.heap.c_allocator;
5656

5757
const handle = allocator.create(Handle) catch {
@@ -70,7 +70,7 @@ export fn {{project}}_init() ?*Handle {
7070
}
7171

7272
/// Free the library handle
73-
export fn {{project}}_free(handle: ?*Handle) void {
73+
export fn civic_connect_free(handle: ?*Handle) void {
7474
const h = handle orelse return;
7575
const allocator = h.allocator;
7676

@@ -86,7 +86,7 @@ export fn {{project}}_free(handle: ?*Handle) void {
8686
//==============================================================================
8787

8888
/// Process data (example operation)
89-
export fn {{project}}_process(handle: ?*Handle, input: u32) Result {
89+
export fn civic_connect_process(handle: ?*Handle, input: u32) Result {
9090
const h = handle orelse {
9191
setError("Null handle");
9292
return .null_pointer;
@@ -110,7 +110,7 @@ export fn {{project}}_process(handle: ?*Handle, input: u32) Result {
110110

111111
/// Get a string result (example)
112112
/// Caller must free the returned string
113-
export fn {{project}}_get_string(handle: ?*Handle) ?[*:0]const u8 {
113+
export fn civic_connect_get_string(handle: ?*Handle) ?[*:0]const u8 {
114114
const h = handle orelse {
115115
setError("Null handle");
116116
return null;
@@ -132,7 +132,7 @@ export fn {{project}}_get_string(handle: ?*Handle) ?[*:0]const u8 {
132132
}
133133

134134
/// Free a string allocated by the library
135-
export fn {{project}}_free_string(str: ?[*:0]const u8) void {
135+
export fn civic_connect_free_string(str: ?[*:0]const u8) void {
136136
const s = str orelse return;
137137
const allocator = std.heap.c_allocator;
138138

@@ -145,7 +145,7 @@ export fn {{project}}_free_string(str: ?[*:0]const u8) void {
145145
//==============================================================================
146146

147147
/// Process an array of data
148-
export fn {{project}}_process_array(
148+
export fn civic_connect_process_array(
149149
handle: ?*Handle,
150150
buffer: ?[*]const u8,
151151
len: u32,
@@ -181,7 +181,7 @@ export fn {{project}}_process_array(
181181

182182
/// Get the last error message
183183
/// Returns null if no error
184-
export fn {{project}}_last_error() ?[*:0]const u8 {
184+
export fn civic_connect_last_error() ?[*:0]const u8 {
185185
const err = last_error orelse return null;
186186

187187
// Return C string (static storage, no need to free)
@@ -195,12 +195,12 @@ export fn {{project}}_last_error() ?[*:0]const u8 {
195195
//==============================================================================
196196

197197
/// Get the library version
198-
export fn {{project}}_version() [*:0]const u8 {
198+
export fn civic_connect_version() [*:0]const u8 {
199199
return VERSION.ptr;
200200
}
201201

202202
/// Get build information
203-
export fn {{project}}_build_info() [*:0]const u8 {
203+
export fn civic_connect_build_info() [*:0]const u8 {
204204
return BUILD_INFO.ptr;
205205
}
206206

@@ -212,7 +212,7 @@ export fn {{project}}_build_info() [*:0]const u8 {
212212
pub const Callback = *const fn (u64, u32) callconv(.C) u32;
213213

214214
/// Register a callback
215-
export fn {{project}}_register_callback(
215+
export fn civic_connect_register_callback(
216216
handle: ?*Handle,
217217
callback: ?Callback,
218218
) Result {
@@ -243,7 +243,7 @@ export fn {{project}}_register_callback(
243243
//==============================================================================
244244

245245
/// Check if handle is initialized
246-
export fn {{project}}_is_initialized(handle: ?*Handle) u32 {
246+
export fn civic_connect_is_initialized(handle: ?*Handle) u32 {
247247
const h = handle orelse return 0;
248248
return if (h.initialized) 1 else 0;
249249
}
@@ -253,22 +253,22 @@ export fn {{project}}_is_initialized(handle: ?*Handle) u32 {
253253
//==============================================================================
254254

255255
test "lifecycle" {
256-
const handle = {{project}}_init() orelse return error.InitFailed;
257-
defer {{project}}_free(handle);
256+
const handle = civic_connect_init() orelse return error.InitFailed;
257+
defer civic_connect_free(handle);
258258

259-
try std.testing.expect({{project}}_is_initialized(handle) == 1);
259+
try std.testing.expect(civic_connect_is_initialized(handle) == 1);
260260
}
261261

262262
test "error handling" {
263-
const result = {{project}}_process(null, 0);
263+
const result = civic_connect_process(null, 0);
264264
try std.testing.expectEqual(Result.null_pointer, result);
265265

266-
const err = {{project}}_last_error();
266+
const err = civic_connect_last_error();
267267
try std.testing.expect(err != null);
268268
}
269269

270270
test "version" {
271-
const ver = {{project}}_version();
271+
const ver = civic_connect_version();
272272
const ver_str = std.mem.span(ver);
273273
try std.testing.expectEqualStrings(VERSION, ver_str);
274274
}

indieweb2-bastion/graphql-dns-api/src/blockchain.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ impl BlockchainClient {
120120
pub async fn verify_hash(&self, tx_hash: &str, expected_hash: &str) -> Result<bool> {
121121
let tx: Transaction = self
122122
.provider
123-
.get_transaction(tx_hash.parse::<TxHash>().unwrap())
123+
.get_transaction(tx_hash.parse::<TxHash>().expect("TODO: handle error"))
124124
.await
125125
.map_err(|e| AppError::Blockchain(e.to_string()))?
126126
.ok_or_else(|| AppError::Blockchain("Transaction not found".to_string()))?;
@@ -143,7 +143,7 @@ impl BlockchainClient {
143143
pub async fn get_receipt(&self, tx_hash: &str) -> Result<TransactionReceipt> {
144144
let receipt = self
145145
.provider
146-
.get_transaction_receipt(tx_hash.parse::<TxHash>().unwrap())
146+
.get_transaction_receipt(tx_hash.parse::<TxHash>().expect("TODO: handle error"))
147147
.await
148148
.map_err(|e| AppError::Blockchain(e.to_string()))?
149149
.ok_or_else(|| AppError::Blockchain("Transaction receipt not found".to_string()))?;

indieweb2-bastion/odns-rs/common/src/crypto.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,10 @@ mod tests {
164164
let (pk, sk) = generate_keypair();
165165
let plaintext = b"example.com A query";
166166

167-
let encrypted = encrypt_query(plaintext, &pk).unwrap();
167+
let encrypted = encrypt_query(plaintext, &pk).expect("TODO: handle error");
168168
assert!(encrypted.len() >= OVERHEAD);
169169

170-
let decrypted = decrypt_query(&encrypted, &sk).unwrap();
170+
let decrypted = decrypt_query(&encrypted, &sk).expect("TODO: handle error");
171171
assert_eq!(decrypted, plaintext);
172172
}
173173

@@ -176,7 +176,7 @@ mod tests {
176176
let (pk, _sk) = generate_keypair();
177177
let (_pk2, sk2) = generate_keypair();
178178

179-
let encrypted = encrypt_query(b"secret query", &pk).unwrap();
179+
let encrypted = encrypt_query(b"secret query", &pk).expect("TODO: handle error");
180180
let result = decrypt_query(&encrypted, &sk2);
181181
assert!(result.is_err());
182182
}
@@ -191,11 +191,11 @@ mod tests {
191191
fn key_serialization_roundtrip() {
192192
let (pk, sk) = generate_keypair();
193193

194-
let pk2 = public_key_from_bytes(pk.as_bytes()).unwrap();
195-
let sk2 = secret_key_from_bytes(sk.as_bytes()).unwrap();
194+
let pk2 = public_key_from_bytes(pk.as_bytes()).expect("TODO: handle error");
195+
let sk2 = secret_key_from_bytes(sk.as_bytes()).expect("TODO: handle error");
196196

197-
let encrypted = encrypt_query(b"test", &pk2).unwrap();
198-
let decrypted = decrypt_query(&encrypted, &sk2).unwrap();
197+
let encrypted = encrypt_query(b"test", &pk2).expect("TODO: handle error");
198+
let decrypted = decrypt_query(&encrypted, &sk2).expect("TODO: handle error");
199199
assert_eq!(decrypted, b"test");
200200
}
201201
}

indieweb2-bastion/odns-rs/common/src/protocol.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ mod tests {
5959
async fn framed_roundtrip() {
6060
let data = b"hello, oDNS";
6161
let mut buf = Vec::new();
62-
write_framed(&mut buf, data).await.unwrap();
62+
write_framed(&mut buf, data).await.expect("TODO: handle error");
6363

6464
let mut cursor = std::io::Cursor::new(buf);
65-
let result = read_framed(&mut cursor).await.unwrap();
65+
let result = read_framed(&mut cursor).await.expect("TODO: handle error");
6666
assert_eq!(result, data);
6767
}
6868

indieweb2-bastion/odns-rs/common/src/signatures.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ mod tests {
211211
let msg = b"test message for hybrid signature";
212212

213213
let sig = hybrid_sign(msg, &kp);
214-
let pk = kp.public_key().unwrap();
214+
let pk = kp.public_key().expect("TODO: handle error");
215215

216216
assert!(hybrid_verify(msg, &sig, &pk).is_ok());
217217
}
@@ -220,7 +220,7 @@ mod tests {
220220
fn hybrid_rejects_wrong_message() {
221221
let kp = generate_hybrid_keypair();
222222
let sig = hybrid_sign(b"original", &kp);
223-
let pk = kp.public_key().unwrap();
223+
let pk = kp.public_key().expect("TODO: handle error");
224224

225225
let result = hybrid_verify(b"tampered", &sig, &pk);
226226
assert!(result.is_err());
@@ -232,7 +232,7 @@ mod tests {
232232
let kp2 = generate_hybrid_keypair();
233233

234234
let sig = hybrid_sign(b"test", &kp1);
235-
let pk2 = kp2.public_key().unwrap();
235+
let pk2 = kp2.public_key().expect("TODO: handle error");
236236

237237
let result = hybrid_verify(b"test", &sig, &pk2);
238238
assert!(result.is_err());
@@ -241,12 +241,12 @@ mod tests {
241241
#[test]
242242
fn public_key_serialization_roundtrip() {
243243
let kp = generate_hybrid_keypair();
244-
let pk = kp.public_key().unwrap();
244+
let pk = kp.public_key().expect("TODO: handle error");
245245

246246
let bytes = pk.to_bytes();
247247
assert_eq!(bytes.len(), HYBRID_PK_LEN);
248248

249-
let pk2 = HybridPublicKey::from_bytes(&bytes).unwrap();
249+
let pk2 = HybridPublicKey::from_bytes(&bytes).expect("TODO: handle error");
250250
assert_eq!(pk.ed448_vk.to_bytes(), pk2.ed448_vk.to_bytes());
251251
assert_eq!(pk.dil5_pk.as_bytes(), pk2.dil5_pk.as_bytes());
252252
}
@@ -260,8 +260,8 @@ mod tests {
260260
let bytes = sig.to_bytes();
261261
assert_eq!(bytes.len(), HYBRID_SIG_LEN);
262262

263-
let sig2 = HybridSignature::from_bytes(&bytes).unwrap();
264-
let pk = kp.public_key().unwrap();
263+
let sig2 = HybridSignature::from_bytes(&bytes).expect("TODO: handle error");
264+
let pk = kp.public_key().expect("TODO: handle error");
265265
assert!(hybrid_verify(msg, &sig2, &pk).is_ok());
266266
}
267267
}

indieweb2-bastion/odns-rs/common/src/sphincs_fallback.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ mod tests {
147147

148148
let pk_restored = public_key_from_bytes(&pk_bytes);
149149
assert!(pk_restored.is_ok());
150-
assert_eq!(pk_restored.unwrap().as_bytes(), kp.pk.as_bytes());
150+
assert_eq!(pk_restored.expect("TODO: handle error").as_bytes(), kp.pk.as_bytes());
151151
}
152152

153153
#[test]

0 commit comments

Comments
 (0)