Evolution SDK

VKey.ts

VKey overview


Table of contents


cryptography

fromPrivateKey

Create a VKey from a PrivateKey (sync version that throws VKeyError). For extended keys (64 bytes), uses CML-compatible Ed25519-BIP32 algorithm. For normal keys (32 bytes), uses standard Ed25519.

Signature

export declare const fromPrivateKey: (privateKey: PrivateKey.PrivateKey) => VKey

Added in v2.0.0

verify

Verify a signature against a message using this verification key.

Signature

export declare const verify: (vkey: VKey, message: Uint8Array, signature: Uint8Array) => boolean

Added in v2.0.0

encoding

toBytes

Convert a VKey to raw bytes.

Signature

export declare const toBytes: (a: VKey, overrideOptions?: ParseOptions) => Uint8Array

Added in v2.0.0

toHex

Convert a VKey to a hex string.

Signature

export declare const toHex: (a: VKey, overrideOptions?: ParseOptions) => string

Added in v2.0.0

parsing

fromBytes

Parse a VKey from raw bytes. Expects exactly 32 bytes.

Signature

export declare const fromBytes: (i: Uint8Array, overrideOptions?: ParseOptions) => VKey

Added in v2.0.0

fromHex

Parse a VKey from a hex string. Expects exactly 64 hex characters (32 bytes).

Signature

export declare const fromHex: (i: string, overrideOptions?: ParseOptions) => VKey

Added in v2.0.0

predicates

isVKey

Check if the given value is a valid VKey

Signature

export declare const isVKey: (u: unknown, overrideOptions?: ParseOptions | number) => u is VKey

Added in v2.0.0

schemas

VKey (class)

Schema for VKey representing a verification key. vkey = bytes .size 32 Follows the Conway-era CDDL specification.

Signature

export declare class VKey

Added in v2.0.0

toJSON (method)

Signature

toJSON()

toString (method)

Signature

toString(): string

[Inspectable.NodeInspectSymbol] (method)

Signature

[Inspectable.NodeInspectSymbol](): unknown

[Equal.symbol] (method)

Signature

[Equal.symbol](that: unknown): boolean

[Hash.symbol] (method)

Signature

[Hash.symbol](): number

testing

arbitrary

FastCheck arbitrary for generating random VKey instances. Used for property-based testing to generate valid test data.

Signature

export declare const arbitrary: FastCheck.Arbitrary<VKey>

Added in v2.0.0

utils

FromBytes

Signature

export declare const FromBytes: Schema.transform<
  Schema.SchemaClass<Uint8Array, Uint8Array, never>,
  Schema.SchemaClass<VKey, VKey, never>
>

FromHex

Signature

export declare const FromHex: Schema.transform<
  Schema.filter<Schema.Schema<Uint8Array, string, never>>,
  Schema.transform<Schema.SchemaClass<Uint8Array, Uint8Array, never>, Schema.SchemaClass<VKey, VKey, never>>
>