Skip to main content

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

ParameterTypeDescription

config

ILocalKeySignerConfig

The config for the LocalECDSAKeySigner. See ILocalKeySignerConfig.

Returns

LocalECDSAKeySigner

Defined

@nilfoundation/niljs/src/signers/LocalECDSAKeySigner.ts:54

Methods

getAddress()

getAddress(shardId): Promise<Uint8Array>

Retrieves the wallet address.

Parameters

ParameterTypeDescription

shardId

number

The ID of the shard where the wallet is deployed.

Returns

Promise<Uint8Array>

The wallet address.

Async

Implementation of

ISigner.getAddress

Defined

@nilfoundation/niljs/src/signers/LocalECDSAKeySigner.ts:116


getPublicKey()

getPublicKey(): Promise<Uint8Array>

Retrieves the public key.

Returns

Promise<Uint8Array>

The publc key of the signer.

Async

Implementation of

ISigner.getPublicKey

Defined

@nilfoundation/niljs/src/signers/LocalECDSAKeySigner.ts:97


sign()

sign(data): Promise<Uint8Array>

Signs the data.

Parameters

ParameterTypeDescription

data

Uint8Array

The input data.

Returns

Promise<Uint8Array>

The signed data.

Async

Implementation of

ISigner.sign

Defined

@nilfoundation/niljs/src/signers/LocalECDSAKeySigner.ts:79