Class Gateway

  • NSObject

    • KeychainCore/Gateway

Gateway

Gateway manages Personas, Contacts, all associated private keys (blockchain and application). This class performs all blockchain network requests, all database interactions, and performs application-level cryptographic operations encrypt, decrypt, sign, and verify.

Constructor Summary

Constructor and Description

init:(NSString *) configPath :(NSString *) dbPath :(BOOL) force :(NSString *) dropSqlFile :(NSString *) createSqlFile

* configPath points to the keychain.cfg file in your resource bundle

* dbPath is the path to a writable folder that your app has access to, where the keychain database will be created

* force should be true if the database is to be recreated if it already exists at dbPath. This parameter should be false under most circumstances. Otherwise, the database will be overridden every time you start your application

* dropSqlFile points to the drop_keychain.sql file in your application resource bundle. This scrip is used to drop the database if force is set to true

* createSQlFile points to the keychain.sql file in your application resource bundle. This script is used to create the keychain database

Instance Methods

Return type Method and Description

Asset *

createAsset:(NSString *) symbol :(NSError **) error

Create/issue custom digital asset.

Contact *

createContact:(NSString *) name :(NSString *) subName :(Uri *) uri :(NSError **) error

Create a contact.

Persona *

createPersona:(NSString *) name :(NSString *) subName :(SecurityLevel) secLevel :(NSError **) error

Create a new persona.

NSString *

decrypt:(NSString *) cipherText :(NSError **) error

Decrypt to a string (binary or not).

NSString *

decryptThenVerify:(NSString *) cipherText :(NSError **) error

Decrypt then verify data that has been signed and encrypted as a string.

BOOL

deleteContact:(Contact *) contact :(NSError **) error

Delete a contact.

BOOL

deletePersona:(Persona *) persona :(NSError **) error

Delete a persona.

NSString *

encrypt:(NSString *) clearText :(NSArray<Contact *> *) contacts :(NSError **) error

Encrypt a string so that it can be decrypted by the given contacts.

Persona *

getActivePersona

Get the active persona.

NSArray<Contact *> *

getContacts :(NSError **) error

Get the list of contacts for the current active persona.

NSArray<Persona *> *

getPersonas :(NSError **) error

Get the list of personas.

BOOL

renameContact:(Contact *) contact :(NSString *) newName :(NSString *) newSubName :(NSError **) error

Renames a contact.

BOOL

renamePersona:(Persona *) contact :(NSString *) newName :(NSString *) newSubName :(NSError **) error

Renames a persona.

BOOL

renewCertificate:(Persona *) persona :(NSError **) error

Renew the given persona’s certificate.

NSNumber *

seed:(NSString *) address :(NSMutableArray<NSString *> *) mnemonicList :(NSError **) error

Seed the private key pool and generate mnemonic recovery string.

BOOL

setActivePersona:(Persona *) persona :(NSError **) error

Set the active persona.

NSString *

sign:(NSString *) clearText :(NSError **) error

Sign a string.

NSString *

signThenEncrypt:(NSArray<Contact *> *) contacts :(NSString *) clearText :(NSError **) error

Sign then encrypt a string so that it can be decrypted (and verified) by the given contacts.

LedgerResult *

transferAsset:(Contact *) contact :(Facade *) approver :(Asset *) asset :(long long) amount :(NSString *) reason :(bool) isIssuance :(NSError **) error

Create a transaction to send the asset to the specified receiver.

LedgerResult *

updateLedger:(NSString *) trxnStr :(Facade *) approver :(NSError **) error

Update local ledger with transaction/response from peers.

NSString *

verify:(NSMutableArray<Verification > *) verifications :(NSString *) signedMessage :(NSError *) error

Verify the signature(s) of a signed string.