@toa.io/extensions.exposition 1.0.0-alpha.273 → 1.0.0-alpha.276

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/CHANGELOG.md +209 -0
  2. package/components/identity.basic/manifest.toa.yaml +1 -1
  3. package/components/identity.basic/operations/authenticate.js +1 -1
  4. package/components/identity.basic/operations/authenticate.js.map +1 -1
  5. package/components/identity.basic/operations/transit.js +1 -1
  6. package/components/identity.basic/operations/transit.js.map +1 -1
  7. package/components/identity.basic/operations/tsconfig.tsbuildinfo +1 -1
  8. package/components/identity.basic/operations/types.d.ts +2 -2
  9. package/components/identity.basic/source/authenticate.ts +1 -1
  10. package/components/identity.basic/source/transit.ts +1 -1
  11. package/components/identity.basic/source/types.ts +2 -2
  12. package/components/identity.credentials/operations/tsconfig.tsbuildinfo +1 -1
  13. package/components/identity.federation/operations/lib/exchange.js +2 -2
  14. package/components/identity.federation/operations/lib/exchange.js.map +1 -1
  15. package/components/identity.federation/operations/tsconfig.tsbuildinfo +1 -1
  16. package/components/identity.federation/operations/types/configuration.d.ts +3 -2
  17. package/components/identity.federation/source/lib/exchange.ts +2 -2
  18. package/components/identity.federation/source/types/configuration.ts +4 -2
  19. package/components/identity.keys/operations/tsconfig.tsbuildinfo +1 -1
  20. package/components/identity.otp/operations/tsconfig.tsbuildinfo +1 -1
  21. package/components/identity.passkeys/operations/tsconfig.tsbuildinfo +1 -1
  22. package/components/identity.roles/operations/tsconfig.tsbuildinfo +1 -1
  23. package/components/identity.tokens/operations/decrypt.js +1 -1
  24. package/components/identity.tokens/operations/decrypt.js.map +1 -1
  25. package/components/identity.tokens/operations/encrypt.js +1 -1
  26. package/components/identity.tokens/operations/encrypt.js.map +1 -1
  27. package/components/identity.tokens/operations/lib/types.d.ts +3 -2
  28. package/components/identity.tokens/operations/tsconfig.tsbuildinfo +1 -1
  29. package/components/identity.tokens/source/authenticate.test.ts +7 -2
  30. package/components/identity.tokens/source/decrypt.test.ts +13 -7
  31. package/components/identity.tokens/source/decrypt.ts +1 -1
  32. package/components/identity.tokens/source/encrypt.test.ts +9 -4
  33. package/components/identity.tokens/source/encrypt.ts +1 -1
  34. package/components/identity.tokens/source/lib/types.ts +3 -2
  35. package/context.toa.yaml +2 -2
  36. package/documentation/components.md +1 -1
  37. package/documentation/protocol.md +24 -0
  38. package/features/configuration.feature +207 -0
  39. package/features/identity.federation.feature +15 -7
  40. package/features/introspection.map.feature +16 -0
  41. package/features/octets.cloudinary.feature +8 -2
  42. package/features/octets.download.feature +3 -1
  43. package/features/probes.feature +8 -4
  44. package/features/steps/Common.ts +24 -1
  45. package/features/steps/Components.ts +29 -0
  46. package/features/steps/Gateway.ts +57 -11
  47. package/features/steps/Parameters.ts +4 -0
  48. package/features/steps/Probe.ts +34 -0
  49. package/package.json +4 -3
  50. package/readme.md +7 -13
  51. package/schemas/annotation.cos.yaml +11 -0
  52. package/source/Annotation.ts +11 -0
  53. package/source/HTTP/Context.ts +1 -6
  54. package/source/HTTP/Probe.ts +112 -0
  55. package/source/HTTP/Server.ts +123 -74
  56. package/source/HTTP/Timing.ts +1 -1
  57. package/source/HTTP/formats/yaml.test.ts +6 -0
  58. package/source/HTTP/formats/yaml.ts +21 -1
  59. package/source/HTTP/index.ts +2 -0
  60. package/source/HTTP/messages.test.ts +2 -5
  61. package/source/HTTP/messages.ts +38 -42
  62. package/source/HTTP/types.ts +39 -0
  63. package/source/deployment.ts +12 -4
  64. package/source/directives/octets/Get.ts +3 -3
  65. package/transpiled/Annotation.d.ts +10 -0
  66. package/transpiled/HTTP/Context.d.ts +1 -6
  67. package/transpiled/HTTP/Context.js.map +1 -1
  68. package/transpiled/HTTP/Probe.d.ts +36 -0
  69. package/transpiled/HTTP/Probe.js +117 -0
  70. package/transpiled/HTTP/Probe.js.map +1 -0
  71. package/transpiled/HTTP/Server.d.ts +11 -7
  72. package/transpiled/HTTP/Server.js +92 -58
  73. package/transpiled/HTTP/Server.js.map +1 -1
  74. package/transpiled/HTTP/Timing.d.ts +1 -2
  75. package/transpiled/HTTP/formats/yaml.js +15 -1
  76. package/transpiled/HTTP/formats/yaml.js.map +1 -1
  77. package/transpiled/HTTP/index.d.ts +2 -0
  78. package/transpiled/HTTP/index.js +2 -0
  79. package/transpiled/HTTP/index.js.map +1 -1
  80. package/transpiled/HTTP/messages.d.ts +8 -3
  81. package/transpiled/HTTP/messages.js +31 -37
  82. package/transpiled/HTTP/messages.js.map +1 -1
  83. package/transpiled/HTTP/types.d.ts +40 -0
  84. package/transpiled/HTTP/types.js +3 -0
  85. package/transpiled/HTTP/types.js.map +1 -0
  86. package/transpiled/deployment.js +8 -2
  87. package/transpiled/deployment.js.map +1 -1
  88. package/transpiled/directives/octets/Get.js +3 -3
  89. package/transpiled/directives/octets/Get.js.map +1 -1
  90. package/transpiled/tsconfig.tsbuildinfo +1 -1
