-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add generate-secret-and-hash to cli (#7977)
- Loading branch information
Showing
2 changed files
with
23 additions
and
0 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
yarn-project/cli/src/cmds/misc/generate_secret_and_hash.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { computeSecretHash } from '@aztec/aztec.js'; | ||
import { Fr } from '@aztec/foundation/fields'; | ||
import { type LogFn } from '@aztec/foundation/log'; | ||
|
||
export function generateSecretAndHash(log: LogFn) { | ||
const secret = Fr.random(); | ||
|
||
// We hash this the same way that aztec nr hash does. | ||
const secretHash = computeSecretHash(secret); | ||
|
||
log(` | ||
Secret: ${secret} | ||
Secret hash: ${secretHash} | ||
`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters