keyhog-scanner 0.5.73

keyhog-scanner: high-performance SIMD-accelerated secret detection engine
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
//! Install-time VYRE orchestration receipt compiler.

use super::{CanonicalDetectorExecutionIr, ExecutionPackBackend, ExecutionPackError};

const MAGIC: &[u8; 8] = b"KHVPACK\x02";
pub const VYRE_ORCHESTRATION_PROGRAM_VERSION: u16 = 2;

#[derive(Clone, Debug, Eq, PartialEq)]
pub struct VyreExecutionIdentity {
    pub target_identity: String,
    pub runtime_identity: String,
    pub device_identity: String,
    pub driver_version: String,
    pub device_limits_digest: [u8; 32],
}

impl VyreExecutionIdentity {
    /// Binds calibration evidence to the VYRE driver version linked into this binary.
    pub fn for_backend(
        backend: ExecutionPackBackend,
        target_identity: impl Into<String>,
        runtime_identity: impl Into<String>,
        device_identity: impl Into<String>,
        device_limits_digest: [u8; 32],
    ) -> Result<Self, ExecutionPackError> {
        let driver_version = match backend {
            ExecutionPackBackend::GpuCuda => env!("KEYHOG_VYRE_CUDA_VERSION"),
            ExecutionPackBackend::GpuWgpu => env!("KEYHOG_VYRE_WGPU_VERSION"),
            ExecutionPackBackend::GpuMetal => env!("KEYHOG_VYRE_METAL_VERSION"),
            _ => {
                return Err(ExecutionPackError::InvalidCompilerInput(
                    "cannot construct a VYRE identity for a non-GPU backend".into(),
                ));
            }
        };
        let identity = Self {
            target_identity: target_identity.into(),
            runtime_identity: runtime_identity.into(),
            device_identity: device_identity.into(),
            driver_version: driver_version.to_owned(),
            device_limits_digest,
        };
        validate_backend_and_identity(backend, &identity)?;
        Ok(identity)
    }
    /// Reconstructs the install-time identity for the selected acquired peer.
    ///
    /// `hardware_identity` is the canonical debug projection used by pack
    /// generation. Length-prefixing every field keeps the digest unambiguous.
    #[doc(hidden)]
    pub fn for_selected_peer(
        backend: ExecutionPackBackend,
        target_digest: [u8; 32],
        runtime_identity: impl Into<String>,
        device_identity: impl Into<String>,
        hardware_identity: &str,
    ) -> Result<Self, ExecutionPackError> {
        let runtime_identity = runtime_identity.into();
        let device_identity = device_identity.into();
        let driver_id = match backend {
            ExecutionPackBackend::GpuCuda => "cuda",
            ExecutionPackBackend::GpuWgpu => "wgpu",
            ExecutionPackBackend::GpuMetal => "metal",
            _ => {
                return Err(ExecutionPackError::InvalidCompilerInput(
                    "cannot construct a VYRE peer identity for a non-GPU backend".into(),
                ));
            }
        };
        let driver_version = match backend {
            ExecutionPackBackend::GpuCuda => env!("KEYHOG_VYRE_CUDA_VERSION"),
            ExecutionPackBackend::GpuWgpu => env!("KEYHOG_VYRE_WGPU_VERSION"),
            ExecutionPackBackend::GpuMetal => env!("KEYHOG_VYRE_METAL_VERSION"),
            _ => unreachable!("GPU backend checked above"),
        };
        let device_limits_digest = digest_parts(&[
            driver_id.as_bytes(),
            driver_version.as_bytes(),
            runtime_identity.as_bytes(),
            device_identity.as_bytes(),
            hardware_identity.as_bytes(),
        ]);
        Self::for_backend(
            backend,
            keyhog_core::hex_encode(&target_digest),
            runtime_identity,
            device_identity,
            device_limits_digest,
        )
    }
}

