AT Protocol PDS + AppView + Tauri Desktop Client, 160-char post limit. - PDS (Rust + axum + sqlx) - Auth: createAccount, createSession, refreshSession - Records: createRecord, deleteRecord (race-safe via SELECT FOR UPDATE) - Feed: feed.like.create, feed.repost.create - Sync: getRepo, getBlocks, getLatestCommit, getRecord (with MST proof), listRepos - Identity: resolveHandle - MST: spec-conformant (at-mst crate, 27 tests) - Repo: signed commits, TID counter (monotonic, 4096 wrap safe) - AppView (Rust + axum + sqlx) - Jetstream consumer (WebSocket, exponential backoff, 38k+ events indexed) - REST API: timeline/home (graph-aware), profile, search, post (with thread hydration) - Handle-sync worker (did:plc + did:web) - JSONB embed storage + thread columns (migration 0003) - Like/repost counter cache (migration 0004) - Tauri 2 + Svelte 5 Desktop Client - System tray (Show/Compose/Quit menu) - OS notifications (tauri-plugin-notification) - Auto-update (tauri-plugin-updater, placeholder endpoint) - Window-state (tauri-plugin-window-state) - 160-char compose with live counter - Image/Link embed rendering - LocalStorage-persisted like state - Timeline with poll (prepend new posts) - Custom TitleBar (transparent, no decorations) - Orange/IBM Plex Mono maarcade design Tests: 231 Rust + 9 vitest = 240 passed.
47 lines
1.4 KiB
Rust
47 lines
1.4 KiB
Rust
use anyhow::Result;
|
|
use at_crypto::did_key::verifying_key_to_multibase;
|
|
use at_crypto::ecdsa::K256Keypair;
|
|
use k256::ecdsa::SigningKey;
|
|
use rand::rngs::OsRng;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct CreatedUser {
|
|
pub did: String,
|
|
pub handle: String,
|
|
pub signing_pubkey_multibase: String,
|
|
pub rotation_pubkey_multibase: String,
|
|
pub k256_signing: K256Keypair,
|
|
pub k256_rotation: K256Keypair,
|
|
}
|
|
|
|
pub fn generate_user_keys() -> Result<CreatedUser> {
|
|
let signing = K256Keypair::generate()?;
|
|
let rotation = K256Keypair::generate()?;
|
|
Ok(CreatedUser {
|
|
did: String::new(),
|
|
handle: String::new(),
|
|
signing_pubkey_multibase: signing.public_multibase.clone(),
|
|
rotation_pubkey_multibase: rotation.public_multibase.clone(),
|
|
k256_signing: signing,
|
|
k256_rotation: rotation,
|
|
})
|
|
}
|
|
|
|
pub fn derive_did_from_signing(k256_signing: &K256Keypair) -> String {
|
|
use at_crypto::did_key::pubkey_to_multibase;
|
|
use k256::PublicKey;
|
|
let sk = k256_signing.secret_key().unwrap();
|
|
let pk: PublicKey = sk.verifying_key().into();
|
|
let mb = pubkey_to_multibase(&pk).unwrap();
|
|
format!("did:key:{}", mb)
|
|
}
|
|
|
|
pub fn random_signing_key() -> SigningKey {
|
|
SigningKey::random(&mut OsRng)
|
|
}
|
|
|
|
pub fn verifying_key_mb(signing: &SigningKey) -> Result<String> {
|
|
Ok(verifying_key_to_multibase(signing.verifying_key())?)
|
|
}
|