1.1--- a/readme.org Sun Oct 29 22:51:03 2023 -0400
1.2+++ b/readme.org Tue Oct 31 00:16:50 2023 -0400
1.3@@ -2,13 +2,12 @@
1.4 #+AUTHOR: Richard Westhaver
1.5 #+EMAIL: ellis@rwest.io
1.6 #+DESCRIPTION: The core of The Compiler Company software stack
1.7-
1.8 This repository contains a collection of software libraries shared
1.9 across all of our products and projects.
1.10
1.11 The basic structure consists of a top-level directory for each
1.12-significant programming language we use. As of [2023-10-26 Thu] this
1.13-includes Common Lisp, Emacs Lisp, and Rust.
1.14+significant language we speak. As of [2023-10-26 Thu] this includes
1.15+Common Lisp, Emacs Lisp, and Rust.
1.16
1.17 - NOTE :: This is *not* a portable library. Starting in version =1.0=
1.18 we will be depending on downstream forks of SBCL and Rust.
1.19@@ -451,3 +450,14 @@
1.20 #+RESULTS:
1.21 : in suite TREE-SITTER with 0/0 tests:
1.22 : No tests failed.
1.23+* emacs
1.24+There are a few internal packages that link to system libraries at
1.25+runtime - the following libraries need to be installed for a fully
1.26+functioning editor:
1.27+
1.28+- libvoikko ::
1.29+ =sudo pacman -Syu libvoikko=
1.30+* lib
1.31+** sxp
1.32+** sk
1.33+** mq
2.1--- a/rust/lib/hash/Cargo.toml Sun Oct 29 22:51:03 2023 -0400
2.2+++ b/rust/lib/hash/Cargo.toml Tue Oct 31 00:16:50 2023 -0400
2.3@@ -3,11 +3,7 @@
2.4 version = "0.1.0"
2.5 authors = ["ellis"]
2.6 edition = "2018"
2.7-description = "Hash Function Modules"
2.8-documentation = "https://docs.rwest.io/hash"
2.9-repository = "https://hg.rwest.io/rlib"
2.10-publish = ["crater"]
2.11-
2.12+description = "Hash Functions"
2.13 [dependencies]
2.14 # contrib
2.15 blake3 = "1.0.0"
3.1--- a/rust/lib/hash/src/lib.rs Sun Oct 29 22:51:03 2023 -0400
3.2+++ b/rust/lib/hash/src/lib.rs Tue Oct 31 00:16:50 2023 -0400
3.3@@ -5,7 +5,10 @@
3.4 use rand::Rng;
3.5 use serde::{Deserialize, Serialize};
3.6 pub use sha2::Sha512;
3.7-
3.8+// hashbrown is now the default for the Rust stdlib. We only need to
3.9+// re-export in no_std envs.
3.10+#[cfg(no_std)]
3.11+pub use hashbrown::{HashMap, HashSet};
3.12 pub use std::hash::{Hash, Hasher};
3.13
3.14 pub const KEY_LEN: usize = 32;
3.15@@ -13,7 +16,8 @@
3.16 pub const OUT_LEN_HEX: usize = OUT_LEN * 2;
3.17
3.18 //mod tree;
3.19-
3.20+#[cfg(test)]
3.21+mod tests;
3.22 /// a simple Id abstraction with help functions. I'm finding this easier than
3.23 /// state machines and traits for the time-being.
3.24 #[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Serialize, Deserialize, Hash)]
3.25@@ -69,41 +73,3 @@
3.26 PeerId { id: [0; 32] }
3.27 }
3.28 }
3.29-
3.30-#[cfg(test)]
3.31-mod tests {
3.32- #[test]
3.33- fn id_state_hash() {
3.34- let id = crate::Id(vec![0; crate::KEY_LEN]);
3.35- let hash = id.state_hash(&mut crate::B3Hasher::new());
3.36- assert_eq!(hash, id.state_hash(&mut crate::B3Hasher::new()));
3.37- }
3.38-
3.39- #[test]
3.40- fn id_hex() {
3.41- let id = crate::Id(vec![255; crate::KEY_LEN]);
3.42-
3.43- assert_eq!(
3.44- hex::decode("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").unwrap(),
3.45- id.0
3.46- );
3.47- }
3.48-
3.49- #[test]
3.50- fn rand_id() {
3.51- let id = crate::Id::rand();
3.52- let hash = id.state_hash(&mut crate::B3Hasher::new());
3.53- assert_eq!(hash, id.state_hash(&mut crate::B3Hasher::new()));
3.54- }
3.55-
3.56- #[test]
3.57- fn random_demon_id_is_valid() {
3.58- use crate::PeerId;
3.59- for _ in 0..5000 {
3.60- let did = PeerId::rand();
3.61- let did2 = PeerId::rand();
3.62- assert_eq!(did, did);
3.63- assert_ne!(did, did2);
3.64- }
3.65- }
3.66-}
4.1--- a/rust/lib/hash/src/tests.rs Sun Oct 29 22:51:03 2023 -0400
4.2+++ b/rust/lib/hash/src/tests.rs Tue Oct 31 00:16:50 2023 -0400
4.3@@ -1,21 +1,56 @@
4.4-use crate::{Hasher, OutputReader};
4.5+use crate::*;
4.6 use hex::decode;
4.7 use std::convert::TryInto;
4.8
4.9 #[test]
4.10 fn hex_hash() -> Result<(), Box<dyn std::error::Error>> {
4.11- let mut hasher1 = crate::Hasher::new();
4.12- hasher1.update(b"foo");
4.13- hasher1.update(b"bar");
4.14- hasher1.update(b"baz");
4.15- let out1 = hasher1.finalize();
4.16- let mut xof1 = [0; 301];
4.17- hasher1.finalize_xof().fill(&mut xof1);
4.18- assert_eq!(out1.as_bytes(), &xof1[..32]);
4.19+ let mut hasher1 = B3Hasher::new();
4.20+ hasher1.update(b"foo");
4.21+ hasher1.update(b"bar");
4.22+ hasher1.update(b"baz");
4.23+ let out1 = hasher1.finalize();
4.24+ let mut xof1 = [0; 301];
4.25+ hasher1.finalize_xof().fill(&mut xof1);
4.26+ assert_eq!(out1.as_bytes(), &xof1[..32]);
4.27+
4.28+ let hash_hex = "d74981efa70a0c880b8d8c1985d075dbcbf679b99a5f9914e5aaf96b831a9e24";
4.29+ let hash_bytes = decode(hash_hex).unwrap();
4.30+ let hash_array: [u8; OUT_LEN] = hash_bytes[..].try_into().unwrap();
4.31+ let _: B3Hash = hash_array.into();
4.32+ Ok(())
4.33+}
4.34+
4.35+#[test]
4.36+fn id_state_hash() {
4.37+ let id = Id(vec![0; crate::KEY_LEN]);
4.38+ let hash = id.state_hash(&mut crate::B3Hasher::new());
4.39+ assert_eq!(hash, id.state_hash(&mut crate::B3Hasher::new()));
4.40+}
4.41
4.42- let hash_hex = "d74981efa70a0c880b8d8c1985d075dbcbf679b99a5f9914e5aaf96b831a9e24";
4.43- let hash_bytes = decode(hash_hex).unwrap();
4.44- let hash_array: [u8; blake3::OUT_LEN] = hash_bytes[..].try_into().unwrap();
4.45- let hash: blake3::Hash = hash_array.into();
4.46- Ok(())
4.47+#[test]
4.48+fn id_hex() {
4.49+ let id = crate::Id(vec![255; crate::KEY_LEN]);
4.50+
4.51+ assert_eq!(
4.52+ hex::decode("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").unwrap(),
4.53+ id.0
4.54+ );
4.55 }
4.56+
4.57+#[test]
4.58+fn rand_id() {
4.59+ let id = crate::Id::rand();
4.60+ let hash = id.state_hash(&mut crate::B3Hasher::new());
4.61+ assert_eq!(hash, id.state_hash(&mut crate::B3Hasher::new()));
4.62+}
4.63+
4.64+#[test]
4.65+fn random_demon_id_is_valid() {
4.66+ use crate::PeerId;
4.67+ for _ in 0..5000 {
4.68+ let did = PeerId::rand();
4.69+ let did2 = PeerId::rand();
4.70+ assert_eq!(did, did);
4.71+ assert_ne!(did, did2);
4.72+ }
4.73+}
5.1--- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2+++ b/rust/lib/krypt/api.org Tue Oct 31 00:16:50 2023 -0400
5.3@@ -0,0 +1,17 @@
5.4+#+title: Krypt API
5.5+#+description: Krypt API specification
5.6+This document defines the ~krypt~ /library/ API as well as the
5.7+standard /service/ APIs which can safely be embedded in user
5.8+applications.
5.9+* Library API
5.10+** Structs
5.11+** Traits
5.12+** Functions
5.13+** krypt.h
5.14+* Service API
5.15+** login
5.16+** logout
5.17+** encode
5.18+** decode
5.19+** verify
5.20+** query
6.1--- a/rust/lib/krypt/readme.org Sun Oct 29 22:51:03 2023 -0400
6.2+++ b/rust/lib/krypt/readme.org Tue Oct 31 00:16:50 2023 -0400
6.3@@ -9,6 +9,7 @@
6.4 This library is opinionated about the algorithms it uses and is not a
6.5 general purpose tool.
6.6
6.7+For an introduction to the key management techniques used, check [[https://rtfm.co.ua/en/what-is-linux-keyring-gnome-keyring-secret-service-and-d-bus/][here]].
6.8 * System Libraries
6.9 - keyutils ::
6.10 The library we are most keen on is [[https://man7.org/linux/man-pages/man7/keyutils.7.html][keyutils]] from the Linux Kernel
6.11@@ -19,8 +20,9 @@
6.12 - secret-service ::
6.13 The [[https://specifications.freedesktop.org/secret-service/latest/][secret-service]] API is the brain-child of GNOME Keyring dev Stef
6.14 Walter and KWallet's Michael Leupold. User-space general-purpose
6.15- secrets management. Linux only.
6.16+ secrets management. Linux only. For an overview of
6.17 - keychain ::
6.18 [[https://developer.apple.com/documentation/security/keychain_services/][keychain-services]] serve a similar purpose to secret-service. It is
6.19 MacOS only.
6.20-* API
6.21+* TODO API
6.22+The krypt API is described [[file:api.org][here]].
7.1--- a/rust/lib/tenex/models/freesound/lib.rs Sun Oct 29 22:51:03 2023 -0400
7.2+++ b/rust/lib/tenex/models/freesound/lib.rs Tue Oct 31 00:16:50 2023 -0400
7.3@@ -6,9 +6,7 @@
7.4 //! features such as basic search, upload, download, and even
7.5 //! fingerprint search based on analysis files from Essentia.
7.6 //!
7.7-//! This module implements the client-side freesound.org API. It is
7.8-//! used in MPK_SESH and is especially useful with the analysis data
7.9-//! from MPK_DB.
7.10+//! This module implements the client-side freesound.org API.
7.11 //!
7.12 //! REF: <https://freesound.org/docs/api/>
7.13 //! ENDPOINT: <https://freesound.org/apiv2/>
7.14@@ -35,7 +33,7 @@
7.15 pub const FREESOUND_ENDPOINT: &str = "https://freesound.org/apiv2";
7.16
7.17 pub const USER_AGENT: &str =
7.18- concat!("mpk/", env!("CARGO_PKG_VERSION"), " (https://rwest.io)");
7.19+ concat!("tenex/", env!("CARGO_PKG_VERSION"), " (https://rwest.io)");
7.20
7.21 pub const CONFIG_FILE: &str = "freesound.json";
7.22 pub type Result<T> = std::result::Result<T, Error>;