timeline: initial contact queries

This implements initial local contact queries. For testing you can
create contact list columns via:

Examples
--------

Make a contacts column from a specific npub:

	$ notedeck --column contacts:npub...

Use the current user's contacts:

	$ notedeck --column contacts --pub npub...

We also introduce a new ColumnKind enum which is used to describe the
column type.

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2024-08-30 08:44:49 -07:00
parent 11ede2086f
commit 71259a8dd5
3 changed files with 191 additions and 30 deletions

View File

@@ -23,6 +23,13 @@ impl Pubkey {
&self.0
}
pub fn parse(s: &str) -> Result<Self, Error> {
match Pubkey::from_hex(s) {
Ok(pk) => Ok(pk),
Err(_) => Pubkey::try_from_bech32_string(s, false),
}
}
pub fn from_hex(hex_str: &str) -> Result<Self, Error> {
Ok(Pubkey(hex::decode(hex_str)?.as_slice().try_into()?))
}