IWKeyManager

This framework is written with Objective-C

Constructor

initWithName

- (instancetype)initWithName:(NSString *)name

Description

  • Please reset name by designating it

Parameter

Type

Parameter

Description

NSString

name

Name of KeyManager file

Return

  • Resetted IWKeyManager object

Security

isLocked

@property (nonatomic, readwrite) BOOL isLocked

Description

  • Returns whether Keyfile is locked or not

lock

Description

  • Encrypting the Privacy data

  • Changing the KeyFile state to lock

Return

  • YES, if the KeyFile is locked if not returns NO

unlockWithFinishBlock

Description

  • Use Bio-authentication of OS to unlock the Private Data of KeyFile.

  • To use this method, set [Face ID Usage Description] in info.plist.

    Cannot be used in combination with unlockWithPassword method

Parameters

Type

Parameter

Description

NSString

touchIdPrompt

displayed text ID when using the touch ID

finishBlock

finishBlock

Block/closer initiates on completion

finishBlock

Type

Parameter

Description

BOOL

result

reports unlock status

unlockWithPassword

Description

  • Use password to unlock Private Data of KeyFile

    Cannot be used in combination with [unlockWithFinishBlock] method

Parameters

Type

Parameter

Description

NSString

password

Password set by the user

finishBlock

finishBlock

Initiated Block/closer on completion

finishBlock

Type

Parameter

Description

BOOL

result

unlock status result

Key Management & Signing

isExistKeyForKeyId

Description

  • checks the existences of the specific Key Id

    Status of Key Manager must be unlocked state

Parameters

Type

Parameter

Description

NSString

keyId

Key ID to check

Return Value

  • YES, if exists otherwise return, NO

addKey

Description

  • Add Key obect on the KeyFile. Status of Key Manager must be unlocked state

Parameters

Type

Parameter

Description

IWKey

key

IWKey

Return Value

  • YES, if added successfully otherwise return, NO

Please refer to IWKeyclass.

removeKeyForKeyId

Description

  • deletes the specified key Id

    Status of Key Manager must be unlocked state

Parameters

Type

Parameter

Description

NSString

keyId

keyID to delete

Return Value

  • YES, if added successfully otherwise return, NO

RemoveAllKeys

Description

  • Remove all keyID

    Status of Key Manager must be unlocked state

Return Value

  • YES, if added successfully otherwise return, NO

getKeyIdList

Description

  • Returns all stored keyID list to NSArray type

Return Value

  • KeyID list object of NSArray type

getPublicKeyForKeyId

Description

  • Gets public key that corresponds to keyID

Parameters

Type

Parameter

Description

NSString

keyId

existing keyID

Return Value

  • Returns encoded public key with Base58 form

getSignForKeyId

Description

  • Signs data with the specific key.

    Status of Key Manager must be unlocked state

Parameters

Type

Parameter

Description

NSString

keyId

keyID that corresponds to the key

NSData

source

data to be signed

Return Value

  • Encoded signature with Base 58 form

getSignDataForKeyId

Description

  • signs data with the specific Key.

    Status of Key Manager must be unlocked state

Parameters

Type

Parameter

Description

NSString

keyId

keyID that corresponds to the key

NSData

source

data to be signed

Return Value

  • Signature of NSData type

Claim Management

addClaim

Description

  • Add, verifiable JSON format, Claim(VC) String on KeyFile

  • On Key File add Claim(VC) String which is a verifiable JSON format Status of Key Manager must be unlocked state

Parameters

Type

Parameter

Description

NSString

claim

CLaim(VC) String of JSON format to be added

Return Value

  • YES, if added successfully otherwise return, NO

getClaims

Description

  • Get all stored VC on NSArray.

Return

  • NSArray of IWClaimData object

Refer to: IWClaimData Class

Filtering Condition

getClaimsWithFilter

Description

  • Uses the filtering condition to get specific confirmable VC

Parameters

Type

Parameter

Description

NSString

filter

filtering condition

Return Value

  • NSArray that has the object of searched IWClaimData type

Refer to: IWClaimData Class

removeClaimAtIndex

Description

  • Uses an index to remove VC. Status of Key Manager must be unlocked state

Parameters

Type

Parameter

Description

NSUInteger

index

제거될 인덱스

Return Value

  • YES, if removed successfully otherwise return, NO

removeClaimObject

Description

  • Removes the identical Claim as the VC object among identifiable claims Status of Key Manager must be unlocked state

Parameters

Type

Name

Description

IWClaimData

claim

Claim Object

Return Value

  • YES, if removed successfully otherwise return, NO

removeClaimsWithFilter

Description

  • Use the filtering condition to remove identifiable Claims Status of Key Manager must be unlocked state

Parameters

Type

Parameter

Description

NSString

filter

filtering condition

Return Value

  • YES, if removed successfully otherwise return, NO

removeAllClaims

Description

  • Remove all VCs that are stored.

    Status of Key Manager must be unlocked state

