Human Network
  • ☀️Welcome to Human Network
  • Overview
    • What is Human Network? What are Human Keys?
    • Methods and their use cases
      • Deriving keys from low-entropy data
      • Deriving keys from web accounts
      • Provably encrypting to Human Network, and setting custom decryption conditions.
    • FAQ
  • For Operators
    • Register and Run a Human Node
      • Use Keystore for private key encryption
      • Keyshare backup
    • Diagnostics using the Network UI
  • Decentralization
    • Architecture
      • Preventing Collusion
      • Scalability
      • Credit System
    • Mainnets and Testnets
  • Usage Instructions
    • Human Network Credits
    • Making Requests to Human Network
      • OPRF To Derive Keys From Low-Entropy Data
      • PRF to Derive Keys from JWTs
      • Decryption of Provably Encrypted Data
    • Sponsor Requests
Powered by GitBook
On this page
  • Getting the point
  • With mishtiwasm
  • Unmasking the point
  1. Usage Instructions
  2. Making Requests to Human Network

OPRF To Derive Keys From Low-Entropy Data

PreviousMaking Requests to Human NetworkNextPRF to Derive Keys from JWTs

Last updated 8 months ago

You will make a standard request to the relay node with the state (see ) using the Secp256k1 method.

Here is an example request using the OPRFSecp256k1 method:

{
  "method": "OPRFSecp256k1",
  "point": [2,58,211,253,26,34,132,83,157,111,80,144,179,1,88,82,243,119,99,104,156,248,158,115,87,30,114,39,90,142,78,236,28],
  "epoch": 123,
  "request_per_user": 69,
  "signature": {
    "r": "0xe3fbde1404800f5ac238b30f2118b69a1cdb604d0b4227056f18f87beb83abf2",
    "s": "0x9132d353ef806f526ef5e48cbee6872a11fcf688c2d92023a384d0f02082466",
    "v": 28
  },
  "extra_data": null
}

However, you will need to get the point to send for the OPRF:

Getting the point

With mishtiwasm

Install:

npm i @holonym-foundation/mishtiwasm

Import:

import init, { oprf_client_step1_secp256k1, unmask_secp256k1 } from "@holonym-foundation/mishtiwasm"
// important to call init -- wasm is initialized asynchronously.
// without it, the other functions won't work
await init();

Use:

// Salt and secret input are arrays of uint8s
const { encoded_masked_point, secret_mask } = oprf_client_step1_secp256k1(salt, secret);

encoded_masked_point can be the value for point in the RequestToNetwork

Unmasking the point

After querying the network and receiving the point response_from_network, unmask the response via

// Salt and secret input are arrays of uint8s
const result = unmask_secp256k1(response_from_network, secret_mask);

This is the output of the OPRF!

Making Requests