Skip to content

Commit

Permalink
feat(identity): export point and signature types (#886)
Browse files Browse the repository at this point in the history
* feat(identity): export point and signature types

re #885

* docs(identity): add the generate commitment function to the readme file
  • Loading branch information
vplasencia authored Oct 28, 2024
1 parent fadcf19 commit 58132a9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
8 changes: 8 additions & 0 deletions packages/identity/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
```
5 changes: 4 additions & 1 deletion packages/identity/src/index.ts
Original file line number Diff line number Diff line change
@@ -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}
Expand Down

0 comments on commit 58132a9

Please sign in to comment.