Skip to content

Commit 6aa62da

Browse files
committed
uniquely name vector function
1 parent 5519cf6 commit 6aa62da

File tree

3 files changed

+4
-653
lines changed

3 files changed

+4
-653
lines changed

tests/Functions.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
use nostriphant\NIP01\Event;
66
use nostriphant\NIP01\Key;
77

8-
function vectors(string $name): object {
9-
return json_decode(file_get_contents(__DIR__ . '/vectors/' . $name . '.json'), false);
8+
function vectors_secp256k1(): object {
9+
return json_decode(file_get_contents(__DIR__ . '/vectors/ecdh-secp256k1.json'), false);
1010
}
1111

1212
function key(string $hex): Key {

tests/KeyTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
use nostriphant\NIP01\Key;
4-
use function \Pest\vectors;
4+
use function \Pest\vectors_secp256k1;
55

66
it('generates a public key without an argument', function() {
77
$private_key = Key::fromHex('435790f13406085d153b10bd9e00a9f977e637f10ce37db5ccfc5d3440c12d6c');
@@ -33,7 +33,7 @@
3333
// https://github.com/paulmillr/noble-secp256k1/blob/main/test/wycheproof/ecdh_secp256k1_test.json
3434
$secret = Key::fromHex($vector->private)(Key::sharedSecret(substr($vector->public, 46)));
3535
expect(str_pad($secret, 64, '0', STR_PAD_LEFT))->toBe($vector->shared);
36-
})->with(array_filter(vectors('ecdh-secp256k1')->testGroups[0]->tests, fn($vector) => $vector->result === 'valid'));
36+
})->with(array_filter(vectors_secp256k1()->testGroups[0]->tests, fn($vector) => $vector->result === 'valid'));
3737

3838
it('can sign a string and verify a signature', function () {
3939
$private_key = Key::fromHex('435790f13406085d153b10bd9e00a9f977e637f10ce37db5ccfc5d3440c12d6c');

0 commit comments

Comments
 (0)