@suveren/gateway 0.36.1 → 0.37.0

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 (65) hide show
  1. package/content/integrations/erp.json +1 -1
  2. package/dist/mcp-server/http.mjs +66 -18
  3. package/dist/ui/assets/{index-BQ5Pr6As.js → index-BC2bXeCQ.js} +26 -26
  4. package/dist/ui/index.html +1 -1
  5. package/node_modules/fast-uri/.github/workflows/release.yml +35 -0
  6. package/node_modules/fast-uri/README.md +8 -0
  7. package/node_modules/fast-uri/index.js +98 -18
  8. package/node_modules/fast-uri/lib/utils.js +52 -0
  9. package/node_modules/fast-uri/package.json +1 -1
  10. package/node_modules/fast-uri/test/host-delimiter-security.test.js +94 -0
  11. package/node_modules/fast-uri/test/relative-normalization-security.test.js +156 -0
  12. package/node_modules/fast-uri/test/reserved-path-normalization.test.js +32 -4
  13. package/node_modules/fast-uri/test/scheme-validation.test.js +53 -14
  14. package/node_modules/jose/README.md +2 -2
  15. package/node_modules/jose/dist/types/jwe/compact/decrypt.d.ts +5 -4
  16. package/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts +4 -4
  17. package/node_modules/jose/dist/types/jwe/flattened/decrypt.d.ts +5 -4
  18. package/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +5 -5
  19. package/node_modules/jose/dist/types/jwe/general/decrypt.d.ts +5 -4
  20. package/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +5 -5
  21. package/node_modules/jose/dist/types/jws/compact/sign.d.ts +5 -4
  22. package/node_modules/jose/dist/types/jws/compact/verify.d.ts +5 -5
  23. package/node_modules/jose/dist/types/jws/flattened/sign.d.ts +5 -4
  24. package/node_modules/jose/dist/types/jws/flattened/verify.d.ts +6 -5
  25. package/node_modules/jose/dist/types/jws/general/sign.d.ts +9 -6
  26. package/node_modules/jose/dist/types/jws/general/verify.d.ts +7 -5
  27. package/node_modules/jose/dist/types/jwt/decrypt.d.ts +7 -6
  28. package/node_modules/jose/dist/types/jwt/encrypt.d.ts +1 -1
  29. package/node_modules/jose/dist/types/jwt/sign.d.ts +1 -1
  30. package/node_modules/jose/dist/types/jwt/unsecured.d.ts +1 -1
  31. package/node_modules/jose/dist/types/jwt/verify.d.ts +3 -5
  32. package/node_modules/jose/dist/types/key/export.d.ts +1 -1
  33. package/node_modules/jose/dist/types/key/generate_secret.d.ts +1 -1
  34. package/node_modules/jose/dist/types/key/import.d.ts +2 -2
  35. package/node_modules/jose/dist/types/types.d.ts +165 -107
  36. package/node_modules/jose/dist/types/util/decode_jwt.d.ts +2 -2
  37. package/node_modules/jose/dist/types/util/errors.d.ts +1 -1
  38. package/node_modules/jose/dist/webapi/jwe/general/encrypt.js +3 -3
  39. package/node_modules/jose/dist/webapi/jwk/thumbprint.js +8 -8
  40. package/node_modules/jose/dist/webapi/jwks/local.js +2 -1
  41. package/node_modules/jose/dist/webapi/jwks/remote.js +4 -4
  42. package/node_modules/jose/dist/webapi/jws/general/sign.js +3 -3
  43. package/node_modules/jose/dist/webapi/jws/general/verify.js +3 -3
  44. package/node_modules/jose/dist/webapi/jwt/encrypt.js +2 -2
  45. package/node_modules/jose/dist/webapi/jwt/sign.js +2 -2
  46. package/node_modules/jose/dist/webapi/jwt/unsecured.js +3 -3
  47. package/node_modules/jose/dist/webapi/key/generate_secret.js +4 -4
  48. package/node_modules/jose/dist/webapi/lib/asn1.js +2 -2
  49. package/node_modules/jose/dist/webapi/lib/buffer_utils.js +4 -4
  50. package/node_modules/jose/dist/webapi/lib/content_encryption.js +8 -8
  51. package/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +14 -14
  52. package/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +3 -3
  53. package/node_modules/jose/dist/webapi/lib/jws_algorithms.js +2 -2
  54. package/node_modules/jose/dist/webapi/lib/jws_sign.js +11 -11
  55. package/node_modules/jose/dist/webapi/lib/jws_verify.js +19 -16
  56. package/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +44 -43
  57. package/node_modules/jose/dist/webapi/lib/key.js +4 -4
  58. package/node_modules/jose/dist/webapi/lib/key_management.js +17 -17
  59. package/node_modules/jose/dist/webapi/lib/validate.js +10 -10
  60. package/node_modules/jose/dist/webapi/util/decode_jwt.js +12 -12
  61. package/node_modules/jose/dist/webapi/util/decode_protected_header.js +5 -5
  62. package/node_modules/jose/package.json +1 -1
  63. package/package.json +1 -1
  64. package/profiles/delegation/0.6.profile.json +183 -0
  65. package/profiles/index.json +2 -1
