philips-software/cogito

View on GitHub
workspaces/cogito-attestations-ios/Attestations/Serialization.swift

Summary

Maintainability
A
3 hrs
Test Coverage
A
100%
extension ProtoAttestation: CustomStringConvertible {
    public var description: String {
        let serialize = Javascript.cogitoAttestations.forProperty("serialize")!
        let serialized = serialize.call(withArguments: [javascriptValue])!
        return serialized.toString()
    }

    public convenience init(_ serialized: String) {
        let deserialize = Javascript.cogitoAttestations.forProperty("deserialize")!
        let deserialized = deserialize.call(withArguments: [serialized])!
        self.init(javascriptValue: deserialized)
    }
}

extension Attestation: CustomStringConvertible {
    public var description: String {
        let serialize = Javascript.cogitoAttestations.forProperty("serialize")!
        let serialized = serialize.call(withArguments: [javascriptValue])!
        return serialized.toString()
    }

    public convenience init(_ serialized: String) {
        let deserialize = Javascript.cogitoAttestations.forProperty("deserialize")!
        let deserialized = deserialize.call(withArguments: [serialized])!
        self.init(javascriptValue: deserialized)
    }
}