Return Value

  • YES, if removed successfully otherwise return, NO

Elliptic Curve Integrated Encryption Scheme

getECIESEncryptData

Description

  • With the value obtained from the Elliptic Curve Cryptosystem get ENCRYPTED data after AES encryption.

    Status of Key Manager must be unlocked state

Parameters

Type

Parameter

Description

NSString

keyId

key ID for private key look-up

NSData

nonce

Unpredictable String (random value)

NSString

publicKey

public key of decryptor encoded with Base 58

NSData

source

data to encrypt

AES_TYPE

aesType

AES128 or AES256

Return Value

  • Encrypted data

Refer : AES_TYPE

getECIESDecryptData

Description

  • with a value obtained from the Elliptic Curve Cryptosystem get DECRYPTED data after AES encryption.

    Status of Key Manager must be unlocked state

Parameters

Type

Parameter

Description

NSString

keyId

Key ID for private key look-up

NSData

nonce

unpredictable Sring (random value)

NSString

publicKey

public key of decryptor encoded with Base 58

NSData

source

Data to decrypt

AES_TYPE

aesType

AES128 or AES256

Return Value

  • Decrypted data

Refer to : AES_TYPE

File Management

getHeader

Description

  • Gets the Header object of the key file.

Return Value

  • Header object of the file (IWKeyStoreHeadElement)

Refer to: IWKeyStoreHeadElement

checkWalletFileExists

Description

  • Checks the existence of KeyFile.

Return Value

  • YESif exists, otherwise returns NO

deleteWalletFile

Description

  • Deletes the key file.

resetWalletFile

Description

  • Resets the wallet files and settings.

EOS KEY Convert

getEOSPublicKeyWithKeyId

Description

  • Uses keyId to get EOSPublicKey

Parameters

Type

Parameter

Description

NSString

keyId

Alias of the key to find

Return Value

  • EOSPublicKey(Wallet Import Format)

getEOSPrivateKeyWithKeyId

Description

  • Uses KeyId to get EOSPrivateKey.

    Status of Key Manager must be an unlocked state.

Parameters

Type

Parameter

Description

NSString

keyId

Alias of the key to find

Return Value

  • EOSPriavteKey(Wallet Import Format)

Zero Knowledge Proof

genZKPMasterSecret

Description

  • Create the master secret for zero-knowledge proof. SDK manages the master secret and App returns only the master secret ID.

Return Value

  • master secret ID of NSString type

removeAllMasterSecrets

Description

  • Removes all the master secrets that is stored.

Return Value

  • YES , if removes successfully and returns NOif fails

verifyCredentialOffer:withPublicKey:completeHandler:failureHandler:

Description

  • verifies the CredentialOffer

Parameters

Type

Parameter

Description

CredentialOfferData

credentialOfferData

CredentialOffer model

ZKPPublicKeyData

pubKey

PublicKeymodel for ZKP

void(^)(void)

completeHandler

Verification success block

void(^)(int)

failureHandler

Verification failed block

failureHandler

Type

Parameter

Description

int

errorCode

Error code

errorCode

errorCode

Description

1

Verification failed

generateZKPCredentialRequest:withDID:withMasterSecretId:withCredentialOffer:withNonce:completeHander:failureHandler:

Description

  • Generates ZKPCredentialRequest to receive ZKPCredential(VC).

Parameters

Type

Parameter

Description

ZKPPublicKeyData

pubkey

ZKPPublicKeyData

NSString

did

User DID

NSString

masterSecretId

MasterSecret ID

CredentialOfferData

credOffer

CredentialOfferData

NSString

nonce

Unpredictable String (random value)

