-
Notifications
You must be signed in to change notification settings - Fork 1
PrivateKey
The ED25519 Private Key
public struct PrivateKey: Equatable, KeyProtocol, CustomStringConvertible
CustomStringConvertible
, Equatable
, KeyProtocol
public init(key: Data)
The length of the key in bytes
public static let LENGTH: Int = 32
The key itself
public let key: Data
public var description: String
Converts the private key to a hexadecimal string.
public func hex() -> String
A string representation of the private key in hexadecimal format, with a "0x" prefix.
Creates a PrivateKey instance from a hex string.
public static func fromHex(_ value: String) -> PrivateKey
- value: A string representing the private key in hexadecimal format.
A PrivateKey instance representing the private key.
Calculates the corresponding public key for this private key instance using the Ed25519 algorithm.
public func publicKey() throws -> PublicKey
An error if the calculation of the public key fails, or if the public key cannot be used to create a PublicKey instance.
A PublicKey instance representing the public key associated with this private key.
Generates a new random private key using the Ed25519 algorithm.
public static func random() throws -> PrivateKey
An error if the generation of the key pair fails or if the generated private key cannot be used to create a PrivateKey instance.
A new PrivateKey instance with a randomly generated private key.
Signs a message using this private key and the Ed25519 algorithm.
public func sign(data: Data) throws -> Signature
- data: The message to be signed.
An error if the signing operation fails or if the resulting signature cannot be used to create a Signature instance.
A Signature instance representing the signature for the message.
public static func deserialize(from deserializer: Deserializer) throws -> PrivateKey
public func serialize(_ serializer: Serializer) throws
public static func == (lhs: PrivateKey, rhs: PrivateKey) -> Bool
Generated at 2023-07-20T02:24:43+0000 using swift-doc 1.0.0-rc.1.
Types
- Account
- AccountAddress
- AccountAddressTag
- AccountResponse
- AnyTransactionArgument
- AptosError
- AptosRestClientError
- BoolTag
- ClientConfig
- Collection
- Ed25519Authenticator
- Ed25519BIP32
- EntryFunction
- HTTPMethod
- InfoResponse
- InvalidPropertyType
- Mnemonic
- Mnemonic.Error
- ModuleBundle
- ModuleId
- MultiAgentAuthenticator
- MultiAgentRawTransaction
- MultiEd25519Authenticator
- MultiPublicKey
- MultiSignature
- Object
- PrivateKey
- Property
- PropertyMap
- PublicKey
- RawTransaction
- RotatingProofChallenge
- Royalty
- Script
- ScriptArgument
- SeedMode
- Serializer
- Signature
- SignedTransaction
- StructTag
- StructTagValue
- Token
- TransactionArgument
- U128Tag
- U16Tag
- U256Tag
- U32Tag
- U64Tag
- U8Tag
- UInt128
- UInt128Errors
- Wallet
- Wordlists
Protocols
Global Variables
Global Functions
- _struct(_:)
- account(_:ledgerVersion:)
- accountBalance(_:_:)
- accountResource(_:_:_:)
- accountResources(_:_:)
- accountSequenceNumber(_:_:)
- addTokenProperty(_:_:_:)
- aggregatorValue(_:_:_:)
- asyncData(with:method:headers:body:)
- bcsTransfer(_:_:_:)
- bool()
- burnToken(_:_:)
- claimToken(_:_:_:_:_:_:)
- createBcsSignedTransaction(_:_:)
- createBcsSignedTransaction(_:_:_:)
- createBcsTransaction(_:_:)
- createBcsTransaction(_:_:_:)
- createCollection(_:_:_:_:)
- createCollection(_:_:_:_:_:_:_:_:_:_:_:_:_:_:_:_:)
- createCollectionPayload(_:_:_:_:_:_:_:_:_:_:_:_:_:_:_:)
- createMultiAgentBcsTransaction(_:_:_:)
- createToken(_:_:_:_:_:_:_:)
- decodeData(_:with:keyDecodingStrategy:dataDecodingStrategy:dateDecodingStrategy:)
- decodeUrl(_:with:)
- decodeUrl(with:_:)
- decodeUrl(with:_:_:)
- deserialize(from:)
- directTransferToken(_:_:_:_:_:_:_:)
- fixedBytes(length:)
- freezeToken(_:_:)
- fundAccount(_:_:)
- getCollection(_:_:)
- getTableItem(_:_:_:_:_:_:)
- getToken(_:_:_:_:_:)
- getTokenBalance(_:_:_:_:_:)
- getTokenData(_:_:_:_:)
- info()
- map(keyDecoder:valueDecoder:)
- mintSoulBoundToken(_:_:_:_:_:_:_:)
- mintToken(_:_:_:_:_:_:)
- mintTokenPayload(_:_:_:_:_:)
- offerToken(_:_:_:_:_:_:_:)
- publishPackage(_:_:_:)
- readObject(address:)
- remaining()
- removeTokenProperty(_:_:_:)
- sequence(valueDecoder:)
- serialize(_:)
- simulateTransaction(_:_:)
- string(_:)
- submitBcsTransaction(_:)
- submitTransaction(_:_:)
- toBytes(_:)
- transactionPending(_:)
- transfer(_:_:_:)
- u128(_:)
- u16(_:)
- u256(_:)
- u32(_:)
- u64(_:)
- u8(_:)
- uleb128()
- unfreezeToken(_:_:)
- updateTokenProperty(_:_:_:)
- verify(_:)
- waitForTransaction(_:)