Skip to content

Commit cd165d6

Browse files
committed
readme
1 parent 6c2e644 commit cd165d6

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,16 @@ import * as secp from '@noble/secp256k1';
4848
const msg = new TextEncoder().encode('hello noble');
4949
const sig = await secp.signAsync(msg, secretKey);
5050
const isValid = await secp.verifyAsync(sig, msg, publicKey);
51+
})();
52+
53+
// ECDH, key recovery
54+
(async () => {
55+
const alice = secp.keygen();
56+
const bob = secp.keygen();
57+
const shared = secp.getSharedSecret(alice.secretKey, bob.publicKey);
5158

52-
const bobsKeys = secp.keygen();
53-
const shared = secp.getSharedSecret(secretKey, bobsKeys.publicKey); // Diffie-Hellman
54-
const sigr = await secp.signAsync(msg, secretKey, { format: 'recovered' });
59+
// recovery
60+
const sigr = await secp.signAsync(msg, alice.secretKey, { format: 'recovered' });
5561
const publicKey2 = secp.recoverPublicKey(sigr, msg);
5662
})();
5763

@@ -309,7 +315,7 @@ Use low-level libraries & languages.
309315
For this package, there are 0 dependencies; and a few dev dependencies:
310316

311317
- [noble-hashes](https://github.com/paulmillr/noble-hashes) provides cryptographic hashing functionality
312-
- micro-bmark, micro-should and jsbt are used for benchmarking / testing / build tooling and developed by the same author
318+
- jsbt is used for benchmarking / testing / build tooling and developed by the same author
313319
- prettier, fast-check and typescript are used for code quality / test generation / ts compilation. It's hard to audit their source code thoroughly and fully because of their size
314320

315321
### Randomness

0 commit comments

Comments
 (0)