This repository has been archived by the owner on Jan 13, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 919
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add createKeyPairFromPrivateKeyBytes helper
- Loading branch information
1 parent
526072b
commit f180911
Showing
5 changed files
with
90 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
'@solana/keys': patch | ||
--- | ||
|
||
Add a `createKeyPairFromPrivateKeyBytes` helper that creates a keypair from the 32-byte private key bytes. | ||
|
||
```ts | ||
import { createKeyPairFromPrivateKeyBytes } from '@solana/keys'; | ||
|
||
const { privateKey, publicKey } = await createKeyPairFromPrivateKeyBytes(new Uint8Array([...])); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
import { ReadonlyUint8Array } from '@solana/codecs-core'; | ||
|
||
import { createKeyPairFromBytes } from '../key-pair'; | ||
import { createKeyPairFromBytes, createKeyPairFromPrivateKeyBytes } from '../key-pair'; | ||
|
||
createKeyPairFromBytes(new Uint8Array()) satisfies Promise<CryptoKeyPair>; | ||
createKeyPairFromBytes(new Uint8Array() as ReadonlyUint8Array) satisfies Promise<CryptoKeyPair>; | ||
createKeyPairFromBytes(new Uint8Array(), true) satisfies Promise<CryptoKeyPair>; | ||
|
||
createKeyPairFromPrivateKeyBytes(new Uint8Array()) satisfies Promise<CryptoKeyPair>; | ||
createKeyPairFromPrivateKeyBytes(new Uint8Array() as ReadonlyUint8Array) satisfies Promise<CryptoKeyPair>; | ||
createKeyPairFromPrivateKeyBytes(new Uint8Array(), true) satisfies Promise<CryptoKeyPair>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters