Skip to content

Commit 7559166

Browse files
committed
feat: remove port number from TEI and add TODO item to docs
Signed-off-by: Pavel Shukhman <[email protected]>
1 parent 4d0d505 commit 7559166

File tree

2 files changed

+44
-28
lines changed

2 files changed

+44
-28
lines changed

discovery/readme.md

Lines changed: 43 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,12 @@ barcode and one with the vendor's product number.
7070
The TEI consists of three core parts
7171

7272
```text
73-
urn:tei:<type>:<domain-name>:<domain-port>:<unique-identifier>
73+
urn:tei:<type>:<domain-name>:<unique-identifier>
7474
````
7575
7676
- The **`type`** which defines the syntax of the unique identifier part
7777
- The **`domain-name`** part resolves into a web server, which may not be the API host.
7878
- The uniqueness of the name is the domain name part that has to be registred at creation of the TEI.
79-
- The **`domain-port`** is the port number of the web server on which ./well-known/tea is available.
8079
- The **`unique-identifier`** has to be unique within the `domain-name`.
8180
Recommendation is to use a UUID but it can be an existing article code too
8281
@@ -95,13 +94,13 @@ Where the `unique-identifier` is a PURL in it's canonical string form.
9594
Syntax:
9695
9796
```text
98-
urn:tei:purl:<domain-name>:<domain-port>:<purl>
97+
urn:tei:purl:<domain-name>:<purl>
9998
````
10099
101100
Example:
102101
103102
```text
104-
urn:tei:purl:cyclonedx.org:443:pkg:pypi/[email protected]?extension=whl&qualifier=py3-none-any
103+
urn:tei:purl:cyclonedx.org:pkg:pypi/[email protected]?extension=whl&qualifier=py3-none-any
105104
```
106105

107106
#### SWID
@@ -111,7 +110,7 @@ Where the `unique-identifier` is a SWID.
111110
Syntax:
112111

113112
```text
114-
urn:tei:swid:<domain-name>:<domain-port>:<swid>
113+
urn:tei:swid:<domain-name>:<swid>
115114
````
116115
117116
Note that there is a TEI SWID type as well as a PURL SWID type.
@@ -125,12 +124,12 @@ Where the `unique-identifier` is a Hash. Supports the following hash types:
125124
- SHA512
126125
127126
```text
128-
urn:tei:hash:<domain-name>:<domain-port>:<hashtype>:<hash>
127+
urn:tei:hash:<domain-name>:<hashtype>:<hash>
129128
````
130129
131130
Example:
132131
```text
133-
urn:tei:hash:cyclonedx.org:443:SHA256:fd44efd601f651c8865acf0dfeacb0df19a2b50ec69ead0262096fd2f67197b9
132+
urn:tei:hash:cyclonedx.org:SHA256:fd44efd601f651c8865acf0dfeacb0df19a2b50ec69ead0262096fd2f67197b9
134133
```
135134

136135
The origin of the hash is up to the vendor to define.
@@ -142,12 +141,12 @@ Where the `unique-identifier` is a UUID.
142141
Syntax:
143142

144143
```text
145-
urn:tei:uuid:<domain-name>:<domain-port>:<uuid>
144+
urn:tei:uuid:<domain-name>:<uuid>
146145
````
147146
148147
Example:
149148
```text
150-
urn:tei:uuid:cyclonedx.org:443:d4d9f54a-abcf-11ee-ac79-1a52914d44b1
149+
urn:tei:uuid:cyclonedx.org:d4d9f54a-abcf-11ee-ac79-1a52914d44b1
151150
```
152151

153152
#### EAN/UPC
@@ -157,12 +156,12 @@ Where the `unique-identifier` is a EAN/UPC.
157156
Syntax:
158157

159158
```text
160-
urn:tei:eanupc:<domain-name>:<domain-port>:<ean/upc-number>
159+
urn:tei:eanupc:<domain-name>:<ean/upc-number>
161160
````
162161
163162
Example:
164163
```text
165-
urn:tei:eanupc:cyclonedx.org:443:1234567890123
164+
urn:tei:eanupc:cyclonedx.org:1234567890123
166165
```
167166

