Skip to content

Commit

Permalink
Add missing network param to EnokiFlow (MystenLabs#17070)
Browse files Browse the repository at this point in the history
## Description 

This was missing from the `EnokiFlow` APIs, adding in a couple places to
fix this.

## Test Plan 

How did you test the new or updated feature?

---
If your changes are not user-facing and do not break anything, you can
skip the following section. Otherwise, please briefly describe what has
changed under the Release Notes section.

### Type of Change (Check all that apply)

- [ ] protocol change
- [ ] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [ ] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration

### Release notes
  • Loading branch information
Jordan-Mysten authored Apr 5, 2024
1 parent 0c595fd commit 9a1406a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/sweet-gorillas-remember.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@mysten/enoki': patch
---

Add missing network param to enokiflow
5 changes: 4 additions & 1 deletion sdk/enoki/src/EnokiFlow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,13 @@ export class EnokiFlow {
provider: AuthProvider;
clientId: string;
redirectUrl: string;
network?: 'mainnet' | 'testnet' | 'devnet';
extraParams?: Record<string, unknown>;
}) {
const ephemeralKeyPair = new Ed25519Keypair();
const { nonce, randomness, maxEpoch, estimatedExpiration } =
await this.#enokiClient.createZkLoginNonce({
network: input.network,
ephemeralPublicKey: ephemeralKeyPair.getPublicKey(),
});

Expand Down Expand Up @@ -255,7 +257,7 @@ export class EnokiFlow {
}

// TODO: Should this return the proof if it already exists?
async getProof() {
async getProof({ network }: { network?: 'mainnet' | 'testnet' } = {}) {
const zkp = await this.getSession();
const { salt } = this.$zkLoginState.get();

Expand All @@ -274,6 +276,7 @@ export class EnokiFlow {
const ephemeralKeyPair = Ed25519Keypair.fromSecretKey(fromB64(zkp.ephemeralKeyPair));

const proof = await this.#enokiClient.createZkLoginZkp({
network,
jwt: zkp.jwt,
maxEpoch: zkp.maxEpoch,
randomness: zkp.randomness,
Expand Down

0 comments on commit 9a1406a

Please sign in to comment.