erebos

erebos

  • Docs
  • Examples
  • API
  • Help
  • GitHub

›Utility libraries

Docs

  • Introduction
  • Getting started

Swarm examples

  • File storage examples
  • Feeds examples
  • Communications examples

Swarm APIs and CLI

  • Swarm client
  • Individual APIs
  • Bzz API
  • Bzz Feed API
  • Bzz FS API
  • Pss API
  • CLI

Data structures

  • Data structures
  • Feed lists
  • Document synchronization
  • Timeline

Timeline protocol

  • Timeline specification
  • Timeline example
  • Timeline API

Utility libraries

  • Hexadecimal encoding
  • Keccak256 hashing
  • SECP256k1 signing
  • Hierarchical Deterministic wallet

RPC tools

  • RPC clients, handler and transport
  • Base RPC class and types
  • RPC Errors
  • RequestRPC client (stateless)
  • StreamRPC client (stateful)
  • RPC handler
  • RPC client over HTTP
  • RPC client over WebSocket
  • RPC client over IPC
  • RPC client for browsers
  • RPC client for Node
  • RPC client for Electron
  • HTTP transport
  • WebSocket transport
  • IPC transport
  • Electron transport
Edit

SECP256k1 signing

Purpose

This package provides a basic signing functionality for Swarm feeds.

⚠️ Security warning

Managing key pairs on behalf of users is the responsibility of your app. This library may not be suited for your needs, depending on your security constraints. It is provided as a convenience but has not been audited, use at your own risk.

Installation

npm install @erebos/secp256k1

Usage

import { createKeyPair, sign } from '@erebos/secp256k1'

const data = [1, 2, 3]
const keyPair = createKeyPair()
const signature = sign(data, keyPair)

Interfaces and types

BNInput

Input type used by the elliptic library.

KeyPair

Key pair object as used by the elliptic library.

API

createKeyPair()

Creates a KeyPair by using the provided privateKey or a new random one.

Arguments

  1. privateKey?: string

Returns KeyPair

createPublic()

Creates a KeyPair from a hex-encoded public key string.

Arguments

  1. publicKey: string

Returns KeyPair

sign()

Arguments

  1. input: BNInput
  2. privateKey: KeyPair | Buffer

Returns Array<number> the signature bytes containing the r value in the first 32 bytes, the s value in the following 32, and the recovery param in the last byte

verify()

Arguments

  1. input: BNInput
  2. signature: Array<number> | elliptic.ec.SignatureOptions: a bytes Array as returned by the sign() function or an object implementing the elliptic.ec.SignatureOptions interface.
  3. pubKey: string | KeyPair: the hex-encoded public key string or KeyPair object created by calling createKeyPair() or createPublic()

Returns boolean

← Keccak256 hashingHierarchical Deterministic wallet →
  • Purpose
    • ⚠️ Security warning
  • Installation
  • Usage
  • Interfaces and types
    • BNInput
    • KeyPair
  • API
    • createKeyPair()
    • createPublic()
    • sign()
    • verify()
Docs
Getting StartedAPI ReferenceCLI
Community
Gitter chatGitHub repositoryStar
Swarm
Official documentationHTTP gatewayDevelopment chat