Skip to content

Commit

Permalink
docs(identity): add export import identity to the docs (#887)
Browse files Browse the repository at this point in the history
re #872
  • Loading branch information
vplasencia authored Oct 28, 2024
1 parent 58132a9 commit 376cd11
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions apps/docs/versioned_docs/version-V4/guides/identities.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,33 @@ After a message is signed, anyone can verify the signature using the message its
// Static method.
Identity.verifySignature(message, signature, identity1.publicKey)
```

## Export and import an identity

A Semaphore Identity can be exported and then imported later for reuse.

### Export an identity

Returns the private key encoded as a base64 string.

```ts
import { Identity } from "@semaphore-protocol/identity"

const identity = new Identity()

const privateKey = identity.export()
```

### Import an identity

Returns a Semaphore identity based on a private key encoded as a base64 string.

```ts
import { Identity } from "@semaphore-protocol/identity"

const identity = new Identity()

const privateKey = identity.export()

const identity2 = Identity.import(privateKey)
```

0 comments on commit 376cd11

Please sign in to comment.