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:56

Methods

getAddress()

getAddress(shardId): Uint8Array<ArrayBufferLike>

Retrieves the smart account address.

Parameters

ParameterTypeDescription

shardId

number

The ID of the shard where the smart account is deployed.

Returns

Uint8Array<ArrayBufferLike>

The smart account address.

Implementation of

ISigner.getAddress

Defined

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


getPublicKey()

getPublicKey(): Uint8Array<ArrayBufferLike>

Retrieves the public key.

Returns

Uint8Array<ArrayBufferLike>

The public key of the signer.

Implementation of

ISigner.getPublicKey

Defined

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


sign()

sign(data): Promise<any>

Signs the data.

Parameters

ParameterTypeDescription

data

Uint8Array<ArrayBufferLike>

The input data.

Returns

Promise<any>

The signed data.

Async

Implementation of

ISigner.sign

Defined

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