Skip to content

Commit

Permalink
[enoki] fix decoding of ephemeral keypair secret (#16104)
Browse files Browse the repository at this point in the history
## Description 

Describe the changes or additions included in this PR.

## 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
hayes-mysten authored Feb 6, 2024
1 parent 80d0faf commit 33752da
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/breezy-ties-juggle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@mysten/enoki': patch
---

Fix decoding of ephemeral keypair secret
3 changes: 2 additions & 1 deletion sdk/enoki/src/EnokiFlow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

import type { SuiClient } from '@mysten/sui.js/client';
import { decodeSuiPrivateKey } from '@mysten/sui.js/cryptography';
import { Ed25519Keypair } from '@mysten/sui.js/keypairs/ed25519';
import type { TransactionBlock } from '@mysten/sui.js/transactions';
import { fromB64, toB64 } from '@mysten/sui.js/utils';
Expand Down Expand Up @@ -160,7 +161,7 @@ export class EnokiFlow {
expiresAt: estimatedExpiration,
maxEpoch,
randomness,
ephemeralKeyPair: ephemeralKeyPair.export().privateKey,
ephemeralKeyPair: toB64(decodeSuiPrivateKey(ephemeralKeyPair.getSecretKey()).secretKey),
});

return oauthUrl;
Expand Down

0 comments on commit 33752da

Please sign in to comment.