Commit Graph
100 Commits
Author SHA1 Message Date
pharpend a73da72382 [wip] jr: working on presenting address to user 2023-08-11 12:15:56 -06:00
pharpend 1e80a53051 idiomatically refactoring jr controller
I am trying to copy the Erlang idiom of "calling" another process through a
function call interface. That is, suppose I have two named processes
corresponding to modules `caller` and `callee`

caller.erl:

    foo() ->
        Result = callee:get_some_data(),
        do_something_with(Result).

callee.erl:
    get_some_data() ->
        gen_server:call(?MODULE, get_some_data)

    handle_call(get_some_data, CalleeState) ->
        {Result, NewState} = do_get_some_data(CalleeState),
        {reply, Result, NewState}.

I'm trying to replicate that in JS, because it's definitely the most pleasant
idiom for having different processes "talk" to each other.  This also allows
the callee process to define an API that black-boxes away the internal
messaging structure, thus giving the developer the flexibility to change that
internal messaging structure without breaking the calling code.
2023-08-01 15:15:15 -06:00
pharpend b3eba95520 starting jr controller api idiom 2023-07-30 22:58:55 -06:00
pharpend c54c57b37a shift script include URLs to be relative 2023-07-26 17:24:49 -06:00
pharpend b680336ba4 all this time i thought that it was the browser that was mentally disabled it turned out the mental disability was inside me all along
======================
NACL mental disability
======================

NACL is mentally disabled and can't be loaded as an ES6 module. That is, it can't be
"imported" using

```js
import * as nacl from './path/to/nacl.js';
```

Instead you have to include it in a page. So we have a page called
`background.html`.

I naively tried this

```html
<script src="dist/jex_include/local-nacl-1.0.3/nacl.js"></script>
```

That of course didn't work because we live in hell.

I initially thought the problem was an invalid hash. No. Notes as I figure it
out:

    Trying to figure out why TweetNaCl isn't loading

    ok so the problem is not an invalid hash, it's something specific
    to nacl

    to have an inline script, its hash must be specified in
    manifest.json

    example (integrity key is not necessary, it is there purely for
    comment purposes)

         beginning of line
        V
        |        <script integrity="sha256-8T3dvQxHPNQvgxzCemw3KGUCM5RhknpCQF6pCcTdFTw=">console.log('bg-test-inline.js line 1!');
        |</script>

    newline is there for hash purposes

    this works if and only if
    'sha256-8T3dvQxHPNQvgxzCemw3KGUCM5RhknpCQF6pCcTdFTw=' is included
    in the manifest.json

    example (top level key):

         "content_security_policy" : "script-src 'self' 'sha256-8T3dvQxHPNQvgxzCemw3KGUCM5RhknpCQF6pCcTdFTw='; object-src 'self'",

    Absent that explicit allow, I get this error from Firefox:

        Content Security Policy: The page’s settings blocked the loading of a resource at inline (“script-src”).

    Refs:
        1. https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/content_security_policy
        2. https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Content_Security_Policy#inline_javascript

    If I include the same script as a file,

        <script src="bg-test-inline.js"></script>

    this works irrespective of if I specify it as allowable in the manifest

    nacl is just refusing to load

        Loading failed for the <script> with source “moz-extension://eafd6a74-b75b-4312-9a34-8087b68395e7/dist/jex_include/local-nacl-1.0.3/nacl.js”.

    I initially thought it was a hash problem, but it is not

    TweetNaCL doesn't work as an ES6 module, it works by destructively
    updating the window namespace.  This I think was necessary before
    ES6, and that behavior is retained either because of laziness or
    because of backward compatibility reasons.

    hmm

    so this just plainly doesn't work and i cannot figure out why

        <script src="dist/jex_include/local-nacl-1.0.3/nacl.js"></script>

I think it works if I do it in the popup window instead. Let's try

oh no

no

oh my god

i am so stupid

the problem was that i typed the url wrong

