diff --git a/.gitignore b/.gitignore
index adbbce4..1973b49 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@
#
# Ignore project resources
+no2all-zerofungus/logs
# Ignore maven resources
target
diff --git a/README.md b/README.md
index 3dea775..a55574e 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,10 @@
# No2All
-THIS WIP AND NEVER BEEN RUN.
+WIP-NOTE; Never been started as only 20% is done.
-Send signed notes to all, is a java library to work with the nostr protocol.
-And zerofungus moves all packages managers over two blockchains.
+Send signed notes to all, no2all-nostr is a POJO library to work
+with the nostr protocol. And no2all-zerofungus is experimental server
+to move all package managers content in DAT and signed in nostr..
TODO: With java webstart example over DAT protocol.
This wowk though dewey of UwU is done in toe toe twailing chains.
@@ -28,8 +29,9 @@ todo
- NIP-X: Add "nsecpw" password protected private key in bech32 TLV format
- NIP-X: Add "nssurl" bech32 TLV for encoded url+pubkey+pubvals+?sockey
- NIP-X: Add "nsseed" web of trust voting(plus/min) + policy tree trust for revoke, like running npkg apps
-- NIP-X: Add "npkgurl" Universal pkg, seed msg type to relay + upkeep + replopt
-- NIP-X: Redo/Clone NIP-89 appurl handlers
+- NIP-X: Add "npkgurl" Universal pkg(+refs) of mime types, seed msg type to relay + upkeep + replopt
+- NIP-X: Add new WS messages for relay managed writable dat streams (after client auth)
+- NIP-X: Redo/Rm/Clone NIP-89 appurl handlers
## ZeroFunGus
@@ -59,3 +61,4 @@ This will run;
- Optional create native OS menu entry for application
- Run jvm with jars and parameters from jnlp file
- Welcome to a js free world over 2 blockchains
+- Also called "The red sea file system" to boot an TempleOS instance
diff --git a/no2all-nostr/pom.xml b/no2all-nostr/pom.xml
new file mode 100644
index 0000000..0537620
--- /dev/null
+++ b/no2all-nostr/pom.xml
@@ -0,0 +1,20 @@
+
+ 4.0.0
+
+ love.distributedrebirth.no2all
+ no2all
+ 0.0.1-SNAPSHOT
+
+ no2all-nostr
+ No2All-NoStr
+
+
+ ${project.groupId}
+ no2all-octo
+
+
+ jakarta.json
+ jakarta.json-api
+
+
+
\ No newline at end of file
diff --git a/no2all-nostr/src/main/java/love/distributedrebirth/no2all/nostr/NoStr.java b/no2all-nostr/src/main/java/love/distributedrebirth/no2all/nostr/NoStr.java
new file mode 100644
index 0000000..97566b7
--- /dev/null
+++ b/no2all-nostr/src/main/java/love/distributedrebirth/no2all/nostr/NoStr.java
@@ -0,0 +1,25 @@
+package love.distributedrebirth.no2all.nostr;
+
+import java.util.function.Consumer;
+
+import love.distributedrebirth.no2all.nostr.fire.NoStrFireWaterBoiler;
+import love.distributedrebirth.no2all.nostr.fire.NoStrFirePipe;
+import love.distributedrebirth.no2all.nostr.model.NoStrIdentity;
+import love.distributedrebirth.no2all.nostr.model.message.NoStrMsgToClient;
+import love.distributedrebirth.no2all.nostr.model.message.NoStrMsgToRelay;
+
+public enum NoStr {
+ FACTORY;
+
+ public NoStrFireWaterBoiler boiler(NoStrIdentity identity) {
+ return new NoStrFireWaterBoiler(identity);
+ }
+
+ public NoStrFirePipe pipeReaderClient(Consumer errHandler, Consumer msgHandler) {
+ return new NoStrFirePipe(errHandler, null, msgHandler);
+ }
+
+ public NoStrFirePipe pipeReaderRelay(Consumer errHandler, Consumer msgHandler) {
+ return new NoStrFirePipe(errHandler, msgHandler, null);
+ }
+}
diff --git a/no2all-nostr/src/main/java/love/distributedrebirth/no2all/nostr/NoStrGospel.java b/no2all-nostr/src/main/java/love/distributedrebirth/no2all/nostr/NoStrGospel.java
new file mode 100644
index 0000000..3e37b98
--- /dev/null
+++ b/no2all-nostr/src/main/java/love/distributedrebirth/no2all/nostr/NoStrGospel.java
@@ -0,0 +1,9 @@
+package love.distributedrebirth.no2all.nostr;
+
+import jakarta.json.JsonValue;
+
+public interface NoStrGospel {
+
+ // slow version, add perf test, rewrite to streaming mode
+ JsonValue toBible();
+}
diff --git a/no2all-nostr/src/main/java/love/distributedrebirth/no2all/nostr/fire/NoStrFirePipe.java b/no2all-nostr/src/main/java/love/distributedrebirth/no2all/nostr/fire/NoStrFirePipe.java
new file mode 100644
index 0000000..80bf4b1
--- /dev/null
+++ b/no2all-nostr/src/main/java/love/distributedrebirth/no2all/nostr/fire/NoStrFirePipe.java
@@ -0,0 +1,72 @@
+package love.distributedrebirth.no2all.nostr.fire;
+
+import java.io.StringReader;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.function.Consumer;
+
+import jakarta.json.Json;
+import jakarta.json.JsonArray;
+import jakarta.json.JsonReader;
+import jakarta.json.JsonValue;
+import love.distributedrebirth.no2all.nostr.model.message.NoStrMsgToClient;
+import love.distributedrebirth.no2all.nostr.model.message.NoStrMsgToRelay;
+import love.distributedrebirth.no2all.nostr.nip.NoStrImplMessageType;
+
+public final class NoStrFirePipe {
+ private static final String ERROR_INVALID_JSON = "Invalid json; "; // on json parse
+ private static final String ERROR_INVALID_ROOT = "Invalid root; "; // on none array root
+ private static final String ERROR_TYPE_UNKNOWN = "Unknown type; "; // on not in values()
+ private static final String ERROR_TYPE_ILLEGAL = "Illegal type"; // on null mapper
+ private static final int MSG_TYPE_INDEX = 0;
+ private final Consumer errHandler;
+ private final Consumer msgHandlerToRelay;
+ private final Consumer msgHandlerToClient;
+
+ public NoStrFirePipe(Consumer errHandler, Consumer msgHandlerToRelay,
+ Consumer msgHandlerToClient) {
+ this.errHandler = Objects.requireNonNull(errHandler);
+ this.msgHandlerToRelay = msgHandlerToRelay;
+ this.msgHandlerToClient = msgHandlerToClient;
+ if (msgHandlerToRelay != null && msgHandlerToClient != null) {
+ throw new IllegalArgumentException("Only use one message handler");
+ }
+ if (msgHandlerToRelay == null && msgHandlerToClient == null) {
+ throw new NullPointerException("Need one message handler");
+ }
+ }
+
+ public void onFire(String msgStr) {
+ JsonValue msgJson = null;
+ try (JsonReader jsonReader = Json.createReader(new StringReader(msgStr))) {
+ msgJson = jsonReader.readValue();
+ } catch (Exception e) {
+ errHandler.accept(ERROR_INVALID_JSON + e.getMessage());
+ return;
+ }
+ if (!JsonValue.ValueType.ARRAY.equals(msgJson.getValueType())) {
+ errHandler.accept(ERROR_INVALID_ROOT + msgJson.getValueType().name());
+ return;
+ }
+ JsonArray msgPacket = msgJson.asJsonArray();
+ String msgTypeRaw = msgPacket.getString(MSG_TYPE_INDEX);
+ if (!NoStrImplMessageType.valueOfValid(msgTypeRaw)) {
+ errHandler.accept(ERROR_TYPE_UNKNOWN + msgTypeRaw);
+ return;
+ }
+ NoStrImplMessageType msgType = NoStrImplMessageType.valueOf(msgTypeRaw);
+ if (msgHandlerToClient != null) {
+ acceptType(msgType.getMapperToClient(), v -> msgHandlerToClient.accept(v.apply(msgPacket))); // on relay
+ } else {
+ acceptType(msgType.getMapperToRelay(), v -> msgHandlerToRelay.accept(v.apply(msgPacket))); // on client
+ }
+ }
+
+ private void acceptType(Optional mapper, Consumer messageHandler) {
+ if (mapper.isEmpty()) {
+ errHandler.accept(ERROR_TYPE_ILLEGAL);
+ return;
+ }
+ messageHandler.accept(mapper.get());
+ }
+}
diff --git a/no2all-nostr/src/main/java/love/distributedrebirth/no2all/nostr/fire/NoStrFireStackFishWelder.java b/no2all-nostr/src/main/java/love/distributedrebirth/no2all/nostr/fire/NoStrFireStackFishWelder.java
new file mode 100644
index 0000000..3e686ba
--- /dev/null
+++ b/no2all-nostr/src/main/java/love/distributedrebirth/no2all/nostr/fire/NoStrFireStackFishWelder.java
@@ -0,0 +1,8 @@
+package love.distributedrebirth.no2all.nostr.fire;
+
+import love.distributedrebirth.no2all.nostr.model.event.NoStrEventTag;
+
+public interface NoStrFireStackFishWelder {
+
+ NoStrFireStackWelder tag(NoStrEventTag eventTag);
+}
diff --git a/no2all-nostr/src/main/java/love/distributedrebirth/no2all/nostr/fire/NoStrFireStackWelder.java b/no2all-nostr/src/main/java/love/distributedrebirth/no2all/nostr/fire/NoStrFireStackWelder.java
new file mode 100644
index 0000000..77e24b8
--- /dev/null
+++ b/no2all-nostr/src/main/java/love/distributedrebirth/no2all/nostr/fire/NoStrFireStackWelder.java
@@ -0,0 +1,76 @@
+package love.distributedrebirth.no2all.nostr.fire;
+
+import java.util.List;
+
+import love.distributedrebirth.no2all.nostr.model.event.NoStrEventTag;
+import love.distributedrebirth.no2all.nostr.model.event.NoStrEventTagMeta;
+import love.distributedrebirth.no2all.nostr.model.tag.NoStrTagA;
+import love.distributedrebirth.no2all.nostr.model.tag.NoStrTagAlt;
+import love.distributedrebirth.no2all.nostr.model.tag.NoStrTagClient;
+import love.distributedrebirth.no2all.nostr.model.tag.NoStrTagContentWarning;
+import love.distributedrebirth.no2all.nostr.model.tag.NoStrTagD;
+import love.distributedrebirth.no2all.nostr.model.tag.NoStrTagDescription;
+import love.distributedrebirth.no2all.nostr.model.tag.NoStrTagE;
+import love.distributedrebirth.no2all.nostr.model.tag.NoStrTagI;
+import love.distributedrebirth.no2all.nostr.model.tag.NoStrTagImage;
+import love.distributedrebirth.no2all.nostr.model.tag.NoStrTagName;
+import love.distributedrebirth.no2all.nostr.model.tag.NoStrTagNonce;
+import love.distributedrebirth.no2all.nostr.model.tag.NoStrTagP;
+import love.distributedrebirth.no2all.nostr.model.tag.NoStrTagPublishedAt;
+import love.distributedrebirth.no2all.nostr.model.tag.NoStrTagR;
+import love.distributedrebirth.no2all.nostr.model.tag.NoStrTagSubject;
+import love.distributedrebirth.no2all.nostr.model.tag.NoStrTagSummary;
+import love.distributedrebirth.no2all.nostr.model.tag.NoStrTagT;
+import love.distributedrebirth.no2all.nostr.model.tag.NoStrTagThumb;
+import love.distributedrebirth.no2all.nostr.model.tag.NoStrTagTitle;
+
+public class NoStrFireStackWelder implements NoStrFireStackFishWelder,
+ NoStrTagA.FishWelder,
+ NoStrTagAlt.FishWelder,
+ NoStrTagClient.FishWelder,
+ NoStrTagContentWarning.FishWelder,
+ NoStrTagD.FishWelder,
+ NoStrTagDescription.FishWelder,
+ NoStrTagE.FishWelder,
+ NoStrTagI.FishWelder,
+ NoStrTagImage.FishWelder,
+ NoStrTagName.FishWelder,
+ NoStrTagNonce.FishWelder,
+ NoStrTagP.FishWelder,
+ NoStrTagPublishedAt.FishWelder,
+ NoStrTagR.FishWelder,
+ NoStrTagSubject.FishWelder,
+ NoStrTagSummary.FishWelder,
+ NoStrTagT.FishWelder,
+ NoStrTagThumb.FishWelder,
+ NoStrTagTitle.FishWelder
+{
+ private final NoStrFireWaterWelder welder;
+
+ protected NoStrFireStackWelder(NoStrFireWaterWelder welder) {
+ this.welder = welder;
+ }
+
+ public NoStrFireWaterWelder burn() {
+ return welder;
+ }
+
+ @Override
+ public NoStrFireStackWelder tag(NoStrEventTag eventTag) {
+ welder.smokeTag(eventTag);
+ return this;
+ }
+
+ public NoStrFireStackWelder tags(List eventTags) {
+ eventTags.forEach(v -> welder.smokeTag(v));
+ return this;
+ }
+
+ public NoStrFireStackWelder tag(NoStrEventTagMeta tag, String... args) {
+ return tag(NoStrEventTag.valueOf(tag, args));
+ }
+
+ public NoStrFireStackWelder tag(String tag, String... args) {
+ return tag(NoStrEventTagMeta.valueOf(tag), args);
+ }
+}
diff --git a/no2all-nostr/src/main/java/love/distributedrebirth/no2all/nostr/fire/NoStrFireWaterBoiler.java b/no2all-nostr/src/main/java/love/distributedrebirth/no2all/nostr/fire/NoStrFireWaterBoiler.java
new file mode 100644
index 0000000..f93d5fe
--- /dev/null
+++ b/no2all-nostr/src/main/java/love/distributedrebirth/no2all/nostr/fire/NoStrFireWaterBoiler.java
@@ -0,0 +1,62 @@
+package love.distributedrebirth.no2all.nostr.fire;
+
+import java.util.List;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+import love.distributedrebirth.no2all.nostr.model.NoStrIdentity;
+import love.distributedrebirth.no2all.nostr.model.NoStrIdentityPublicKey;
+import love.distributedrebirth.no2all.nostr.model.NoStrProfileMetaData;
+import love.distributedrebirth.no2all.nostr.model.event.NoStrEvent;
+import love.distributedrebirth.no2all.nostr.model.tag.NoStrTagP;
+import love.distributedrebirth.no2all.nostr.nip.NoStrImplEventKind;
+import love.distributedrebirth.no2all.nostr.nip.NoStrImplEventTag;
+
+public final class NoStrFireWaterBoiler {
+
+ private final NoStrIdentity identity;
+
+ public NoStrFireWaterBoiler(NoStrIdentity identity) {
+ this.identity = Objects.requireNonNull(identity);
+ }
+
+ public NoStrFireWaterWelder burn() {
+ return new NoStrFireWaterWelder(identity);
+ }
+
+ public NoStrFireStackWelder smoker() {
+ return new NoStrFireStackWelder(burn());
+ }
+
+ public NoStrEvent boilProfileMetaData(NoStrProfileMetaData profileData) {
+ return burn().water(NoStrImplEventKind.METADATA, profileData.toBible().toString());
+ }
+
+ public NoStrEvent boilClientAuth(String relay, String challenge) {
+ return smoker()
+ .tag(NoStrImplEventTag.RELAY, relay)
+ .tag(NoStrImplEventTag.CHALLENGE, challenge)
+ .burn()
+ .water(NoStrImplEventKind.CLIENT_AUTH);
+ }
+
+ public NoStrEvent boilRecommendRelay(String relayUrl) {
+ return burn().water(NoStrImplEventKind.RECOMMEND_RELAY, relayUrl);
+ }
+
+ public NoStrEvent boilTextNote(String content, String subject, List pubs) {
+ return smoker()
+ .tagSubject(subject)
+ .tags(pubs.stream().map(v -> new NoStrTagP(v, Optional.empty(), Optional.empty())).collect(Collectors.toList()))
+ .burn()
+ .water(NoStrImplEventKind.TEXT_NOTE, content);
+ }
+
+// public NoStrEvent waterTextNote(String content, List