Skip to content

Commit

Permalink
license file
Browse files Browse the repository at this point in the history
  • Loading branch information
ovx committed Nov 27, 2023
1 parent 97f532b commit 156d3de
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 12 deletions.
21 changes: 21 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Daniel Regeci

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

ALTCHA uses a proof-of-work mechanism to protect your website, APIs, and online services from spam and abuse. Unlike other solutions, ALTCHA is self-hosted, does not use cookies nor fingerprinting, does not track users, and is fully compliant with GDPR.

https://altcha.org

## Benefits

- __Friction-less__ - Using PoW instead of visual puzzles.
Expand Down Expand Up @@ -38,29 +40,29 @@ See [server documentation](https://altcha.org/docs/server-integration) for more

## Configuration

Main options:
Required options (at least one is required):

- __challengeurl__ - The URL of your server, where to fetch the challenge from. See [server integration](/docs/server-integration).
- __challengejson__ - The JSON-encoded challenge. If you don't want to make an HTTP request to `challengeurl`, provide the data here instead.
- __challengeurl__ - URL of your server to fetch the challenge from. Refer to [server integration](/docs/server-integration).
- __challengejson__ - JSON-encoded challenge data. If avoiding an HTTP request to `challengeurl`, provide the data here.

Customization options:
Additional options:

- __hidefooter__ - Hide the footer (ALTCHA link).
- __hidelogo__ - Hide the ALTCHA logo.
- __maxnumber__ - Max. number to iterate to (defaults to 10,000,000).
- __name__ - The name of the hidden field containing payload (defaults to "altcha").
- __strings__ - JSON-encoded translation strings. See [customization](/docs/widget-customization).
- __maxnumber__ - The max. number to iterate to (defaults to 10,000,000).
- __name__ - The name of the hidden field containing the payload (defaults to "altcha").
- __strings__ - JSON-encoded translation strings. Refer to [customization](/docs/widget-customization).

Development / testing options:

- __debug__ - Print log messages into the console.
- __debug__ - Print log messages in the console.
- __mockerror__ - Causes the verification to always fail with a "mock" error.
- __test__ - This option will make the widget generate its own "mock" challenge, thus __not__ making the request to the `challengeurl`.
- __test__ - Generates a "mock" challenge within the widget, bypassing the request to `challengeurl`.

Events:

- __statechange__ - triggers whenever an internal `state` changes.
- __verified__ - triggers when the challenge is verified.
- __statechange__ - Triggers whenever an internal `state` changes.
- __verified__ - Triggers when the challenge is verified.

Using events:

Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"name": "altcha",
"version": "0.1.0",
"license": "MIT",
"author": {
"name": "Daniel Regeci; BAU Software s.r.o."
},
"homepage": "https://github.com/altcha-org/altchajs",
"repository": {
"type": "git",
Expand Down
3 changes: 2 additions & 1 deletion src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ export function ab2hex(ab: ArrayBuffer) {

export async function createTestChallenge(max: number = 1e5, algorithm: string = 'SHA-256') {
const salt = Date.now().toString(16);
const challenge = await hashChallenge(salt, Math.round(Math.random() * max), algorithm);
const num = Math.round(Math.random() * max);
const challenge = await hashChallenge(salt, num, algorithm);
return {
algorithm,
challenge,
Expand Down

0 comments on commit 156d3de

Please sign in to comment.