@zeroad.network/token 0.13.3 → 0.13.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Introduction
|
|
2
2
|
|
|
3
|
-
This NPM module is meant to be used by sites
|
|
3
|
+
This NPM module is meant to be used by sites participating in [Zero Ad Network](https://zeroad.network) program, that are running in either Node.js, Bun or Deno runtimes. The `@zeroad.network/token` module is a lightweight, TypeScript ready, fully open source, well tested and has no production dependencies.
|
|
4
4
|
|
|
5
5
|
You will find the official Zero Ad Network documentation at [docs.zeroad.network](https://docs.zeroad.network). Up-to-date and in depth guides, how-to's and platform implementation details can be found there.
|
|
6
6
|
|
|
@@ -29,10 +29,10 @@ It helps partnered site developer to:
|
|
|
29
29
|
|
|
30
30
|
## Implementation details
|
|
31
31
|
|
|
32
|
-
The
|
|
32
|
+
The module uses the `node:crypto` runtime module to ensure the user's Request Header payload is valid by verifying its signature for the payload using Zero Ad Network's public ED25519 cryptographic key which is supplied within the module. Then:
|
|
33
33
|
|
|
34
34
|
- User's token payload is decoded and token's protocol version, expiration timestamp and site's feature list are extracted.
|
|
35
|
-
- A map of site's features and their toggle states is generated.
|
|
35
|
+
- A map of the site's features and their toggle states is generated.
|
|
36
36
|
- An expired token will produce a feature list with all flags being set to `false`.
|
|
37
37
|
|
|
38
38
|
Parsed token result example:
|
|
@@ -47,11 +47,11 @@ Parsed token result example:
|
|
|
47
47
|
};
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
User's token payload verification is done locally
|
|
50
|
+
User's token payload verification is done locally within your app and no data leaves your server.
|
|
51
51
|
|
|
52
52
|
When a token is present, parsing and token integrity verification will roughly add between `0.06ms` to `0.6ms` to the total endpoint execution time (as per testing done on a M1 MacBook Pro). Your mileage will vary depending on your hardware, but the impact should stay minimal.
|
|
53
53
|
|
|
54
|
-
As per our exploratory test results in attempts to cache token and its parsed results in Redis - it takes longer to retrieve the cached result than to verify token payload integrity.
|
|
54
|
+
As per our exploratory test results in attempts to cache the token and its parsed results in Redis - it takes longer to retrieve the cached result than to verify token payload integrity.
|
|
55
55
|
|
|
56
56
|
## Why to join
|
|
57
57
|
|
|
@@ -63,7 +63,7 @@ With every new site joining us, it becomes easier to reshape the internet closer
|
|
|
63
63
|
|
|
64
64
|
To register your site, [sign up](https://zeroad.network/login) with Zero Ad Network and [register your site](https://zeroad.network/publisher/sites/add). On the second step of the Site registration process you'll be provided with your unique `X-Better-Web-Welcome` header value.
|
|
65
65
|
|
|
66
|
-
If you decide for your site to participate in Zero Ad Network program, then it must respond with this header at all times on every publicly accessible endpoint containing HTML or RESTful response. When Zero Ad Network users visit your site, this allows their browser extension to know your site is participating in the program.
|
|
66
|
+
If you decide for your site to participate in the Zero Ad Network program, then it must respond with this header at all times on every publicly accessible endpoint containing HTML or RESTful response. When Zero Ad Network users visit your site, this allows their browser extension to know your site is participating in the program.
|
|
67
67
|
|
|
68
68
|
## Module installation
|
|
69
69
|
|