Skip to content

Commit 564de65

Browse files
committed
Merge branch 'RM-3194_key_shares_split' into 'SID'
RM-3194: Separate key-capsules and key-shares openapi yaml files See merge request cdoc2/cdoc2-openapi!2
2 parents ccd8b89 + 7734cb2 commit 564de65

File tree

5 files changed

+245
-159
lines changed

5 files changed

+245
-159
lines changed

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ So defining single Maven package repo from `open-eid` is enough for pulling cdoc
4444
Test that `settings.xml` is properly configured:
4545
```bash
4646
mvn dependency::get -Dartifact=ee.cyber.cdoc2.openapi:cdoc2-key-capsules-openapi:2.1.0:yaml
47+
mvn dependency::get -Dartifact=ee.cyber.cdoc2.openapi:cdoc2-key-shares-openapi:1.0.0:yaml
4748
```
4849

4950
Optionally specifying
@@ -58,11 +59,18 @@ Or from Maven pom.xml:
5859
<version>2.1.0</version>
5960
<type>yaml</type>
6061
</dependency>
62+
<dependency>
63+
<groupId>ee.cyber.cdoc2.openapi</groupId>
64+
<artifactId>cdoc2-key-shares-openapi</artifactId>
65+
<version>1.0.0</version>
66+
<type>yaml</type>
67+
</dependency>
6168
```
6269

6370
Copy into project directory:
6471
```bash
6572
mvn dependency::copy -Dartifact=ee.cyber.cdoc2.openapi:cdoc2-key-capsules-openapi:2.1.0:yaml -DoutputDirectory=./target/openapi
73+
mvn dependency::copy -Dartifact=ee.cyber.cdoc2.openapi:cdoc2-key-shares-openapi:1.0.0:yaml -DoutputDirectory=./target/openapi
6674
```
6775

6876
### Usage from Java Maven projects for code generation
@@ -101,6 +109,8 @@ where `project.distributionManagement.repository.id` is `<id>` under `<server>`
101109
In most cases, this parameter will be required for authentication.
102110

103111
Or use maven deploy:deploy-file directly to deploy single file:
112+
113+
cdoc2-key-capsules:
104114
```
105115
mvn deploy:deploy-file \
106116
-DrepositoryId=github \
@@ -112,13 +122,32 @@ mvn deploy:deploy-file \
112122
-DartifactId=cdoc2-key-capsules-openapi \
113123
-Dmaven.deploy.file.skip=false
114124
```
125+
126+
cdoc2-key-shares:
127+
```
128+
mvn deploy:deploy-file \
129+
-DrepositoryId=github \
130+
-Durl=https://maven.pkg.github.com/open-eid/cdoc2-openapi \
131+
-Dfile=cdoc2-openapi/cdoc2-key-shares-openapi.yaml \
132+
-Dversion=1.0.0 \
133+
-Dpackaging=yaml \
134+
-DgroupId=ee.cyber.cdoc2.openapi \
135+
-DartifactId=cdoc2-key-shares-openapi \
136+
-Dmaven.deploy.file.skip=false
137+
```
115138
Refer: https://maven.apache.org/plugins/maven-deploy-plugin/deploy-file-mojo.html
116139

117140
## Delete OpenApi package from local Maven repository
141+
cdoc2-key-capsules:
118142
```
119143
mvn dependency:purge-local-repository -DmanualInclude=ee.cyber.cdoc2.openapi:cdoc2-key-capsules-openapi
120144
```
121145

146+
cdoc2-key-shares:
147+
```
148+
mvn dependency:purge-local-repository -DmanualInclude=ee.cyber.cdoc2.openapi:cdoc2-key-shares-openapi
149+
```
150+
122151

123152

124153

cdoc2-key-capsules-openapi.yaml

Lines changed: 2 additions & 149 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ info:
33
contact:
44
url: http://ria.ee
55
title: cdoc2-key-capsules
6-
version: sid2.1.0
6+
version: 2.1.0
77
description: API for exchanging CDOC2 ephemeral key material in key capsules
88
servers:
99
- url: 'https://localhost:8443'
@@ -49,6 +49,7 @@ paths:
4949
operationId: getCapsuleByTransactionId
5050
security:
5151
- mutualTLS: []
52+
5253
/key-capsules:
5354
post:
5455
summary: Add Key Capsule
@@ -83,110 +84,6 @@ paths:
8384
tags:
8485
- cdoc2-key-capsules
8586

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-
19087
components:
19188
schemas:
19289
Capsule:
@@ -221,56 +118,12 @@ components:
221118
- recipient_id
222119
- ephemeral_key_material
223120
- 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-
260121
securitySchemes:
261122
mutualTLS:
262123
# since mutualTLS is not supported by OAS 3.0.x, then define it as http basic auth. MutualTLS must be implemented
263124
# manually anyway
264125
#type: mutualTLS
265126
type: http
266127
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-
274128
tags:
275129
- name: cdoc2-key-capsules
276-
- name: cdoc2-key-shares

0 commit comments

Comments
 (0)