#[derive(Clone, Debug, Eq, PartialEq)]
pub struct VyreOrchestrationProgram {
    pub version: u16,
    pub backend: ExecutionPackBackend,
    pub detector_ir_digest: [u8; 32],
    pub execution_identity: VyreExecutionIdentity,
    pub matcher_cache_key: String,
    pub matcher_pattern_count: u32,
    pub matcher_wire_magic: [u8; 4],
    pub matcher_wire_version: u32,
    pub matcher_digest: [u8; 32],
    pub matcher_bytes: Vec<u8>,
    pub phase2_catalog_digest: [u8; 32],
    pub phase2_catalog_bytes: Vec<u8>,
    pub feature_schema_digest: [u8; 32],
    pub quantized_model_digest: [u8; 32],
    pub quantized_score_abi_version: u16,
}

impl VyreOrchestrationProgram {
    /// Compiles VYRE's canonical literal matcher and binds it to one calibrated device route.
    pub fn compile(
        detector_ir: &CanonicalDetectorExecutionIr,
        backend: ExecutionPackBackend,
        execution_identity: VyreExecutionIdentity,
    ) -> Result<Self, ExecutionPackError> {
        validate_backend_and_identity(backend, &execution_identity)?;
        let artifacts = crate::gpu_literal_artifacts::compile_gpu_literal_artifacts_default(
            detector_ir.detectors(),
        )
        .map_err(|error| {
            ExecutionPackError::InvalidCompilerInput(format!(
                "VYRE matcher compilation failed for {backend:?}: {error}"
            ))
        })?;
        if artifacts.positioned_literal.is_some() {
            return Err(ExecutionPackError::InvalidCompilerInput(
                "VYRE compiler emitted a retired separate positioned matcher; the fused matcher is required"
                    .into(),
            ));
        }
        let matcher = artifacts.literal.ok_or_else(|| {
            ExecutionPackError::InvalidCompilerInput(
                "VYRE compiler emitted no fused literal matcher".into(),
            )
        })?;
        let matcher_pattern_count = u32::try_from(matcher.pattern_count).map_err(|_| {
            ExecutionPackError::InvalidCompilerInput(
                "VYRE matcher pattern count exceeds the execution-pack u32 limit".into(),
            )
        })?;
        let matcher_digest = *blake3::hash(&matcher.bytes).as_bytes();
        #[cfg(not(feature = "gpu"))]
        return Err(ExecutionPackError::InvalidCompilerInput(
            "VYRE phase-2 catalog compilation requires the scanner GPU feature".into(),
        ));
        #[cfg(feature = "gpu")]
        let backend_id = match backend {
            ExecutionPackBackend::GpuCuda => Some("cuda"),
            ExecutionPackBackend::GpuWgpu => Some("wgpu"),
            ExecutionPackBackend::GpuMetal => Some("metal"),
            _ => {
                return Err(ExecutionPackError::InvalidCompilerInput(
                    "phase-2 GPU catalog requires a GPU backend".into(),
                ));
            }
        };
        #[cfg(feature = "gpu")]
        let phase2_catalog_bytes =
            crate::engine::compile_phase2_gpu_catalog_artifact(detector_ir.detectors(), backend_id)
                .map_err(ExecutionPackError::InvalidCompilerInput)?;
        #[cfg(feature = "gpu")]
        let phase2_catalog_digest = *blake3::hash(&phase2_catalog_bytes).as_bytes();
        let feature_schema_digest = crate::confidence::quantized::feature_schema_digest();
        let quantized_model_digest = crate::confidence::quantized::model_artifact_digest();
        let quantized_score_abi_version = crate::confidence::quantized::QUANTIZED_SCORE_ABI_VERSION;
        Ok(Self {
            version: VYRE_ORCHESTRATION_PROGRAM_VERSION,
            backend,
            detector_ir_digest: detector_ir.digest(),
            execution_identity,
            matcher_cache_key: matcher.cache_key,
            matcher_pattern_count,
            matcher_wire_magic: matcher.wire_magic,
            matcher_wire_version: matcher.wire_version,
            matcher_digest,
            feature_schema_digest,
            quantized_model_digest,
            quantized_score_abi_version,
            matcher_bytes: matcher.bytes,
            phase2_catalog_digest,
            phase2_catalog_bytes,
        })
    }