@@ -1,3 +1,4 @@
1
+ import type { Secret } from '@toa.io/types';
1
2
  export interface Configuration {
2
3
  trust: Trust[];
3
4
  principal?: Principal;
@@ -6,11 +7,11 @@ export interface Configuration {
6
7
  export interface Trust {
7
8
  iss: string;
8
9
  aud?: string | [string, ...string[]];
9
- secret?: string;
10
+ secret?: Secret;
10
11
  signature?: {
11
12
  iss: string;
12
13
  kid: string;
13
- key: string;
14
+ key: Secret;
14
15
  };
15
16
  }
16
17
  interface Principal {
@@ -29,7 +29,7 @@ export async function exchange (credentials: string, ctx: Ctx): Promise<Payload
29
29
 
30
30
  // array actually is not expected here, but it is a valid format
31
31
  const aud = Array.isArray(trusted.aud) ? trusted.aud[0] : trusted.aud
32
- const secret = trusted.secret ?? await sign(trusted)
32
+ const secret = trusted.secret === undefined ? await sign(trusted) : trusted.secret.unwrap()
33
33
  const params = new URLSearchParams()
34
34
 
35
35
  params.append('grant_type', 'authorization_code')
@@ -95,7 +95,7 @@ async function sign (trust: Trust): Promise<string> {
95
95
  const signature = trust.signature!
96
96
  const aud = Array.isArray(trust.aud) ? trust.aud[0] : trust.aud!
97
97
  const now = Math.floor(Date.now() / 1000)
98
- const key = await jose.importPKCS8(signature.key, 'ES256')
98
+ const key = await jose.importPKCS8(signature.key.unwrap(), 'ES256')
99
99
 
100
100
  return await new jose.SignJWT({})
101
101
  .setProtectedHeader({ alg: 'ES256', kid: signature.kid })
@@ -1,3 +1,5 @@
1
+ import type { Secret } from '@toa.io/types'
2
+
1
3
  export interface Configuration {
2
4
  trust: Trust[]
3
5
  principal?: Principal
@@ -7,11 +9,11 @@ export interface Configuration {
7
9
  export interface Trust {
8
10
  iss: string
9
11
  aud?: string | [string, ...string[]]
10
- secret?: string
12
+ secret?: Secret
11
13
  signature?: {
12
14
  iss: string
13
15
  kid: string
14
- key: string
16
+ key: Secret
15
17
  }
16
18
  }
17
19