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
  • Decentralization
    • Architecture
      • Preventing Collusion
      • Scalability
      • Credit System
    • Mainnets and Testnets
  • For Operators
    • Register and Run a Human Node
      • Use Keystore for private key encryption
      • Keyshare backup
    • Diagnostics using the Network UI
  • For developers
    • Human Network Credits
    • Making Requests to Human Network
      • Signer on behalf of users
      • Directly query the network
    • Types of requests
      • OPRF To Derive Keys From Low-Entropy Data
      • Decryption of Provably Encrypted Data
Powered by GitBook
On this page
  • Build the signer
  • Obtain Credits
  • Make Requests to the Signer
  1. For developers
  2. Making Requests to Human Network

Signer on behalf of users

If you have a dapp, we suggest that you sponsor requests on behalf of your users using the Signer.

To use the Signer you will want to

  1. Build the signer

  2. Obtain credits for the signer.

  3. Optionally, set up custom rate limiting so that users cannot exhaust your credits too quickly.

  4. Send user requests to the signer to be sponsored

Build the signer

Using docker (easy, but no rate limit)

If you do not want to add a custom rate limit, you can fetch the signer as a Docker image mishtinetwork/dev:mainnetalphaV1

Please, provide the team your docker hub email address or username so we can give you access to the docker image.

To run the Signer enter the following commands:

sudo docker run --env-file .env mishtinetwork/dev:mainnetalphaV1

with the following .env file

// Some code

.env

From source (slightly more work, but allows custom rate limiting)

Coming soon...

Obtain Credits

To obtain credits, please review:

Make Requests to the Signer

Then from our mishtiwasm, you'll be able to form the correct requests to send to your Signer.

mishtiwasm can be fetched by running:

npm i @holonym-foundation/mishtiwasm

Here is an example of a frontend TypeScript code for generating keys using mishtiwasm and the signer.

import initMishtiwasm, {
  make_oprf_request,
  unmask_and_hash_to_field_secp256k1,
  new_mask,
  msg_to_point,
  generate_ephemeral_key_and_sign_conditions_with_it
} from '@holonym-foundation/mishtiwasm'
import axios from 'axios'
// Alternatively, import like this:
// const mishtiwasm = await import('@holonym-foundation/mishtiwasm')
// And then call a function like this:
// const mask = await mishtiwasm.new_mask()

type MaskOutput = {
  public_mask: string;
  secret_mask: string;
}

// Initialize mishtiwasm
await initMishtiwasm()



// Build the request to send to Human Network
const request_to_network = make_oprf_request('<USER_SECRET_INPUT>')

// Send the request to the Signer. The Signer will relay the request to Human Network
const SIGNER_URL = '<signer-url>' // --- You will set this for your app
const res = await axios.post(SIGNER_URL, request_to_network)

// Parse the response
const point = res.data.replaceAll('"', '')

// Unmask the response and hash it
// prfOutput is a decimal number. Its javascript type is string
const prfOutput = await unmask_and_hash_to_field_secp256k1(
  mask.secret_mask,
  point
)
PreviousMaking Requests to Human NetworkNextDirectly query the network

Last updated 7 days ago

Human Network Credits

Note: Making a request for OPRF is more trivial than a request for JWTPRF or DecryptBabyJubJub. JWTPRF requires a JWT of a particular format which some JWT issuers do not support. DecryptBabyJubJub requires a smart contract and a zero-knowledge proof. Due to the complexity of their usage, they are currently only used internally until more documentation is created. If you are interested in using those methods, please reach out so we can document them and support you in developing with them.