|
| 1 | +openapi: 3.0.3 |
| 2 | +info: |
| 3 | + contact: |
| 4 | + url: http://ria.ee |
| 5 | + title: cdoc2-key-shares |
| 6 | + version: 1.0.1-draft |
| 7 | + description: API for exchanging CDOC2 key material shares |
| 8 | +servers: |
| 9 | + - url: 'https://localhost:8443' |
| 10 | + description: Regular TLS (no mutual TLS required). |
| 11 | + |
| 12 | +paths: |
| 13 | + '/key-shares/{shareId}': |
| 14 | + get: |
| 15 | + summary: Get key share for shareId |
| 16 | + description: Get key share for shareId |
| 17 | + tags: |
| 18 | + - cdoc2-key-shares |
| 19 | + operationId: getKeyShareByShareId |
| 20 | + parameters: |
| 21 | + - name: shareId |
| 22 | + in: path |
| 23 | + schema: |
| 24 | + type: string |
| 25 | + minLength: 18 |
| 26 | + maxLength: 34 |
| 27 | + required: true |
| 28 | + - name: x-cdoc2-auth-ticket |
| 29 | + in: header |
| 30 | + schema: |
| 31 | + type: string |
| 32 | + required: true |
| 33 | + description: | |
| 34 | + SDJWT [Auth ticket WIP](https://gitlab.ext.cyber.ee/cdoc2/cdoc2-documentation/-/blob/RM-2776-authentication-protocol/cdoc2-system-docs/docs/03_system_architecture/ch05_ID_authentication_protocol.md?ref_type=heads#verifying-sd-jwt-verifying-authentication-ticket) |
| 35 | + - name: x-cdoc2-auth-x5c |
| 36 | + in: header |
| 37 | + schema: |
| 38 | + type: string |
| 39 | + required: true |
| 40 | + description: | |
| 41 | + PEM encoded X509 certificate (without newlines) that was used to sign X-Cdoc2-Auth-Ticket. |
| 42 | + Certificate holders identify is specified in Subject "serialnumber" field. This must match to |
| 43 | + "kid" in "x-cdoc2-auth-ticket" header. Example certificate subject: |
| 44 | + 'serialNumber = PNOEE-30303039914, GN = OK, SN = TESTNUMBER, CN = "TESTNUMBER,OK", C = EE' |
| 45 | + Certificate full structure is defined in |
| 46 | + [Certificate and OCSP Profile for Smart-ID](https://www.skidsolutions.eu/wp-content/uploads/2024/10/SK-CPR-SMART-ID-EN-v4_7-20241127.pdf) |
| 47 | + responses: |
| 48 | + '200': |
| 49 | + description: OK |
| 50 | + content: |
| 51 | + application/json: |
| 52 | + schema: |
| 53 | + $ref: '#/components/schemas/KeyShare' |
| 54 | + '400': |
| 55 | + description: 'Bad request. Client error.' |
| 56 | + '401': |
| 57 | + description: 'Unauthorized. No correct auth headers' |
| 58 | + '404': |
| 59 | + description: 'Not Found. 404 is also returned, when recipient id in record does not match user id in auth-ticket' |
| 60 | + |
| 61 | + |
| 62 | + '/key-shares': |
| 63 | + post: |
| 64 | + summary: Add Key Share |
| 65 | + description: Save a key share and generate share id using secure random. Generated share is returned in Location header |
| 66 | + operationId: createKeyShare |
| 67 | + responses: |
| 68 | + '201': |
| 69 | + description: Created |
| 70 | + headers: |
| 71 | + Location: |
| 72 | + schema: |
| 73 | + type: string |
| 74 | + example: /key-shares/9a7c3717d21f5cf19d18fa4fa5adee21 |
| 75 | + description: 'URI of created resource. ShareId can be extracted from URI as it follows pattern /key-shares/{shareId}' |
| 76 | + '400': |
| 77 | + description: 'Bad request. Client error.' |
| 78 | + requestBody: |
| 79 | + required: true |
| 80 | + content: |
| 81 | + application/json: |
| 82 | + schema: |
| 83 | + $ref: '#/components/schemas/KeyShare' |
| 84 | + tags: |
| 85 | + - cdoc2-key-shares |
| 86 | + |
| 87 | + '/key-shares/{shareId}/nonce': |
| 88 | + post: |
| 89 | + description: | |
| 90 | + Create server nonce for authentication signature. |
| 91 | + operationId: createNonce |
| 92 | + parameters: |
| 93 | + - name: shareId |
| 94 | + in: path |
| 95 | + schema: |
| 96 | + type: string |
| 97 | + minLength: 18 |
| 98 | + maxLength: 34 |
| 99 | + required: true |
| 100 | + responses: |
| 101 | + '200': |
| 102 | + description: Created |
| 103 | + content: |
| 104 | + application/json: |
| 105 | + schema: |
| 106 | + $ref: '#/components/schemas/NonceResponse' |
| 107 | + '400': |
| 108 | + description: 'Bad request. Client error.' |
| 109 | + '403': |
| 110 | + description: 'Authentication failed' |
| 111 | + '404': |
| 112 | + description: 'Not Found. (shareId)' |
| 113 | + requestBody: |
| 114 | + required: false |
| 115 | + description: Always empty (OAS doesn't allow post without body, so optional body is defined here) |
| 116 | + content: |
| 117 | + application/json: |
| 118 | + schema: #empty request body |
| 119 | + type: object |
| 120 | + nullable: true |
| 121 | + tags: |
| 122 | + - cdoc2-key-shares |
| 123 | + |
| 124 | +components: |
| 125 | + schemas: |
| 126 | + KeyShare: |
| 127 | + title: Key Share |
| 128 | + type: object |
| 129 | + properties: |
| 130 | + share: |
| 131 | + type: string |
| 132 | + format: byte |
| 133 | + minLength: 32 |
| 134 | + maxLength: 128 |
| 135 | + description: Key Share. Binary format is yet to be defined [#RM-55912](https://rm-int.cyber.ee/ito/issues/55912) |
| 136 | + recipient: |
| 137 | + type: string |
| 138 | + minLength: 12 |
| 139 | + maxLength: 32 |
| 140 | + description: | |
| 141 | + Recipient who can download this share. ETSI319412-1. Example "etsi/PNOEE-48010010101". |
| 142 | + In future might support other formats |
| 143 | + [etsi/:semantics-identifier](https://github.com/SK-EID/smart-id-documentation/blob/v2/README.md#2322-etsisemantics-identifier) |
| 144 | + required: |
| 145 | + - share |
| 146 | + - recipient |
| 147 | + |
| 148 | + NonceResponse: |
| 149 | + title: Nonce response |
| 150 | + type: object |
| 151 | + properties: |
| 152 | + nonce: |
| 153 | + type: string |
| 154 | + minLength: 12 |
| 155 | + maxLength: 16 |
| 156 | + description: 'server nonce for subsequent authentication' |
| 157 | + required: |
| 158 | + - nonce |
| 159 | + |
| 160 | + securitySchemes: |
| 161 | + bearerAuth: # for /key-shares endpoints, long-term token |
| 162 | + type: http |
| 163 | + scheme: bearer |
| 164 | + basicAuth: # temporary solution for initial functionality of /key-shares endpoints |
| 165 | + type: http |
| 166 | + scheme: basic |
| 167 | + |
| 168 | +tags: |
| 169 | + - name: cdoc2-key-shares |
0 commit comments