Skip to content

Commit c8da0dc

Browse files
committed
refactor(heyauthn): update tests and doc
1 parent 2b05a94 commit c8da0dc

File tree

5 files changed

+10
-15
lines changed

5 files changed

+10
-15
lines changed

packages/heyauthn/README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,13 @@ import { Group } from "@semaphore-protocol/group"
101101
import { generateProof } from "@semaphore-protocol/proof"
102102
import { utils } from "ethers"
103103

104-
const group = new Group("42")
104+
const group = new Group()
105105

106106
group.addMembers(memberList)
107107

108-
const signal = utils.formatBytes32String("Hey anon!")
108+
const message = utils.formatBytes32String("Hey anon!")
109109

110-
generateProof(identity, group, group.id, "42", {
111-
zkeyFilePath: "./semaphore.zkey",
112-
wasmFilePath: "./semaphore.wasm"
113-
})
110+
generateProof(identity, group, message, group.root)
114111
```
115112

116113
## Authors
File renamed without changes.

packages/heyauthn/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Identity } from "@semaphore-protocol/identity"
22
import { GenerateAuthenticationOptionsOpts, GenerateRegistrationOptionsOpts } from "@simplewebauthn/server"
3-
import HeyAuthn from "./heyAuthn"
3+
import HeyAuthn from "./hey-authn"
44

55
export {
66
HeyAuthn,

packages/heyauthn/src/heyAuthn.test.ts renamed to packages/heyauthn/tests/index.test.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
GenerateRegistrationOptionsOpts as RegistrationOptions
55
} from "@simplewebauthn/server"
66

7-
import HeyAuthn from "./heyAuthn"
7+
import { HeyAuthn } from "../src"
88

99
jest.mock("@simplewebauthn/browser", () => ({
1010
startRegistration: async () => ({
@@ -52,9 +52,8 @@ describe("HeyAuthn", () => {
5252
const { identity } = await HeyAuthn.fromRegister(options)
5353
const expectedIdentity = new Identity("my-new-credential")
5454

55-
expect(expectedIdentity.trapdoor).toEqual(identity.trapdoor)
56-
expect(expectedIdentity.nullifier).toEqual(identity.nullifier)
57-
expect(expectedIdentity.commitment).toEqual(identity.commitment)
55+
expect(identity.secretScalar).toEqual(expectedIdentity.secretScalar)
56+
expect(identity.commitment).toEqual(expectedIdentity.commitment)
5857
})
5958
})
6059

@@ -67,9 +66,8 @@ describe("HeyAuthn", () => {
6766
const { identity } = await HeyAuthn.fromAuthenticate(options)
6867
const expectedIdentity = new Identity("my-existing-credential")
6968

70-
expect(expectedIdentity.trapdoor).toEqual(identity.trapdoor)
71-
expect(expectedIdentity.nullifier).toEqual(identity.nullifier)
72-
expect(expectedIdentity.commitment).toEqual(identity.commitment)
69+
expect(identity.secretScalar).toEqual(expectedIdentity.secretScalar)
70+
expect(identity.commitment).toEqual(expectedIdentity.commitment)
7371
})
7472
})
7573
})

packages/heyauthn/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"extends": "../../tsconfig.json",
3-
"include": ["src", "rollup.config.ts"]
3+
"include": ["src", "tests", "rollup.config.ts"]
44
}

0 commit comments

Comments
 (0)