From 58132a9478a857dd9cf635f9dc159ee41a364505 Mon Sep 17 00:00:00 2001 From: Vivian Plasencia Date: Mon, 28 Oct 2024 13:29:03 +0100 Subject: [PATCH] feat(identity): export point and signature types (#886) * feat(identity): export point and signature types re #885 * docs(identity): add the generate commitment function to the readme file --- packages/identity/README.md | 8 ++++++++ packages/identity/src/index.ts | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) 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}