@@ -77,13 +77,13 @@ test('serialize uses the RFC 3986 path character set without opening escapes', (
77
77
  )
78
78
  t.equal(
79
79
  fastURI.serialize({ path: './a:b/c:d' }),
80
- 'a%3Ab/c:d',
81
- 'escapes a first-segment colon exposed by dot-segment removal'
80
+ './a:b/c:d',
81
+ 'a first-segment colon exposed by dot-segment removal is kept behind a "." segment'
82
82
  )
83
83
  t.equal(
84
84
  fastURI.normalize('./a:b'),
85
- 'a%3Ab',
86
- 'normalization keeps a relative path from becoming a scheme'
85
+ './a:b',
86
+ 'normalization keeps a relative path from becoming a scheme without re-encoding the colon'
87
87
  )
88
88
  t.equal(
89
89
  fastURI.serialize({ path: '/Kſ' }),
@@ -107,3 +107,31 @@ test('equal distinguishes escaped reserved path data from literal syntax', (t) =
107
107
  )
108
108
  t.end()
109
109
  })
110
+
111
+ // A suffix reference never emits its scheme token, so it is a scheme-less
112
+ // (path-noscheme) reference: a bare ':' in its first path segment must be
113
+ // escaped, or the serialized output reparses as an absolute URI with a scheme.
114
+ // @see https://github.com/fastify/fast-uri/security/advisories/GHSA-333x-w4r6-6crp
115
+ test('suffix reference escapes a first-segment colon instead of emitting a scheme', (t) => {
116
+ const dangerous = /^(?:javascript|data|vbscript):/i
117
+ const options = { reference: 'suffix', scheme: 'x' }
118
+
119
+ for (const input of ['javascript:alert(1)', '%6Aavascript:alert(1)', 'data:text/html,x', 'vbscript:msgbox(1)']) {
120
+ t.notOk(dangerous.test(fastURI.normalize(input, options)), `${input} normalizes to an inert reference`)
121
+ }
122
+
123
+ t.equal(
124
+ fastURI.normalize('javascript:alert(1)', options),
125
+ 'javascript%3Aalert(1)',
126
+ 'escapes the leading-segment colon to %3A'
127
+ )
128
+ t.notOk(
129
+ dangerous.test(fastURI.resolve('https://a.example/base/', '%6Aavascript:alert(1)', { reference: 'suffix' })),
130
+ 'resolve in suffix mode does not emit a live scheme'
131
+ )
132
+
133
+ // legitimate suffix usage is unchanged
134
+ t.equal(fastURI.normalize('path/to/file', options), 'path/to/file', 'plain path unchanged')
135
+ t.equal(fastURI.normalize('a/b:c', options), 'a/b:c', 'colon in a later segment stays literal')
136
+ t.end()
137
+ })
@@ -15,7 +15,15 @@ const malformedSchemes = [
15
15
  'foo_bar:value',
16
16
  'éxample:value',
17
17
  'Kttp://example.com/',
18
- 'ſcheme:value'
18
+ 'ſcheme:value',
19
+ // RFC 3986 section 3.1 does not allow percent-encoding in a scheme.
20
+ '%4Aavascript:alert(1)',
21
+ '%6aavascript:alert(1)',
22
+ 'foo%2Bbar:value',
23
+ '%u006Aavascript:1',
24
+ 'ht%74ps://example.com/',
25
+ 'ma%69lto:user@example.org',
26
+ '%64ata:text/html,x'
19
27
  ]
20
28
 