(void(^)(NSString *)

completeHandler

Generation complete block

(void(^)(int))

failureHand

Generation failed block

completeHandler

Type

Parameter

Description

NSString

zkpCredentialReqest

required NSString of JSON format necessary to receive ZKPCredential

failureHandler

Type

Parameter

Description

int

errorCode

failed error code

errorCode

errorCode

Description

1

relevant masterSecret ID does not exist

zkpCredentialVerifierWithSignatureCredential:withSignCredProof:withValues:withPublicKey:withMasterSecretKeyId:withVPrime:withNonce:completeHander:failureHandler:

Description

  • Verifies the received ZKP Credential(VC).

Parameters

Type

Parameter

Description

ZKPSignatureCredential

signCred

ZKPSignatureCredential

ZKPSignatureCorrectnessProof

proof

ZKPSignatureCorrectnessProof

NSMutableDictionary

values

Credential values

ZKPPublicKeyData

pubKey

ZKPPublicKeyData

NSString

masterSecretId

Master secret ID

NSString

vPrime

vPrime value of the credential

NSString

nonce

Unpredictable String (random value)

void(^)(void)

completeHandler

Verification success block

void(^)(int)

failureHandler

Verification failed block

failureHandler

Type

Parameter

Description

int

errorCode

failed error code

errorCode

errorCode

Description

1

Key-value of r and values does not match

2

Abnormal public key

3

cred failed

4

proof failed

5

Relevant masterSecret ID does not exist

saveZKPCredentialWithID:withOriginCredential:withVPrime

Description

  • Saves the received zkpCredential(VC).

Parameters

Type

Parameter

Description

NSString

credDefID

credentialDefinitionID

NSString

credentialJsonString

JSON format String of ZKPCredential

NSString

vPrime

vPrime value of a 0credential

getZKPCredential:withError:

Description

  • Gets all the stored ZKPCredential.

Parameters

Type

Parameter

Description

NSString

credDefId

credentialDefinitionID

NSError *

error

a pointer of NSError type

completeHandler

Type

Parameter

Description

NSString

backedUpData

backed-up date

failureHandler

Type

Parameter

Description

NSString

errorMessage

failed message

NSUInteger

errorCode

failed error code

getAllZKPCredentials

Description

  • Gets all the ZKP Credential.

Return Value

  • NSDictionary which has the ZKP Credential

removeAllZKPClaims

Description

  • Removes all the ZKP Credential.

Return Value

  • YES, if removed successfully and returns NOwhen failed

getZKPCredentialsList

Description

  • Gets file list of stored ZKP Credential

Return Value

  • file list NSArray

makeZkpVerifyProof:withCredential:withMasterSecretId:withPublicKey:completehandler:failureHandler:

Description

  • Creates Request to verify the ZKP Credential(VC)

Parameters

Type

Parameter

Description

ZKPProofRequest

zkpProofRequest

ZKPProofRequest

ZKPCredential

credential

ZKPCredential

NSString

masterSecretId

masterSecret ID

ZKPPublicKeyData

pubKey

ZKPPublicKeyData

void(^)(NSString *)

completeHandler

Creation completed block

void(^)(int)

failureHanlder

Creation failed block

completeHandler

Type

Parameter

Description

NSString

zkpVerifyRequestString

JSON format string to verify the ZKP Credential(VC)

failureHandler

Type

Parameter

Description

int

errorCode

Fail error code

errorCode

errorCode

Description

1

relevant masterSecretId does not exist

101

the key which trying to hide (unrevealed Attrs) does not exist in the [r] values of the public key.

102

the key which trying to hide does not exist in the mTilde value

151

the delta value is not valid

152

the key value of unrevealedAttrs does not contain the key value of mTilde

153

key-value of uTilde is not normal

154

key-value of rTilde is not normal

155

the delta value of rTilde does not exist

156

the value of t is not normal

157

the value of uTilde is not normal

158

The Credential(VC) value and key of the input-value does not match

201

The value of initProof is null

202

cList of initProof is null

203

tList of initProof is null

204

nonce of ZKPProofRequest does not exist

205

value of challenge is null

206

value of tList is null

207

equalProof object does not exist.

208

key-value of unrevealedAttrs does not contain in the key -value of mTilde

209

the value of Credential(VC) and key of the input-value does not match

210

the value of Credential(VC) and key of the input-value does not match

makeZkpVerifyProof:withCredentialJsonString:withMasterSecretId:withPublicKey:completehandler:failureHandler:

Description

  • Create a Request to verify the ZKP Credential(VC).

Parameters

Type

Parameter

Description

ZKPProofRequest

zkpProofRequest

ZKPProofRequest

NSString

credentialJsonString

JSON format NSString value of the ZKPCredential

NSString

masterSecretId

masterSecret Id

ZKPPublicKeyData

pubKey

ZKPPublicKeyData

void(^)(NSString *)

completeHandler

Creation completed block

void(^)(int)

failureHanlder

Creation failed block

completeHandler

Type

Parameter

Description

NSString

zkpVerifyRequestString

JSON format String to verify ZKP Credential(VC)

failureHandler

Type

Parameter

Description

int

errorCode

failed error code

errorCode

errorCode

Description

1

relevant masterSecretId does not exist

101

the key which trying to hide (unrevealed Attrs) does not exist in the [r] values of the public key.

102

the key which trying to hide does not exist in the mTilde value

151

the delta value is not valid

152

the key value of unrevealedAttrs does not contain the key value of mTilde

153

key-value of uTilde is not normal

154

key-value of rTilde is not normal

155

the delta value of rTilde does not exist

156

the value of t is not normal

157

the value of uTilde is not normal

158

The Credential(VC) value and key of the input-value does not match

201

The value of initProof is null

202

cList of initProof is null

203

tList of initProof is null

204

nonce of ZKPProofRequest does not exist

205

value of challenge is null

206

value of tList is null

207

equalProof object does not exist.

208

key-value of unrevealedAttrs does not contain in the key -value of mTilde

209

the value of Credential(VC) and key of the input-value does not match

210

the value of Credential(VC) and key of the input-value does not match

Last updated

Was this helpful?