Skip to content

BlsPoint.fromHex

Converts Hex.Hex to a BLS point.

Imports

Named
import { BlsPoint } from 'ox'

Examples

Hex to Public Key

import { BlsPoint } from 'ox'
 
const publicKey = BlsPoint.fromHex('0xacafff52270773ad1728df2807c0f1b0b271fa6b37dfb8b2f75448573c76c81bcd6790328a60e40ef5a13343b32d9e66', 'G1')
{
x: 172...n,
y: 175...n,
z: 1n,
}

Hex to Signature

import { BlsPoint } from 'ox'
 
const signature = BlsPoint.fromHex(
  '0xb4698f7611999fba87033b9cf72312c76c683bbc48175e2d4cb275907d6a267ab9840a66e3051e5ed36fd13aa712f9a9024f9fa9b67f716dfb74ae4efb7d9f1b7b43b4679abed6644cf476c12e79f309351ea8452487cd93f66e29e04ebe427c',
  'G2',
)
{
x: 511...n,
y: 234...n,
z: 1n,
}

Definition

function fromHex<group>(
  hex: Hex.Hex,
  group: group,
): group extends 'G1' ? G1 : G2

Source: src/BlsPoint.ts

Parameters

hex

  • Type: Hex.Hex

group

  • Type: group

Return Type

The BLS point.

group extends 'G1' ? G1 : G2