It's been a little been empty than before (look at the commit history), but I really wanted to showcase new stuff. As I'm improving, the time to make something good has also risen up a lot.
It will be easier as everything will be fetched in an easier fashion. It would provide maybe the wallet provider, the SEA keypair, the namespace to use for gunDB, and all of the configuration for it. It could look like that:
exportconstconf={keypair: awaitgetKeypair(),namespace: "succus-supercool-chat",gun: {// use gun.eco/docs},dev: true// debug to not clutter public community peers with bloat data// etc}
Why use JS over JSON? Well, here's a few reasons:
You can directly use functions
Therefore it allows to simplify the workflow, and the use of the library by centralising all needed information in a file.
Allows you to easily use environment variables
It's always good to split your code in a few parts for simplicity
Here are the step to implement it:
Implement a Config interface/type (doesn't know how to choose) to define what's mandatory and what is not!
Implement the parser thanks to the implemented type.
We should implement another way of encrypting to support both environment while keeping the library lightweight without installing too much bloatware. The goal of the chat is to be easily embeddable so we don't want it to clutter our user's stack ๐ !
Tried to test this by creating a react app using cra with nvm use 14, npm i succus, then importing succus and it's exported functions. Getting this error:
ERROR in ./node_modules/succus/dist/index.js 3:0-17
Module not found: Error: Can't resolve 'gun/sea' in '/Users/kmm/Dropbox/aws/gun/succus/node_modules/succus/dist'
Did you mean 'sea.js'?
BREAKING CHANGE: The request 'gun/sea' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '.mjs' file, or a '.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.