> For the complete documentation index, see [llms.txt](https://dev-en.omnione.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dev-en.omnione.net/sdk-instruction-guide/core-sdk-guide/ios-wallet/untitled-4.md).

# IWDidManager

## Constructor

### initWithName

```
- (instancetype)initWithName:(NSString *)name withDidType:(DID_TYPE)type
```

Description

* Specify a name to reset the object.
* DID Manager has to specify who manages Public DID as well as Private DID.

| Type      | Parameter | Description               |
| --------- | --------- | ------------------------- |
| NSString  | name      | Name of the DID Document  |
| DID\_TYPE | type      | Public DID or Private DID |

Return Value

* Resetted  IWDidManager object

## File

### initWithName

```
+ (NSArray *)getDidFileList:(DID_TYPE)type
```

Description

* Gets the name of the DID Document
* Can specify the type of DID to get

| Type      | Parameter | Description               |
| --------- | --------- | ------------------------- |
| DID\_TYPE | type      | Public DID or Private DID |

Return Value

* Name NSArray of the Document

### didExistsInLocal

```
- (BOOL)didExistsInLocal
```

Description

* Checks if the DID Document is stored in locally.

Return Value

* The value of DID Document existence is in BOOL value. If exists `YES`otherwise `NO`

## Save

### saveDids

```
- (BOOL)saveDids:(NSString *)dids
```

Description

* FileWrite the DID Document in JSON format

| Type     | Parameter | Description                        |
| -------- | --------- | ---------------------------------- |
| NSString | dids      | DID Document String in JSON format |

Return Value

* The value of DID Document saving is in BOOL value. If succeeds
  * `YES` otherwise, `No`

## Read

### makeRequestDIDsRead

```
- (NSString *)makeRequestDIDsRead
```

Description

* Read the DID Document stored Locally.

Return Value

* The DID Document String in JSON format that has been read

### getDidDocumentDataFromFile

```
- (IWDidDocumentData *)getDidDocumentDataFromFile
```

Description

* Read Locally stored DID Document as type object format of  IWDidDcoumentData&#x20;

Return Value

* The object of IWDidDcoumentData that has been read

## Delete

### deleteDidFile

```
- (void)deleteDidFile
```

Description

* Deletes the DID Document file stored Locally.

## DID

### genDid

```
- (NSString *)genDid
```

Description

* Generates the DID String that suits the DID format.

Return Value

* a String which starts with `did:omn`

### genDidWithPrefix

```
- (NSString *)genDidWithPrefix:(nullable NSString *)prefix
```

Description

* Generates DID by adding Prefix to a String which starts with `did:omn`

Parameters

| Type       | Parameter | Description                       |
| ---------- | --------- | --------------------------------- |
| `NSString` | prefix    | A word designated to specific DID |

Return Value

* A String value that starts with `did:omn:` and has appended Prefix
* example) `did:omn:prefix:zg2op1hgcnl5`

### genDidForPairwiseDid

```
- (NSString *)genDidForPairwiseDid
```

Description

* Generates DID String that suits the Private DID format

Return Value

* `did:omn:agent1`로 시작하는 String
* A String that starts with `did:omn:agentl`

### getDid

```
- (NSString *)getDid
```

Description

* Gets the DID from the stored DID Document.

Return Value

* DID String

## DID Document < Basic >

### makeRequestDIDsCreateWithDid

```
- (NSString *)makeRequestDIDsCreateWithDid:(NSString *)did
                                    KeyIds:(NSArray <NSString *> *)keyIds
                                keyManager:(IWKeyManager *)keyManager
```

Description

* Creates DID Document String of JSON type to register on the blockchain.

Parameters

| Type                    | Name       | Description                                                                           |
| ----------------------- | ---------- | ------------------------------------------------------------------------------------- |
| `NSString`              | did        | User's DID to be used                                                                 |
| `NSArray` of `NSString` | keyIds     | KeyID Array that is registered in the keyManager object to be used for authentication |
| `IWKeyManager`          | keyManager | keyManager object with unlock status                                                  |

Return Value

* DID Document String of JSON format that has no Proof

Refer to: `makeProofForDids`

### makeRequestDIDsAddForKeyId

```
- (NSString *)makeRequestDIDsAddForKeyId:(NSString *)keyId
                              keyManager:(IWKeyManager *)keyManager
```

Description

* Create the DID Document String in JSON type in order to register on the blockchain after adding keyID to the DID Document

Parameters

| Type           | Name       | Description                          |
| -------------- | ---------- | ------------------------------------ |
| `NSString`     | keyId      | keyID to add                         |
| `IWKeyManager` | keyManager | keyManager object with unlock status |

Return Value

* The DID Document String in JSON format that has no Proof

