Compare commits

..

No commits in common. "c8f255f0aa78ce5cda1022b4c1606440b49a99b7" and "3e0bc0c396a6469a57554ca903b24746bbb505f4" have entirely different histories.

7 changed files with 113 additions and 356 deletions

3
Cargo.lock generated
View File

@ -1768,6 +1768,7 @@ version = "0.1.0"
name = "keyfork-frame" name = "keyfork-frame"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"hex",
"insta", "insta",
"sha2", "sha2",
"thiserror", "thiserror",
@ -1842,7 +1843,7 @@ dependencies = [
name = "keyfork-slip10-test-data" name = "keyfork-slip10-test-data"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"smex", "hex",
] ]
[[package]] [[package]]

View File

@ -16,6 +16,7 @@ sha2 = "0.10.7"
# Personally audited # Personally audited
thiserror = "1.0.47" thiserror = "1.0.47"
hex = "0.4.3"
# Optional, not personally audited # Optional, not personally audited
tokio = { version = "1.32.0", optional = true, features = ["io-util"] } tokio = { version = "1.32.0", optional = true, features = ["io-util"] }

View File

@ -34,8 +34,8 @@ pub enum DecodeError {
IncorrectLength(usize, u32), IncorrectLength(usize, u32),
/// The provided checksum of the data did not match the locally-generated checksum. /// The provided checksum of the data did not match the locally-generated checksum.
#[error("Checksum did not match: Their {0:X?} != Our {1:X?}")] #[error("Checksum did not match: Their {0} != Our {1}")]
BadChecksum(Vec<u8>, Vec<u8>), BadChecksum(String, String),
/// Data could not be read from the input source. /// Data could not be read from the input source.
#[error("Data could not be read from the input source: {0}")] #[error("Data could not be read from the input source: {0}")]
@ -88,7 +88,10 @@ pub(crate) fn verify_checksum(data: &[u8]) -> Result<&[u8], DecodeError> {
let content = &data[32..]; let content = &data[32..];
let our_checksum = hash(content); let our_checksum = hash(content);
if our_checksum != checksum { if our_checksum != checksum {
return Err(DecodeError::BadChecksum(checksum.to_vec(), our_checksum)); return Err(DecodeError::BadChecksum(
hex::encode(checksum),
hex::encode(our_checksum),
));
} }
Ok(content) Ok(content)
} }

View File

@ -4,5 +4,7 @@ version = "0.1.0"
edition = "2021" edition = "2021"
license = "MIT" license = "MIT"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
smex = { version = "0.1.0", path = "../smex" } hex = "0.4.3"

View File

