|
3 | 3 | contact: |
4 | 4 | url: http://ria.ee |
5 | 5 | title: cdoc2-key-capsules |
6 | | - version: 2.1.0 |
| 6 | + version: sid2.1.0 |
7 | 7 | description: API for exchanging CDOC2 ephemeral key material in key capsules |
8 | 8 | servers: |
9 | 9 | - url: 'https://localhost:8443' |
10 | | - description: no auth (for creating key capsules) |
| 10 | + description: no auth (for creating key capsules). Regular TLS (no mutual TLS required). May require bearerAuth, depending on endpoint |
11 | 11 | - url: 'https://localhost:8444' |
12 | 12 | description: mutual TLS authentication (for retrieving key capsules) |
| 13 | + |
13 | 14 | paths: |
14 | 15 | '/key-capsules/{transactionId}': |
15 | 16 | get: |
@@ -81,6 +82,111 @@ paths: |
81 | 82 | security: [] |
82 | 83 | tags: |
83 | 84 | - cdoc2-key-capsules |
| 85 | + |
| 86 | + '/key-shares/{shareId}': |
| 87 | + get: |
| 88 | + summary: Get key share for shareId |
| 89 | + description: Get key share for shareId |
| 90 | + tags: |
| 91 | + - cdoc2-key-shares |
| 92 | + parameters: |
| 93 | + - name: shareId |
| 94 | + in: path |
| 95 | + schema: |
| 96 | + type: string |
| 97 | + minLength: 18 |
| 98 | + maxLength: 34 |
| 99 | + required: true |
| 100 | + - name: X-Auth-Ticket |
| 101 | + in: header |
| 102 | + schema: |
| 103 | + type: string |
| 104 | + format: byte |
| 105 | + required: true |
| 106 | + description: | |
| 107 | + [Auth ticket](https://gitlab.cyber.ee/id/ee-ria/ria_tender_test_assignment_2023/-/blob/master/exercise-2.3-authentication-multi-server/multi-server-auth-protocol.md?ref_type=heads#cdoc2-autentimispiletid) |
| 108 | + responses: |
| 109 | + '200': |
| 110 | + description: OK |
| 111 | + content: |
| 112 | + application/json: |
| 113 | + schema: |
| 114 | + $ref: '#/components/schemas/KeyShare' |
| 115 | + '400': |
| 116 | + description: 'Bad request. Client error.' |
| 117 | + '401': |
| 118 | + description: 'Unauthorized. No correct auth headers' |
| 119 | + '404': |
| 120 | + description: 'Not Found. 404 is also returned, when recipient id in record does not match user id in auth-ticket' |
| 121 | + operationId: getKeyShareByShareId |
| 122 | + security: |
| 123 | + - basicAuth: [] |
| 124 | + |
| 125 | + '/key-shares': |
| 126 | + post: |
| 127 | + summary: Add Key Share |
| 128 | + description: Save a key share and generate share id using secure random. Generated share is returned in Location header |
| 129 | + operationId: createKeyShare |
| 130 | + responses: |
| 131 | + '201': |
| 132 | + description: Created |
| 133 | + headers: |
| 134 | + Location: |
| 135 | + schema: |
| 136 | + type: string |
| 137 | + example: /key-shares/SS0123456789ABCDEF |
| 138 | + description: 'URI of created resource. ShareId can be extracted from URI as it follows pattern /key-shares/{shareId}' |
| 139 | + '400': |
| 140 | + description: 'Bad request. Client error.' |
| 141 | + requestBody: |
| 142 | + required: true |
| 143 | + content: |
| 144 | + application/json: |
| 145 | + schema: |
| 146 | + $ref: '#/components/schemas/KeyShare' |
| 147 | + security: |
| 148 | + - basicAuth: [] |
| 149 | + tags: |
| 150 | + - cdoc2-key-shares |
| 151 | + |
| 152 | + '/key-shares/{shareId}/nonce': |
| 153 | + post: |
| 154 | + description: | |
| 155 | + Create server nonce for authentication signature. |
| 156 | + operationId: createNonce |
| 157 | + parameters: |
| 158 | + - name: shareId |
| 159 | + in: path |
| 160 | + schema: |
| 161 | + type: string |
| 162 | + minLength: 18 |
| 163 | + maxLength: 34 |
| 164 | + required: true |
| 165 | + responses: |
| 166 | + '200': |
| 167 | + description: Created |
| 168 | + content: |
| 169 | + application/json: |
| 170 | + schema: |
| 171 | + $ref: '#/components/schemas/NonceResponse' |
| 172 | + '400': |
| 173 | + description: 'Bad request. Client error.' |
| 174 | + '403': |
| 175 | + description: 'Authentication failed' |
| 176 | + '404': |
| 177 | + description: 'Not Found. (shareId)' |
| 178 | + requestBody: |
| 179 | + required: false |
| 180 | + content: |
| 181 | + application/json: |
| 182 | + schema: #empty request body |
| 183 | + type: object |
| 184 | + nullable: true |
| 185 | + security: |
| 186 | + - basicAuth: [] |
| 187 | + tags: |
| 188 | + - cdoc2-key-shares |
| 189 | + |
84 | 190 | components: |
85 | 191 | schemas: |
86 | 192 | Capsule: |
@@ -115,12 +221,56 @@ components: |
115 | 221 | - recipient_id |
116 | 222 | - ephemeral_key_material |
117 | 223 | - capsule_type |
| 224 | + |
| 225 | + KeyShare: |
| 226 | + title: Key Share |
| 227 | + type: object |
| 228 | + properties: |
| 229 | + share: |
| 230 | + type: string |
| 231 | + format: byte |
| 232 | + minLength: 32 |
| 233 | + maxLength: 128 |
| 234 | + description: Key Share. Binary format is yet to be defined [#RM-55912](https://rm-int.cyber.ee/ito/issues/55912) |
| 235 | + recipient: |
| 236 | + type: string |
| 237 | + minLength: 12 |
| 238 | + maxLength: 32 |
| 239 | + description: | |
| 240 | + Recipient who can download this share. ETSI319412-1. Example "etsi/PNOEE-48010010101". |
| 241 | + In future might support other formats |
| 242 | + [etsi/:semantics-identifier](https://github.com/SK-EID/smart-id-documentation/blob/v2/README.md#2322-etsisemantics-identifier) |
| 243 | + required: |
| 244 | + - share |
| 245 | + - recipient |
| 246 | + |
| 247 | + NonceResponse: |
| 248 | + title: Nonce response |
| 249 | + type: object |
| 250 | + properties: |
| 251 | + nonce: |
| 252 | + type: string |
| 253 | + format: byte |
| 254 | + minLength: 12 |
| 255 | + maxLength: 16 |
| 256 | + description: 'server nonce for subsequent authentication' |
| 257 | + required: |
| 258 | + - nonce |
| 259 | + |
118 | 260 | securitySchemes: |
119 | 261 | mutualTLS: |
120 | 262 | # since mutualTLS is not supported by OAS 3.0.x, then define it as http basic auth. MutualTLS must be implemented |
121 | 263 | # manually anyway |
122 | 264 | #type: mutualTLS |
123 | 265 | type: http |
124 | 266 | scheme: basic |
| 267 | + bearerAuth: # for /key-shares endpoints, long-term token |
| 268 | + type: http |
| 269 | + scheme: bearer |
| 270 | + basicAuth: # temporary solution for initial functionality of /key-shares endpoints |
| 271 | + type: http |
| 272 | + scheme: basic |
| 273 | + |
125 | 274 | tags: |
126 | 275 | - name: cdoc2-key-capsules |
| 276 | + - name: cdoc2-key-shares |
0 commit comments