diff --git a/packages/identity/README.md b/packages/identity/README.md index 737e9a674..dc582dc75 100644 --- a/packages/identity/README.md +++ b/packages/identity/README.md @@ -129,3 +129,11 @@ const signature = identity.signMessage(message) Identity.verifySignature(message, signature, identity.publicKey) ``` + +\# **Identity.generateCommitment**(publicKey: _Point_): _bigint_ + +```typescript +import { Identity } from "@semaphore-protocol/identity" + +Identity.generateCommitment(identity.publicKey) +``` diff --git a/packages/identity/src/index.ts b/packages/identity/src/index.ts index 13b443ded..480bf6511 100644 --- a/packages/identity/src/index.ts +++ b/packages/identity/src/index.ts @@ -1,10 +1,13 @@ import type { Point } from "@zk-kit/baby-jubjub" -import { EdDSAPoseidon, Signature, signMessage, verifySignature } from "@zk-kit/eddsa-poseidon" +import { EdDSAPoseidon, type Signature, signMessage, verifySignature } from "@zk-kit/eddsa-poseidon" import type { BigNumberish } from "@zk-kit/utils" import { base64ToBuffer, bufferToBase64, textToBase64 } from "@zk-kit/utils/conversions" import { isString } from "@zk-kit/utils/type-checks" import { poseidon2 } from "poseidon-lite/poseidon2" +export type { Point } +export type { Signature } + /** * The Semaphore identity is essentially an {@link https://www.rfc-editor.org/rfc/rfc8032 | EdDSA} * public/private key pair. The {@link https://github.com/privacy-scaling-explorations/zk-kit/tree/main/packages/eddsa-poseidon | EdDSA implementation}