-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathed25519.test.js
35 lines (30 loc) · 898 Bytes
/
ed25519.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
* Copyright (c) 2021-2022, Alden Torres
*
* Licensed under the terms of the MIT license.
* Copy of the license at https://opensource.org/licenses/MIT
*/
import libecc_module from "./libecc.js";
import assert from "assert";
import {
bin2hex,
hex2bin,
} from "./util.js";
describe("ecc_ed25519_random", () => {
it("generates a random valid point", async () => {
const libecc = await libecc_module();
let p = new Uint8Array(32);
libecc.ecc_ed25519_random(p);
let r = libecc.ecc_ed25519_is_valid_point(p);
assert.ok(r);
});
});
describe("ecc_ed25519_is_valid_point", () => {
it("test a random valid point", async () => {
const libecc = await libecc_module();
let p = new Uint8Array(32);
libecc.ecc_ed25519_random(p);
let r = libecc.ecc_ed25519_is_valid_point(p);
assert.ok(r);
});
});