168167
#### GTIN
@@ -172,12 +171,12 @@ Where the `unique-identifier` is a [GTIN](https://www.gs1.org/standards/id-keys/
172171
Syntax:
173172

174173
```text
175-
urn:tei:gtin:<domain-name>:<domain-port>:<gtin-number>
174+
urn:tei:gtin:<domain-name>:<gtin-number>
176175
````
177176
178177
Example:
179178
```text
180-
urn:tei:gtin:cyclonedx.org:443:0234567890123
179+
urn:tei:gtin:cyclonedx.org:0234567890123
181180
```
182181

183182
#### ASIN
@@ -187,12 +186,12 @@ Where the `unique-identifier` is a [ASIN](https://sell.amazon.com/blog/what-is-a
187186
Syntax:
188187

189188
```text
190-
urn:tei:asin:<domain-name>:<domain-port>:<asin-identifier>
189+
urn:tei:asin:<domain-name>:<asin-identifier>
191190
````
192191
193192
Example:
194193
```text
195-
urn:tei:asin:cyclonedx.org:443:B07FZ8S74R
194+
urn:tei:asin:cyclonedx.org:B07FZ8S74R
196195
```
197196

198197

@@ -203,12 +202,12 @@ Where the `unique-identifier` is a [UDI](https://www.gs1.org/industries/healthca
203202
Syntax:
204203

205204
```text
206-
urn:tei:udi:<domain-name>:<domain-port>:<udi-identifier>
205+
urn:tei:udi:<domain-name>:<udi-identifier>
207206
````
208207
209208
Example:
210209
```text
211-
urn:tei:udi:cyclonedx.org:443:00123456789012
210+
urn:tei:udi:cyclonedx.org:00123456789012
212211
```
213212

214213
Note that if an identifier, like EAN, is used for multiple different product releases
@@ -226,19 +225,19 @@ product transparency exchange information.
226225
At the URL a well-known name space is used to find out where the API endpoint is hosted.
227226
This is solved by using the ".well-known" name space as defined by the IETF.
228227

229-
- `urn:tei:uuid:products.example.com:443:d4d9f54a-abcf-11ee-ac79-1a52914d44b1`
230-
- Syntax: `urn:tei:uuid:<name based on domain>:<domain-port>:<unique identifier>`
228+
- `urn:tei:uuid:products.example.com:d4d9f54a-abcf-11ee-ac79-1a52914d44b1`
229+
- Syntax: `urn:tei:uuid:<name based on domain>:<unique identifier>`
231230

232231
The name in the DNS name part points to a set of DNS records.
233232

234233
A TEI with `domain-name` `tea.example.com` queries DNS for `tea.example.com`, considering `A`, `AAAA` and `CNAME` records.
235234
These point to the hosts available for the Transparency Exchange API.
236235

237-
The TEA client connects to the host using HTTPS on the domain port specified in TEI and validates
238-
the certificate. The URL is composed of the host name and port with the `/.well-known/tea` path added.
236+
The TEA client connects to the host using HTTPS and validates
237+
the certificate. The URL is composed of the host name with the `/.well-known/tea` path added.
239238

240239
This results in the base URL such as
241-
`https://products.example.com:443/.well-known/tea`
240+
`https://products.example.com/.well-known/tea`
242241

243242
This response must contain json object that lists the available TEA server endpoints and supported versions.
244243
The json must conform to the [TEA Well-Known Schema](tea-well-known.schema.json).
@@ -270,6 +269,23 @@ Example:
270269
}
271270
```
272271

272+
## TODO: Port resolution
273+
274+
N.B. This needs to be resolved before finalizing the spec.
275+
276+
Currently, the port number is not part of the TEI but it is needed to connect to the API.
277+
The current assumption is that the client connects on the default https port (443).
278+
At this time, it is recommended that experimental clients add an optional port parameter, which
279+
allows to override the default port.
280+
281+
A port number cannot be added to the TEI URN spec as it breaks the location independence
282+
requirement of URN.
283+
284+
Possible solutions to this issue:
285+
1. Make a convention that the port number for the ./well-known/tea is always 443. Exceptions
286+
possible via explicit client setting for non-production environments only.
287+
2. Use SRV or HTTPS DNS records to resolve the ./well-known/tea URL with the port number.
288+
273289

274290
## Connecting to the API
275291

@@ -288,10 +304,10 @@ plus "/discovery?tei=", plus the TEI that is url-encoded according to [RFC3986]
288304
and [RFC3986]).
289305

290306
Examples:
291-
1. For TEI `urn:tei:uuid:products.example.com:443:d4d9f54a-abcf-11ee-ac79-1a52914d44b`
292-
`https://api.teaexample.com/v0.2.0-beta.2/discovery?tei=urn%3Atei%3Auuid%3Aproducts.example.com%3A443%3Ad4d9f54a-abcf-11ee-ac79-1a52914d44b`
293-
2. For TEI `urn:tei:purl:products.example.com:443:pkg:deb/debian/[email protected]?arch=i386&distro=jessie`
294-
`https://api2.teaexample.com/mytea/v1.0.0/discovery?tei=urn%3Atei%3Apurl%3Aproducts.example.com%3A443%3Apkg%3Adeb%2Fdebian%2Fcurl%407.50.3-1%3Farch%3Di386%26distro%3Djessie`
307+
1. For TEI `urn:tei:uuid:products.example.com:d4d9f54a-abcf-11ee-ac79-1a52914d44b`
308+
`https://api.teaexample.com/v0.2.0-beta.2/discovery?tei=urn%3Atei%3Auuid%3Aproducts.example.com%3Ad4d9f54a-abcf-11ee-ac79-1a52914d44b`
309+
2. For TEI `urn:tei:purl:products.example.com:pkg:deb/debian/[email protected]?arch=i386&distro=jessie`
310+
`https://api2.teaexample.com/mytea/v1.0.0/discovery?tei=urn%3Atei%3Apurl%3Aproducts.example.com%3Apkg%3Adeb%2Fdebian%2Fcurl%407.50.3-1%3Farch%3Di386%26distro%3Djessie`
295311

296312
The discovery endpoint is a part of the TEA OpenAPI specification.
297313

@@ -321,7 +337,7 @@ Servers MUST NOT locate the actual TEA service endpoint at the
321337

322338
The .well-known endpoint must only be available via HTTPS. Using unencrypted HTTP is not valid.
323339

324-
- TEI: `urn:tei:uuid:products.example.com:443:d4d9f54a-abcf-11ee-ac79-1a52914d44b1`
340+
- TEI: `urn:tei:uuid:products.example.com:d4d9f54a-abcf-11ee-ac79-1a52914d44b1`
325341
- URL: `https://products.example.com/.well-known/tea`
326342

327343
**NOTE:** The `/.well-known/tea` names space needs to be registred.

spec/openapi.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ paths:
389389
description: Transparency Exchange Identifier (TEI) for the product being discovered. Provide the TEI as a URL-encoded string per RFC 3986, RFC 3987.
390390
schema:
391391
type: string
392-
example: urn%3Atei%3Auuid%3Aproducts.example.com%3A443%3Ad4d9f54a-abcf-11ee-ac79-1a52914d44b
392+
example: urn%3Atei%3Auuid%3Aproducts.example.com%3Ad4d9f54a-abcf-11ee-ac79-1a52914d44b
393393
responses:
394394
'200':
395395
$ref: "#/components/responses/discovery-response"

0 commit comments

Comments
 (0)