21
29
  test('parse validates the decoded scheme against RFC 3986', (t) => {
@@ -23,10 +31,7 @@ test('parse validates the decoded scheme against RFC 3986', (t) => {
23
31
  ['a:value', 'a'],
24
32
  ['HTTP://example.com/', 'http'],
25
33
  ['a1+.-:value', 'a1+.-'],
26
- ['%4Aavascript:alert(1)', 'javascript'],
27
- ['foo%2Bbar:value', 'foo+bar'],
28
- ['%u006Aavascript:1', 'javascript'],
29
- ['ht%74ps://example.com/', 'https']
34
+ ['foo+bar:value', 'foo+bar']
30
35
  ]
31
36
 
32
37
  for (const [uri, scheme] of validSchemes) {
@@ -42,17 +47,41 @@ test('parse validates the decoded scheme against RFC 3986', (t) => {
42
47
  t.end()
43
48
  })
44
49
 
45
- test('decoded schemes select their scheme handlers', (t) => {
50
+ test('percent-encoded schemes do not select scheme handlers', (t) => {
46
51
  t.equal(
47
52
  fastURI.normalize('ht%74ps://example.com:443'),
48
- 'https://example.com/',
49
- 'HTTP normalization runs after decoding the scheme'
53
+ 'ht%74ps://example.com:443',
54
+ 'HTTP normalization does not run for an encoded scheme'
50
55
  )
51
56
 
52
57
  // 3.x has no mailto scheme handler (added in v4); use the ws handler to
53
- // verify that a percent-encoded scheme still selects its scheme handler
54
- const ws = fastURI.parse('we%62socket://example.com/')
55
- t.equal(ws.scheme, 'websocket', 'ws parsing runs after decoding the scheme')
58
+ // verify that a percent-encoded scheme does not select its scheme handler
59
+ const ws = fastURI.parse('w%73://example.com/a?b')
60
+ t.equal(ws.resourceName, undefined, 'ws parsing does not run for an encoded scheme')
61
+ t.equal(ws.error, MALFORMED_SCHEME_ERROR)
62
+ t.end()
63
+ })
64
+
65
+ test('normalization cannot synthesize a scheme from encoded input', (t) => {
66
+ const inputs = [
67
+ '%6Aavascript:alert(1)',
68
+ '%4A%41%56%41%53%43%52%49%50%54:alert(1)',
69
+ '%u006Aavascript:alert(1)',
70
+ 'j%61vascript:alert(1)',
71
+ '%64ata:text/html,<script>alert(1)</script>',
72
+ 'vb%73cript:msgbox(1)'
73
+ ]
74
+
75
+ for (const uri of inputs) {
76
+ const parsed = fastURI.parse(uri)
77
+ t.equal(parsed.error, MALFORMED_SCHEME_ERROR, uri + ' is malformed')
78
+ t.notOk(/^(?:javascript|data|vbscript):/i.test(String(parsed.scheme) + ':'), uri + ' parsed scheme is not decoded')
79
+ t.equal(fastURI.normalize(uri), uri, uri + ' normalizes to itself')
80
+ t.equal(fastURI.equal(uri, uri), false, uri + ' is not comparable')
81
+ t.throws(() => fastURI.resolve('https://example.com/app/', uri), /URI scheme is malformed\./, uri + ' is rejected by resolve')
82
+ }
83
+
84
+ t.equal(fastURI.equal('%68ttp://a/', 'http://a/'), false, 'encoded scheme does not alias a plain scheme')
56
85
  t.end()
57
86
  })
58
87
 
@@ -95,11 +124,21 @@ test('resolve rejects malformed decoded schemes in either input', (t) => {
95
124
  t.end()
96
125
  })
97
126
 
98
- test('serialize validates decoded component schemes', (t) => {
127
+ test('serialize validates component schemes without decoding them', (t) => {
99
128
  t.equal(
100
- fastURI.serialize({ scheme: 'foo%2Bbar', path: 'value' }),
129
+ fastURI.serialize({ scheme: 'foo+bar', path: 'value' }),
101
130
  'foo+bar:value',
102
- 'valid decoded scheme is serialized'
131
+ 'valid scheme is serialized'
132
+ )
133
+ t.throws(
134
+ () => fastURI.serialize({ scheme: 'foo%2Bbar', path: 'value' }),
135
+ /URI scheme is malformed\./,
136
+ 'percent-encoded scheme is rejected'
137
+ )
138
+ t.throws(
139
+ () => fastURI.serialize({ scheme: '%6Aavascript', path: 'alert(1)' }),
140
+ /URI scheme is malformed\./,
141
+ 'encoded scheme cannot serialize as javascript:'
103
142
  )
104
143
  t.throws(
105
144
  () => fastURI.serialize({ scheme: '//evil.example', path: '/pwn' }),
@@ -70,7 +70,7 @@ The `jose` module supports importing, exporting, and generating keys and secrets
70
70
 
71
71
  ### JSON Web Signature (JWS)
72
72
 
73
- The `jose` module supports signing and verification of JWS messages with arbitrary payloads in Compact, Flattened JSON, and General JSON serialization syntaxes.
73
+ The `jose` module supports digital signature and MAC computation and validation over arbitrary JWS Payloads using the JWS Compact Serialization and the flattened and general JWS JSON Serialization syntaxes ([RFC 7515, Section 7](https://www.rfc-editor.org/info/rfc7515/#section-7)).
74
74
 
75
75
  - Signing - [Compact](docs/jws/compact/sign/classes/CompactSign.md), [Flattened JSON](docs/jws/flattened/sign/classes/FlattenedSign.md), [General JSON](docs/jws/general/sign/classes/GeneralSign.md)
76
76
  - Verification - [Compact](docs/jws/compact/verify/functions/compactVerify.md), [Flattened JSON](docs/jws/flattened/verify/functions/flattenedVerify.md), [General JSON](docs/jws/general/verify/functions/generalVerify.md)
@@ -81,7 +81,7 @@ The `jose` module supports signing and verification of JWS messages with arbitra
81
81
 
82
82
  ### JSON Web Encryption (JWE)
83
83
 
84
- The `jose` module supports encryption and decryption of JWE messages with arbitrary plaintext in Compact, Flattened JSON, and General JSON serialization syntaxes.
84
+ The `jose` module supports encryption and authenticated decryption of arbitrary plaintext using the JWE Compact Serialization and the flattened and general JWE JSON Serialization syntaxes ([RFC 7516, Section 7](https://www.rfc-editor.org/info/rfc7516/#section-7)).
85
85
 
86
86
  - Encryption - [Compact](docs/jwe/compact/encrypt/classes/CompactEncrypt.md), [Flattened JSON](docs/jwe/flattened/encrypt/classes/FlattenedEncrypt.md), [General JSON](docs/jwe/general/encrypt/classes/GeneralEncrypt.md)
87
87
  - Decryption - [Compact](docs/jwe/compact/decrypt/functions/compactDecrypt.md), [Flattened JSON](docs/jwe/flattened/decrypt/functions/flattenedDecrypt.md), [General JSON](docs/jwe/general/decrypt/functions/generalDecrypt.md)
@@ -3,21 +3,22 @@ import type * as t from '../../types.d.ts';
3
3
  export interface CompactDecryptGetKey<KeyType extends t.CryptoKey | Uint8Array = t.CryptoKey | Uint8Array> extends t.GetKeyFunction<t.CompactJWEHeaderParameters, t.FlattenedJWE, KeyType | t.KeyObject | t.JWK> {
4
4
  }
5
5
  /**
6
- * Decrypts a Compact JWE.
6
+ * Authenticates and decrypts a JWE Compact Serialization.
7
7
  *
8
8
  * @param key Private key or shared secret. See
9
9
  * {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
10
10
  */
11
11
  export declare function compactDecrypt(jwe: string | Uint8Array, key: t.KeyInput, options?: t.DecryptOptions): Promise<t.CompactDecryptResult>;
12
12
  /**
13
- * Decrypts a Compact JWE with a dynamically resolved key, included in the result.
13
+ * Authenticates and decrypts a JWE Compact Serialization with a dynamically resolved key, included
14
+ * in the result.
14
15
  *
15
16
  * @param getKey Resolves a private key or shared secret from unverified token data.
16
17
  */
17
18
  export declare function compactDecrypt<KeyType extends t.CryptoKey | Uint8Array = t.CryptoKey | Uint8Array>(jwe: string | Uint8Array, getKey: CompactDecryptGetKey<KeyType>, options?: t.DecryptOptions): Promise<t.CompactDecryptResult & t.ResolvedKey<KeyType>>;
18
19
  /**
19
- * Decrypts a Compact JWE with a key or key resolver. The result includes `key` only when a resolver
20
- * is used.
20
+ * Authenticates and decrypts a JWE Compact Serialization with a key or key resolver. The result
21
+ * includes `key` only when a resolver is used.
21
22
  *
22
23
  * @param key Private key or shared secret, or a function resolving one.
23
24
  */
@@ -1,9 +1,9 @@
1
1
  import type * as t from '../../types.d.ts';
2
- /** Builds and encrypts Compact JWE strings. */
2
+ /** Produces JWE Compact Serialization using authenticated encryption. */
3
3
  export declare class CompactEncrypt {
4
4
  #private;
5
5
  /**
6
- * Creates a Compact JWE encryptor.
6
+ * Creates an encryptor for JWE Compact Serialization.
7
7
  *
8
8
  * @param plaintext Binary representation of the plaintext to encrypt.
9
9
  */
@@ -26,12 +26,12 @@ export declare class CompactEncrypt {
26
26
  setProtectedHeader(protectedHeader: t.CompactJWEHeaderParameters): this;
27
27
  /**
28
28
  * Sets key management inputs such as ECDH-ES "apu"/"apv" or PBES2 "p2c". Use this method instead
29
- * of header setters; the resulting parameters are added to the JOSE header. May only be called
29
+ * of header setters; the resulting parameters are added to the JOSE Header. May only be called
30
30
  * once.
31
31
  */
32
32
  setKeyManagementParameters(parameters: t.JWEKeyManagementHeaderParameters): this;
33
33
  /**
34
- * Encrypts the plaintext as a Compact JWE.
34
+ * Encrypts the plaintext and returns the JWE Compact Serialization.
35
35
  *
36
36
  * @param key Public key or shared secret. See
37
37
  * {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
@@ -3,21 +3,22 @@ import type * as t from '../../types.d.ts';
3
3
  export interface FlattenedDecryptGetKey<KeyType extends t.CryptoKey | Uint8Array = t.CryptoKey | Uint8Array> extends t.GetKeyFunction<t.JWEHeaderParameters | undefined, t.FlattenedJWE, KeyType | t.KeyObject | t.JWK> {
4
4
  }
5
5
  /**
6
- * Decrypts a Flattened JWE.
6
+ * Authenticates and decrypts a flattened JWE JSON Serialization.
7
7
  *
8
8
  * @param key Private key or shared secret. See
9
9
  * {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
10
10
  */
11
11
  export declare function flattenedDecrypt(jwe: t.FlattenedJWE, key: t.KeyInput, options?: t.DecryptOptions): Promise<t.FlattenedDecryptResult>;
12
12
  /**
13
- * Decrypts a Flattened JWE with a dynamically resolved key, included in the result.
13
+ * Authenticates and decrypts a flattened JWE JSON Serialization with a dynamically resolved key,
14
+ * included in the result.
14
15
  *
15
16
  * @param getKey Resolves a private key or shared secret from unverified token data.
16
17
  */
17
18
  export declare function flattenedDecrypt<KeyType extends t.CryptoKey | Uint8Array = t.CryptoKey | Uint8Array>(jwe: t.FlattenedJWE, getKey: FlattenedDecryptGetKey<KeyType>, options?: t.DecryptOptions): Promise<t.FlattenedDecryptResult & t.ResolvedKey<KeyType>>;
18
19
  /**
19
- * Decrypts a Flattened JWE with a key or key resolver. The result includes `key` only when a
20
- * resolver is used.
20
+ * Authenticates and decrypts a flattened JWE JSON Serialization with a key or key resolver. The
21
+ * result includes `key` only when a resolver is used.
21
22
  *
22
23
  * @param key Private key or shared secret, or a function resolving one.
23
24
  */
@@ -1,16 +1,16 @@
1
1
  import type * as t from '../../types.d.ts';
2
- /** Builds and encrypts Flattened JWE objects. */
2
+ /** Produces flattened JWE JSON Serialization using authenticated encryption. */
3
3
  export declare class FlattenedEncrypt {
4
4
  #private;
5
5
  /**
6
- * Creates a Flattened JWE encryptor.
6
+ * Creates an encryptor for flattened JWE JSON Serialization.
7
7
  *
8
8
  * @param plaintext Binary representation of the plaintext to encrypt.
9
9
  */
10
10
  constructor(plaintext: Uint8Array);
11
11
  /**
12
12
  * Sets key management inputs such as ECDH-ES "apu"/"apv" or PBES2 "p2c". Use this method instead
13
- * of header setters; the resulting parameters are added to the JOSE header. May only be called
13
+ * of header setters; the resulting parameters are added to the JOSE Header. May only be called
14
14
  * once.
15
15
  */
16
16
  setKeyManagementParameters(parameters: t.JWEKeyManagementHeaderParameters): this;
@@ -20,7 +20,7 @@ export declare class FlattenedEncrypt {
20
20
  setSharedUnprotectedHeader(sharedUnprotectedHeader: t.JWEHeaderParameters): this;
21
21
  /** Sets the JWE Per-Recipient Unprotected Header. May only be called once. */
22
22
  setUnprotectedHeader(unprotectedHeader: t.JWEHeaderParameters): this;
23
- /** Sets additional data to authenticate without encrypting it. */
23
+ /** Sets the JWE AAD, which is integrity protected but not encrypted. */
24
24
  setAdditionalAuthenticatedData(aad: Uint8Array): this;
25
25
  /**
26
26
  * Sets a content encryption key instead of generating a random one for the JWE "enc" algorithm.
@@ -37,7 +37,7 @@ export declare class FlattenedEncrypt {
37
37
  */
38
38
  setInitializationVector(iv: Uint8Array): this;
39
39
  /**
40
- * Encrypts the plaintext as a Flattened JWE.
40
+ * Encrypts the plaintext and returns the flattened JWE JSON Serialization.
41
41
  *
42
42
  * @param key Public key or shared secret. See
43
43
  * {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
@@ -3,7 +3,7 @@ import type * as t from '../../types.d.ts';
3
3
  export interface GeneralDecryptGetKey<KeyType extends t.CryptoKey | Uint8Array = t.CryptoKey | Uint8Array> extends t.GetKeyFunction<t.JWEHeaderParameters | undefined, t.FlattenedJWE, KeyType | t.KeyObject | t.JWK> {
4
4
  }
5
5
  /**
6
- * Decrypts a General JWE.
6
+ * Authenticates and decrypts a general JWE JSON Serialization.
7
7
  *
8
8
  * > Note: Returns plaintext and headers from the first recipient that decrypts successfully. Other
9
9
  * > recipients may be inspected to enforce serialization rules, but their headers are not included in
@@ -14,14 +14,15 @@ export interface GeneralDecryptGetKey<KeyType extends t.CryptoKey | Uint8Array =
14
14
  */
15
15
  export declare function generalDecrypt(jwe: t.GeneralJWE, key: t.KeyInput, options?: t.DecryptOptions): Promise<t.GeneralDecryptResult>;
16
16
  /**
17
- * Decrypts a General JWE with a dynamically resolved key, included in the result.
17
+ * Authenticates and decrypts a general JWE JSON Serialization with a dynamically resolved key,
18
+ * included in the result.
18
19
  *
19
20
  * @param getKey Resolves a private key or shared secret from unverified token data.
20
21
  */
21
22
  export declare function generalDecrypt<KeyType extends t.CryptoKey | Uint8Array = t.CryptoKey | Uint8Array>(jwe: t.GeneralJWE, getKey: GeneralDecryptGetKey<KeyType>, options?: t.DecryptOptions): Promise<t.GeneralDecryptResult & t.ResolvedKey<KeyType>>;
22
23
  /**
23
- * Decrypts a General JWE with a key or key resolver. The result includes `key` only when a resolver
24
- * is used.
24
+ * Authenticates and decrypts a general JWE JSON Serialization with a key or key resolver. The
25
+ * result includes `key` only when a resolver is used.
25
26
  *
26
27
  * @param key Private key or shared secret, or a function resolving one.
27
28
  */
@@ -5,7 +5,7 @@ export interface Recipient {
5
5
  setUnprotectedHeader(unprotectedHeader: t.JWEHeaderParameters): Recipient;
6
6
  /**
7
7
  * Sets key management inputs such as ECDH-ES "apu"/"apv" or PBES2 "p2c". Use this method instead
8
- * of header setters; the resulting parameters are added to the JOSE header. May only be called
8
+ * of header setters; the resulting parameters are added to the JOSE Header. May only be called
9
9
  * once.
10
10
  */
11
11
  setKeyManagementParameters(parameters: t.JWEKeyManagementHeaderParameters): Recipient;
@@ -24,11 +24,11 @@ export interface Recipient {
24
24
  /** Returns the enclosing {@link GeneralEncrypt} instance. */
25
25
  done(): GeneralEncrypt;
26
26
  }
27
- /** Builds and encrypts General JWE objects. */
27
+ /** Produces general JWE JSON Serialization using authenticated encryption. */
28
28
  export declare class GeneralEncrypt {
29
29
  #private;
30
30
  /**
31
- * Creates a General JWE encryptor.
31
+ * Creates an encryptor for general JWE JSON Serialization.
32
32
  *
33
33
  * @param plaintext Binary representation of the plaintext to encrypt.
34
34
  */
@@ -44,8 +44,8 @@ export declare class GeneralEncrypt {
44
44
  setProtectedHeader(protectedHeader: t.JWEHeaderParameters): this;
45
45
  /** Sets the JWE Shared Unprotected Header. May only be called once. */
46
46
  setSharedUnprotectedHeader(sharedUnprotectedHeader: t.JWEHeaderParameters): this;
47
- /** Sets additional data to authenticate without encrypting it. */
47
+ /** Sets the JWE AAD, which is integrity protected but not encrypted. */
48
48
  setAdditionalAuthenticatedData(aad: Uint8Array): this;
49
- /** Encrypts the plaintext as a General JWE. */
49
+ /** Encrypts the plaintext and returns the general JWE JSON Serialization. */
50
50
  encrypt(): Promise<t.GeneralJWE>;
51
51
  }
@@ -1,17 +1,18 @@
1
1
  import type * as t from '../../types.d.ts';
2
- /** Builds and signs Compact JWS strings. */
2
+ /** Produces JWS Compact Serialization using a digital signature or MAC. */
3
3
  export declare class CompactSign {
4
4
  #private;
5
5
  /**
6
- * Creates a Compact JWS signer.
6
+ * Creates a signer for JWS Compact Serialization.
7
7
  *
8
- * @param payload Binary representation of the payload to sign.
8
+ * @param payload JWS Payload bytes to sign or MAC.
9
9
  */
10
10
  constructor(payload: Uint8Array);
11
11
  /** Sets the JWS Protected Header. May only be called once. */
12
12
  setProtectedHeader(protectedHeader: t.CompactJWSHeaderParameters): this;
13
13
  /**
14
- * Signs the payload as a Compact JWS.
14
+ * Computes the JWS Signature (digital signature or MAC) and returns the JWS Compact
15
+ * Serialization.
15
16
  *
16
17
  * @param key Private key or shared secret. See
17
18
  * {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
@@ -3,22 +3,22 @@ import type * as t from '../../types.d.ts';
3
3
  export interface CompactVerifyGetKey<KeyType extends t.CryptoKey | Uint8Array = t.CryptoKey | Uint8Array> extends t.GetKeyFunction<t.CompactJWSHeaderParameters, t.FlattenedJWSInput, KeyType | t.KeyObject | t.JWK> {
4
4
  }
5
5
  /**
6
- * Verifies a Compact JWS signature and decodes its payload.
6
+ * Validates a JWS Compact Serialization (digital signature or MAC) and decodes its JWS Payload.
7
7
  *
8
8
  * @param key Public key or shared secret. See
9
9
  * {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
10
10
  */
11
11
  export declare function compactVerify(jws: string | Uint8Array, key: t.KeyInput, options?: t.VerifyOptions): Promise<t.CompactVerifyResult>;
12
12
  /**
13
- * Verifies a Compact JWS signature and decodes its payload with a dynamically resolved key,
14
- * included in the result.
13
+ * Validates a JWS Compact Serialization (digital signature or MAC) and decodes its JWS Payload with
14
+ * a dynamically resolved key, included in the result.
15
15
  *
16
16
  * @param getKey Resolves a public key or shared secret from unverified token data.
17
17
  */
18
18
  export declare function compactVerify<KeyType extends t.CryptoKey | Uint8Array = t.CryptoKey | Uint8Array>(jws: string | Uint8Array, getKey: CompactVerifyGetKey<KeyType>, options?: t.VerifyOptions): Promise<t.CompactVerifyResult & t.ResolvedKey<KeyType>>;
19
19
  /**
20
- * Verifies a Compact JWS and decodes its payload using a key or key resolver. The result includes
21
- * `key` only when a resolver is used.
20
+ * Validates a JWS Compact Serialization (digital signature or MAC) and decodes its JWS Payload
21
+ * using a key or key resolver. The result includes `key` only when a resolver is used.
22
22
  *
23
23
  * @param key Public key or shared secret, or a function resolving one.
24
24
  */
@@ -1,11 +1,11 @@
1
1
  import type * as t from '../../types.d.ts';
2
- /** Builds and signs Flattened JWS objects. */
2
+ /** Produces flattened JWS JSON Serialization using a digital signature or MAC. */
3
3
  export declare class FlattenedSign {
4
4
  #private;
5
5
  /**
6
- * Creates a Flattened JWS signer.
6
+ * Creates a signer for flattened JWS JSON Serialization.
7
7
  *
8
- * @param payload Binary representation of the payload to sign.
8
+ * @param payload JWS Payload bytes to sign or MAC.
9
9
  */
10
10
  constructor(payload: Uint8Array);
11
11
  /** Sets the JWS Protected Header. May only be called once. */
@@ -13,7 +13,8 @@ export declare class FlattenedSign {
13
13
  /** Sets the JWS Unprotected Header. May only be called once. */
14
14
  setUnprotectedHeader(unprotectedHeader: t.JWSHeaderParameters): this;
15
15
  /**
16
- * Signs the payload as a Flattened JWS.
16
+ * Computes the JWS Signature (digital signature or MAC) and returns the flattened JWS JSON
17
+ * Serialization.
17
18
  *
18
19
  * @param key Private key or shared secret. See
19
20
  * {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
@@ -3,22 +3,23 @@ import type * as t from '../../types.d.ts';
3
3
  export interface FlattenedVerifyGetKey<KeyType extends t.CryptoKey | Uint8Array = t.CryptoKey | Uint8Array> extends t.GetKeyFunction<t.JWSHeaderParameters, t.FlattenedJWSInput, KeyType | t.KeyObject | t.JWK> {
4
4
  }
5
5
  /**
6
- * Verifies a Flattened JWS signature and decodes its payload.
6
+ * Validates a flattened JWS JSON Serialization (digital signature or MAC) and decodes its JWS
7
+ * Payload.
7
8
  *
8
9
  * @param key Public key or shared secret. See
9
10
  * {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
10
11
  */
11
12
  export declare function flattenedVerify(jws: t.FlattenedJWSInput, key: t.KeyInput, options?: t.VerifyOptions): Promise<t.FlattenedVerifyResult>;
12
13
  /**
13
- * Verifies a Flattened JWS signature and decodes its payload with a dynamically resolved key,
14
- * included in the result.
14
+ * Validates a flattened JWS JSON Serialization (digital signature or MAC) and decodes its JWS
15
+ * Payload with a dynamically resolved key, included in the result.
15
16
  *
16
17
  * @param getKey Resolves a public key or shared secret from unverified token data.
17
18
  */
18
19
  export declare function flattenedVerify<KeyType extends t.CryptoKey | Uint8Array = t.CryptoKey | Uint8Array>(jws: t.FlattenedJWSInput, getKey: FlattenedVerifyGetKey<KeyType>, options?: t.VerifyOptions): Promise<t.FlattenedVerifyResult & t.ResolvedKey<KeyType>>;
19
20
  /**
20
- * Verifies a Flattened JWS and decodes its payload using a key or key resolver. The result includes
21
- * `key` only when a resolver is used.
21
+ * Validates a flattened JWS JSON Serialization (digital signature or MAC) and decodes its JWS
22
+ * Payload using a key or key resolver. The result includes `key` only when a resolver is used.
22
23
  *
23
24
  * @param key Public key or shared secret, or a function resolving one.
24
25
  */
@@ -1,5 +1,5 @@
1
1
  import type * as t from '../../types.d.ts';
2
- /** Configures an individual signature in a General JWS. */
2
+ /** Configures an individual JWS Signature (digital signature or MAC) in a General JWS. */
3
3
  export interface Signature {
4
4
  /** Sets the JWS Protected Header. May only be called once. */
5
5
  setProtectedHeader(protectedHeader: t.JWSHeaderParameters): Signature;
@@ -12,18 +12,18 @@ export interface Signature {
12
12
  * {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
13
13
  */
14
14
  addSignature(key: t.KeyInput, options?: t.SignOptions): Signature;
15
- /** Creates all signatures on the enclosing {@link GeneralSign}, using their configured keys. */
15
+ /** Computes all JWS Signatures on the enclosing {@link GeneralSign}, using their configured keys. */
16
16
  sign(): Promise<t.GeneralJWS>;
17
17
  /** Returns the enclosing {@link GeneralSign} instance. */
18
18
  done(): GeneralSign;
19
19
  }
20
- /** Builds and signs General JWS objects. */
20
+ /** Produces general JWS JSON Serialization using digital signatures or MACs. */
21
21
  export declare class GeneralSign {
22
22
  #private;
23
23
  /**
24
- * Creates a General JWS signer.
24
+ * Creates a signer for general JWS JSON Serialization.
25
25
  *
26
- * @param payload Binary representation of the payload to sign.
26
+ * @param payload JWS Payload bytes to sign or MAC.
27
27
  */
28
28
  constructor(payload: Uint8Array);
29
29
  /**
@@ -33,6 +33,9 @@ export declare class GeneralSign {
33
33
  * {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
34
34
  */
35
35
  addSignature(key: t.KeyInput, options?: t.SignOptions): Signature;
36
- /** Signs the payload as a General JWS. */
36
+ /**
37
+ * Computes each JWS Signature (digital signature or MAC) and returns the general JWS JSON
38
+ * Serialization.
39
+ */
37
40
  sign(): Promise<t.GeneralJWS>;
38
41
  }
@@ -3,7 +3,8 @@ import type * as t from '../../types.d.ts';
3
3
  export interface GeneralVerifyGetKey<KeyType extends t.CryptoKey | Uint8Array = t.CryptoKey | Uint8Array> extends t.GetKeyFunction<t.JWSHeaderParameters, t.FlattenedJWSInput, KeyType | t.KeyObject | t.JWK> {
4
4
  }
5
5
  /**
6
- * Verifies a General JWS signature and decodes its payload.
6
+ * Validates a JWS Signature (digital signature or MAC) from a general JWS JSON Serialization and
7
+ * decodes its JWS Payload.
7
8
  *
8
9
  * > Note: Returns payload and headers from the first signature that verifies successfully. Other entries'
9
10
  * > headers may be inspected to reject inconsistent use of the JWS Unencoded Payload Option, but are
@@ -14,15 +15,16 @@ export interface GeneralVerifyGetKey<KeyType extends t.CryptoKey | Uint8Array =
14
15
  */
15
16
  export declare function generalVerify(jws: t.GeneralJWSInput, key: t.KeyInput, options?: t.VerifyOptions): Promise<t.GeneralVerifyResult>;
16
17
  /**
17
- * Verifies a General JWS signature and decodes its payload with a dynamically resolved key,
18
- * included in the result.
18
+ * Validates a JWS Signature (digital signature or MAC) from a general JWS JSON Serialization and
19
+ * decodes its JWS Payload with a dynamically resolved key, included in the result.
19
20
  *
20
21
  * @param getKey Resolves a public key or shared secret from unverified token data.
21
22
  */
22
23
  export declare function generalVerify<KeyType extends t.CryptoKey | Uint8Array = t.CryptoKey | Uint8Array>(jws: t.GeneralJWSInput, getKey: GeneralVerifyGetKey<KeyType>, options?: t.VerifyOptions): Promise<t.GeneralVerifyResult & t.ResolvedKey<KeyType>>;
23
24
  /**
24
- * Verifies a General JWS and decodes its payload using a key or key resolver. The result includes
25
- * `key` only when a resolver is used.
25
+ * Validates a JWS Signature (digital signature or MAC) from a general JWS JSON Serialization and
26
+ * decodes its JWS Payload using a key or key resolver. The result includes `key` only when a
27
+ * resolver is used.
26
28
  *
27
29
  * @param key Public key or shared secret, or a function resolving one.
28
30
  */
@@ -9,9 +9,9 @@ export interface JWTDecryptOptions extends t.DecryptOptions, t.JWTClaimVerificat
9
9
  export interface JWTDecryptGetKey<KeyType extends t.CryptoKey | Uint8Array = t.CryptoKey | Uint8Array> extends t.GetKeyFunction<t.CompactJWEHeaderParameters, t.FlattenedJWE, KeyType | t.KeyObject | t.JWK> {
10
10
  }
11
11
  /**
12
- * Decrypts a Compact JWE-formatted JWT and validates its Claims Set.
12
+ * Authenticates and decrypts a JWT in JWE Compact Serialization and validates its JWT Claims Set.
13
13
  *
14
- * @param key Private key or shared secret to decrypt and verify the JWT with. See
14
+ * @param key Private key or shared secret to authenticate and decrypt the JWT with. See
15
15
  * {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
16
16
  */
17
17
  export declare function jwtDecrypt<PayloadType = t.JWTPayload>(jwt: string | Uint8Array, key: t.KeyInput, options?: JWTDecryptOptions): Promise<t.JWTDecryptResult<PayloadType>>;
@@ -19,16 +19,17 @@ export declare function jwtDecrypt<PayloadType = t.JWTPayload>(jwt: string | Uin
19
19
  * Decrypts a JWT and validates its claims, returning the dynamically
20
20
  * {@link t.ResolvedKey.key resolved key}.
21
21
  *
22
- * @param getKey Function resolving a private key or shared secret to decrypt and verify the JWT
23
- * with. See {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
22
+ * @param getKey Function resolving a private key or shared secret to authenticate and decrypt the
23
+ * JWT with. See
24
+ * {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
24
25
  */
25
26
  export declare function jwtDecrypt<PayloadType = t.JWTPayload, KeyType extends t.CryptoKey | Uint8Array = t.CryptoKey | Uint8Array>(jwt: string | Uint8Array, getKey: JWTDecryptGetKey<KeyType>, options?: JWTDecryptOptions): Promise<t.JWTDecryptResult<PayloadType> & t.ResolvedKey<KeyType>>;
26
27
  /**
27
28
  * Accepts a key or key resolver. Use this overload when forwarding either form; the result includes
28
29
  * `key` only when a resolver was used.
29
30
  *
30
- * @param key Private key or shared secret, or a function resolving one, to decrypt and verify the
31
- * JWT with. See
31
+ * @param key Private key or shared secret, or a function resolving one, to authenticate and decrypt
32
+ * the JWT with. See
32
33
  * {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
33
34
  */
34
35
  export declare function jwtDecrypt<PayloadType = t.JWTPayload>(jwt: string | Uint8Array, key: t.KeyInput | JWTDecryptGetKey, options?: JWTDecryptOptions): Promise<t.JWTDecryptResult<PayloadType> & Partial<t.ResolvedKey>>;
@@ -1,7 +1,7 @@
1
1
  import type * as t from '../types.d.ts';
2
2
  /** @param payload Initial JWT Claims Set. Defaults to an empty object. */
3
3
  declare const EncryptJWT_base: new (payload?: t.JWTPayload) => t.ProduceJWT;
4
- /** Builds and encrypts Compact JWE-formatted JSON Web Tokens. */
4
+ /** Produces encrypted JWTs in JWE Compact Serialization. */
5
5
  export declare class EncryptJWT extends EncryptJWT_base {
6
6
  #private;
7
7
  /**
@@ -1,7 +1,7 @@
1
1
  import type * as t from '../types.d.ts';
2
2
  /** @param payload Initial JWT Claims Set. Defaults to an empty object. */
3
3
  declare const SignJWT_base: new (payload?: t.JWTPayload) => t.ProduceJWT;
4
- /** Builds and signs Compact JWS-formatted JSON Web Tokens. */
4
+ /** Produces JWTs in JWS Compact Serialization using a digital signature or MAC. */
5
5
  export declare class SignJWT extends SignJWT_base {
6
6
  #private;
7
7
  /**
@@ -3,7 +3,7 @@ import type * as t from '../types.d.ts';
3
3
  export interface UnsecuredResult<PayloadType = t.JWTPayload> {
4
4
  /** JWT Claims Set. */
5
5
  payload: PayloadType & t.JWTPayload & ([PayloadType] extends [object] ? unknown : unknown extends PayloadType ? unknown : never);
6
- /** The decoded JOSE Header; always `{ "alg": "none" }` for an Unsecured JWT. */
6
+ /** The decoded JOSE Header; its "alg" (Algorithm) Header Parameter is "none". */
7
7
  header: t.JWSHeaderParameters;
8
8
  }
9
9
  /** @param payload Initial JWT Claims Set. Defaults to an empty object. */