-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Feliciss
committed
Jul 6, 2023
1 parent
dc31959
commit ca12e51
Showing
35 changed files
with
8,889 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
[package] | ||
name = "rooch-ws-relay" | ||
version = "0.1.0" | ||
|
||
# Workspace inherited keys | ||
authors = { workspace = true } | ||
edition = { workspace = true } | ||
homepage = { workspace = true } | ||
license = { workspace = true } | ||
publish = { workspace = true } | ||
repository = { workspace = true } | ||
rust-version = { workspace = true } | ||
|
||
[dependencies] | ||
clap = { workspace = true } | ||
tracing = { workspace = true } | ||
tracing-appender = { workspace = true } | ||
tracing-subscriber = { workspace = true } | ||
tokio = { workspace = true } | ||
prost = { workspace = true } | ||
tonic = { workspace = true } | ||
console-subscriber = { workspace = true } | ||
futures = { workspace = true } | ||
futures-util = { workspace = true } | ||
tokio-tungstenite = { workspace = true } | ||
tungstenite = { workspace = true } | ||
thiserror = { workspace = true } | ||
uuid = { workspace = true } | ||
config = { workspace = true } | ||
bitcoin_hashes = { workspace = true } | ||
secp256k1 = { workspace = true } | ||
serde = { workspace = true } | ||
serde_json = { workspace = true } | ||
hex = { workspace = true } | ||
rusqlite = { workspace = true } | ||
r2d2 = { workspace = true } | ||
r2d2_sqlite = { workspace = true } | ||
lazy_static = { workspace = true } | ||
governor = { workspace = true } | ||
nonzero_ext = { workspace = true } | ||
hyper = { workspace = true } | ||
hyper-tls = { workspace = true } | ||
http = { workspace = true } | ||
parse_duration = { workspace = true } | ||
rand = { workspace = true } | ||
const_format = { workspace = true } | ||
regex = { workspace = true } | ||
async-trait = { workspace = true } | ||
async-std = { workspace = true } | ||
sqlx = { workspace = true } | ||
chrono = { workspace = true } | ||
prometheus = { workspace = true } | ||
indicatif = { workspace = true } | ||
bech32 = { workspace = true } | ||
url = { workspace = true } | ||
qrcode = { workspace = true } | ||
nostr = { workspace = true } | ||
anyhow = { workspace = true } | ||
sha3 = { workspace = true } | ||
jsonrpsee = { workspace = true } | ||
coerce = { workspace = true } | ||
|
||
move-core-types = { workspace = true } | ||
move-resource-viewer = { workspace = true } | ||
move-binary-format = { workspace = true } | ||
|
||
moveos-store = { workspace = true } | ||
moveos-types = { workspace = true } | ||
move-bytecode-utils = { workspace = true } | ||
|
||
rooch-config = { workspace = true } | ||
rooch-types = { workspace = true } | ||
rooch-executor = { workspace = true } | ||
rooch-sequencer = { workspace = true } | ||
rooch-proposer = { workspace = true } | ||
rooch-key = { workspace = true } | ||
rooch-open-rpc = { workspace = true } | ||
rooch-open-rpc-macros = { workspace = true } | ||
rooch-store = { workspace = true } | ||
rooch-rpc-api = { workspace = true } | ||
|
||
[build-dependencies] | ||
tonic-build = { workspace = true } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
fn main() -> Result<(), Box<dyn std::error::Error>> { | ||
tonic_build::configure() | ||
.build_server(false) | ||
.protoc_arg("--experimental_allow_proto3_optional") | ||
.compile(&["proto/nauthz.proto"], &["proto"])?; | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
syntax = "proto3"; | ||
|
||
// Nostr Authorization Services | ||
package nauthz; | ||
|
||
// Authorization for actions against a relay | ||
service Authorization { | ||
// Determine if an event should be admitted to the relay | ||
rpc EventAdmit(EventRequest) returns (EventReply) {} | ||
} | ||
|
||
message Event { | ||
bytes id = 1; // 32-byte SHA256 hash of serialized event | ||
bytes pubkey = 2; // 32-byte public key of event creator | ||
fixed64 created_at = 3; // UNIX timestamp provided by event creator | ||
uint64 kind = 4; // event kind | ||
string content = 5; // arbitrary event contents | ||
repeated TagEntry tags = 6; // event tag array | ||
bytes sig = 7; // 32-byte signature of the event id | ||
// Individual values for a single tag | ||
message TagEntry { | ||
repeated string values = 1; | ||
} | ||
} | ||
|
||
// Event data and metadata for authorization decisions | ||
message EventRequest { | ||
Event event = | ||
1; // the event to be admitted for further relay processing | ||
optional string ip_addr = | ||
2; // IP address of the client that submitted the event | ||
optional string origin = | ||
3; // HTTP origin header from the client, if one exists | ||
optional string user_agent = | ||
4; // HTTP user-agent header from the client, if one exists | ||
optional bytes auth_pubkey = | ||
5; // the public key associated with a NIP-42 AUTH'd session, if | ||
// authentication occurred | ||
optional Nip05Name nip05 = | ||
6; // NIP-05 address associated with the event pubkey, if it is | ||
// known and has been validated by the relay | ||
// A NIP_05 verification record | ||
message Nip05Name { | ||
string local = 1; | ||
string domain = 2; | ||
} | ||
} | ||
|
||
// A permit or deny decision | ||
enum Decision { | ||
DECISION_UNSPECIFIED = 0; | ||
DECISION_PERMIT = 1; // Admit this event for further processing | ||
DECISION_DENY = 2; // Deny persisting or propagating this event | ||
} | ||
|
||
// Response to a event authorization request | ||
message EventReply { | ||
Decision decision = 1; // decision to enforce | ||
optional string message = 2; // informative message for the client | ||
} |
Oops, something went wrong.