the package is "tweetnacl" not "nacl", and i also need /dist/ too

    <script src="dist/jex_include/local-tweetnacl-1.0.3/dist/nacl.js"></script>

that works

all this time i thought that it was the browser that was mentally disabled

it turned out the mental disability was inside me all along

alright well I discovered a potential future pitfall at least
2023-07-26 17:21:17 -06:00
pharpend d41f29aa1f website 2023-07-26 15:19:41 -06:00
pharpend 12b5a01394 organizing vanillae website
index.html is *just* going to be an index. it will factor out everything to
links, but it will have *all* the links
2023-07-22 01:24:24 -06:00
pharpend 301030d3b8 Merge branch 'pharpend/sidekick-tx-sign-yesprop' into pharpend/develop 2023-07-20 14:38:12 -06:00
pharpend 6e1189a789 version bump sk/awcp/parasite to add tx_sign_yesprop
There is now an explicit function to have superhero sign the transaction *and*
propagate it into the network.  JR will simply reject these requests.
2023-07-20 14:34:19 -06:00
pharpend 50cac48f99 [wip] updating sidekick 2023-07-19 00:38:03 -06:00
pharpend ff8670d592 committing because switching branches 2023-07-18 14:48:23 -06:00
pharpend 19203cc003 have page script talking to controller 2023-07-14 20:53:35 -06:00
pharpend 984f562579 wrote out architecture rant in readme 2023-07-12 17:17:03 -06:00
pharpend 373d43dd8c committing because commitment is good 2023-07-09 21:01:54 -06:00
pharpend b76397b723 jr code cleanups 2023-07-09 15:03:53 -06:00
pharpend ef112d7da4 apparently github doesn't understand what hyperlinks are anymore 2023-07-08 23:02:26 -06:00
pharpend 49ce304ec5 add readme to vrlp, assertion about encode->decode roundtrip 2023-07-08 23:00:45 -06:00
pharpend 8f09c41676 doccing things 2023-07-06 23:59:30 -06:00
pharpend e408ba9b2a add vrlp tests 2023-07-06 19:52:40 -06:00
pharpend 180a395092 Merge branch 'master' into pharpend/develop 2023-07-06 11:14:00 -06:00
pharpend c900e16e02 Merge branch 'pharpend/develop' of github.com:aeternity/Vanillae into pharpend/develop 2023-07-06 11:13:26 -06:00
pharpend 472c97df62 add vanillae rlp lib 2023-07-06 11:13:20 -06:00
pharpend 754a3faf89 add vrlp project 2023-07-06 11:08:25 -06:00
pharpend 6c80c37efa bits more 2023-05-24 00:52:59 -06:00
pharpend 892c9cd9da Merge branch 'pharpend/develop' of github.com:aeternity/Vanillae into pharpend/develop 2023-04-30 14:38:09 -06:00
pharpend c432a32de8 update awcp version as sidekick dep, polishing docs 2023-04-30 01:45:14 -06:00
pharpend 478fcd123f trivial change to vb64 2023-04-28 18:44:52 -06:00
pharpend d79697a9c7 cleaning faert ts implementation 2023-04-28 18:44:29 -06:00
pharpend 662cdbd5de jrx prettification 2023-04-28 18:43:59 -06:00
pharpend a7ff4c5e2e add untested faert implementation 2023-04-21 18:30:59 -06:00
pharpend 261846aa7e move vanillae ts over here 2023-04-21 18:30:37 -06:00
pharpend abcd435d01 update docs readme 2023-04-06 19:50:21 -06:00
pharpend bd8c94f5a6 draft of keccak explainer is done 2023-04-02 02:09:44 -06:00
pharpend a2eedda9ab have everythinig except the coordinate system 2023-04-02 01:46:32 -06:00
pharpend 4efc812130 update toc again 2023-04-02 00:10:45 -06:00
pharpend 05124629d7 update toc 2023-04-02 00:06:54 -06:00
pharpend 8adf16ffd8 start toc 2023-04-02 00:05:46 -06:00
pharpend db6cffe92c wrote up rho step 2023-04-01 23:37:59 -06:00
pharpend ec0bb46eb7 add image 2023-03-30 01:37:40 -06:00
pharpend 40d033a7b9 significant chip at the the base N docs 2023-03-25 18:01:43 -06:00
pharpend 16e20a03ba more ecc 2023-03-11 19:51:17 -07:00
pharpend fe24698a34 start ecc explainer 2023-03-10 21:10:23 -07:00
pharpend 0a29489872 [wip] I need to think seriously about zod 2023-02-12 05:47:18 -07:00
pharpend 3ad5590d90 [wip] jr model 2023-02-07 21:50:28 -07:00
pharpend 548087cc85 [wip/broken] sidekick examples updating 2023-01-29 06:30:11 -07:00
pharpend aca416218d vw deompose ak function 2023-01-23 01:07:26 -07:00
pharpend cbe6d51eb9 have transitioned jr to typescript 2023-01-23 00:40:22 -07:00
pharpend da0fa03869 [wip] state management and keypair generation 2023-01-14 14:56:01 -07:00
pharpend 279bd888e3 [wip] getting keypair stuff to work 2023-01-10 18:28:20 -07:00
pharpend ad722f8954 turn off stupid erlang warnings about unused variables 2022-12-28 03:23:54 -07:00
pharpend b442a54cd2 awcp version bump 2022-12-28 03:23:19 -07:00
pharpend 75d6d89bdf jex detects and connects 2022-12-28 03:23:03 -07:00
pharpend ce4047f795 add bip39 files from Hans 2022-12-22 00:24:26 -07:00
pharpend c4f71c8b4d generating a keypair works 2022-12-20 21:13:24 -07:00
pharpend cbe487618c [wip] generating keypair with ec_utils copied from zx's github 2022-12-20 20:58:21 -07:00
pharpend 8cc46b6ac9 Merge branch 'pharpend/develop' of github.com:aeternity/Vanillae into pharpend/develop 2022-12-20 03:02:17 -07:00
pharpend 529cf078e1 jrx basics 2022-12-20 03:02:06 -07:00
pharpend 353eee7cd2 ignore something 2022-12-20 02:53:57 -07:00
pharpend 434ed02e83 package tweetnacl correctly 2022-12-20 02:53:05 -07:00
pharpend c8ddd77004 got echo pkg_type done
working on packaging nacl, need to branch based on package type
2022-12-19 22:23:00 -07:00
pharpend c6274c9ac8 [wip] sidekick version bump, documenting message signature verification 2022-11-30 22:30:38 -07:00
pharpend 3ddca3db2f ready for zx message sign demo 2022-11-27 00:12:15 -07:00
pharpend b9b06436af add a bunch of examples 2022-11-23 18:19:23 -07:00
pharpend 86d0501b90 [wip] playing around with maybe making tarballs 2022-11-20 19:49:45 -07:00
pharpend 083e159096 add jex mkdocs command 2022-11-20 16:23:53 -07:00
pharpend a3cc4cdddc [wip] add primitive message sign functionality 2022-11-18 18:23:02 -07:00
pharpend 9589adaef8 [wip] various inconsequential changes 2022-11-17 16:01:19 -07:00
pharpend ab2b816f88 [wip] initial vw commit 2022-11-16 15:13:20 -07:00
pharpend 045384420e tx humanization in erlang prototype 2022-11-08 13:15:23 -07:00
pharpend 900581bc23 [wip] templating vanillae ts tx deconstruction 2022-11-08 09:21:45 -07:00
pharpend 993ae4261b [wip] code cleanups 2022-11-06 12:24:49 -07:00
pharpend 127be10d03 [wip] code cleanups, making style uniform in vanillae ts 2022-11-06 12:20:45 -07:00
pharpend c21a4c42fe [wip] start work on api deconstructor 2022-10-26 08:52:11 -06:00
pharpend 64f9752ee5 wrote an encoder and it worked on the first try. wtf 2022-10-23 20:19:21 -06:00
pharpend 7751e71982 my ts rlp decoder seems to work
i feel like i would have more confidence in my code if i didn't test it
2022-10-23 06:41:19 -06:00
pharpend 2254c82f77 my erl rlp implementation agrees with ethereum python implementation for 59,638 random cases 2022-10-23 04:55:59 -06:00
pharpend 9701993e8b more python cases 2022-10-23 04:49:03 -06:00
pharpend 27eac056eb Generating tests for RLP Erlang (appears to work!)
Methodology:

