Skip to main content
Version: Next

Interface: ProjPointType<T>

ec.weierstrass.ProjPointType

Design rationale for types​

  • Interaction between classes from different curves should fail: k256.Point.BASE.add(p256.Point.BASE)
  • For this purpose we want to use instanceof operator, which is fast and works during runtime
  • Different calls of curve() would return different classes - curve(params) !== curve(params): if somebody decided to monkey-patch their curve, it won't affect others

TypeScript can't infer types for classes created inside a function. Classes is one instance of nominative types in TypeScript and interfaces only check for shape, so it's hard to create unique type for every function call.

We can use generic types via some param, like curve opts, but that would:

1. Enable interaction between `curve(params)` and `curve(params)` (curves of same params)
which is hard to debug.
2. Params can be generic and we can't enforce them to be constant value:
if somebody creates curve from non-constant params,
it would be allowed to interact with other curves with non-constant params

TODO: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-7.html#unique-symbol

Type parameters​

Name
T

Hierarchy​

Properties​

px​

• Readonly px: T

Defined in​

node_modules/@noble/curves/abstract/weierstrass.d.ts:58


py​

• Readonly py: T

Defined in​

node_modules/@noble/curves/abstract/weierstrass.d.ts:59


pz​

• Readonly pz: T

Defined in​

node_modules/@noble/curves/abstract/weierstrass.d.ts:60

Accessors​

x​

• get x(): T

Returns​

T

Defined in​

node_modules/@noble/curves/abstract/weierstrass.d.ts:61


y​

• get y(): T

Returns​

T

Defined in​

node_modules/@noble/curves/abstract/weierstrass.d.ts:62

Methods​

multiply​

â–¸ multiply(scalar): ProjPointType<T>

Parameters​

NameType
scalarbigint

Returns​

ProjPointType<T>

Overrides​

Group.multiply

Defined in​

node_modules/@noble/curves/abstract/weierstrass.d.ts:63


toAffine​

â–¸ toAffine(iz?): AffinePoint<T>

Parameters​

NameType
iz?T

Returns​

AffinePoint<T>

Defined in​

node_modules/@noble/curves/abstract/weierstrass.d.ts:64


isTorsionFree​

â–¸ isTorsionFree(): boolean

Returns​

boolean

Defined in​

node_modules/@noble/curves/abstract/weierstrass.d.ts:65


clearCofactor​

â–¸ clearCofactor(): ProjPointType<T>

Returns​

ProjPointType<T>

Defined in​

node_modules/@noble/curves/abstract/weierstrass.d.ts:66


assertValidity​

â–¸ assertValidity(): void

Returns​

void

Defined in​

node_modules/@noble/curves/abstract/weierstrass.d.ts:67


hasEvenY​

â–¸ hasEvenY(): boolean

Returns​

boolean

Defined in​

node_modules/@noble/curves/abstract/weierstrass.d.ts:68


toRawBytes​

â–¸ toRawBytes(isCompressed?): Uint8Array

Parameters​

NameType
isCompressed?boolean

Returns​

Uint8Array

Defined in​

node_modules/@noble/curves/abstract/weierstrass.d.ts:69


toHex​

â–¸ toHex(isCompressed?): string

Parameters​

NameType
isCompressed?boolean

Returns​

string

Defined in​

node_modules/@noble/curves/abstract/weierstrass.d.ts:70


multiplyUnsafe​

â–¸ multiplyUnsafe(scalar): ProjPointType<T>

Parameters​

NameType
scalarbigint

Returns​

ProjPointType<T>

Defined in​

node_modules/@noble/curves/abstract/weierstrass.d.ts:71


multiplyAndAddUnsafe​

â–¸ multiplyAndAddUnsafe(Q, a, b): undefined | ProjPointType<T>

Parameters​

NameType
QProjPointType<T>
abigint
bbigint

Returns​

undefined | ProjPointType<T>

Defined in​

node_modules/@noble/curves/abstract/weierstrass.d.ts:72


_setWindowSize​

â–¸ _setWindowSize(windowSize): void

Parameters​

NameType
windowSizenumber

Returns​

void

Defined in​

node_modules/@noble/curves/abstract/weierstrass.d.ts:73


double​

â–¸ double(): ProjPointType<T>

Returns​

ProjPointType<T>

Inherited from​

Group.double

Defined in​

node_modules/@noble/curves/abstract/curve.d.ts:11


negate​

â–¸ negate(): ProjPointType<T>

Returns​

ProjPointType<T>

Inherited from​

Group.negate

Defined in​

node_modules/@noble/curves/abstract/curve.d.ts:12


add​

â–¸ add(other): ProjPointType<T>

Parameters​

NameType
otherProjPointType<T>

Returns​

ProjPointType<T>

Inherited from​

Group.add

Defined in​

node_modules/@noble/curves/abstract/curve.d.ts:13


subtract​

â–¸ subtract(other): ProjPointType<T>

Parameters​

NameType
otherProjPointType<T>

Returns​

ProjPointType<T>

Inherited from​

Group.subtract

Defined in​

node_modules/@noble/curves/abstract/curve.d.ts:14


equals​

â–¸ equals(other): boolean

Parameters​

NameType
otherProjPointType<T>

Returns​

boolean

Inherited from​

Group.equals

Defined in​

node_modules/@noble/curves/abstract/curve.d.ts:15