@ -31,166 +31,166 @@ pub fn test_data() -> Result<HashMap<String, Vec<TestData>>, Box<dyn std::error:
let mut map = HashMap::new(); let mut map = HashMap::new();
let secp256k1 = vec![ let secp256k1 = vec![
TestData { TestData {
seed: smex::decode("000102030405060708090a0b0c0d0e0f")?, seed: hex::decode("000102030405060708090a0b0c0d0e0f")?,
tests: vec![ tests: vec![
Test { Test {
chain: "m", chain: "m",
fingerprint: smex::decode("00000000")?, fingerprint: hex::decode("00000000")?,
chain_code: smex::decode( chain_code: hex::decode(
"873dff81c02f525623fd1fe5167eac3a55a049de3d314bb42ee227ffed37d508", "873dff81c02f525623fd1fe5167eac3a55a049de3d314bb42ee227ffed37d508",
)?, )?,
private_key: smex::decode( private_key: hex::decode(
"e8f32e723decf4051aefac8e2c93c9c5b214313817cdb01a1494b917c8436b35", "e8f32e723decf4051aefac8e2c93c9c5b214313817cdb01a1494b917c8436b35",
)?, )?,
public_key: smex::decode( public_key: hex::decode(
"0339a36013301597daef41fbe593a02cc513d0b55527ec2df1050e2e8ff49c85c2", "0339a36013301597daef41fbe593a02cc513d0b55527ec2df1050e2e8ff49c85c2",
)?, )?,
}, },
Test { Test {
chain: "m/0'", chain: "m/0'",
fingerprint: smex::decode("3442193e")?, fingerprint: hex::decode("3442193e")?,
chain_code: smex::decode( chain_code: hex::decode(
"47fdacbd0f1097043b78c63c20c34ef4ed9a111d980047ad16282c7ae6236141", "47fdacbd0f1097043b78c63c20c34ef4ed9a111d980047ad16282c7ae6236141",
)?, )?,
private_key: smex::decode( private_key: hex::decode(
"edb2e14f9ee77d26dd93b4ecede8d16ed408ce149b6cd80b0715a2d911a0afea", "edb2e14f9ee77d26dd93b4ecede8d16ed408ce149b6cd80b0715a2d911a0afea",
)?, )?,
public_key: smex::decode( public_key: hex::decode(
"035a784662a4a20a65bf6aab9ae98a6c068a81c52e4b032c0fb5400c706cfccc56", "035a784662a4a20a65bf6aab9ae98a6c068a81c52e4b032c0fb5400c706cfccc56",
)?, )?,
}, },
Test { Test {
chain: "m/0'/1", chain: "m/0'/1",
fingerprint: smex::decode("5c1bd648")?, fingerprint: hex::decode("5c1bd648")?,
chain_code: smex::decode( chain_code: hex::decode(
"2a7857631386ba23dacac34180dd1983734e444fdbf774041578e9b6adb37c19", "2a7857631386ba23dacac34180dd1983734e444fdbf774041578e9b6adb37c19",
)?, )?,
private_key: smex::decode( private_key: hex::decode(
"3c6cb8d0f6a264c91ea8b5030fadaa8e538b020f0a387421a12de9319dc93368", "3c6cb8d0f6a264c91ea8b5030fadaa8e538b020f0a387421a12de9319dc93368",
)?, )?,
public_key: smex::decode( public_key: hex::decode(
"03501e454bf00751f24b1b489aa925215d66af2234e3891c3b21a52bedb3cd711c", "03501e454bf00751f24b1b489aa925215d66af2234e3891c3b21a52bedb3cd711c",
)?, )?,
}, },
Test { Test {
chain: "m/0'/1/2'", chain: "m/0'/1/2'",
fingerprint: smex::decode("bef5a2f9")?, fingerprint: hex::decode("bef5a2f9")?,
chain_code: smex::decode( chain_code: hex::decode(
"04466b9cc8e161e966409ca52986c584f07e9dc81f735db683c3ff6ec7b1503f", "04466b9cc8e161e966409ca52986c584f07e9dc81f735db683c3ff6ec7b1503f",
)?, )?,
private_key: smex::decode( private_key: hex::decode(
"cbce0d719ecf7431d88e6a89fa1483e02e35092af60c042b1df2ff59fa424dca", "cbce0d719ecf7431d88e6a89fa1483e02e35092af60c042b1df2ff59fa424dca",
)?, )?,
public_key: smex::decode( public_key: hex::decode(
"0357bfe1e341d01c69fe5654309956cbea516822fba8a601743a012a7896ee8dc2", "0357bfe1e341d01c69fe5654309956cbea516822fba8a601743a012a7896ee8dc2",
)?, )?,
}, },
Test { Test {
chain: "m/0'/1/2'/2", chain: "m/0'/1/2'/2",
fingerprint: smex::decode("ee7ab90c")?, fingerprint: hex::decode("ee7ab90c")?,
chain_code: smex::decode( chain_code: hex::decode(
"cfb71883f01676f587d023cc53a35bc7f88f724b1f8c2892ac1275ac822a3edd", "cfb71883f01676f587d023cc53a35bc7f88f724b1f8c2892ac1275ac822a3edd",
)?, )?,
private_key: smex::decode( private_key: hex::decode(
"0f479245fb19a38a1954c5c7c0ebab2f9bdfd96a17563ef28a6a4b1a2a764ef4", "0f479245fb19a38a1954c5c7c0ebab2f9bdfd96a17563ef28a6a4b1a2a764ef4",
)?, )?,
public_key: smex::decode( public_key: hex::decode(
"02e8445082a72f29b75ca48748a914df60622a609cacfce8ed0e35804560741d29", "02e8445082a72f29b75ca48748a914df60622a609cacfce8ed0e35804560741d29",
)?, )?,
}, },
Test { Test {
chain: "m/0'/1/2'/2/1000000000", chain: "m/0'/1/2'/2/1000000000",
fingerprint: smex::decode("d880d7d8")?, fingerprint: hex::decode("d880d7d8")?,
chain_code: smex::decode( chain_code: hex::decode(
"c783e67b921d2beb8f6b389cc646d7263b4145701dadd2161548a8b078e65e9e", "c783e67b921d2beb8f6b389cc646d7263b4145701dadd2161548a8b078e65e9e",
)?, )?,
private_key: smex::decode( private_key: hex::decode(
"471b76e389e528d6de6d816857e012c5455051cad6660850e58372a6c3e6e7c8", "471b76e389e528d6de6d816857e012c5455051cad6660850e58372a6c3e6e7c8",
)?, )?,
public_key: smex::decode( public_key: hex::decode(
"022a471424da5e657499d1ff51cb43c47481a03b1e77f951fe64cec9f5a48f7011", "022a471424da5e657499d1ff51cb43c47481a03b1e77f951fe64cec9f5a48f7011",
)?, )?,
}, },
], ],
}, },
TestData { TestData {
seed: smex::decode(SECP256K1_512)?, seed: hex::decode(SECP256K1_512)?,
tests: vec![ tests: vec![
Test { Test {
chain: "m", chain: "m",
fingerprint: smex::decode("00000000")?, fingerprint: hex::decode("00000000")?,
chain_code: smex::decode( chain_code: hex::decode(
"60499f801b896d83179a4374aeb7822aaeaceaa0db1f85ee3e904c4defbd9689", "60499f801b896d83179a4374aeb7822aaeaceaa0db1f85ee3e904c4defbd9689",
)?, )?,
private_key: smex::decode( private_key: hex::decode(
"4b03d6fc340455b363f51020ad3ecca4f0850280cf436c70c727923f6db46c3e", "4b03d6fc340455b363f51020ad3ecca4f0850280cf436c70c727923f6db46c3e",
)?, )?,
public_key: smex::decode( public_key: hex::decode(
"03cbcaa9c98c877a26977d00825c956a238e8dddfbd322cce4f74b0b5bd6ace4a7", "03cbcaa9c98c877a26977d00825c956a238e8dddfbd322cce4f74b0b5bd6ace4a7",
)?, )?,
}, },
Test { Test {
chain: "m/0", chain: "m/0",
fingerprint: smex::decode("bd16bee5")?, fingerprint: hex::decode("bd16bee5")?,
chain_code: smex::decode( chain_code: hex::decode(
"f0909affaa7ee7abe5dd4e100598d4dc53cd709d5a5c2cac40e7412f232f7c9c", "f0909affaa7ee7abe5dd4e100598d4dc53cd709d5a5c2cac40e7412f232f7c9c",
)?, )?,
private_key: smex::decode( private_key: hex::decode(
"abe74a98f6c7eabee0428f53798f0ab8aa1bd37873999041703c742f15ac7e1e", "abe74a98f6c7eabee0428f53798f0ab8aa1bd37873999041703c742f15ac7e1e",
)?, )?,
public_key: smex::decode( public_key: hex::decode(
"02fc9e5af0ac8d9b3cecfe2a888e2117ba3d089d8585886c9c826b6b22a98d12ea", "02fc9e5af0ac8d9b3cecfe2a888e2117ba3d089d8585886c9c826b6b22a98d12ea",
)?, )?,
}, },
Test { Test {
chain: "m/0/2147483647'", chain: "m/0/2147483647'",
fingerprint: smex::decode("5a61ff8e")?, fingerprint: hex::decode("5a61ff8e")?,
chain_code: smex::decode( chain_code: hex::decode(
"be17a268474a6bb9c61e1d720cf6215e2a88c5406c4aee7b38547f585c9a37d9", "be17a268474a6bb9c61e1d720cf6215e2a88c5406c4aee7b38547f585c9a37d9",
)?, )?,
private_key: smex::decode( private_key: hex::decode(
"877c779ad9687164e9c2f4f0f4ff0340814392330693ce95a58fe18fd52e6e93", "877c779ad9687164e9c2f4f0f4ff0340814392330693ce95a58fe18fd52e6e93",
)?, )?,
public_key: smex::decode( public_key: hex::decode(
"03c01e7425647bdefa82b12d9bad5e3e6865bee0502694b94ca58b666abc0a5c3b", "03c01e7425647bdefa82b12d9bad5e3e6865bee0502694b94ca58b666abc0a5c3b",
)?, )?,
}, },
Test { Test {
chain: "m/0/2147483647'/1", chain: "m/0/2147483647'/1",
fingerprint: smex::decode("d8ab4937")?, fingerprint: hex::decode("d8ab4937")?,
chain_code: smex::decode( chain_code: hex::decode(
"f366f48f1ea9f2d1d3fe958c95ca84ea18e4c4ddb9366c336c927eb246fb38cb", "f366f48f1ea9f2d1d3fe958c95ca84ea18e4c4ddb9366c336c927eb246fb38cb",
)?, )?,
private_key: smex::decode( private_key: hex::decode(
"704addf544a06e5ee4bea37098463c23613da32020d604506da8c0518e1da4b7", "704addf544a06e5ee4bea37098463c23613da32020d604506da8c0518e1da4b7",
)?, )?,
public_key: smex::decode( public_key: hex::decode(
"03a7d1d856deb74c508e05031f9895dab54626251b3806e16b4bd12e781a7df5b9", "03a7d1d856deb74c508e05031f9895dab54626251b3806e16b4bd12e781a7df5b9",
)?, )?,
}, },
Test { Test {
chain: "m/0/2147483647'/1/2147483646'", chain: "m/0/2147483647'/1/2147483646'",
fingerprint: smex::decode("78412e3a")?, fingerprint: hex::decode("78412e3a")?,
chain_code: smex::decode( chain_code: hex::decode(
"637807030d55d01f9a0cb3a7839515d796bd07706386a6eddf06cc29a65a0e29", "637807030d55d01f9a0cb3a7839515d796bd07706386a6eddf06cc29a65a0e29",
)?, )?,
private_key: smex::decode( private_key: hex::decode(
"f1c7c871a54a804afe328b4c83a1c33b8e5ff48f5087273f04efa83b247d6a2d", "f1c7c871a54a804afe328b4c83a1c33b8e5ff48f5087273f04efa83b247d6a2d",
)?, )?,
public_key: smex::decode( public_key: hex::decode(
"02d2b36900396c9282fa14628566582f206a5dd0bcc8d5e892611806cafb0301f0", "02d2b36900396c9282fa14628566582f206a5dd0bcc8d5e892611806cafb0301f0",
)?, )?,
}, },
Test { Test {
chain: "m/0/2147483647'/1/2147483646'/2", chain: "m/0/2147483647'/1/2147483646'/2",
fingerprint: smex::decode("31a507b8")?, fingerprint: hex::decode("31a507b8")?,
chain_code: smex::decode( chain_code: hex::decode(
"9452b549be8cea3ecb7a84bec10dcfd94afe4d129ebfd3b3cb58eedf394ed271", "9452b549be8cea3ecb7a84bec10dcfd94afe4d129ebfd3b3cb58eedf394ed271",
)?, )?,
private_key: smex::decode( private_key: hex::decode(
"bb7d39bdb83ecf58f2fd82b6d918341cbef428661ef01ab97c28a4842125ac23", "bb7d39bdb83ecf58f2fd82b6d918341cbef428661ef01ab97c28a4842125ac23",
)?, )?,
public_key: smex::decode( public_key: hex::decode(
"024d902e1a2fc7a8755ab5b694c575fce742c48d9ff192e63df5193e4c7afe1f9c", "024d902e1a2fc7a8755ab5b694c575fce742c48d9ff192e63df5193e4c7afe1f9c",
)?, )?,
}, },
@ -201,166 +201,166 @@ pub fn test_data() -> Result<HashMap<String, Vec<TestData>>, Box<dyn std::error:
let ed25519 = vec![ let ed25519 = vec![
TestData { TestData {
seed: smex::decode("000102030405060708090a0b0c0d0e0f")?, seed: hex::decode("000102030405060708090a0b0c0d0e0f")?,
tests: vec![ tests: vec![
Test { Test {
chain: "m", chain: "m",
fingerprint: smex::decode("00000000")?, fingerprint: hex::decode("00000000")?,
chain_code: smex::decode( chain_code: hex::decode(
"90046a93de5380a72b5e45010748567d5ea02bbf6522f979e05c0d8d8ca9fffb", "90046a93de5380a72b5e45010748567d5ea02bbf6522f979e05c0d8d8ca9fffb",
)?, )?,
private_key: smex::decode( private_key: hex::decode(
"2b4be7f19ee27bbf30c667b642d5f4aa69fd169872f8fc3059c08ebae2eb19e7", "2b4be7f19ee27bbf30c667b642d5f4aa69fd169872f8fc3059c08ebae2eb19e7",
)?, )?,
public_key: smex::decode( public_key: hex::decode(
"00a4b2856bfec510abab89753fac1ac0e1112364e7d250545963f135f2a33188ed", "00a4b2856bfec510abab89753fac1ac0e1112364e7d250545963f135f2a33188ed",
)?, )?,
}, },
Test { Test {
chain: "m/0'", chain: "m/0'",
fingerprint: smex::decode("ddebc675")?, fingerprint: hex::decode("ddebc675")?,
chain_code: smex::decode( chain_code: hex::decode(
"8b59aa11380b624e81507a27fedda59fea6d0b779a778918a2fd3590e16e9c69", "8b59aa11380b624e81507a27fedda59fea6d0b779a778918a2fd3590e16e9c69",
)?, )?,
private_key: smex::decode( private_key: hex::decode(
"68e0fe46dfb67e368c75379acec591dad19df3cde26e63b93a8e704f1dade7a3", "68e0fe46dfb67e368c75379acec591dad19df3cde26e63b93a8e704f1dade7a3",
)?, )?,
public_key: smex::decode( public_key: hex::decode(
"008c8a13df77a28f3445213a0f432fde644acaa215fc72dcdf300d5efaa85d350c", "008c8a13df77a28f3445213a0f432fde644acaa215fc72dcdf300d5efaa85d350c",
)?, )?,
}, },
Test { Test {
chain: "m/0'/1'", chain: "m/0'/1'",
fingerprint: smex::decode("13dab143")?, fingerprint: hex::decode("13dab143")?,
chain_code: smex::decode( chain_code: hex::decode(
"a320425f77d1b5c2505a6b1b27382b37368ee640e3557c315416801243552f14", "a320425f77d1b5c2505a6b1b27382b37368ee640e3557c315416801243552f14",
)?, )?,
private_key: smex::decode( private_key: hex::decode(
"b1d0bad404bf35da785a64ca1ac54b2617211d2777696fbffaf208f746ae84f2", "b1d0bad404bf35da785a64ca1ac54b2617211d2777696fbffaf208f746ae84f2",
)?, )?,
public_key: smex::decode( public_key: hex::decode(
"001932a5270f335bed617d5b935c80aedb1a35bd9fc1e31acafd5372c30f5c1187", "001932a5270f335bed617d5b935c80aedb1a35bd9fc1e31acafd5372c30f5c1187",
)?, )?,
}, },
Test { Test {
chain: "m/0'/1'/2'", chain: "m/0'/1'/2'",
fingerprint: smex::decode("ebe4cb29")?, fingerprint: hex::decode("ebe4cb29")?,
chain_code: smex::decode( chain_code: hex::decode(
"2e69929e00b5ab250f49c3fb1c12f252de4fed2c1db88387094a0f8c4c9ccd6c", "2e69929e00b5ab250f49c3fb1c12f252de4fed2c1db88387094a0f8c4c9ccd6c",
)?, )?,
private_key: smex::decode( private_key: hex::decode(
"92a5b23c0b8a99e37d07df3fb9966917f5d06e02ddbd909c7e184371463e9fc9", "92a5b23c0b8a99e37d07df3fb9966917f5d06e02ddbd909c7e184371463e9fc9",
)?, )?,
public_key: smex::decode( public_key: hex::decode(
"00ae98736566d30ed0e9d2f4486a64bc95740d89c7db33f52121f8ea8f76ff0fc1", "00ae98736566d30ed0e9d2f4486a64bc95740d89c7db33f52121f8ea8f76ff0fc1",
)?, )?,
}, },
Test { Test {
chain: "m/0'/1'/2'/2'", chain: "m/0'/1'/2'/2'",
fingerprint: smex::decode("316ec1c6")?, fingerprint: hex::decode("316ec1c6")?,
chain_code: smex::decode( chain_code: hex::decode(
"8f6d87f93d750e0efccda017d662a1b31a266e4a6f5993b15f5c1f07f74dd5cc", "8f6d87f93d750e0efccda017d662a1b31a266e4a6f5993b15f5c1f07f74dd5cc",
)?, )?,
private_key: smex::decode( private_key: hex::decode(
"30d1dc7e5fc04c31219ab25a27ae00b50f6fd66622f6e9c913253d6511d1e662", "30d1dc7e5fc04c31219ab25a27ae00b50f6fd66622f6e9c913253d6511d1e662",
)?, )?,
public_key: smex::decode( public_key: hex::decode(
"008abae2d66361c879b900d204ad2cc4984fa2aa344dd7ddc46007329ac76c429c", "008abae2d66361c879b900d204ad2cc4984fa2aa344dd7ddc46007329ac76c429c",
)?, )?,
}, },
Test { Test {
chain: "m/0'/1'/2'/2'/1000000000'", chain: "m/0'/1'/2'/2'/1000000000'",
fingerprint: smex::decode("d6322ccd")?, fingerprint: hex::decode("d6322ccd")?,
chain_code: smex::decode( chain_code: hex::decode(
"68789923a0cac2cd5a29172a475fe9e0fb14cd6adb5ad98a3fa70333e7afa230", "68789923a0cac2cd5a29172a475fe9e0fb14cd6adb5ad98a3fa70333e7afa230",
)?, )?,
private_key: smex::decode( private_key: hex::decode(
"8f94d394a8e8fd6b1bc2f3f49f5c47e385281d5c17e65324b0f62483e37e8793", "8f94d394a8e8fd6b1bc2f3f49f5c47e385281d5c17e65324b0f62483e37e8793",
)?, )?,
public_key: smex::decode( public_key: hex::decode(
"003c24da049451555d51a7014a37337aa4e12d41e485abccfa46b47dfb2af54b7a", "003c24da049451555d51a7014a37337aa4e12d41e485abccfa46b47dfb2af54b7a",
)?, )?,
}, },
], ],
}, },
TestData { TestData {
seed: smex::decode(ED25519_512)?, seed: hex::decode(ED25519_512)?,
tests: vec![ tests: vec![
Test { Test {
chain: "m", chain: "m",
fingerprint: smex::decode("00000000")?, fingerprint: hex::decode("00000000")?,
chain_code: smex::decode( chain_code: hex::decode(
"ef70a74db9c3a5af931b5fe73ed8e1a53464133654fd55e7a66f8570b8e33c3b", "ef70a74db9c3a5af931b5fe73ed8e1a53464133654fd55e7a66f8570b8e33c3b",
)?, )?,
private_key: smex::decode( private_key: hex::decode(
"171cb88b1b3c1db25add599712e36245d75bc65a1a5c9e18d76f9f2b1eab4012", "171cb88b1b3c1db25add599712e36245d75bc65a1a5c9e18d76f9f2b1eab4012",
)?, )?,
public_key: smex::decode( public_key: hex::decode(
"008fe9693f8fa62a4305a140b9764c5ee01e455963744fe18204b4fb948249308a", "008fe9693f8fa62a4305a140b9764c5ee01e455963744fe18204b4fb948249308a",
)?, )?,
}, },
Test { Test {
chain: "m/0'", chain: "m/0'",
fingerprint: smex::decode("31981b50")?, fingerprint: hex::decode("31981b50")?,
chain_code: smex::decode( chain_code: hex::decode(
"0b78a3226f915c082bf118f83618a618ab6dec793752624cbeb622acb562862d", "0b78a3226f915c082bf118f83618a618ab6dec793752624cbeb622acb562862d",
)?, )?,
private_key: smex::decode( private_key: hex::decode(
"1559eb2bbec5790b0c65d8693e4d0875b1747f4970ae8b650486ed7470845635", "1559eb2bbec5790b0c65d8693e4d0875b1747f4970ae8b650486ed7470845635",
)?, )?,
public_key: smex::decode( public_key: hex::decode(
"0086fab68dcb57aa196c77c5f264f215a112c22a912c10d123b0d03c3c28ef1037", "0086fab68dcb57aa196c77c5f264f215a112c22a912c10d123b0d03c3c28ef1037",
)?, )?,
}, },
Test { Test {
chain: "m/0'/2147483647'", chain: "m/0'/2147483647'",
fingerprint: smex::decode("1e9411b1")?, fingerprint: hex::decode("1e9411b1")?,
chain_code: smex::decode( chain_code: hex::decode(
"138f0b2551bcafeca6ff2aa88ba8ed0ed8de070841f0c4ef0165df8181eaad7f", "138f0b2551bcafeca6ff2aa88ba8ed0ed8de070841f0c4ef0165df8181eaad7f",
)?, )?,
private_key: smex::decode( private_key: hex::decode(
"ea4f5bfe8694d8bb74b7b59404632fd5968b774ed545e810de9c32a4fb4192f4", "ea4f5bfe8694d8bb74b7b59404632fd5968b774ed545e810de9c32a4fb4192f4",
)?, )?,
public_key: smex::decode( public_key: hex::decode(
"005ba3b9ac6e90e83effcd25ac4e58a1365a9e35a3d3ae5eb07b9e4d90bcf7506d", "005ba3b9ac6e90e83effcd25ac4e58a1365a9e35a3d3ae5eb07b9e4d90bcf7506d",
)?, )?,
}, },
Test { Test {
chain: "m/0'/2147483647'/1'", chain: "m/0'/2147483647'/1'",
fingerprint: smex::decode("fcadf38c")?, fingerprint: hex::decode("fcadf38c")?,
chain_code: smex::decode( chain_code: hex::decode(
"73bd9fff1cfbde33a1b846c27085f711c0fe2d66fd32e139d3ebc28e5a4a6b90", "73bd9fff1cfbde33a1b846c27085f711c0fe2d66fd32e139d3ebc28e5a4a6b90",
)?, )?,
private_key: smex::decode( private_key: hex::decode(
"3757c7577170179c7868353ada796c839135b3d30554bbb74a4b1e4a5a58505c", "3757c7577170179c7868353ada796c839135b3d30554bbb74a4b1e4a5a58505c",
)?, )?,
public_key: smex::decode( public_key: hex::decode(
"002e66aa57069c86cc18249aecf5cb5a9cebbfd6fadeab056254763874a9352b45", "002e66aa57069c86cc18249aecf5cb5a9cebbfd6fadeab056254763874a9352b45",
)?, )?,
}, },
Test { Test {
chain: "m/0'/2147483647'/1'/2147483646'", chain: "m/0'/2147483647'/1'/2147483646'",
fingerprint: smex::decode("aca70953")?, fingerprint: hex::decode("aca70953")?,
chain_code: smex::decode( chain_code: hex::decode(
"0902fe8a29f9140480a00ef244bd183e8a13288e4412d8389d140aac1794825a", "0902fe8a29f9140480a00ef244bd183e8a13288e4412d8389d140aac1794825a",
)?, )?,
private_key: smex::decode( private_key: hex::decode(
"5837736c89570de861ebc173b1086da4f505d4adb387c6a1b1342d5e4ac9ec72", "5837736c89570de861ebc173b1086da4f505d4adb387c6a1b1342d5e4ac9ec72",
)?, )?,
public_key: smex::decode( public_key: hex::decode(
"00e33c0f7d81d843c572275f287498e8d408654fdf0d1e065b84e2e6f157aab09b", "00e33c0f7d81d843c572275f287498e8d408654fdf0d1e065b84e2e6f157aab09b",
)?, )?,
}, },
Test { Test {
chain: "m/0'/2147483647'/1'/2147483646'/2'", chain: "m/0'/2147483647'/1'/2147483646'/2'",
fingerprint: smex::decode("422c654b")?, fingerprint: hex::decode("422c654b")?,
chain_code: smex::decode( chain_code: hex::decode(
"5d70af781f3a37b829f0d060924d5e960bdc02e85423494afc0b1a41bbe196d4", "5d70af781f3a37b829f0d060924d5e960bdc02e85423494afc0b1a41bbe196d4",
)?, )?,
private_key: smex::decode( private_key: hex::decode(
"551d333177df541ad876a60ea71f00447931c0a9da16f227c11ea080d7391b8d", "551d333177df541ad876a60ea71f00447931c0a9da16f227c11ea080d7391b8d",
)?, )?,
public_key: smex::decode( public_key: hex::decode(
"0047150c75db263559a70d5778bf36abbab30fb061ad69f69ece61a72b0cfa4fc0", "0047150c75db263559a70d5778bf36abbab30fb061ad69f69ece61a72b0cfa4fc0",
)?, )?,
}, },

View File

@ -27,4 +27,4 @@
- [Writing Binaries](./dev-guide/index.md) - [Writing Binaries](./dev-guide/index.md)
- [Provisioners](./dev-guide/provisioners.md) - [Provisioners](./dev-guide/provisioners.md)
- [Auditing Dependencies](./dev-guide/auditing.md) - [Auditing](./dev-guide/auditing.md)

View File

@ -19,254 +19,4 @@ to ensure only the required dependencies are enabled. This reduces the burden
of auditors, but it does mean we can't use projects such as [`hakari`] to of auditors, but it does mean we can't use projects such as [`hakari`] to
optimize full-project builds. optimize full-project builds.
Below is a list of all immediate dependencies enabled by default, and why they
have been used, as of 2024-01-15.
### Common Dependencies
These dependencies will show up often:
* [`serde`]: Rust-native serialization and deserialization of types.
* [`thiserror`]: Automatic generation of error types.
* [`sequoia-openpgp`]: An OpenPGP interface.
## `keyfork`
A command line interface for generating, deriving from, and managing secrets.
* [`card-backend-pcsc`]: Interacting with smartcards using PCSC. Used as a card
backend for `openpgp-card`.
* [`clap`]: Command line argument parsing, helps building an intuitive command
line interface.
* [`clap_complete`]: Shell autocompletion file generator. Helps the user
experience. Can be disabled.
* [`keyfork-derive-openpgp`]
* [`keyfork-derive-util`]
* [`keyfork-entropy`]
* [`keyfork-mnemonic-util`]
* [`keyfork-prompt`]
* [`keyfork-qrcode`]
* [`keyfork-shard`]
* [`keyforkd`]
* [`keyforkd-client`]
* [`openpgp-card`]: Managing OpenPGP smart cards.
* [`openpgp-card-sequoia`]: Managing OpenPGP smart cards with Sequoia OpenPGP.
* [`sequoia-openpgp`]: Manage OpenPGP features across Keyfork crates.
* [`serde`]
* [`smex`]
* [`thiserror`]
* [`tokio`]: Starting and running the Keyfork server.
## `keyforkd`
A server to handle derivation requests without providing access to the root
seed or close-to-root derivations.
* [`bincode`]: Compact data serialization.
* [`keyfork-derive-path-data`]
* [`keyfork-derive-util`]
* [`keyfork-frame`]
* [`keyfork-mnemonic-util`]
* [`keyforkd-models`]
* [`serde`]
* [`thiserror`]
* [`tokio`]: An async framework, used for handling many UNIX server clients.
* [`tower`]: Framework traits for providing a Service.
* [`tracing`]: Trace requests made to Keyforkd.
* [`tracing-error`]: Error capture support for tracing.
* [`tracing-subscriber`]: Configure logging and span-capture rules for tracing.
## keyforkd-client
A client for [`keyforkd`].
* [`bincode`]: Compact data serialization.
* [`keyfork-derive-util`]
* [`keyfork-frame`]
* [`keyforkd-models`]
* [`thiserror`]
## `keyforkd-models`
Types used by keyforkd and keyforkd-client
* [`keyfork-derive-util`]
* [`serde`]
* [`thiserror`]
## `keyfork-derive-key`
Derivation of arbitrary data using Keyfork.
* [`keyfork-derive-util`]
* [`keyforkd-client`]
* [`smex`]
* [`thiserror`]
## `keyfork-derive-openpgp`
Derivation of OpenPGP Keys using Keyfork.
* [`anyhow`]: Create errors accepted by Sequoia.
* [`ed25519-dalek`]: Ed25519 key parsing.
* [`keyfork-derive-util`]
* [`keyforkd-client`]
* [`sequoia-openpgp`]: Creation of OpenPGP Keys from provided derived keys.
## `keyfork-derive-path-data`
Guessing possible meanings for BIP-0032 derivation paths.
* [`keyfork-derive-util`]
## `keyfork-derive-util`
BIP-0032 derivation.
* [`digest`]: Hash digest creation.
* [`ed25519-dalek`]: Ed25519 key parsing and arithmetic.
* [`hmac`]: Derivation of keys using HMAC.
* [`k256`]: secp256k1 (K-256) key parsing and arithmetic.
* [`keyfork-mnemonic-util`]
* [`ripemd`]: Generating hash for fingerprinting of BIP-0032 derived data.
* [`serde`]
* [`sha2`]: Generating hashes for fingerprinting and derivation of data.
* [`thiserror`]
## `keyfork-shard`
M-of-N recombination of secret data using Shamir's Secret Sharing.
* [`aes-gcm`]: Transport encryption for Shamir shares.
* [`anyhow`]: Create errors accepted by Sequoia.
* [`card-backend`]: OpenPGP card backend management.
* [`card-backend-pcsc`]: PCSC support for OpenPGP-card.
* [`hkdf`]: Key derivation for transport encryption keys.
* [`keyfork-derive-openpgp`]
* [`keyfork-mnemonic-util`]: Encoding encrypted shards using mnemonics.
* [`keyfork-prompt`]
* [`keyfork-qrcode`]: Encoding and decoding of encrypted shards using QR codes.
* [`openpgp-card`]: OpenPGP card support.
* [`openpgp-card-sequoia`]: Sequoia-OpenPGP support for openpgp-card.
* [`sequoia-openpgp`]
## `keyfork-qrcode`
Encoding and decoding of QR codes
* [`image`]: Parse image data, to be sent to rqrr.
* [`rqrr`]: Rust native QR decoding
* [`thiserror`]
* [`v4l`]: Read video frames from a camera device.
## `keyfork-zbar`
ZBar bindings and Rustic interface.
* [`image`]: Transformation from `image::Image` to a ZBar `Image`.
* [`keyfork-zbar-sys`]
## `keyfork-zbar-sys`
Generated bindings for [`zbar`]
### Build dependencies
* [`bindgen`]: Automatic binding generation.
* [`pkg-config`]: Probe for zbar system libary.
## `keyfork-crossterm`
Fork of: https://github.com/rust-lang/pkg-config-rs
## `keyfork-entropy`
Load entropy from a secure source on the current system.
## `keyfork-frame`
Frame data in a length-storing checksum-verified format.
* [`sha2`]: Generate and verify checksum of framed data
* [`thiserror`]
* [`tokio`]: Read and write from AsyncRead and AsyncWrite sources.
## `keyfork-mnemonic-util`
* [`hmac`]: Hash utilities.
* [`sha2`]: Checksum of mnemonic data and hash for pbkdf2
* [`pbkdf2`]: BIP-0032 seed generation
## `keyfork-prompt`
* [`keyfork-crossterm`]: Interacting with the terminal.
* [`keyfork-mnemonic-util`]
* [`thiserror`]
## `keyfork-plumbing`
Binaries for `keyfork-entropy` and `keyfork-mnemonic-from-seed`.
* [`keyfork-entropy`]
* [`keyfork-mnemonic-util`]
* [`smex`]
## `keyfork-slip10-test-data`
Test data for SLIP10/BIP-0032 derivation.
* [`smex`]
## `smex`
Zero-dependency hex encoding and decoding.
[`aes-gcm`]: https://github.com/RustCrypto/AEADs/tree/master/aes-gcm
[`anyhow`]: https://github.com/dtolnay/anyhow
[`bincode`]: https://github.com/bincode-org/bincode
[`card-backend`]: https://gitlab.com/openpgp-card/openpgp-card/-/tree/main/card-backend
[`card-backend-pcsc`]: https://gitlab.com/openpgp-card/openpgp-card/-/tree/main/pcsc
[`clap`]: https://github.com/clap-rs/clap/
[`clap_complete`]: https://github.com/clap-rs/clap/tree/master/clap_complete
[`digest`]: https://github.com/RustCrypto/traits/tree/master/digest
[`ed25519-dalek`]: https://github.com/dalek-cryptography/curve25519-dalek/tree/main/ed25519-dalek
[`hakari`]: https://docs.rs/cargo-hakari/latest/cargo_hakari/index.html [`hakari`]: https://docs.rs/cargo-hakari/latest/cargo_hakari/index.html
[`hkdf`]: https://github.com/RustCrypto/KDFs/tree/master/hkdf
[`hmac`]: https://github.com/RustCrypto/MACs/tree/master/hmac
[`image`]: https://github.com/image-rs/image
[`k256`]: https://github.com/RustCrypto/elliptic-curves/tree/master/k256
[`openpgp-card`]: https://gitlab.com/openpgp-card/openpgp-card/-/tree/main
[`openpgp-card-sequoia`]: https://gitlab.com/openpgp-card/openpgp-card/-/tree/main/openpgp-card-sequoia
[`pbkdf2`]: https://github.com/RustCrypto/password-hashes/tree/master/pbkdf2
[`ripemd`]: https://github.com/RustCrypto/hashes/tree/master/ripemd
[`rqrr`]: https://github.com/WanzenBug/rqrr/
[`sequoia-openpgp`]: https://gitlab.com/sequoia-pgp/sequoia
[`serde`]: https://github.com/dtolnay/serde
[`sha2`]: https://github.com/RustCrypto/hashes/tree/master/sha2
[`thiserror`]: https://github.com/dtolnay/thiserror
[`tokio`]: https://github.com/tokio-rs/tokio
[`tower`]: https://github.com/tower-rs/tower
[`tracing`]: https://github.com/tokio-rs/tracing
[`tracing-error`]: https://github.com/tokio-rs/tracing/tree/master/tracing-error
[`tracing-subscriber`]: https://github.com/tokio-rs/tracing/tree/master/tracing-subscriber
[`v4l`]: https://github.com/raymanfx/libv4l-rs/
[`zbar`]: https://github.com/mchehab/zbar
[`bindgen`]: https://github.com/rust-lang/rust-bindgen
[`pkg-config`]: https://github.com/rust-lang/pkg-config-rs
[`keyfork-crossterm`]: #keyfork-crossterm
[`keyfork-derive-openpgp`]: #keyfork-derive-openpgp
[`keyfork-derive-path-data`]: #keyfork-derive-path-data
[`keyfork-derive-util`]: #keyfork-derive-util
[`keyfork-entropy`]: #keyfork-entropy
[`keyfork-frame`]: #keyfork-frame
[`keyfork-mnemonic-util`]: #keyfork-mnemonic-util
[`keyfork-prompt`]: #keyfork-prompt
[`keyfork-qrcode`]: #keyfork-qrcode
[`keyfork-shard`]: #keyfork-shard
[`keyfork-zbar-sys`]: #keyfork-zbar-sys
[`keyforkd`]: #keyforkd
[`keyforkd-client`]: #keyforkd-client
[`keyforkd-models`]: #keyforkd-models
[`smex`]: #smex