SimpleSignature
SimpleSignature
class SimpleSignature
A basic signature
This enumeration defines the set of simple or basic signature schemes supported by IOTA. Most signature schemes supported by IOTA end up comprising of a at least one simple signature scheme.
BCS
The BCS serialized form of this type is specified in
bcs-schema.abnf.
Note: Due to historical reasons, signatures are serialized slightly different from the majority
of the types in IOTA. In particular if a signature is ever embedded in another structure it
generally is serialized as bytes meaning it has a length prefix that defines the length of the
completely serialized signature.
debugDescription
var debugDescription: String { get }
A textual representation of this instance, suitable for debugging.
Calling this property directly is discouraged. Instead, convert an
instance of any type to a string by using the String(reflecting:)
initializer. This initializer works with any type, and uses the custom
debugDescription property for types that conform to
CustomDebugStringConvertible:
struct Point: CustomDebugStringConvertible {
let x: Int, y: Int
var debugDescription: String {
return "(\(x), \(y))"
}
}
let p = Point(x: 21, y: 30)
let s = String(reflecting: p)
print(s)
// Prints "(21, 30)"
The conversion of p to a string in the assignment to s uses the
Point type's debugDescription property.
deriveAddress()
func deriveAddress() -> Address
Derive the Address of the public key that produced this signature.
ed25519PublicKey()
func ed25519PublicKey() -> Ed25519PublicKey
ed25519Signature()
func ed25519Signature() -> Ed25519Signature
hash(into:)
func hash(into hasher: inout Hasher)
Hashes the essential components of this value by feeding them into the given hasher.
Implement this method to conform to the Hashable protocol. The
components used for hashing must be the same as the components compared
in your type's == operator implementation. Call hasher.combine(_:)
with each of these components.
-
Important: In your implementation of
hash(into:), don't callfinalize()on thehasherinstance provided, or replace it with a different instance. Doing so may become a compile-time error in the future. -
Parameter hasher: The hasher to use when combining the components of this instance.
isEd25519()
func isEd25519() -> Bool
isSecp256k1()
func isSecp256k1() -> Bool
isSecp256r1()
func isSecp256r1() -> Bool
optEd25519PublicKey()
func optEd25519PublicKey() -> Ed25519PublicKey?
optEd25519Signature()
func optEd25519Signature() -> Ed25519Signature?
optSecp256k1PublicKey()
func optSecp256k1PublicKey() -> Secp256k1PublicKey?
optSecp256k1Signature()
func optSecp256k1Signature() -> Secp256k1Signature?
optSecp256r1PublicKey()
func optSecp256r1PublicKey() -> Secp256r1PublicKey?
optSecp256r1Signature()
func optSecp256r1Signature() -> Secp256r1Signature?
scheme()
func scheme() -> SignatureScheme
secp256k1PublicKey()
func secp256k1PublicKey() -> Secp256k1PublicKey
secp256k1Signature()
func secp256k1Signature() -> Secp256k1Signature
secp256r1PublicKey()
func secp256r1PublicKey() -> Secp256r1PublicKey
secp256r1Signature()
func secp256r1Signature() -> Secp256r1Signature
signatureBytes()
func signatureBytes() -> Data
The raw signature bytes, without the scheme flag or the public key.
toBase64()
func toBase64() -> String
Base64-encode this signature as its flag || sig || pubkey bytes.
toBcs()
func toBcs() throws -> Data
Convert this type to BCS encoded bytes.
toBytes()
func toBytes() -> Data
toDisplayString()
func toDisplayString() -> String
Render this type as human-readable text.
Some types also print this through the binding's native string conversion; this method is the spelling every object type has.
The layout is meant for reading and can change between releases. Use the JSON or BCS conversions for output that gets parsed.
toJson()
func toJson() throws -> String
Convert this type to a JSON encoded string.
toPublicKey()
func toPublicKey() -> PublicKey
The public key embedded in this signature.
fromBase64(base64:)
static func fromBase64(base64: String) throws -> SimpleSignature
Decode a signature from the Base64 form produced by to_base64, i.e. base64 over the
flag || sig || pubkey bytes.
fromBcs(bcs:)
static func fromBcs(bcs: Data) throws -> SimpleSignature
Create this type from BCS encoded bytes.
fromJson(json:)
static func fromJson(json: String) throws -> SimpleSignature
Create this type from a JSON encoded string.
newEd25519(signature:publicKey:)
static func newEd25519(signature: Ed25519Signature, publicKey: Ed25519PublicKey) -> SimpleSignature
newSecp256k1(signature:publicKey:)
static func newSecp256k1(signature: Secp256k1Signature, publicKey: Secp256k1PublicKey) -> SimpleSignature
newSecp256r1(signature:publicKey:)
static func newSecp256r1(signature: Secp256r1Signature, publicKey: Secp256r1PublicKey) -> SimpleSignature
!=(_:_:)
static func != (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether two values are not equal.
Inequality is the inverse of equality. For any values a and b, a != b
implies that a == b is false.
This is the default implementation of the not-equal-to operator (!=)
for any type that conforms to Equatable.
- Parameters:
- lhs: A value to compare.
- rhs: Another value to compare.
==(_:_:)
static func == (self: SimpleSignature, other: SimpleSignature) -> Bool
Returns a Boolean value indicating whether two values are equal.
Equality is the inverse of inequality. For any values a and b,
a == b implies that a != b is false.
- Parameters:
- lhs: A value to compare.
- rhs: Another value to compare.