- in Erlang, generate random DecodeData that are decentish (hard to generate
  because of arbitrary depth recursive nature)
- in Erlang, check that DecodeData->rlp:encode->rlp:decode is an identity (it
  is!)
- generate tons of encode/decode pairs for Python, make sure they all work
  (they do!)
2022-10-23 04:44:07 -06:00
pharpend ebf82a091c fix comment in b58.py 2022-10-23 04:43:56 -06:00
pharpend 3e86f27063 minor cleanups in rlp.erl 2022-10-23 04:43:35 -06:00
pharpend 427583e530 update notes 2022-10-21 20:37:13 -06:00
pharpend b826080c1b wrote an rlp implementation in erlang that seems to work
my current methodology for doing X

- find library that does X in Python with lots of stars on GitHub
- autogenerate test cases against Python library
- do X in Erlang to work out logic in easier setting
- make sure Erlang implementation works
- do X in TypeScript
- make sure TypeScript implementation works
2022-10-21 20:35:01 -06:00
pharpend c5afe1dd20 forgot to add the actual code 2022-10-21 05:57:09 -06:00
pharpend 3a9cd39046 my base58 encoder/decoder worked the first time and I'm scared 2022-10-21 05:54:08 -06:00
pharpend 9f65987ca2 base58 test generation in python 2022-10-21 05:17:04 -06:00
pharpend aa9b8b7339 [wip] add untested base58 encode in ts 2022-10-21 04:47:55 -06:00
pharpend 0e600f0f05 thinking about base58, fix some comments 2022-10-21 03:14:34 -06:00
pharpend c72088075d fix sidekick documentation error 2022-10-20 22:20:42 -06:00
pharpend 039d246d84 base64 encode/decode done and tested 2022-10-20 02:00:27 -06:00
pharpend 90d464040d add more cases 2022-10-19 22:01:29 -06:00
pharpend 584ffff507 it turns out that testing your code is a good idea
I found a bug in my base64 implementation

