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): Uint8Array

Retrieves the wallet address.

Parameters

ParameterTypeDescription

shardId

number

The ID of the shard where the wallet is deployed.

Returns

Uint8Array

The wallet address.

Implementation of

ISigner.getAddress

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

ISigner.getPublicKey

Defined

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


sign()

sign(data): Promise<any>

Signs the data.

Parameters

ParameterTypeDescription

data

Uint8Array

The input data.

Returns

Promise<any>

The signed data.

Async

Implementation of

ISigner.sign

Defined

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