@solana/signers
Advanced tools
Comparing version 2.0.0-rc.0 to 2.0.0-rc.1
@@ -25,2 +25,4 @@ import { Address } from '@solana/addresses'; | ||
export declare function createKeyPairSignerFromBytes(bytes: ReadonlyUint8Array, extractable?: boolean): Promise<KeyPairSigner>; | ||
/** Creates a signer capable of signing messages and transactions using the 32 bytes of a private key. */ | ||
export declare function createKeyPairSignerFromPrivateKeyBytes(bytes: ReadonlyUint8Array, extractable?: boolean): Promise<KeyPairSigner>; | ||
//# sourceMappingURL=keypair-signer.d.ts.map |
{ | ||
"name": "@solana/signers", | ||
"version": "2.0.0-rc.0", | ||
"version": "2.0.0-rc.1", | ||
"description": "An abstraction layer over signing messages and transactions in Solana", | ||
@@ -52,9 +52,9 @@ "exports": { | ||
"dependencies": { | ||
"@solana/addresses": "2.0.0-rc.0", | ||
"@solana/codecs-core": "2.0.0-rc.0", | ||
"@solana/errors": "2.0.0-rc.0", | ||
"@solana/instructions": "2.0.0-rc.0", | ||
"@solana/keys": "2.0.0-rc.0", | ||
"@solana/transaction-messages": "2.0.0-rc.0", | ||
"@solana/transactions": "2.0.0-rc.0" | ||
"@solana/codecs-core": "2.0.0-rc.1", | ||
"@solana/addresses": "2.0.0-rc.1", | ||
"@solana/errors": "2.0.0-rc.1", | ||
"@solana/instructions": "2.0.0-rc.1", | ||
"@solana/transaction-messages": "2.0.0-rc.1", | ||
"@solana/keys": "2.0.0-rc.1", | ||
"@solana/transactions": "2.0.0-rc.1" | ||
}, | ||
@@ -61,0 +61,0 @@ "peerDependencies": { |
@@ -9,5 +9,5 @@ [![npm][npm-image]][npm-url] | ||
[code-style-prettier-url]: https://github.com/prettier/prettier | ||
[npm-downloads-image]: https://img.shields.io/npm/dm/@solana/signers/experimental.svg?style=flat | ||
[npm-image]: https://img.shields.io/npm/v/@solana/signers/experimental.svg?style=flat | ||
[npm-url]: https://www.npmjs.com/package/@solana/signers/v/experimental | ||
[npm-downloads-image]: https://img.shields.io/npm/dm/@solana/signers/rc.svg?style=flat | ||
[npm-image]: https://img.shields.io/npm/v/@solana/signers/rc.svg?style=flat | ||
[npm-url]: https://www.npmjs.com/package/@solana/signers/v/rc | ||
[semantic-release-image]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg | ||
@@ -18,3 +18,3 @@ [semantic-release-url]: https://github.com/semantic-release/semantic-release | ||
This package provides an abstraction layer over signing messages and transactions in Solana. It can be used standalone, but it is also exported as part of the Solana JavaScript SDK [`@solana/web3.js@experimental`](https://github.com/solana-labs/solana-web3.js/tree/master/packages/library). | ||
This package provides an abstraction layer over signing messages and transactions in Solana. It can be used standalone, but it is also exported as part of the Solana JavaScript SDK [`@solana/web3.js@rc`](https://github.com/solana-labs/solana-web3.js/tree/master/packages/library). | ||
@@ -321,2 +321,32 @@ You can think of signers as an abstract way to sign messages and transactions. This could be using a Crypto KeyPair, a wallet adapter in the browser, a Noop signer for testing purposes, or anything you want. Here's an example using a `CryptoKeyPair` signer: | ||
#### `createKeyPairSignerFromBytes()` | ||
A convenience function that creates a new KeyPair from a 64-bytes `Uint8Array` secret key and immediately creates a `KeyPairSigner` from it. | ||
```ts | ||
import fs from 'fs'; | ||
import { createKeyPairFromBytes } from '@solana/keys'; | ||
// Get bytes from local keypair file. | ||
const keypairFile = fs.readFileSync('~/.config/solana/id.json'); | ||
const keypairBytes = new Uint8Array(JSON.parse(keypairFile.toString())); | ||
// Create a KeyPairSigner from the bytes. | ||
const { privateKey, publicKey } = await createKeyPairSignerFromBytes(keypairBytes); | ||
``` | ||
#### `createKeyPairSignerFromPrivateKeyBytes()` | ||
A convenience function that creates a new KeyPair from a 32-bytes `Uint8Array` private key and immediately creates a `KeyPairSigner` from it. | ||
```ts | ||
import { getUtf8Encoder } from '@solana/codecs-strings'; | ||
import { createKeyPairFromPrivateKeyBytes } from '@solana/keys'; | ||
const message = getUtf8Encoder().encode('Hello, World!'); | ||
const seed = new Uint8Array(await crypto.subtle.digest('SHA-256', message)); | ||
const derivedSigner = await createKeyPairSignerFromPrivateKeyBytes(seed); | ||
``` | ||
#### `isKeyPairSigner()` | ||
@@ -323,0 +353,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
402119
1949
603
+ Added@solana/addresses@2.0.0-rc.1(transitive)
+ Added@solana/assertions@2.0.0-rc.1(transitive)
+ Added@solana/codecs-core@2.0.0-rc.1(transitive)
+ Added@solana/codecs-data-structures@2.0.0-rc.1(transitive)
+ Added@solana/codecs-numbers@2.0.0-rc.1(transitive)
+ Added@solana/codecs-strings@2.0.0-rc.1(transitive)
+ Added@solana/errors@2.0.0-rc.1(transitive)
+ Added@solana/functional@2.0.0-rc.1(transitive)
+ Added@solana/instructions@2.0.0-rc.1(transitive)
+ Added@solana/keys@2.0.0-rc.1(transitive)
+ Added@solana/rpc-types@2.0.0-rc.1(transitive)
+ Added@solana/transaction-messages@2.0.0-rc.1(transitive)
+ Added@solana/transactions@2.0.0-rc.1(transitive)
- Removed@solana/addresses@2.0.0-rc.0(transitive)
- Removed@solana/assertions@2.0.0-rc.0(transitive)
- Removed@solana/codecs-core@2.0.0-rc.0(transitive)
- Removed@solana/codecs-data-structures@2.0.0-rc.0(transitive)
- Removed@solana/codecs-numbers@2.0.0-rc.0(transitive)
- Removed@solana/codecs-strings@2.0.0-rc.0(transitive)
- Removed@solana/errors@2.0.0-rc.0(transitive)
- Removed@solana/functional@2.0.0-rc.0(transitive)
- Removed@solana/instructions@2.0.0-rc.0(transitive)
- Removed@solana/keys@2.0.0-rc.0(transitive)
- Removed@solana/rpc-types@2.0.0-rc.0(transitive)
- Removed@solana/transaction-messages@2.0.0-rc.0(transitive)
- Removed@solana/transactions@2.0.0-rc.0(transitive)
Updated@solana/addresses@2.0.0-rc.1
Updated@solana/errors@2.0.0-rc.1
Updated@solana/keys@2.0.0-rc.1