update docs

This commit is contained in:
creating2morrow 2024-04-09 23:58:41 -04:00
parent 3b6e34119d
commit 91d4ce3966
16 changed files with 56 additions and 27 deletions

View file

@ -51,13 +51,13 @@ curl -iv http://localhost:9044/contacts
## send message ## send message
```bash ```bash
curl -ivk http://localhost:9045/tx -d '{"uid":"123", "mid": "", "body": [1,2,3 <PLAINTEXT_BYTES>], "from": "alice.b32.i2p", "created": 0, "to": "bob.b32.i2p"}' -H 'Content-Type: application/json' curl -ivk http://localhost:9045/tx -d '{"uid":"123", "mid": "", "body": "string", "from": "alice.b32.i2p", "created": 0, "to": "bob.b32.i2p"}' -H 'Content-Type: application/json'
``` ```
## receive message ## receive message
```bash ```bash
curl -iv http://alice.b32.i2p/message/rx -d '{"uid":"", "mid": "", "body": [1,2,3 <ENCRYPTED_BYTES>], "from": "bob.b32.i2p", "created": 0, "to": "alice.b32.i2p"}' -H 'Content-Type: application/json' -H 'proof: eyJhbGciOiJIUzUxMiJ9...' curl -iv http://alice.b32.i2p/message/rx -d '{"uid":"", "mid": "", "body": "string", "from": "bob.b32.i2p", "created": 0, "to": "alice.b32.i2p"}' -H 'Content-Type: application/json' -H 'proof: eyJhbGciOiJIUzUxMiJ9...'
``` ```
## view messages ## view messages

View file

@ -1,3 +1,4 @@
//! core command line arguments
use clap::Parser; use clap::Parser;
/// cmd line args /// cmd line args

View file

@ -1,3 +1,5 @@
//! Internal authorization module that uses JWTs
use crate::{ use crate::{
args, args,
db, db,

View file

@ -1,4 +1,5 @@
// db created and exported from here //! Primary LMDB interface for read, write, delete etc.
extern crate lmdb_rs as lmdb; extern crate lmdb_rs as lmdb;
use lmdb::{ use lmdb::{

View file

@ -1,3 +1,5 @@
//! Marketplace disputes operations module
use std::error::Error; use std::error::Error;
use crate::{ use crate::{

View file

@ -1,3 +1,5 @@
//! TODO: replace i2p-zero with i2pd bindings
use crate::{ use crate::{
args, args,
utils, utils,

View file

@ -1,23 +1,24 @@
pub mod args; // command line arguments pub mod args;
pub mod auth; // internal auth repo/service layer pub mod auth;
pub mod contact; // contact repo/service layer pub mod contact;
pub mod neveko25519; // cipher logic pub mod neveko25519;
pub mod dispute; // dispute repo/service layer pub mod dispute;
pub mod db; // lmdb interface pub mod db;
pub mod i2p; // i2p repo/service layer pub mod i2p;
pub mod message; // message repo/service layer pub mod message;
pub mod models; // db structs pub mod models;
pub mod monero; // monero-wallet-rpc interface pub mod monero;
pub mod order; // order repo/service layer pub mod order;
pub mod product; // product repo/service layer pub mod product;
pub mod proof; // external auth/payment proof module pub mod proof;
pub mod reqres; // http request/responses pub mod reqres;
pub mod user; // user repo/service layer pub mod user;
pub mod utils; // misc. pub mod utils;
pub const APP_NAME: &str = "neveko"; pub const APP_NAME: &str = "neveko";
pub const NEVEKO_JWP_SECRET_KEY: &str = "NEVEKO_JWP_SECRET_KEY"; pub const NEVEKO_JWP_SECRET_KEY: &str = "NEVEKO_JWP_SECRET_KEY";
pub const NEVEKO_JWT_SECRET_KEY: &str = "NEVEKO_JWT_SECRET_KEY"; pub const NEVEKO_JWT_SECRET_KEY: &str = "NEVEKO_JWT_SECRET_KEY";
pub const NEVEKO_NMPK: &str = "NEVEKO_NMPK";
// LMDB Keys // LMDB Keys
pub const AUTH_DB_KEY: &str = "a"; pub const AUTH_DB_KEY: &str = "a";

View file

@ -1,4 +1,5 @@
// Message repo/service layer //! Message processing module
use crate::{ use crate::{
contact, contact,
db, db,

View file

@ -1,3 +1,5 @@
//! Custom object relational mapping (ORM) for structs into LMBD
use crate::utils; use crate::utils;
use rocket::serde::{ use rocket::serde::{
json::Json, json::Json,

View file

@ -1,3 +1,5 @@
//! TODO: replace with monero bindings
use crate::{ use crate::{
args, args,
i2p, i2p,

View file

@ -1,3 +1,5 @@
//! Marketplace order logic module
use std::error::Error; use std::error::Error;
use crate::{ use crate::{

View file

@ -1,4 +1,5 @@
// Product repo/service layer //! Marketplace products upload, modification, etc module
use crate::{ use crate::{
db, db,
models::*, models::*,

View file

@ -1,3 +1,5 @@
//! External authorization module via JWPs
use crate::{ use crate::{
db, db,
monero, monero,

View file

@ -1,3 +1,5 @@
//! Structs for all http requests
use crate::utils; use crate::utils;
use serde::{ use serde::{
Deserialize, Deserialize,

View file

@ -1,4 +1,6 @@
// User repo/service layer //! TODO(c2m): remove this module since there is only support for a single
//! authenticated user
use crate::{ use crate::{
db, db,
models::*, models::*,
@ -11,10 +13,6 @@ use log::{
}; };
use rocket::serde::json::Json; use rocket::serde::json::Json;
// This module is only used for remote access
// TODO(c2m): remove this module since there is only support for a single
// authenticated user
/// Create a new user /// Create a new user
pub fn create(address: &String) -> User { pub fn create(address: &String) -> User {
let f_uid: String = format!("{}{}", crate::USER_DB_KEY, utils::generate_rnd()); let f_uid: String = format!("{}{}", crate::USER_DB_KEY, utils::generate_rnd());

View file

@ -1,7 +1,17 @@
//! Generic functions for startup and convenience //! Generic functions for startup and convenience
use crate::{ use crate::{
args, contact, db, dispute, i2p, message, models, monero, neveko25519, reqres, utils args,
contact,
db,
dispute,
i2p,
message,
models,
monero,
neveko25519,
reqres,
utils,
}; };
use clap::Parser; use clap::Parser;
use log::{ use log::{