    pub fn canonical_bytes(&self) -> Result<Vec<u8>, ExecutionPackError> {
        validate_backend_and_identity(self.backend, &self.execution_identity)?;
        if self.matcher_bytes.is_empty() || self.matcher_cache_key.is_empty() {
            return Err(ExecutionPackError::InvalidCompilerInput(
                "VYRE orchestration program has no matcher artifact".into(),
            ));
        }
        if *blake3::hash(&self.matcher_bytes).as_bytes() != self.matcher_digest {
            return Err(ExecutionPackError::InvalidCompilerInput(
                "VYRE matcher digest does not match its bytes".into(),
            ));
        }
        if self.phase2_catalog_bytes.is_empty()
            || *blake3::hash(&self.phase2_catalog_bytes).as_bytes() != self.phase2_catalog_digest
        {
            return Err(ExecutionPackError::InvalidCompilerInput(
                "phase-2 GPU catalog digest does not match its bytes".into(),
            ));
        }
        validate_wire_header(
            &self.matcher_bytes,
            self.matcher_wire_magic,
            self.matcher_wire_version,
        )?;
        if self.version != VYRE_ORCHESTRATION_PROGRAM_VERSION
            || self.feature_schema_digest != crate::confidence::quantized::feature_schema_digest()
            || self.quantized_model_digest != crate::confidence::quantized::model_artifact_digest()
            || self.quantized_score_abi_version
                != crate::confidence::quantized::QUANTIZED_SCORE_ABI_VERSION
        {
            return Err(ExecutionPackError::Incompatible(
                "VYRE confidence artifact identity is stale; reinstall and recalibrate".into(),
            ));
        }

        let mut out = Vec::new();
        out.extend_from_slice(MAGIC);
        out.extend_from_slice(&self.version.to_le_bytes());
        out.push(self.backend as u8);
        out.extend_from_slice(&[0; 5]);
        out.extend_from_slice(&self.detector_ir_digest);
        out.extend_from_slice(&self.matcher_digest);
        out.extend_from_slice(&self.phase2_catalog_digest);
        out.extend_from_slice(&self.execution_identity.device_limits_digest);
        out.extend_from_slice(&self.feature_schema_digest);
        out.extend_from_slice(&self.quantized_model_digest);
        out.extend_from_slice(&self.quantized_score_abi_version.to_le_bytes());
        out.extend_from_slice(&self.matcher_pattern_count.to_le_bytes());
        out.extend_from_slice(&self.matcher_wire_magic);
        out.extend_from_slice(&self.matcher_wire_version.to_le_bytes());
        write_bytes(&mut out, self.execution_identity.target_identity.as_bytes())?;
        write_bytes(
            &mut out,
            self.execution_identity.runtime_identity.as_bytes(),
        )?;
        write_bytes(&mut out, self.execution_identity.device_identity.as_bytes())?;
        write_bytes(&mut out, self.execution_identity.driver_version.as_bytes())?;
        write_bytes(&mut out, self.matcher_cache_key.as_bytes())?;
        write_bytes(&mut out, &self.matcher_bytes)?;
        write_bytes(&mut out, &self.phase2_catalog_bytes)?;
        Ok(out)
    }

