iOS HMSigned

HMSigned is a protocol for accessing the signature of an object and verifying it.

Instance Methods

.isSignatureValid(forPublicKey:)

Declaration

func isSignatureValid<C>(forPublicKey publicKey: C) -> Bool where C : Collection, C.Element == UInt8

Parameters

publicKey

(UInt8 Collection) public key to use for verifing the signature

Returns

Bool

Discussion

Used to verify if the signature was given with a private key matching the public key. Commonly used to verify if the object is from a trust source.

Example

import HMKit

class Something: HMSigned { ... }

let object = Something()
let publicKey: [UInt8] = [0xFA, 0x1B...0xE3, 0x22]
let isValid: Bool = object.isSignatureValid(forPublicKey: publicKey)

Properties

.signature

Declaration

var signature: [UInt8] { get }

Conforming

HMBytesGettable

Declaration

protocol HMBytesGettable

Discussion

A type that can return it's bytes value in [UInt8].

Read More