directory.openapi.yml 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341
  1. .references:
  2. # Servers
  3. work-servers: &work-servers
  4. - url: https://ds-apip-work.threema.ch
  5. description: Production server
  6. - url: https://ds-apip-work.test.threema.ch
  7. description: Sandbox server
  8. # Primitives
  9. base64: &base64
  10. type: string
  11. format: byte
  12. u16: &u16
  13. type: integer
  14. minimum: 0
  15. maximum: 65535
  16. u32: &u32
  17. type: integer
  18. minimum: 0
  19. maximum: 4294967295
  20. u64: &u64
  21. type: integer
  22. minimum: 0
  23. maximum: 18446744073709551615
  24. # Common
  25. identity: &identity
  26. description: A Threema ID.
  27. type: string
  28. minLength: 8
  29. maxLength: 8
  30. pattern: ^[0-9A-Z*]{1}[0-9A-Z]{7}$
  31. example: ECHOECHO
  32. public-key: &public-key
  33. <<: *base64
  34. description: Public Key (32 bytes, base64) associated to a Threema ID.
  35. example: ZWNob2VjaG9lY2hvZWNob2VjaG9lY2hvZWNob2VjaG8=
  36. app-version: &app-version
  37. description: |-
  38. App version. This is the CSP `client-info` but with the following special postfix:
  39. 1. If at least one Threema-MDM parameter and at least one external MDM parameter is active, append `;me`
  40. 2. If at least one Threema-MDM parameter is active, append `;m`
  41. 3. If at least one external MDM parameter is active, append `;e`
  42. 4. If no MDM parameter is active, don't append. (A lone `;` is also acceptable.)
  43. type: string
  44. minLength: 1
  45. example: 1.2.3;Q;de/DE;...
  46. work-username: &work-username
  47. description: Work license username.
  48. type: string
  49. minLength: 1
  50. example: echoecho@threema.ch
  51. work-password: &work-password
  52. description: Work license password.
  53. type: string
  54. minLength: 1
  55. example: super-secret-password
  56. work-nickname: &work-nickname
  57. description: |-
  58. User's nickname sourced from the MDM parameter `th_nickname`. Empty is
  59. equivalent to unset.
  60. type: string
  61. example: personal-🦜
  62. work-first-name: &work-first-name
  63. description: |-
  64. User's first name sourced from the MDM parameter `th_firstname`. Empty is
  65. equivalent to unset.
  66. type: string
  67. example: Aria
  68. work-last-name: &work-last-name
  69. description: |-
  70. User's last name sourced from the MDM parameter `th_lastname`. Empty is
  71. equivalent to unset.
  72. type: string
  73. example: Reverb
  74. work-user-identifier: &work-user-identifier
  75. description: |-
  76. Custom unique identifier of the user (e.g. employee number), sourced from
  77. the MDM parameter `th_csi`. Also known as _Customer Specific Identifier_.
  78. Empty is equivalent to unset.
  79. type: string
  80. work-job-title: &work-job-title
  81. description: |-
  82. Job title of the user, sourced from the MDM parameter `th_job_title`.
  83. Empty is equivalent to unset.
  84. type: string
  85. work-department: &work-department
  86. description: |-
  87. Department the user is working in, sourced from the MDM parameter
  88. `th_department`. Empty is equivalent to unset.
  89. type: string
  90. work-user-category-labels-delimited: &work-user-category-labels-delimited
  91. description: |-
  92. Custom category labels assigned to the user (e.g. building name, room
  93. number), sourced from the MDM parameter `th_category`. Empty is equivalent
  94. to unset.
  95. Note: For compatibility with the app configuration parameter
  96. `th_category`, this is the delimited variant with the category label
  97. separated by the category delimiter (`,` by default).
  98. type: string
  99. example: Building 1, Room 337
  100. work-user-category-id: &work-user-category-id
  101. description: A custom category ID.
  102. type: string
  103. minLength: 1
  104. example: 'jNekOWhQ8B'
  105. work-user-category-ids: &work-user-category-ids
  106. description: |-
  107. Custom category IDs of the user (e.g. mapping to a corresponding label
  108. such as building name or room number), chosen by the Work subscription
  109. administrator.
  110. type: array
  111. items: *work-user-category-id
  112. example:
  113. - '1'
  114. - 'jNekOWhQ8B'
  115. work-contacts-match: &work-contacts-match
  116. type: array
  117. items: *identity
  118. example:
  119. - ECHOECHO
  120. - '*SUPPORT'
  121. work-contact: &work-contact
  122. type: object
  123. required:
  124. - id
  125. - pk
  126. properties:
  127. id: *identity
  128. pk: *public-key
  129. first:
  130. <<: *work-first-name
  131. type:
  132. - string
  133. - 'null'
  134. last:
  135. <<: *work-last-name
  136. type:
  137. - string
  138. - 'null'
  139. jobTitle: *work-job-title
  140. department: *work-department
  141. work-organisation: &work-organisation
  142. type: object
  143. required:
  144. - name
  145. properties:
  146. name:
  147. description: |-
  148. Optional name of the organisation, translated by the `Accept-Language`
  149. header (if provided).
  150. type:
  151. - string
  152. - 'null'
  153. work-directory-page-index: &work-directory-page-index
  154. description: Page index.
  155. type: integer
  156. minimum: 0
  157. work-directory-sort: &work-directory-sort
  158. type: object
  159. properties:
  160. by:
  161. description: The sort key applied to the resulting contacts.
  162. type: string
  163. anyOf:
  164. - title: First name
  165. const: firstName
  166. - title: Last name
  167. const: lastName
  168. - {}
  169. default: firstName
  170. asc:
  171. description: |-
  172. Sort contacts ascending by `by` if `true`, sort descending if `false`.
  173. type: boolean
  174. default: true
  175. remote-secret: &remote-secret
  176. <<: *base64
  177. description: Remote Secret (32 bytes, base64).
  178. remote-secret-authentication-token: &remote-secret-authentication-token
  179. <<: *base64
  180. description: |-
  181. Remote Secret Authentication Token (32 bytes, base64). Allows to retrieve
  182. an associated Remote Secret.
  183. # Authentication challenge/response
  184. auth-challenge-request: &auth-challenge-request
  185. description: Authentication required.
  186. type: object
  187. required:
  188. - token
  189. - tokenRespKeyPub
  190. properties:
  191. token:
  192. <<: *base64
  193. description: An arbitrary challenge token (base64) to be _signed_.
  194. tokenRespKeyPub:
  195. <<: *base64
  196. description: |-
  197. The public key (CPK, 32 bytes, base64) to derive a shared secret for
  198. solving the challenge.
  199. auth-challenge-response: &auth-challenge-response
  200. type: object
  201. required:
  202. - token
  203. - response
  204. properties:
  205. token:
  206. <<: *base64
  207. description: The token of the challenge request (base64).
  208. response:
  209. <<: *base64
  210. description: |-
  211. The token of the challenge request, _signed_ in the following way:
  212. ```text
  213. base64(
  214. BLAKE2b(
  215. key=BLAKE2b(
  216. key=X25519HSalsa20(CK.secret, CPK.public),
  217. salt='dir',
  218. personal='3ma-csp',
  219. ),
  220. input=<token>
  221. )
  222. )
  223. ```
  224. work-auth-challenge-request: &work-auth-challenge-request
  225. description: |-
  226. Authentication challenge request for a Work endpoint.
  227. type: object
  228. required:
  229. - challengePublicKey
  230. - challenge
  231. properties:
  232. challengePublicKey:
  233. <<: *base64
  234. description: |-
  235. The public key (CPK, 32 bytes, base64) to derive a shared secret for
  236. solving the challenge.
  237. challenge:
  238. <<: *base64
  239. description: An arbitrary challenge (base64) to be _signed_.
  240. work-auth-challenge-response: &work-auth-challenge-response
  241. description: |-
  242. Authentication challenge response for a Work endpoint.
  243. type: object
  244. required:
  245. - challenge
  246. - response
  247. properties:
  248. challenge:
  249. <<: *base64
  250. description: The challenge (base64).
  251. response:
  252. <<: *base64
  253. description: |-
  254. The challenge, _signed_ in the following way:
  255. ```text
  256. base64(
  257. BLAKE2b(
  258. key=BLAKE2b(
  259. key=X25519HSalsa20(CK.secret, CPK.public),
  260. salt='wdir',
  261. personal='3ma-csp',
  262. ),
  263. input=<token>
  264. )
  265. )
  266. ```
  267. work-auth-failed: &work-auth-failed
  268. type: object
  269. required:
  270. - code
  271. properties:
  272. code:
  273. type: string
  274. anyOf:
  275. - enum:
  276. - invalid-credentials
  277. - challenge-expired
  278. - invalid-challenge-response
  279. - {}
  280. # Request/response data fragments
  281. blob-credentials-request: &blob-credentials-request
  282. type: object
  283. required:
  284. - identity
  285. properties:
  286. identity: *identity
  287. blob-credentials-response:
  288. ok: &blob-credentials-response-ok
  289. description: |-
  290. Blob server authentication credentials retrieved successfully.
  291. type: object
  292. required:
  293. - success
  294. - token
  295. - expiration
  296. properties:
  297. success:
  298. type: boolean
  299. const: true
  300. token:
  301. description: |-
  302. An opaque token used to authenticate against the blob server.
  303. HTTP requests towards the the blob server must include it as a
  304. header in the following way: `Authorization: ThreemaBlobToken
  305. <token>`
  306. type: string
  307. expiration:
  308. <<: *u64
  309. description: |-
  310. Amount of seconds until the token expires and must be discarded.
  311. example:
  312. success: true
  313. token: givemeaccessplz
  314. expiration: 600
  315. error: &blob-credentials-response-error
  316. description: |-
  317. Blob server authentication credentials could not be retrieved.
  318. type: object
  319. required:
  320. - success
  321. properties:
  322. success:
  323. type: boolean
  324. const: false
  325. error:
  326. type: string
  327. example:
  328. sucess: false
  329. error: Identity not found
  330. id-revocation-request: &id-revocation-request
  331. type: object
  332. required:
  333. - identity
  334. properties:
  335. identity: *identity
  336. id-revocation-key-v1: &id-revocation-key-v1
  337. <<: *base64
  338. minLength: 8
  339. maxLength: 8
  340. description: |-
  341. A legacy (v1) identity revocation key.
  342. The revocation key is computed as follows (`[:4]` denotes the first four bytes):
  343. ```text
  344. base64(
  345. SHA256(revocation-password)[:4]
  346. )
  347. ```
  348. id-revocation-request-v1: &id-revocation-request-v1
  349. type: object
  350. required:
  351. - identity
  352. - revocationKey
  353. properties:
  354. identity: *identity
  355. revocationKey: *id-revocation-key-v1
  356. id-revocation-key-check-response:
  357. found: &id-revocation-key-check-response-found
  358. description: 'ID revocation key was set'
  359. required:
  360. - revocationKeySet
  361. - lastChanged
  362. properties:
  363. revocationKeySet:
  364. type: boolean
  365. const: true
  366. lastChanged:
  367. type: string
  368. format: date-time
  369. example:
  370. revocationKeySet: true
  371. lastChanged: '2014-10-29T12:32:54Z'
  372. empty: &id-revocation-key-check-response-empty
  373. description: 'ID revocation key was not set'
  374. required:
  375. - revocationKeySet
  376. properties:
  377. revocationKeySet:
  378. type: boolean
  379. const: false
  380. id-revocation-response:
  381. ok: &id-revocation-response-ok
  382. description: 'ID revocation key request was successful'
  383. type: object
  384. required:
  385. - success
  386. properties:
  387. success:
  388. type: boolean
  389. const: true
  390. error: &id-revocation-response-error
  391. description: 'ID revocation key was not successful'
  392. type: object
  393. required:
  394. - success
  395. properties:
  396. success:
  397. type: boolean
  398. const: false
  399. error:
  400. type: string
  401. example:
  402. sucess: false
  403. error: 'Identity not found'
  404. sfu-credentials-request: &sfu-credentials-request
  405. type: object
  406. required:
  407. - identity
  408. properties:
  409. identity: *identity
  410. sfu-credentials-response:
  411. ok: &sfu-credentials-response-ok
  412. description: SFU information retrieved successfully.
  413. type: object
  414. required:
  415. - success
  416. - sfuBaseUrl
  417. - allowedSfuHostnameSuffixes
  418. - sfuToken
  419. - expiration
  420. properties:
  421. success:
  422. type: boolean
  423. const: true
  424. sfuBaseUrl:
  425. description: |-
  426. Base URL used to create and distribute new calls.
  427. type: string
  428. allowedSfuHostnameSuffixes:
  429. description: |-
  430. A set of allowed hostname suffixes to be applied against a _SFU
  431. Base URL_ when joining calls.
  432. If the provided _SFU Base URL_'s hostname does not end with one of
  433. the provided hostname suffixes, joining or peeking that call is
  434. disallowed.
  435. type: array
  436. items:
  437. type: string
  438. sfuToken:
  439. description: |-
  440. An opaque token used to authenticate against a SFU.
  441. HTTP requests towards the SFU must include it as a header in the
  442. following way: `Authorization: ThreemaSfuToken <token>`
  443. type: string
  444. expiration:
  445. <<: *u64
  446. description: |-
  447. Amount of seconds until the SFU information is considered stale and
  448. must be discarded.
  449. example:
  450. success: true
  451. sfuBaseUrl: https://sfu.threema.ch
  452. allowedSfuHostnameSuffixes:
  453. - threema.ch
  454. sfuToken: givemeaccessplz
  455. expiration: 600
  456. error: &sfu-credentials-response-error
  457. description: SFU information could not be retrieved.
  458. type: object
  459. required:
  460. - success
  461. properties:
  462. success:
  463. type: boolean
  464. const: false
  465. error:
  466. type: string
  467. example:
  468. sucess: false
  469. error: 'Identity not found'
  470. update-work-data-request: &update-work-data-request
  471. type: object
  472. required:
  473. - identity
  474. - licenseUsername
  475. - licensePassword
  476. - version
  477. properties:
  478. identity: *identity
  479. licenseUsername: *work-username
  480. licensePassword: *work-password
  481. version: *app-version
  482. publicNickname: *work-nickname
  483. firstName: *work-first-name
  484. lastName: *work-last-name
  485. csi: *work-user-identifier
  486. jobTitle: *work-job-title
  487. department: *work-department
  488. category: *work-user-category-labels-delimited
  489. update-work-data-response:
  490. ok: &update-work-data-response-ok
  491. description: Work data updated successfully.
  492. type: object
  493. required:
  494. - success
  495. properties:
  496. success:
  497. type: boolean
  498. const: true
  499. error: &update-work-data-response-error
  500. description: Updating Work data failed.
  501. type: object
  502. required:
  503. - success
  504. properties:
  505. success:
  506. type: boolean
  507. const: false
  508. error:
  509. type: string
  510. example:
  511. sucess: false
  512. error: 'Missing parameters'
  513. work-credentials: &work-credentials
  514. type: object
  515. required:
  516. - username
  517. - password
  518. properties:
  519. username: *work-username
  520. password: *work-password
  521. sync-work-data-request: &sync-work-data-request
  522. type: object
  523. required:
  524. - contacts
  525. properties:
  526. contacts:
  527. <<: *work-contacts-match
  528. description: |-
  529. A list of all existing contacts of the user to match against the Work
  530. subscription.
  531. Note: This is necessary to determine whether a contact is part of the
  532. user's Work subscription and, in that case, get additional
  533. information.
  534. Note 2: Explicitly providing all of the user's contacts also prevents
  535. having to configure **all** Work contacts of the same subscription.
  536. sync-work-data-response: &sync-work-data-response
  537. type: object
  538. required:
  539. - checkInterval
  540. - org
  541. - logo
  542. - support
  543. - directory
  544. - mdm
  545. - contacts
  546. properties:
  547. checkInterval:
  548. <<: *u64
  549. description: |-
  550. Target amount of seconds until a subsequent Work sync should be
  551. initiated.
  552. org: *work-organisation
  553. logo:
  554. description: Logo to be displayed in the app.
  555. type: object
  556. required:
  557. - light
  558. - dark
  559. properties:
  560. light: &work-logo-url
  561. description: |-
  562. Optional URL to a logo to be displayed in the app. The logo must
  563. be provided in PNG format.
  564. type:
  565. - string
  566. - 'null'
  567. dark: *work-logo-url
  568. support:
  569. description: Optional custom in-app support base URL.
  570. type:
  571. - string
  572. - 'null'
  573. directory:
  574. oneOf:
  575. - description: Disabled Work directory.
  576. type: object
  577. required:
  578. - enabled
  579. properties:
  580. enabled:
  581. type: boolean
  582. const: false
  583. - description: Enabled Work directory.
  584. type: object
  585. required:
  586. - enabled
  587. - cat
  588. properties:
  589. enabled:
  590. type: boolean
  591. const: true
  592. cat:
  593. description: |-
  594. Map of contact category IDs to their respective label.
  595. type: object
  596. additionalProperties: *work-user-category-id
  597. mdm:
  598. description: App configuration to be applied.
  599. type: object
  600. required:
  601. - override
  602. - params
  603. properties:
  604. override:
  605. description: |-
  606. Whether the app configuration parameters provided here take
  607. precedence over the the externally configured MDM parameters.
  608. type: boolean
  609. params:
  610. description: |-
  611. A key/value map of app configuration / MDM parameters as defined
  612. by the protocol.
  613. type: object
  614. additionalProperties:
  615. oneOf:
  616. - type: string
  617. - *u64
  618. - type: boolean
  619. contacts:
  620. description: |-
  621. A list of contacts from the same Work subscription to be configured
  622. on the user's device.
  623. type: array
  624. items:
  625. <<: *work-contact
  626. description: A configured Work contact.
  627. work-contacts-request: &work-contacts-request
  628. type: object
  629. required:
  630. - contacts
  631. properties:
  632. contacts:
  633. <<: *work-contacts-match
  634. description: |-
  635. A list of contacts (Threema IDs) to get additional Work properties for.
  636. Note: This is necessary to determine whether a contact is part of the
  637. user's Work subscription and, in that case, get additional
  638. information.
  639. work-contacts-response: &work-contacts-response
  640. type: object
  641. required:
  642. - contacts
  643. properties:
  644. contacts:
  645. description: |-
  646. A subset of the provided contacts that are part of the same Work
  647. subscription with the associated additional Work properties.
  648. type: array
  649. items:
  650. <<: *work-contact
  651. description: A Work contact.
  652. work-directory-request-wildcard: &work-directory-request-wildcard
  653. type: object
  654. required:
  655. - query
  656. - page
  657. - categories
  658. properties:
  659. identity:
  660. <<: *identity
  661. description: The user's Threema ID.
  662. page: *work-directory-page-index
  663. query:
  664. description: Wildcard search query.
  665. type: string
  666. const: '*'
  667. categories:
  668. <<: *work-user-category-ids
  669. description: At least one category ID to narrow down the search with.
  670. minLength: 1
  671. sort: *work-directory-sort
  672. work-directory-request-specific: &work-directory-request-specific
  673. type: object
  674. required:
  675. - query
  676. - page
  677. properties:
  678. identity:
  679. <<: *identity
  680. description: The user's Threema ID.
  681. page: *work-directory-page-index
  682. query:
  683. description: |-
  684. Search query. Matches any of Threema ID, first name, or last name.
  685. type: string
  686. minLength: 3
  687. example: Bob
  688. categories:
  689. <<: *work-user-category-ids
  690. description: Optional category IDs to narrow down the search with.
  691. sort: *work-directory-sort
  692. work-directory-response: &work-directory-response
  693. type: object
  694. required:
  695. - contacts
  696. - paging
  697. properties:
  698. paging:
  699. description: Page information.
  700. type: object
  701. required:
  702. - size
  703. - total
  704. properties:
  705. size:
  706. description: Maximum amount of results present in a single page.
  707. type: integer
  708. minimum: 0
  709. total:
  710. description: Total amount of results (spread across pages).
  711. type: integer
  712. minimum: 0
  713. prev:
  714. description: Previous page index, if any is available.
  715. type: integer
  716. minimum: 0
  717. next:
  718. description: Next page index, if any is available.
  719. type: integer
  720. minimum: 1
  721. contacts:
  722. description: |-
  723. A Work contact of the same subcription that matches the search query.
  724. type: array
  725. items: !merge-objects
  726. - *work-contact
  727. - type: object
  728. required:
  729. - org
  730. properties:
  731. csi: *work-user-identifier
  732. cat: *work-user-category-ids
  733. org: *work-organisation
  734. remote-secret-create-request: &remote-secret-create-request
  735. type: object
  736. required:
  737. - secret
  738. properties:
  739. secret: *remote-secret
  740. remote-secret-create-response: &remote-secret-create-response
  741. type: object
  742. required:
  743. - secretAuthenticationToken
  744. properties:
  745. secretAuthenticationToken: *remote-secret-authentication-token
  746. remote-secret-delete-request: &remote-secret-delete-request
  747. type: object
  748. required:
  749. - secretAuthenticationToken
  750. properties:
  751. secretAuthenticationToken: *remote-secret-authentication-token
  752. remote-secret-fetch-request: &remote-secret-fetch-request
  753. type: object
  754. required:
  755. - secretAuthenticationToken
  756. properties:
  757. secretAuthenticationToken: *remote-secret-authentication-token
  758. remote-secret-fetch-response: &remote-secret-fetch-response
  759. type: object
  760. required:
  761. - secret
  762. - checkIntervalS
  763. - nMissedChecksMax
  764. properties:
  765. secret: *remote-secret
  766. checkIntervalS:
  767. <<: *u32
  768. description: |-
  769. Amount of time in seconds until the Remote Secret should be fetched
  770. again.
  771. nMissedChecksMax:
  772. <<: *u16
  773. description: |-
  774. The maximum number of fetches that may be missed until application
  775. storage should be locked.
  776. openapi: 3.1.0
  777. info:
  778. title: Directory and Work Directory Server APIs
  779. description: |-
  780. Maintains the directory of allocated Threema IDs and all associated
  781. properties.
  782. version: 1.0.0
  783. servers:
  784. - url: https://ds-apip.threema.ch
  785. description: Production server
  786. - url: https://ds-apip.test.threema.ch
  787. description: Sandbox server
  788. paths:
  789. /identity/blob_cred:
  790. post:
  791. summary: Blob Server Credentials
  792. description: |-
  793. Retrieve blob server authentication credentials.
  794. The first call without the challenge response properties initiates the
  795. challenge request. The second call must repeat the exact same properties
  796. and the challenge response.
  797. requestBody:
  798. required: true
  799. content:
  800. application/json:
  801. schema:
  802. oneOf:
  803. - *blob-credentials-request
  804. - !merge-objects
  805. - *auth-challenge-response
  806. - *blob-credentials-request
  807. responses:
  808. '200':
  809. description: Success... or not.
  810. content:
  811. application/json:
  812. schema:
  813. oneOf:
  814. - *auth-challenge-request
  815. - *blob-credentials-response-ok
  816. - *blob-credentials-response-error
  817. '429':
  818. description: Rate limit exceeded.
  819. /identity/revoke:
  820. post:
  821. summary: ID Revocation by Client Key
  822. description: |-
  823. Revoke a Threema ID by proofing the knowledge of the client key.
  824. The first call without the challenge response properties initiates the
  825. challenge request. The second call must repeat the exact same properties
  826. and the challenge response.
  827. requestBody:
  828. required: true
  829. content:
  830. application/json:
  831. schema:
  832. oneOf:
  833. - *id-revocation-request
  834. - !merge-objects
  835. - *id-revocation-request
  836. - *auth-challenge-response
  837. responses:
  838. '200':
  839. description: Success... or not.
  840. content:
  841. application/json:
  842. schema:
  843. oneOf:
  844. - *auth-challenge-request
  845. - *id-revocation-response-ok
  846. - *id-revocation-response-error
  847. /identity/set_revocation_key:
  848. post:
  849. summary: Set ID Revocation Key
  850. description: |-
  851. Set the revocation key for an identity.
  852. The first call without the challenge response properties initiates the
  853. challenge request. The second call must repeat the exact same properties
  854. and the challenge response.
  855. requestBody:
  856. required: true
  857. content:
  858. application/json:
  859. schema:
  860. oneOf:
  861. - *id-revocation-request-v1
  862. - !merge-objects
  863. - *id-revocation-request-v1
  864. - *auth-challenge-response
  865. responses:
  866. '200':
  867. description: Success... or not.
  868. content:
  869. application/json:
  870. schema:
  871. oneOf:
  872. - *auth-challenge-request
  873. - *id-revocation-response-ok
  874. - *id-revocation-response-error
  875. /identity/check_revocation_key:
  876. post:
  877. summary: Check ID Revocation Key
  878. description: |-
  879. Check whether a revocation key is set for a given ID
  880. The first call without the challenge response properties initiates the
  881. challenge request. The second call must repeat the exact same properties
  882. and the challenge response.
  883. requestBody:
  884. required: true
  885. content:
  886. application/json:
  887. schema:
  888. oneOf:
  889. - *id-revocation-request
  890. - !merge-objects
  891. - *id-revocation-request-v1
  892. - *auth-challenge-response
  893. responses:
  894. '200':
  895. description: Success... or not.
  896. content:
  897. application/json:
  898. schema:
  899. oneOf:
  900. - *auth-challenge-request
  901. - *id-revocation-response-error
  902. - *id-revocation-key-check-response-found
  903. - *id-revocation-key-check-response-empty
  904. /identity/ws/revoke:
  905. post:
  906. summary: ID Revocation by User-set Key
  907. description:
  908. Revoke a Threema ID with a user-set key previously derived from a
  909. password.
  910. requestBody:
  911. required: true
  912. content:
  913. application/json:
  914. schema:
  915. oneOf:
  916. - *id-revocation-request-v1
  917. responses:
  918. '200':
  919. description: Success... or not.
  920. content:
  921. application/json:
  922. schema:
  923. oneOf:
  924. - *id-revocation-response-ok
  925. - *id-revocation-response-error
  926. /identity/sfu_cred:
  927. post:
  928. summary: SFU Information
  929. description: |-
  930. Retrieve SFU information including URLs and authentication credentials.
  931. The first call without the challenge response properties initiates the
  932. challenge request. The second call must repeat the exact same properties
  933. and the challenge response.
  934. requestBody:
  935. required: true
  936. content:
  937. application/json:
  938. schema:
  939. oneOf:
  940. - *sfu-credentials-request
  941. - !merge-objects
  942. - *auth-challenge-response
  943. - *sfu-credentials-request
  944. responses:
  945. '200':
  946. description: Success... or not.
  947. content:
  948. application/json:
  949. schema:
  950. oneOf:
  951. - *auth-challenge-request
  952. - *sfu-credentials-response-ok
  953. - *sfu-credentials-response-error
  954. '429':
  955. description: Rate limit exceeded.
  956. /identity/update_work_info:
  957. post:
  958. summary: Work Properties
  959. description: |-
  960. Update Work properties associated to the currently used Threema ID. Only
  961. used by the _Work_ flavour of Threema.
  962. The first call without the challenge response properties initiates the
  963. challenge request. The second call must repeat the exact same properties
  964. and the challenge response.
  965. Note that all data of the request must be sourced **exclusively** from
  966. MDM parameters. For example, the data source for `nickname` must be
  967. `th_nickname` and not the custom nickname chosen by the user.
  968. TODO(SE-368): When sending/receiving steps.
  969. requestBody:
  970. required: true
  971. content:
  972. application/json:
  973. schema:
  974. oneOf:
  975. - *update-work-data-request
  976. - !merge-objects
  977. - *auth-challenge-response
  978. - *update-work-data-request
  979. responses:
  980. '200':
  981. description: Success... or not.
  982. content:
  983. application/json:
  984. schema:
  985. oneOf:
  986. - *auth-challenge-request
  987. - *update-work-data-response-ok
  988. - *update-work-data-response-error
  989. '429':
  990. description: Rate limit exceeded.
  991. /fetch2:
  992. post:
  993. summary: Work Sync
  994. description: |-
  995. Full sync of all data associated to the Work subscription. Only used by
  996. the _Work_ flavour of Threema.
  997. TODO(SE-368): When sending/receiving steps.
  998. servers: *work-servers
  999. requestBody:
  1000. required: true
  1001. content:
  1002. application/json:
  1003. schema: !merge-objects
  1004. - *work-credentials
  1005. - *sync-work-data-request
  1006. responses:
  1007. '200':
  1008. description: Work subscription data.
  1009. content:
  1010. application/json:
  1011. schema: *sync-work-data-response
  1012. '400':
  1013. description: Invalid request.
  1014. '401':
  1015. description: Invalid username or password.
  1016. '429':
  1017. description: Rate limit exceeded.
  1018. /identities:
  1019. post:
  1020. summary: Work Contacts
  1021. description: |-
  1022. Request properties associated to a contact of the same Work subscription.
  1023. Note: This endpoint is currently buggy. See TWRK-1633 for a list of bugs.
  1024. TODO(SE-368): When sending/receiving steps. Send before adding a new
  1025. contact.
  1026. servers: *work-servers
  1027. requestBody:
  1028. required: true
  1029. content:
  1030. application/json:
  1031. schema: !merge-objects
  1032. - *work-credentials
  1033. - *work-contacts-request
  1034. responses:
  1035. '200':
  1036. description: Matching Work contacts in the same Work subscription.
  1037. content:
  1038. application/json:
  1039. schema: *work-contacts-response
  1040. '400':
  1041. description: Invalid request.
  1042. '401':
  1043. description: Invalid username or password.
  1044. '429':
  1045. description: Rate limit exceeded.
  1046. /directory:
  1047. post:
  1048. summary: Work Directory
  1049. description: |-
  1050. Search for contacts in the same Work subscription as the user.
  1051. TODO(SE-368): When sending/receiving steps.
  1052. servers: *work-servers
  1053. requestBody:
  1054. required: true
  1055. content:
  1056. application/json:
  1057. schema:
  1058. oneOf:
  1059. - !merge-objects
  1060. - *work-credentials
  1061. - *work-directory-request-wildcard
  1062. - !merge-objects
  1063. - *work-credentials
  1064. - *work-directory-request-specific
  1065. responses:
  1066. '200':
  1067. description: Queried Work contacts of the same Work subscription.
  1068. content:
  1069. application/json:
  1070. schema: *work-directory-response
  1071. '400':
  1072. description: Invalid request.
  1073. '401':
  1074. description: Invalid username or password.
  1075. '429':
  1076. description: Rate limit exceeded.
  1077. /api-client/v1/remote-secret:
  1078. put:
  1079. summary: Create Remote Secret
  1080. description: |-
  1081. Create a new Remote Secret.
  1082. The first call without the challenge response properties initiates the
  1083. challenge request. The second call must repeat the exact same properties
  1084. and the challenge response.
  1085. When receiving this request without the challenge response:
  1086. 1. If the request could not be decoded, respond with status code `400`.
  1087. 2. Respond with an authentication challenge tied to the provided data
  1088. with purpose _create_.
  1089. When receiving this request with the challenge response:
  1090. 1. If the request could not be decoded, respond with status code `400`.
  1091. 2. If the Work `credentials` are invalid, respond with status code `401`
  1092. and code `invalid-credentials`.
  1093. 3. If the `challenge` expired, respond with status code `401` and code
  1094. `challenge-expired`.
  1095. 4. If the `challenge` is not tied to the provided data or does not have
  1096. the purpose _create_, respond with status code `401` and code
  1097. `invalid-challenge-response`.
  1098. 5. If the `response` is not the correctly _signed_ `challenge`, respond
  1099. with status code `401` and code `invalid-challenge-response`.
  1100. 6. Create a new random Remote Secret Authentication Token and let
  1101. `remote-secret-authentication-token` be the result.
  1102. 7. Add a new entry for the Remote Secret `secret` tied to `identity` and
  1103. `remote-secret-authentication-token`.
  1104. 8. Respond with status code `200` and the
  1105. `remote-secret-authentication-token`.
  1106. servers: *work-servers
  1107. requestBody:
  1108. required: true
  1109. content:
  1110. application/json:
  1111. schema:
  1112. oneOf:
  1113. - !merge-objects
  1114. - *work-credentials
  1115. - *remote-secret-create-request
  1116. - !merge-objects
  1117. - *work-credentials
  1118. - *work-auth-challenge-response
  1119. - *remote-secret-create-request
  1120. responses:
  1121. '200':
  1122. description: Success or authentication challenge.
  1123. content:
  1124. application/json:
  1125. schema:
  1126. oneOf:
  1127. - *work-auth-challenge-request
  1128. - *remote-secret-create-response
  1129. '400':
  1130. description: Invalid request.
  1131. '401':
  1132. description: Authentication failed.
  1133. content:
  1134. application/json:
  1135. schema: *work-auth-failed
  1136. '429':
  1137. description: Rate limit exceeded.
  1138. delete:
  1139. summary: Delete Remote Secret
  1140. description: |-
  1141. Remove an existing Remote Secret.
  1142. The first call without the challenge response properties initiates the
  1143. challenge request. The second call must repeat the exact same properties
  1144. and the challenge response.
  1145. When receiving this request without the challenge response:
  1146. 1. If the request could not be decoded, respond with status code `400`.
  1147. 2. Respond with an authentication challenge tied to the provided data
  1148. with purpose _delete_.
  1149. When receiving this request with the challenge response:
  1150. 1. If the request could not be decoded, respond with status code `400`.
  1151. 2. If the Work `credentials` are invalid, respond with status code `401`
  1152. and code `invalid-credentials`.
  1153. 3. If the `challenge` expired, respond with status code `401` and code
  1154. `challenge-expired`.
  1155. 4. If the `challenge` is not tied to the provided data or does not have
  1156. the purpose _delete_, respond with status code `401` and code
  1157. `invalid-challenge-response`.
  1158. 5. If the `response` is not the correctly _signed_ `challenge`, respond
  1159. with status code `401` and code `invalid-challenge-response`.
  1160. 6. Remove any existing Remote Secret entry tied to `identity` and
  1161. `remoteSecretAuthenticationToken`.
  1162. 7. Respond with status code `204`.
  1163. servers: *work-servers
  1164. requestBody:
  1165. required: true
  1166. content:
  1167. application/json:
  1168. schema:
  1169. oneOf:
  1170. - !merge-objects
  1171. - *work-credentials
  1172. - *remote-secret-delete-request
  1173. - !merge-objects
  1174. - *work-credentials
  1175. - *work-auth-challenge-response
  1176. - *remote-secret-delete-request
  1177. responses:
  1178. '200':
  1179. description: Authentication challenge.
  1180. content:
  1181. application/json:
  1182. schema: *work-auth-challenge-request
  1183. '204':
  1184. description: Success.
  1185. '400':
  1186. description: Invalid request.
  1187. '401':
  1188. description: Authentication failed.
  1189. content:
  1190. application/json:
  1191. schema: *work-auth-failed
  1192. '429':
  1193. description: Rate limit exceeded.
  1194. post:
  1195. summary: Fetch Remote Secret
  1196. description: |-
  1197. Fetch an existing Remote Secret.
  1198. When receiving this request:
  1199. 1. Look up a Remote Secret tied to `identity` and
  1200. `remoteSecretAuthenticationToken` and let `secret` be the result.
  1201. 2. If `secret` is not defined, respond with status code `404`.
  1202. 3. If the access to `secret` is blocked, respond with status code `403`.
  1203. 4. Respond with status code `200` and `secret` along with the associated
  1204. configuration for `identity`.
  1205. servers: *work-servers
  1206. requestBody:
  1207. required: true
  1208. content:
  1209. application/json:
  1210. schema: *remote-secret-fetch-request
  1211. responses:
  1212. '200':
  1213. description: Success.
  1214. content:
  1215. application/json:
  1216. schema: *remote-secret-fetch-response
  1217. '400':
  1218. description: Invalid request.
  1219. '403':
  1220. description: Access to the Remote Secret blocked.
  1221. '404':
  1222. description: Remote Secret does not exist.
  1223. '429':
  1224. description: Rate limit exceeded.