Skip to content

Commit

Permalink
Reformat example code
Browse files Browse the repository at this point in the history
  • Loading branch information
mariano-perez-rodriguez committed Aug 13, 2024
1 parent 853cf3f commit 5be0b9f
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions assets/docs/nip-XX-1/appendix-a.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,7 @@ A TypeScript reference implementation of exactly _how_ this is done is given bel

```typescript
import { mod } from "@noble/curves/abstract/modular";
import {
bytesToHex,
numberToBytesBE,
bytesToNumberBE,
} from "@noble/curves/abstract/utils";
import { bytesToHex, numberToBytesBE, bytesToNumberBE, } from "@noble/curves/abstract/utils";
import { secp256k1, schnorr } from "@noble/curves/secp256k1";
import { hkdf } from "@noble/hashes/hkdf";
import { sha256 } from "@noble/hashes/sha256";
Expand All @@ -62,8 +58,7 @@ function buildPredefinedDependencyEvent(predefinedName: string): object {

const encoder: TextEncoder = new TextEncoder();
const privkey: Uint8Array = numberToBytesBE(
// re-implement @noble/curves/abstract/modular.hashToPrivateScalar
// without the annoying deprecation notice
// re-implement @noble/curves/abstract/modular.hashToPrivateScalar without the annoying deprecation notice
mod(
bytesToNumberBE(hkdf(sha256, encoder.encode(predefinedName), undefined, undefined, 48)),
secp256k1.CURVE.n - 1n,
Expand Down

0 comments on commit 5be0b9f

Please sign in to comment.