Class: LocalECDSAKeySigner
The LocalKeySigner is a class that allows for signing data with the private key. It uses the secp256k1 curve implementation by the @noble/curves/secp256k1 library.
Example
import {
LocalECDSAKeySigner,
generateRandomPrivateKey,
} from '@nilfoundation/niljs';
const signer = new LocalECDSAKeySigner({
privateKey: generateRandomPrivateKey(),
});
Implements
Constructors
new LocalECDSAKeySigner()
new LocalECDSAKeySigner(config): LocalECDSAKeySigner
Creates an instance of LocalECDSAKeySigner.
Parameters
Parameter | Type | Description |
---|---|---|
| The config for the LocalECDSAKeySigner. See ILocalKeySignerConfig. |
Returns
Defined
@nilfoundation/niljs/src/signers/LocalECDSAKeySigner.ts:54
Methods
getAddress()
getAddress(shardId): Uint8Array
Retrieves the wallet address.
Parameters
Parameter | Type | Description |
---|---|---|
|
| The ID of the shard where the wallet is deployed. |
Returns
Uint8Array
The wallet address.
Implementation of
Defined
@nilfoundation/niljs/src/signers/LocalECDSAKeySigner.ts:109
getPublicKey()
getPublicKey(): Uint8Array
Retrieves the public key.
Returns
Uint8Array
The publc key of the signer.
Implementation of
Defined
@nilfoundation/niljs/src/signers/LocalECDSAKeySigner.ts:91
sign()
sign(data): Promise<any>
Signs the data.
Parameters
Parameter | Type | Description |
---|---|---|
|
| The input data. |
Returns
Promise
<any
>
The signed data.
Async
Implementation of
Defined
@nilfoundation/niljs/src/signers/LocalECDSAKeySigner.ts:74