Refer to: `makeProofForDids`

### makeRequestDIDsDeleteForKeyId

```
- (NSString *)makeRequestDIDsDeleteForKeyId:(NSString *)keyId
```

Description

* Create the DID Document String in JSON type in order to register on the blockchain after deleting keyID to the Document

Parameters

| Type       |  Name |     Description |
| ---------- | :---: | --------------: |
| `NSString` | keyId | KeyID to delete |

Return Value

* The DID Document String in JSON format that has no Proof

Refer to : `makeProofForDids`

## DID Document < Advanced >

### makeRequestDIDsCreateWithDid(Advance)

```
- (NSString *)makeRequestDIDsCreateWithDid:(NSString *)did
                   keyIdsForAuthentication:(NSArray <NSString *> *)aKeyIds
                        keyIdsForPublicKey:(NSArray <NSString *> *)pKeyIds
                                keyManager:(IWKeyManager *)keyManager
```

Description

* Creates the DID Document String in JSON type to register on the blockchain

Parameters

| Type                    |    Name    |                                                                           Description |
| ----------------------- | :--------: | ------------------------------------------------------------------------------------: |
| `NSString`              |     did    |                                                                 User's DID to be used |
| `NSArray` of `NSString` |   aKeyIds  | KeyID Array that is registered in the keyManager object to be used for authentication |
| `NSArray` of `NSString` |   pKeyIds  |     KeyID Array that is registered in the keyManager object to be used for public key |
| `IWKeyManager`          | keyManager |                                                  keyManager object in unlocked status |

Return Value

* The DID Document String in JSON format that has no Proof

Refer to : `makeProofForDids`

## DID Assertion

### makeDIDAssertionWithType

```
- (NSString *)makeDIDAssertionWithType:(DID_ASSERTION_TYPE)type
                             signKeyId:(NSString *)signKeyId
                                 nonce:(NSString *)nonce
                            keyManager:(IWKeyManager *)keyManager
```

Description

* Creates a String in JSON format for using DID Auth

Parameters

| Type                 |    Name    |                                                                           Description |
| -------------------- | :--------: | ------------------------------------------------------------------------------------: |
| `DID_ASSERTION_TYPE` |    type    | <p>Assertion Type. <br>Currently, only the <code>default</code> type is available</p> |
| `NSString`           |  signKeyId |      KeyID alias that is registered in the keyManager object to be used for signature |
| `NSString`           |    nonce   |                                                   Unpredictable String (random value) |
| `IWKeyManager`       | keyManager |                                                  keyManager object in unlocked status |

Return Value

* The DID Auth String of JSON format that has Proof

#### DID\_ASSERTION\_TYPE

```
typedef NS_ENUM(NSInteger, DID_ASSERTION_TYPE){
    DID_ASSERTION_TYPE_DEFAULT,
    DID_ASSERTION_TYPE_END
};
```

Description

* DID assertion type. Currently, only`DID_ASSERTION_TYPE_DEFAULT` type is available to use

### makeDIDRevokeAssertion

```
- (NSString *)makeDIDRevokeAssertion:(IWRevokeElement *)didRevoke
                           signKeyId:(NSString *)signKeyId
                               nonce:(NSString *)nonce
                          keyManager:(IWKeyManager *)keyManager
```

Description

* Creates the DID document String in JSON format that has Proof to register on the blockchain

Parameters

| Type              |    Name    |                          Description |
| ----------------- | :--------: | -----------------------------------: |
| `IWRevokeElement` |  didRevoke |                        Revoke object |
| `NSString`        |  signKeyId |    key alias to be used on signature |
| `NSString`        |    nonce   |  Unpredictable String (random value) |
| `IWKeyManager`    | keyManager | keyManager object in unlocked status |

Return Value

* The DID Auth String in JSON format that has Proof

Refer to  : `IWRevokeElement` Class

## Proof

### makeProofForDids

```
- (NSString *)makeProofForDids:(NSString *)dids
                           did:(NSString *)did
                         nonce:(NSString *)nonce
                     signKeyId:(NSString *)signKeyId
                    keyManager:(IWKeyManager *)keyManager
```

Description

* Creates the DID Document String in JSON format with Proof in order to register on the blockchain

Parameters

| Type           |    Name    |                            Description |
| -------------- | :--------: | -------------------------------------: |
| `NSString`     |    dids    | The DID Document String in JSON format |
| `NSString`     |     did    |                  DID used when signing |
| `NSString`     |    nonce   |    Unpredictable String (random value) |
| `NSString`     |  signKeyId |      Key alias to be used on signature |
| `IWKeyManager` | keyManager |   keyManager object in unlocked status |

Return Value

* The DID Document String in JSON format that has Proof
