FMPDSS

Description

The FMPDSS class is used to work with digital signatures.

class FMPDSS

Properties

Property Description

certificate

The current certificate.
var certificate: FMPDSS.Certificate? { get set }

Methods

Method Description

certs(completion:)

Get list of certificates available for the user.
func certs(completion: @escaping FMPCertsHandler)

Parameters:

  • completion. Closing expression containing method execution result.

signs(completion:) Get list of DSS signatures.
func signs(completion: @escaping FMPSignsHandler)

Parameters:

  • completion. Closing expression containing method execution result.

sign(table:columnName:rowId:completion:) Sign table cell with the current certificate.
func sign(table: FMPTable, columnName: String, rowId: String, completion: @escaping FMPSignHandler)

Parameters:

  • table. Table.

  • columnName. Column name.

  • rowId. Row name

  • completion. Closing expression containing method execution result.

unsign(_:completion:) Delete signature.
func unsign(_ signature: FMPDSS.Signature, completion: @escaping FMPRequestResponseHandler)

Parameters:

  • signature. Signature.

  • completion. Closing expression containing method execution result.

Examples

Install the current certificate:

// Build an instance of the FMPDSS class. For details see examples for FMPDSS.Builder.
let dss: FMPDSS = fmp.dss.build()
 
// Build an instance of the FMPDSS.Certificate class. For details see examples for FMPDSS.Certificate.Builder.
let certificate: FMPDSS.Certificate = fmp.certificate
  
// Install the current certificate
dss.certificate = certificate

Get list of available certificates:

// Build an instance of the FMPDSS class. For details see examples for FMPDSS.Builder.
let dss: FMPDSS = fmp.dss.build()
  
// Get list of available certificates
dss.certs { (success, error, certs) in
    if success {
        // Display list of identifiers of available certificates
        print(certs.map {$0.id})
    } else {
        // Display error code and description
        print(error?.code, error?.description)
    }
}

Get list of DSS signatures:

// Build an instance of the FMPDSS class. For details see examples for FMPDSS.Builder.
let dss: FMPDSS = fmp.dss.build()
  
// Get list of signatures
dss.signs { (success, error, signs) in
    if success {
        // Display list of signature identifiers
        print(signs.map {$0.id})
    } else {
        // Display error code and description
        print(error?.code, error?.description)
    }
}

Sign table cell on server:

// Build an instance of the FMPDSS class. For details see examples for FMPDSS.Builder.
let dss: FMPDSS = fmp.dss.build()
  
// Build an instance of the FMPTable class. For details see examples for FMPTable.Builder.
let table: FMPTable = fmp.table.build()
  
// Sign table cell on server
dss.sign(table: table, columnName: "column", rowId: "rowId") { (success, error, sign) in
    if success {
        // Display identifier of applied signature
        print(sign?.id)
    } else {
        // Display error code and description
        print(error?.code, error?.description)
    }
}

Delete signature:

// Build an instance of the FMPDSS class. For details see examples for FMPDSS.Builder.
let dss: FMPDSS = fmp.dss.build()
  
let sign: FMPDSS.Signature // Private initialization
  
// Sign table cell on server
dss.unsign(sign) { (response) in
    if response.success {
        // Display server response
        print(response.result)
    } else {
        // Display error code and description
        print(response.error?.code, response.error?.description)
    }
}

See also:

FMPWrapper Framework | Classes