Skip to content

Commit

Permalink
Merge pull request #3 from eu-digital-identity-wallet/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
psima authored Nov 9, 2023
2 parents b1a932c + 0dcdece commit cc98010
Show file tree
Hide file tree
Showing 16 changed files with 723 additions and 10 deletions.
17 changes: 17 additions & 0 deletions Documentation/Reference/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Reference Documentation

## Protocols

- [DataStorageService](protocols/DataStorageService.md)

## Structs

- [Document](structs/Document.md)
- [IssueRequest](structs/IssueRequest.md)
- [StorageError](structs/StorageError.md)

## Classes

- [KeyChainStorageService](classes/KeyChainStorageService.md)

This file was generated by [SourceDocs](https://github.com/eneko/SourceDocs) on 2023-11-08 22:44:40 +0000
159 changes: 159 additions & 0 deletions Documentation/Reference/classes/KeyChainStorageService.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
**CLASS**

# `KeyChainStorageService`

**Contents**

- [Properties](#properties)
- `serviceName`
- `accessGroup`
- [Methods](#methods)
- `loadDocument(id:)`
- `init()`
- `loadDocuments()`
- `saveDocument(_:)`
- `deleteDocument(id:)`
- `deleteDocuments()`
- `makeQuery(id:bAll:)`
- `makeDocument(dict:)`

```swift
public class KeyChainStorageService: DataStorageService
```

Implements key-chain storage

## Properties
### `serviceName`

```swift
public var serviceName: String = "eudiw"
```

### `accessGroup`

```swift
public var accessGroup: String?
```

## Methods
### `loadDocument(id:)`

```swift
public func loadDocument(id: String) throws -> Document?
```

### `init()`

```swift
public init()
```

### `loadDocuments()`

```swift
public func loadDocuments() throws -> [Document]?
```

Gets the secret with the id passed in parameter
- Parameters:
- label: The label (docType) of the secret
- Returns: The secret

#### Parameters

| Name | Description |
| ---- | ----------- |
| label | The label (docType) of the secret |

### `saveDocument(_:)`

```swift
public func saveDocument(_ document: Document) throws
```

Save the secret to keychain
Note: the value passed in will be zeroed out after the secret is saved
- Parameters:
- id: The Id of the secret
- accessGroup: The access group to use to save secret.
- value: The value of the secret
- label: label of the document

#### Parameters

| Name | Description |
| ---- | ----------- |
| id | The Id of the secret |
| accessGroup | The access group to use to save secret. |
| value | The value of the secret |
| label | label of the document |

### `deleteDocument(id:)`

```swift
public func deleteDocument(id: String) throws
```

Delete the secret from keychain
Note: the value passed in will be zeroed out after the secret is deleted
- Parameters:
- id: The Id of the secret

#### Parameters

| Name | Description |
| ---- | ----------- |
| id | The Id of the secret |

### `deleteDocuments()`

```swift
public func deleteDocuments() throws
```

Delete all documents from keychain
Note: the value passed in will be zeroed out after the secret is deleted
- Parameters:
- id: The Id of the secret

#### Parameters

| Name | Description |
| ---- | ----------- |
| id | The Id of the secret |

### `makeQuery(id:bAll:)`

```swift
func makeQuery(id: String?, bAll: Bool) -> [String: Any]
```

Make a query for a an item in keychain
- Parameters:
- id: id
- bAll: request all matching items
- Returns: The dictionary query

#### Parameters

| Name | Description |
| ---- | ----------- |
| id | id |
| bAll | request all matching items |

### `makeDocument(dict:)`

```swift
func makeDocument(dict: NSDictionary) -> Document
```

Make a document from a keychain item
- Parameter dict: keychain item returned as dictionary
- Returns: the document

#### Parameters

| Name | Description |
| ---- | ----------- |
| dict | keychain item returned as dictionary |
53 changes: 53 additions & 0 deletions Documentation/Reference/protocols/DataStorageService.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
**PROTOCOL**

# `DataStorageService`

```swift
public protocol DataStorageService
```

Data storage protocol

## Properties
### `serviceName`

```swift
var serviceName: String
```

### `accessGroup`

```swift
var accessGroup: String?
```

## Methods
### `loadDocument(id:)`

```swift
func loadDocument(id: String) throws -> Document?
```

### `loadDocuments()`

```swift
func loadDocuments() throws -> [Document]?
```

### `saveDocument(_:)`

```swift
func saveDocument(_ document: Document) throws
```

### `deleteDocument(id:)`

```swift
func deleteDocument(id: String) throws
```

### `deleteDocuments()`

```swift
func deleteDocuments() throws
```
58 changes: 58 additions & 0 deletions Documentation/Reference/structs/Document.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
**STRUCT**

# `Document`

**Contents**

- [Properties](#properties)
- `id`
- `docType`
- `data`
- `createdAt`
- `modifiedAt`
- [Methods](#methods)
- `init(id:docType:data:createdAt:modifiedAt:)`

```swift
public struct Document
```

wallet document structure

## Properties
### `id`

```swift
public var id: String = UUID().uuidString
```

### `docType`

```swift
public let docType: String
```

### `data`

```swift
public let data: Data
```

### `createdAt`

```swift
public let createdAt: Date
```

### `modifiedAt`

```swift
public let modifiedAt: Date?
```

## Methods
### `init(id:docType:data:createdAt:modifiedAt:)`

```swift
public init(id: String = UUID().uuidString, docType: String, data: Data, createdAt: Date, modifiedAt: Date? = nil)
```
55 changes: 55 additions & 0 deletions Documentation/Reference/structs/IssueRequest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
**STRUCT**

# `IssueRequest`

**Contents**

- [Properties](#properties)
- `secureKey`
- `publicKey`
- `certificate`
- [Methods](#methods)
- `init(certificate:savedKey:)`
- `signData(_:)`

```swift
public struct IssueRequest
```

Issue request structure

## Properties
### `secureKey`

### `publicKey`

### `certificate`

```swift
let certificate: SecCertificate?
```

## Methods
### `init(certificate:savedKey:)`

```swift
public init(certificate: SecCertificate? = nil, savedKey: Data? = nil) throws
```

Initialize issue request
- Parameters:
- certificate: Root certificate (optional)
- savedKey: saved key representation (optional)

#### Parameters

| Name | Description |
| ---- | ----------- |
| certificate | Root certificate (optional) |
| savedKey | saved key representation (optional) |

### `signData(_:)`

Sign data with ``secureKey``
- Parameter data: Data to be signed
- Returns: DER representation of signture for SHA256 hash
49 changes: 49 additions & 0 deletions Documentation/Reference/structs/StorageError.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
**STRUCT**

# `StorageError`

**Contents**

- [Properties](#properties)
- `description`
- `code`
- `errorDescription`
- [Methods](#methods)
- `init(description:code:)`
- `==(_:_:)`

```swift
public struct StorageError: LocalizedError
```

## Properties
### `description`

```swift
var description: String
```

### `code`

```swift
var code: Int
```

### `errorDescription`

```swift
public var errorDescription: String?
```

## Methods
### `init(description:code:)`

```swift
init(description: String, code: Int = 0)
```

### `==(_:_:)`

```swift
public static func ==(lhs: StorageError, rhs: StorageError) -> Bool
```
Loading

0 comments on commit cc98010

Please sign in to comment.