Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienux/blob/main/crates/aienos-artifact/src/verify.rs # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienux / crates / aienos-artifact / src / verify.rs` 42 lines ยท 1555 bytes Raw Blame History 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright 2026 Drake Stapleton (AIEN / aien-dev) 3 // 4 // Licensed under the Apache License, Version 2.0 (the "License"); 5 // you may not use this file except in compliance with the License. 6 // You may obtain a copy of the License at 7 // 8 // http://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unless required by applicable law or agreed to in writing, software 11 // distributed under the License is distributed on an "AS IS" BASIS, 12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 16 //! Structural parsing and identity entry points shared by host tooling and 17 //! the kernel. Authentication is added in P2-3. 18 19 use crate::canonical::payload_digest; 20 use crate::error::ArtifactError; 21 use crate::format::{Artifact, MAX_ARTIFACT_SIZE}; 22 use crate::id::{compute_artifact_id, ArtifactId}; 23 use aienos_crypto::sha256::Digest; 24 25 #[derive(Clone, Copy, Debug, Eq, PartialEq)] 26 pub struct IdentifiedArtifact<'a> { 27 pub artifact: Artifact<'a>, 28 pub artifact_id: ArtifactId, 29 pub payload_digest: Digest, 30 } 31 32 pub fn parse_and_identify(bytes: &[u8]) -> Result, ArtifactError> { 33 if bytes.len() > MAX_ARTIFACT_SIZE { 34 return Err(ArtifactError::ResourceLimit); 35 } 36 let artifact = Artifact::parse(bytes)?; 37 Ok(IdentifiedArtifact { 38 artifact_id: compute_artifact_id(&artifact), 39 payload_digest: payload_digest(&artifact), 40 artifact, 41 }) 42 }