Skip to content

BlsPoint.fromBytes

Converts Bytes.Bytes to a BLS point.

Imports

Named
import { BlsPoint } from 'ox'

Examples

Bytes to Public Key

import { BlsPoint } from 'ox'
 
const publicKey = BlsPoint.fromBytes(Bytes.from([172, 175, 255, ...]), 'G1')
{
x: 172...n,
y: 175...n,
z: 1n,
}

Bytes to Signature

import { BlsPoint } from 'ox'
 
const signature = BlsPoint.fromBytes(Bytes.from([172, 175, 255, ...]), 'G2')
{
x: 511...n,
y: 234...n,
z: 1n,
}

Definition

function fromBytes<group>(
  bytes: Bytes.Bytes,
  group: group,
): group extends 'G1' ? G1 : G2

Source: src/BlsPoint.ts

Parameters

bytes

  • Type: Bytes.Bytes

The bytes to convert.

group

  • Type: group

Return Type

The BLS point.

group extends 'G1' ? G1 : G2