have started implementing a "test system"
2022-10-19 21:47:46 -06:00
pharpend 0f1a181c08 write out the rest of the encode cases 2022-10-19 03:17:49 -06:00
pharpend 7fe7e1cc2b improvements to vanillae documentation 2022-10-19 01:25:29 -06:00
pharpend 0e95fef840 [wip] start making vanillae js library
It compiles but there's some NYI functions

This is going to have all the common functions that we need all over the place

- base64 encode/decode
- base58 encode/decode
- rlp encode/decode
- transaction types
- transaction formation
- reading stuff from the transaction
- safe type
- (maybe) AWCP

This commit contains a refactored version of my prior base64 implementation,
which is more imperativey and less "trying to fit Erlang into TS".
2022-10-19 01:21:41 -06:00
pharpend ea95e59640 delete makefiles 2022-10-19 01:16:52 -06:00
pharpend 601ad6baa3 start writing a manual 2022-10-12 18:09:39 -06:00
pharpend a045704a33 add link in readme to npm thing 2022-10-12 01:21:34 -06:00
pharpend fd325e7723 add npm helper doc 2022-10-12 01:20:25 -06:00
pharpend 3367920371 improve sidekick README 2022-10-12 01:19:17 -06:00
pharpend 2d66768951 add jex dwim[-+] commands, and a README 2022-10-12 01:18:35 -06:00