altcha-lib 0.3.0 → 0.4.0
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 +16 -0
- package/cjs/dist/helpers.d.ts +0 -1
- package/cjs/dist/helpers.js +0 -2
- package/dist/helpers.d.ts +0 -1
- package/dist/helpers.js +0 -2
- package/package.json +1 -1
- package/cjs/dist/crypto.d.ts +0 -1
- package/cjs/dist/crypto.js +0 -6
- package/dist/crypto.d.ts +0 -1
- package/dist/crypto.js +0 -5
package/README.md
CHANGED
|
@@ -28,6 +28,22 @@ const challenge = await createChallenge({
|
|
|
28
28
|
const ok = await verifySolution(payload, hmacKey);
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
+
### Usage with Node.js 16
|
|
32
|
+
|
|
33
|
+
In Node.js version 16, there is no global reference to crypto by default. To use this library, you need to add the following code to your codebase:
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
globalThis.crypto = require('node:crypto').webcrypto;
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Or with `import` syntax:
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import { webcrypto } from 'node:crypto';
|
|
43
|
+
|
|
44
|
+
globalThis.crypto = webcrypto;
|
|
45
|
+
```
|
|
46
|
+
|
|
31
47
|
## API
|
|
32
48
|
|
|
33
49
|
### `createChallenge(options)`
|
package/cjs/dist/helpers.d.ts
CHANGED
package/cjs/dist/helpers.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.randomInt = exports.randomBytes = exports.hmacHex = exports.hmac = exports.hashHex = exports.hash = exports.ab2hex = exports.encoder = void 0;
|
|
4
|
-
// @denoify-line-ignore
|
|
5
|
-
require("./crypto.js");
|
|
6
4
|
exports.encoder = new TextEncoder();
|
|
7
5
|
function ab2hex(ab) {
|
|
8
6
|
return [...new Uint8Array(ab)]
|
package/dist/helpers.d.ts
CHANGED
package/dist/helpers.js
CHANGED
package/package.json
CHANGED
package/cjs/dist/crypto.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/cjs/dist/crypto.js
DELETED
package/dist/crypto.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|