You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: xmldsig/js/README.md
+25-7
Original file line number
Diff line number
Diff line change
@@ -7,32 +7,50 @@ demonstration on how to verify xmldsig with JavaScript code.
7
7
8
8
First, make sure your nodejs is above version 15.0.0 where [WebCrypto was introduced](https://www.nearform.com/blog/implementing-the-web-cryptography-api-for-node-js-core/)
9
9
10
-
Then, install the dependencies
10
+
Then, install the dependencies in the `src` directory:
11
11
12
12
````
13
-
$ npm install
13
+
src$ npm install
14
14
````
15
15
16
-
Finally, apply an xmldom patch for [a known bug](https://github.com/xmldom/xmldom/issues/203). Note that this patch is destructive, the resulting xmldom won't work properly on html files (which we don't use in our case). Such a patch will not be needed (hence will be deleted from this repo) when xmldom release the next version after 0.5.0.
16
+
Finally, also in `src`, apply an xmldom patch for [a known bug](https://github.com/xmldom/xmldom/issues/203). Note that this patch is destructive, the resulting xmldom won't work properly on html files (which we don't use in our case). Such a patch will not be needed (hence will be deleted from this repo) when xmldom release the next version after 0.5.0.
17
17
18
18
````
19
-
$ patch -p0 < xmldom.patch
19
+
src$ patch -p0 < xmldom.patch
20
20
````
21
21
22
22
## Test ##
23
23
24
24
Let's say you have a bunch of signed TokenScripts residing in `../../../TokenScript-Repo/aw.app/2020/06/` (which you can get by checking out [TokenScript-Repo](https://github.com/AlphaWallet/TokenScript-Repo)). Run the files through the `xmldsigverifier.js` script:
[ OK ] ../../../TokenScript-Repo/aw.app/2020/06/aDAI.tsml
29
29
[ OK ] ../../../TokenScript-Repo/aw.app/2020/06/cBAT.tsml
30
30
…
31
31
[ OK ] ../../../TokenScript-Repo/aw.app/2020/06/WETH.tsml
32
32
````
33
33
34
+
## Creating a webpack ##
35
+
36
+
Somehow webpack version >5 requires further configuration which hasn't been done, so make sure you use an earlier version of webpack, such as 4.44.2. Run `webpack` at this level, that is, not under `src` directory:
37
+
38
+
39
+
````
40
+
$ webpack
41
+
Hash: 5f6510c90828ac124c4f
42
+
Version: webpack 4.44.2
43
+
Time: 8110ms
44
+
Built at: 08/04/2021 11:31:47
45
+
Asset Size Chunks Chunk Names
46
+
main.js 1.1 MiB 0 [emitted] [big] main
47
+
Entrypoint main [big] = main.js
48
+
````
49
+
50
+
The resulting file should be `dist/main.js`.
51
+
34
52
## Work in progress ##
35
53
36
-
-Because this signature verifier doesn't check the certificates, the result is not an indication whether or not the TokenScript is signed with the correct key. More work needs to be done to use it in production environment.
54
+
-It currently fails with ECDSA signatures.
37
55
38
-
-A version that can run in the web browser is needed.
56
+
-Because this signature verifier doesn't check the certificates, the result is not an indication whether or not the TokenScript is signed with the correct key. More work needs to be done to use it in production environment.
0 commit comments