···1818 path_instructions:
1919 - path: "**/*.{rs,toml}"
2020 instructions:
2121- "Review the Rust code for conformity with best practices in Rust,
2222- Systems programming. Highlight any deviations."
2121+ "Review the Rust code and Python code for conformity with best practices in Rust,
2222+ Systems programming and Python. Highlight any deviations. Also highlight if there any
2323+ any security issues in the code"
2324
···11+//! Handles stuff related to accounts, identity etc..
22+33+use anyhow::Result;
44+use ed25519_dalek::{SigningKey, ed25519::signature::rand_core::OsRng};
55+use keyring::Entry;
66+use ucan::did::Ed25519Did;
77+88+type Did = String;
99+type Identity = Did;
1010+1111+/// Creates an `Identity` for given application
1212+/// The keypair generated will be stored in OS secure storage
1313+///
1414+/// # Arguments
1515+///
1616+/// - `app`: The service for which Identity is made (for ex: tiles)
1717+pub fn create_identity(app: &str) -> Result<Identity> {
1818+ let mut csprng = OsRng;
1919+ let signing_key = SigningKey::generate(&mut csprng);
2020+ let ed_did = Ed25519Did::from(signing_key.clone());
2121+ let did = ed_did.to_string();
2222+ let entry = Entry::new(app, &did)?;
2323+ entry.set_secret(&signing_key.to_keypair_bytes())?;
2424+ Ok(did)
2525+}
2626+2727+#[cfg(test)]
2828+mod tests {
2929+ use keyring::{mock, set_default_credential_builder};
3030+3131+ use super::*;
3232+3333+ #[test]
3434+ fn test_create_success() -> Result<()> {
3535+ set_default_credential_builder(mock::default_credential_builder());
3636+ let did = create_identity("tiles")?;
3737+ assert!(did.starts_with("did:key"));
3838+ Ok(())
3939+ }
4040+}
+1
tilekit/src/lib.rs
···11+pub mod accounts;
12pub mod modelfile;
23pub mod optimize;
-2
tilekit/src/modelfile.rs
···341341 .parse(input)
342342}
343343fn create_modelfile(commands: Vec<(&str, Output)>) -> Result<Modelfile, String> {
344344- // TODO: There might be a better way
345344 let mut modelfile: Modelfile = Modelfile::new();
346345 for command in commands {
347346 let _ = match (command.0.to_lowercase().as_str(), command.1) {
348348- //TODO: Can add validations for path if its a gguf file later
349347 ("from", Output::Single(from)) => modelfile.add_from(from.trim()),
350348 ("parameter", Output::Pair((param, argument))) => {
351349 modelfile.add_parameter(param, argument.trim())