    pub fn decode(
        bytes: &[u8],
        expected_backend: ExecutionPackBackend,
        expected_ir_digest: [u8; 32],
        expected_identity: &VyreExecutionIdentity,
    ) -> Result<Self, ExecutionPackError> {
        let mut cursor = Cursor::new(bytes);
        if cursor.take(8)? != MAGIC {
            return Err(ExecutionPackError::InvalidPack(
                "VYRE orchestration program magic is invalid".into(),
            ));
        }
        let version = cursor.u16()?;
        if version != VYRE_ORCHESTRATION_PROGRAM_VERSION {
            return Err(ExecutionPackError::Incompatible(format!(
                "VYRE orchestration program version {version} is unsupported; this binary requires {VYRE_ORCHESTRATION_PROGRAM_VERSION}"
            )));
        }
        let backend_byte = cursor.take(1)?[0];
        let backend = ExecutionPackBackend::from_u8(backend_byte).ok_or_else(|| {
            ExecutionPackError::InvalidPack(format!(
                "VYRE orchestration backend byte {backend_byte} is invalid"
            ))
        })?;
        if cursor.take(5)?.iter().any(|byte| *byte != 0) {
            return Err(ExecutionPackError::InvalidPack(
                "VYRE orchestration program reserved bytes are nonzero".into(),
            ));
        }
        if backend != expected_backend {
            return Err(ExecutionPackError::Incompatible(format!(
                "VYRE orchestration backend is {backend:?}, not selected {expected_backend:?}; reinstall and recalibrate"
            )));
        }
        let detector_ir_digest: [u8; 32] = cursor.take(32)?.try_into().expect("fixed digest");
        if detector_ir_digest != expected_ir_digest {
            return Err(ExecutionPackError::Incompatible(
                "VYRE orchestration detector IR identity is stale; reinstall and recalibrate"
                    .into(),
            ));
        }
        let matcher_digest: [u8; 32] = cursor.take(32)?.try_into().expect("fixed digest");
        let phase2_catalog_digest: [u8; 32] = cursor.take(32)?.try_into().expect("fixed digest");
        let device_limits_digest: [u8; 32] = cursor.take(32)?.try_into().expect("fixed digest");
        let feature_schema_digest: [u8; 32] = cursor
            .take(32)?
            .try_into()
            .expect("fixed feature schema digest");
        let quantized_model_digest: [u8; 32] = cursor
            .take(32)?
            .try_into()
            .expect("fixed quantized model digest");
        let quantized_score_abi_version = cursor.u16()?;
        if feature_schema_digest != crate::confidence::quantized::feature_schema_digest()
            || quantized_model_digest != crate::confidence::quantized::model_artifact_digest()
            || quantized_score_abi_version
                != crate::confidence::quantized::QUANTIZED_SCORE_ABI_VERSION
        {
            return Err(ExecutionPackError::Incompatible(
                "VYRE confidence schema, model, or score ABI is stale; reinstall and recalibrate"
                    .into(),
            ));
        }
        let matcher_pattern_count = cursor.u32()?;
        let matcher_wire_magic: [u8; 4] = cursor.take(4)?.try_into().expect("fixed magic");
        let matcher_wire_version = cursor.u32()?;
        let execution_identity = VyreExecutionIdentity {
            target_identity: cursor.string()?,
            runtime_identity: cursor.string()?,
            device_identity: cursor.string()?,
            driver_version: cursor.string()?,
            device_limits_digest,
        };
        validate_backend_and_identity(backend, expected_identity)?;
        validate_backend_and_identity(backend, &execution_identity)?;
        if &execution_identity != expected_identity {
            return Err(ExecutionPackError::Incompatible(
                "VYRE execution identity does not match the calibrated target, runtime, driver, device, or limits; reinstall and recalibrate"
                    .into(),
            ));
        }
        let matcher_cache_key = cursor.string()?;
        let matcher_bytes = cursor.bytes()?.to_vec();
        let phase2_catalog_bytes = cursor.bytes()?.to_vec();
        if !cursor.is_empty() {
            return Err(ExecutionPackError::InvalidPack(
                "VYRE orchestration program has trailing bytes".into(),
            ));
        }
        if *blake3::hash(&matcher_bytes).as_bytes() != matcher_digest {
            return Err(ExecutionPackError::InvalidPack(
                "VYRE matcher artifact is corrupt; its content digest does not match".into(),
            ));
        }
        if phase2_catalog_bytes.is_empty()
            || *blake3::hash(&phase2_catalog_bytes).as_bytes() != phase2_catalog_digest
        {
            return Err(ExecutionPackError::InvalidPack(
                "phase-2 GPU catalog artifact is corrupt; its content digest does not match".into(),
            ));
        }
        validate_wire_header(&matcher_bytes, matcher_wire_magic, matcher_wire_version)?;
        let program = Self {
            version,
            backend,
            detector_ir_digest,
            execution_identity,
            matcher_cache_key,
            matcher_pattern_count,
            matcher_wire_magic,
            matcher_wire_version,
            matcher_digest,
            matcher_bytes,
            phase2_catalog_digest,
            phase2_catalog_bytes,
            feature_schema_digest,
            quantized_model_digest,
            quantized_score_abi_version,
        };
        if program.canonical_bytes()?.as_slice() != bytes {
            return Err(ExecutionPackError::InvalidPack(
                "VYRE orchestration program is not canonically encoded".into(),
            ));
        }
        Ok(program)
    }
    /// Return the canonical VYRE receipt carried by an execution-pack backend envelope.
    pub fn backend_section_receipt(
        bytes: &[u8],
        expected_backend: ExecutionPackBackend,
    ) -> Result<&[u8], ExecutionPackError> {
        const HEADER_LEN: usize = 17;
        if bytes.len() < HEADER_LEN || &bytes[..8] != b"KHVYRE\0\x01" {
            return Err(ExecutionPackError::InvalidPack(
                "VYRE backend-program envelope is invalid or truncated".into(),
            ));
        }
        if bytes[8] != expected_backend as u8 {
            return Err(ExecutionPackError::Incompatible(
                "VYRE backend-program envelope does not name the selected backend".into(),
            ));
        }
        let receipt_len =
            u64::from_le_bytes(bytes[9..17].try_into().expect("fixed receipt length"));
        let receipt_len = usize::try_from(receipt_len).map_err(|_| {
            ExecutionPackError::InvalidPack(
                "VYRE backend-program receipt length does not fit this target".into(),
            )
        })?;
        if bytes.len().checked_sub(HEADER_LEN) != Some(receipt_len) {
            return Err(ExecutionPackError::InvalidPack(
                "VYRE backend-program receipt length does not match its bytes".into(),
            ));
        }
        Ok(&bytes[HEADER_LEN..])
    }

