🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

@requestnetwork/epk-signature

Package Overview
Dependencies
Maintainers
6
Versions
724
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@requestnetwork/epk-signature

Signature provider using ethereum private keys.

latest
Source
npmnpm
Version
0.10.0
Version published
Maintainers
6
Created
Source

@requestnetwork/epk-signature

Ethereum Private Key Signature Provider.

@requestnetwork/epk-signature is a typescript library part of the Request Network protocol.

Implementation of the signature provider from the private keys. The signature provider is used to make signature in the Request Network Protocol (e.g.: see Request Logic).

It uses the Request Network Protocol concepts of Identity and Signature described in the request logic specification.

Installation

npm install @requestnetwork/epk-signature

Usage

import { IdentityTypes,  SignatureTypes } from '@requestnetwork/types'

import EthereumPrivateKeySignatureProvider from '@requestnetwork/epk-signature'

const signatureParametersExample: SignatureTypes.ISignatureParameters = {
  method: SignatureTypes.METHOD.ECDSA,
  privateKey: '0xc87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3',
};

// Identity from the previous signature parameter
const identityExample: IdentityTypes.IIdentity = {
  type: IdentityTypes.TYPE.ETHEREUM_ADDRESS,
  value: '0x627306090abab3a6e1400e9345bc60c78a8bef57'
};

// Construct the provider with a
const signatureProvider = new EthereumPrivateKeySignatureProvider(signatureParametersExample);

// can list the identity usable
const listOfAvailableIdentity = signatureProvider.getAllRegisteredIdentities(); // [identityExample]

// can sign data with identity
const dataToSign = { ... };
const signedData = await signatureProvider.sign(dataToSign, identityExample); // { data: { ... }, signature: { method: SignatureTypes.METHOD.ECDSA, value: '0x...' }}

// can add a new signature parameters
signatureProvider.addSignatureParameters({method: ..., privateKey: ...});

// can remove a signature parameters from its identity
signatureProvider.removeRegisteredIdentity({type: ..., value: ...});

// can remove all signature parameters
signatureProvider.clearAllRegisteredIdentities();

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Read the contributing guide

License

MIT

Keywords

requestnetwork

FAQs

Package last updated on 03 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts