Skip to content

MultiPublicKey

MarcoDotIO edited this page Jul 6, 2023 · 2 revisions

MultiPublicKey

The ED25519 Multi-Public Key

public struct MultiPublicKey: EncodingProtocol, CustomStringConvertible, Equatable, KeyProtocol 

Inheritance

CustomStringConvertible, EncodingProtocol, Equatable, KeyProtocol

Initializers

init(keys:threshold:checked:)

public init(keys: [PublicKey], threshold: Int, checked: Bool = true) throws 

Properties

keys

The Public Keys themselves

public var keys: [PublicKey]

threshold

The current amount of keys in the keys array

public var threshold: Int

minKeys

The minimum amount of keys to initialize this class

public static let minKeys: Int = 2

maxKeys

The maximum amount of keys allowed for initialization

public static let maxKeys: Int = 32

minThreshold

The minimum threshold amount

public static let minThreshold: Int = 1

description

public var description: String 

Methods

toBytes()

Serialize the threshold and concatenated keys of a given threshold signature scheme instance to a Data object.

public func toBytes() -> Data 

This function concatenates the keys of the instance and serializes the threshold and concatenated keys to a Data object.

Returns

A Data object containing the serialized threshold and concatenated keys.

fromBytes(_:)

Deserialize a Data object to a MultiPublicKey instance.

public static func fromBytes(_ key: Data) throws -> MultiPublicKey 

This function deserializes the given Data object to a MultiPublicKey instance by extracting the threshold and keys from it.

Parameters

  • key: A Data object containing the serialized threshold and keys of a MultiPublicKey instance.

Throws

An AptosError object indicating that the given Data object is invalid or cannot be deserialized to a MultiPublicKey instance.

Returns

A MultiPublicKey instance initialized with the deserialized keys and threshold.

serialize(_:)

Serializes an output instance using the given Serializer.

public func serialize(_ serializer: Serializer) throws 

Parameters

  • serializer: The Serializer instance used to serialize the data.

Throws

An error if the serialization fails.

deserialize(from:)

public static func deserialize(from deserializer: Deserializer) throws -> MultiPublicKey 
Types
Protocols
Global Variables
Global Functions
Extensions
Clone this wiki locally