    /// Decode the VYRE receipt carried by an execution-pack backend envelope.
    pub fn decode_backend_section(
        bytes: &[u8],
        expected_backend: ExecutionPackBackend,
        expected_ir_digest: [u8; 32],
        expected_identity: &VyreExecutionIdentity,
    ) -> Result<Self, ExecutionPackError> {
        Self::decode(
            Self::backend_section_receipt(bytes, expected_backend)?,
            expected_backend,
            expected_ir_digest,
            expected_identity,
        )
    }
}

fn validate_backend_and_identity(
    backend: ExecutionPackBackend,
    identity: &VyreExecutionIdentity,
) -> Result<(), ExecutionPackError> {
    if !backend.is_gpu() {
        return Err(ExecutionPackError::InvalidCompilerInput(
            "VYRE orchestration program names a non-GPU backend".into(),
        ));
    }
    let required_driver = match backend {
        ExecutionPackBackend::GpuCuda => env!("KEYHOG_VYRE_CUDA_VERSION"),
        ExecutionPackBackend::GpuWgpu => env!("KEYHOG_VYRE_WGPU_VERSION"),
        ExecutionPackBackend::GpuMetal => env!("KEYHOG_VYRE_METAL_VERSION"),
        _ => unreachable!("GPU backend checked above"),
    };
    if identity.driver_version != required_driver {
        return Err(ExecutionPackError::Incompatible(format!(
            "VYRE {backend:?} driver version {} does not match this binary's {required_driver}; reinstall and recalibrate",
            identity.driver_version
        )));
    }
    for (name, value) in [
        ("target", identity.target_identity.as_str()),
        ("runtime", identity.runtime_identity.as_str()),
        ("device", identity.device_identity.as_str()),
    ] {
        if value.is_empty() {
            return Err(ExecutionPackError::InvalidCompilerInput(format!(
                "VYRE orchestration {name} identity is empty"
            )));
        }
    }
    Ok(())
}

fn validate_wire_header(
    bytes: &[u8],
    expected_magic: [u8; 4],
    expected_version: u32,
) -> Result<(), ExecutionPackError> {
    let header = bytes.get(..8).ok_or_else(|| {
        ExecutionPackError::InvalidPack("VYRE matcher artifact is truncated".into())
    })?;
    if header[..4] != expected_magic
        || u32::from_le_bytes(header[4..8].try_into().expect("fixed version")) != expected_version
    {
        return Err(ExecutionPackError::InvalidPack(
            "VYRE matcher wire header does not match its orchestration receipt".into(),
        ));
    }
    Ok(())
}

fn digest_parts(parts: &[&[u8]]) -> [u8; 32] {
    let mut hasher = blake3::Hasher::new();
    for part in parts {
        hasher.update(&(part.len() as u64).to_le_bytes());
        hasher.update(part);
    }
    *hasher.finalize().as_bytes()
}

fn write_bytes(out: &mut Vec<u8>, bytes: &[u8]) -> Result<(), ExecutionPackError> {
    let len = u64::try_from(bytes.len())
        .map_err(|_| ExecutionPackError::InvalidCompilerInput("VYRE field exceeds u64".into()))?;
    out.extend_from_slice(&len.to_le_bytes());
    out.extend_from_slice(bytes);
    Ok(())
}

struct Cursor<'a> {
    bytes: &'a [u8],
    offset: usize,
}

impl<'a> Cursor<'a> {
    fn new(bytes: &'a [u8]) -> Self {
        Self { bytes, offset: 0 }
    }

    fn take(&mut self, len: usize) -> Result<&'a [u8], ExecutionPackError> {
        let end = self.offset.checked_add(len).ok_or_else(|| {
            ExecutionPackError::InvalidPack("VYRE orchestration length overflow".into())
        })?;
        let value = self.bytes.get(self.offset..end).ok_or_else(|| {
            ExecutionPackError::InvalidPack("VYRE orchestration program is truncated".into())
        })?;
        self.offset = end;
        Ok(value)
    }

    fn u16(&mut self) -> Result<u16, ExecutionPackError> {
        Ok(u16::from_le_bytes(
            self.take(2)?.try_into().expect("fixed u16"),
        ))
    }

    fn u32(&mut self) -> Result<u32, ExecutionPackError> {
        Ok(u32::from_le_bytes(
            self.take(4)?.try_into().expect("fixed u32"),
        ))
    }

    fn bytes(&mut self) -> Result<&'a [u8], ExecutionPackError> {
        let len = usize::try_from(u64::from_le_bytes(
            self.take(8)?.try_into().expect("fixed u64"),
        ))
        .map_err(|_| ExecutionPackError::InvalidPack("VYRE byte length exceeds usize".into()))?;
        self.take(len)
    }

    fn string(&mut self) -> Result<String, ExecutionPackError> {
        String::from_utf8(self.bytes()?.to_vec()).map_err(|error| {
            ExecutionPackError::InvalidPack(format!("VYRE identity is not UTF-8: {error}"))
        })
    }

    fn is_empty(&self) -> bool {
        self.offset == self.bytes.len()
    }
}