toolcraft 0.0.119 → 0.0.121

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 (153) hide show
  1. package/composition.json +17 -2
  2. package/dist/composition.json +17 -2
  3. package/dist/http.compile-check.d.ts +1 -0
  4. package/dist/http.compile-check.js +31 -0
  5. package/dist/http.d.ts +19 -0
  6. package/dist/http.js +62 -0
  7. package/dist/mcp.js +26 -11
  8. package/node_modules/jose/LICENSE.md +21 -0
  9. package/node_modules/jose/README.md +153 -0
  10. package/node_modules/jose/dist/types/index.d.ts +55 -0
  11. package/node_modules/jose/dist/types/jwe/compact/decrypt.d.ts +31 -0
  12. package/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts +65 -0
  13. package/node_modules/jose/dist/types/jwe/flattened/decrypt.d.ts +31 -0
  14. package/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +83 -0
  15. package/node_modules/jose/dist/types/jwe/general/decrypt.d.ts +38 -0
  16. package/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +74 -0
  17. package/node_modules/jose/dist/types/jwk/embedded.d.ts +17 -0
  18. package/node_modules/jose/dist/types/jwk/thumbprint.d.ts +32 -0
  19. package/node_modules/jose/dist/types/jwks/local.d.ts +29 -0
  20. package/node_modules/jose/dist/types/jwks/remote.d.ts +237 -0
  21. package/node_modules/jose/dist/types/jws/compact/sign.d.ts +36 -0
  22. package/node_modules/jose/dist/types/jws/compact/verify.d.ts +33 -0
  23. package/node_modules/jose/dist/types/jws/flattened/sign.d.ts +42 -0
  24. package/node_modules/jose/dist/types/jws/flattened/verify.d.ts +33 -0
  25. package/node_modules/jose/dist/types/jws/general/sign.d.ts +53 -0
  26. package/node_modules/jose/dist/types/jws/general/verify.d.ts +41 -0
  27. package/node_modules/jose/dist/types/jwt/decrypt.d.ts +35 -0
  28. package/node_modules/jose/dist/types/jwt/encrypt.d.ts +91 -0
  29. package/node_modules/jose/dist/types/jwt/sign.d.ts +43 -0
  30. package/node_modules/jose/dist/types/jwt/unsecured.d.ts +43 -0
  31. package/node_modules/jose/dist/types/jwt/verify.d.ts +37 -0
  32. package/node_modules/jose/dist/types/key/export.d.ts +33 -0
  33. package/node_modules/jose/dist/types/key/generate_key_pair.d.ts +47 -0
  34. package/node_modules/jose/dist/types/key/generate_secret.d.ts +35 -0
  35. package/node_modules/jose/dist/types/key/import.d.ts +83 -0
  36. package/node_modules/jose/dist/types/types.d.ts +852 -0
  37. package/node_modules/jose/dist/types/util/base64url.d.ts +9 -0
  38. package/node_modules/jose/dist/types/util/decode_jwt.d.ts +18 -0
  39. package/node_modules/jose/dist/types/util/decode_protected_header.d.ts +17 -0
  40. package/node_modules/jose/dist/types/util/errors.d.ts +213 -0
  41. package/node_modules/jose/dist/webapi/index.js +32 -0
  42. package/node_modules/jose/dist/webapi/jwe/compact/decrypt.js +27 -0
  43. package/node_modules/jose/dist/webapi/jwe/compact/encrypt.js +27 -0
  44. package/node_modules/jose/dist/webapi/jwe/flattened/decrypt.js +159 -0
  45. package/node_modules/jose/dist/webapi/jwe/flattened/encrypt.js +167 -0
  46. package/node_modules/jose/dist/webapi/jwe/general/decrypt.js +31 -0
  47. package/node_modules/jose/dist/webapi/jwe/general/encrypt.js +182 -0
  48. package/node_modules/jose/dist/webapi/jwk/embedded.js +17 -0
  49. package/node_modules/jose/dist/webapi/jwk/thumbprint.js +68 -0
  50. package/node_modules/jose/dist/webapi/jwks/local.js +119 -0
  51. package/node_modules/jose/dist/webapi/jwks/remote.js +179 -0
  52. package/node_modules/jose/dist/webapi/jws/compact/sign.js +18 -0
  53. package/node_modules/jose/dist/webapi/jws/compact/verify.js +21 -0
  54. package/node_modules/jose/dist/webapi/jws/flattened/sign.js +89 -0
  55. package/node_modules/jose/dist/webapi/jws/flattened/verify.js +110 -0
  56. package/node_modules/jose/dist/webapi/jws/general/sign.js +70 -0
  57. package/node_modules/jose/dist/webapi/jws/general/verify.js +24 -0
  58. package/node_modules/jose/dist/webapi/jwt/decrypt.js +23 -0
  59. package/node_modules/jose/dist/webapi/jwt/encrypt.js +101 -0
  60. package/node_modules/jose/dist/webapi/jwt/sign.js +52 -0
  61. package/node_modules/jose/dist/webapi/jwt/unsecured.js +63 -0
  62. package/node_modules/jose/dist/webapi/jwt/verify.js +15 -0
  63. package/node_modules/jose/dist/webapi/key/export.js +11 -0
  64. package/node_modules/jose/dist/webapi/key/generate_key_pair.js +97 -0
  65. package/node_modules/jose/dist/webapi/key/generate_secret.js +40 -0
  66. package/node_modules/jose/dist/webapi/key/import.js +57 -0
  67. package/node_modules/jose/dist/webapi/lib/aesgcmkw.js +15 -0
  68. package/node_modules/jose/dist/webapi/lib/aeskw.js +25 -0
  69. package/node_modules/jose/dist/webapi/lib/asn1.js +243 -0
  70. package/node_modules/jose/dist/webapi/lib/base64.js +22 -0
  71. package/node_modules/jose/dist/webapi/lib/buffer_utils.js +43 -0
  72. package/node_modules/jose/dist/webapi/lib/check_key_type.js +122 -0
  73. package/node_modules/jose/dist/webapi/lib/content_encryption.js +217 -0
  74. package/node_modules/jose/dist/webapi/lib/crypto_key.js +136 -0
  75. package/node_modules/jose/dist/webapi/lib/deflate.js +44 -0
  76. package/node_modules/jose/dist/webapi/lib/ecdhes.js +52 -0
  77. package/node_modules/jose/dist/webapi/lib/helpers.js +19 -0
  78. package/node_modules/jose/dist/webapi/lib/invalid_key_input.js +27 -0
  79. package/node_modules/jose/dist/webapi/lib/is_key_like.js +17 -0
  80. package/node_modules/jose/dist/webapi/lib/jwk_to_key.js +107 -0
  81. package/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +238 -0
  82. package/node_modules/jose/dist/webapi/lib/key_management.js +186 -0
  83. package/node_modules/jose/dist/webapi/lib/key_to_jwk.js +31 -0
  84. package/node_modules/jose/dist/webapi/lib/normalize_key.js +166 -0
  85. package/node_modules/jose/dist/webapi/lib/pbes2kw.js +42 -0
  86. package/node_modules/jose/dist/webapi/lib/rsaes.js +24 -0
  87. package/node_modules/jose/dist/webapi/lib/signing.js +68 -0
  88. package/node_modules/jose/dist/webapi/lib/type_checks.js +40 -0
  89. package/node_modules/jose/dist/webapi/lib/validate_algorithms.js +10 -0
  90. package/node_modules/jose/dist/webapi/lib/validate_crit.js +33 -0
  91. package/node_modules/jose/dist/webapi/util/base64url.js +30 -0
  92. package/node_modules/jose/dist/webapi/util/decode_jwt.js +32 -0
  93. package/node_modules/jose/dist/webapi/util/decode_protected_header.js +34 -0
  94. package/node_modules/jose/dist/webapi/util/errors.js +99 -0
  95. package/node_modules/jose/package.json +200 -0
  96. package/node_modules/tiny-http-mcp-server/LICENSE +21 -0
  97. package/node_modules/tiny-http-mcp-server/README.md +778 -0
  98. package/node_modules/tiny-http-mcp-server/dist/auth.d.ts +69 -0
  99. package/node_modules/tiny-http-mcp-server/dist/auth.js +261 -0
  100. package/node_modules/tiny-http-mcp-server/dist/cli.d.ts +20 -0
  101. package/node_modules/tiny-http-mcp-server/dist/cli.js +465 -0
  102. package/node_modules/tiny-http-mcp-server/dist/composition.json +30 -0
  103. package/node_modules/tiny-http-mcp-server/dist/express-middleware.d.ts +18 -0
  104. package/node_modules/tiny-http-mcp-server/dist/express-middleware.js +90 -0
  105. package/node_modules/tiny-http-mcp-server/dist/http-server.d.ts +49 -0
  106. package/node_modules/tiny-http-mcp-server/dist/http-server.js +264 -0
  107. package/node_modules/tiny-http-mcp-server/dist/http-transport.d.ts +164 -0
  108. package/node_modules/tiny-http-mcp-server/dist/http-transport.js +897 -0
  109. package/node_modules/tiny-http-mcp-server/dist/index.d.ts +13 -0
  110. package/node_modules/tiny-http-mcp-server/dist/index.js +6 -0
  111. package/node_modules/tiny-http-mcp-server/dist/load-oauth-verifier.d.ts +6 -0
  112. package/node_modules/tiny-http-mcp-server/dist/load-oauth-verifier.js +43 -0
  113. package/node_modules/tiny-http-mcp-server/dist/parse-body.d.ts +22 -0
  114. package/node_modules/tiny-http-mcp-server/dist/parse-body.js +150 -0
  115. package/node_modules/tiny-http-mcp-server/dist/server.d.ts +9 -0
  116. package/node_modules/tiny-http-mcp-server/dist/server.js +4 -0
  117. package/node_modules/tiny-http-mcp-server/dist/session.d.ts +18 -0
  118. package/node_modules/tiny-http-mcp-server/dist/session.js +37 -0
  119. package/node_modules/tiny-http-mcp-server/dist/sse.d.ts +11 -0
  120. package/node_modules/tiny-http-mcp-server/dist/sse.js +22 -0
  121. package/node_modules/tiny-http-mcp-server/dist/test-support.d.ts +10 -0
  122. package/node_modules/tiny-http-mcp-server/dist/test-support.js +398 -0
  123. package/node_modules/tiny-http-mcp-server/dist/testing.d.ts +59 -0
  124. package/node_modules/tiny-http-mcp-server/dist/testing.js +191 -0
  125. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/LICENSE +21 -0
  126. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/README.md +70 -0
  127. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/auth-store-session-store.d.ts +14 -0
  128. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/auth-store-session-store.js +169 -0
  129. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/authorization-state.d.ts +8 -0
  130. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/authorization-state.js +47 -0
  131. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/default-oauth-client-provider.d.ts +3 -0
  132. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/default-oauth-client-provider.js +627 -0
  133. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/loopback-authorization.d.ts +20 -0
  134. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/loopback-authorization.js +207 -0
  135. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/pkce.d.ts +2 -0
  136. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/pkce.js +7 -0
  137. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/token-endpoint.d.ts +40 -0
  138. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/token-endpoint.js +164 -0
  139. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/types.d.ts +113 -0
  140. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/types.js +1 -0
  141. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/index.d.ts +10 -0
  142. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/index.js +7 -0
  143. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/resource-indicator.d.ts +1 -0
  144. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/resource-indicator.js +11 -0
  145. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/server/jwks-token-verifier.d.ts +32 -0
  146. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/server/jwks-token-verifier.js +388 -0
  147. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/types.compile-check.d.ts +1 -0
  148. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/types.compile-check.js +22 -0
  149. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/package.json +28 -0
  150. package/node_modules/tiny-http-mcp-server/package.json +59 -0
  151. package/node_modules/tiny-stdio-mcp-server/dist/composition.json +1 -1
  152. package/node_modules/toolcraft-schema/package.json +1 -1
  153. package/package.json +11 -4
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Verifying JSON Web Signature (JWS) in Flattened JSON Serialization
3
+ *
4
+ * @module
5
+ */
6
+ import type * as types from '../../types.d.ts';
7
+ /**
8
+ * Interface for Flattened JWS Verification dynamic key resolution. No token components have been
9
+ * verified at the time of this function call.
10
+ *
11
+ * @see {@link jwks/remote.createRemoteJWKSet createRemoteJWKSet} to verify using a remote JSON Web Key Set.
12
+ */
13
+ export interface FlattenedVerifyGetKey extends types.GenericGetKeyFunction<types.JWSHeaderParameters | undefined, types.FlattenedJWSInput, types.CryptoKey | types.KeyObject | types.JWK | Uint8Array> {
14
+ }
15
+ /**
16
+ * Verifies the signature and format of and afterwards decodes the Flattened JWS.
17
+ *
18
+ * This function is exported (as a named export) from the main `'jose'` module entry point as well
19
+ * as from its subpath export `'jose/jws/flattened/verify'`.
20
+ *
21
+ * @param jws Flattened JWS.
22
+ * @param key Key to verify the JWS with. See
23
+ * {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
24
+ * @param options JWS Verify options.
25
+ */
26
+ export declare function flattenedVerify(jws: types.FlattenedJWSInput, key: types.CryptoKey | types.KeyObject | types.JWK | Uint8Array, options?: types.VerifyOptions): Promise<types.FlattenedVerifyResult>;
27
+ /**
28
+ * @param jws Flattened JWS.
29
+ * @param getKey Function resolving a key to verify the JWS with. See
30
+ * {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
31
+ * @param options JWS Verify options.
32
+ */
33
+ export declare function flattenedVerify(jws: types.FlattenedJWSInput, getKey: FlattenedVerifyGetKey, options?: types.VerifyOptions): Promise<types.FlattenedVerifyResult & types.ResolvedKey>;
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Signing JSON Web Signature (JWS) in General JSON Serialization
3
+ *
4
+ * @module
5
+ */
6
+ import type * as types from '../../types.d.ts';
7
+ /** Used to build General JWS object's individual signatures. */
8
+ export interface Signature {
9
+ /**
10
+ * Sets the JWS Protected Header on the Signature object.
11
+ *
12
+ * @param protectedHeader JWS Protected Header.
13
+ */
14
+ setProtectedHeader(protectedHeader: types.JWSHeaderParameters): Signature;
15
+ /**
16
+ * Sets the JWS Unprotected Header on the Signature object.
17
+ *
18
+ * @param unprotectedHeader JWS Unprotected Header.
19
+ */
20
+ setUnprotectedHeader(unprotectedHeader: types.JWSHeaderParameters): Signature;
21
+ /** A shorthand for calling addSignature() on the enclosing {@link GeneralSign} instance */
22
+ addSignature(...args: Parameters<GeneralSign['addSignature']>): Signature;
23
+ /** A shorthand for calling encrypt() on the enclosing {@link GeneralSign} instance */
24
+ sign(...args: Parameters<GeneralSign['sign']>): Promise<types.GeneralJWS>;
25
+ /** Returns the enclosing {@link GeneralSign} instance */
26
+ done(): GeneralSign;
27
+ }
28
+ /**
29
+ * The GeneralSign class is used to build and sign General JWS objects.
30
+ *
31
+ * This class is exported (as a named export) from the main `'jose'` module entry point as well as
32
+ * from its subpath export `'jose/jws/general/sign'`.
33
+ *
34
+ */
35
+ export declare class GeneralSign {
36
+ #private;
37
+ /**
38
+ * {@link GeneralSign} constructor
39
+ *
40
+ * @param payload Binary representation of the payload to sign.
41
+ */
42
+ constructor(payload: Uint8Array);
43
+ /**
44
+ * Adds an additional signature for the General JWS object.
45
+ *
46
+ * @param key Private Key or Secret to sign the individual JWS signature with. See
47
+ * {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
48
+ * @param options JWS Sign options.
49
+ */
50
+ addSignature(key: types.CryptoKey | types.KeyObject | types.JWK | Uint8Array, options?: types.SignOptions): Signature;
51
+ /** Signs and resolves the value of the General JWS object. */
52
+ sign(): Promise<types.GeneralJWS>;
53
+ }
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Verifying JSON Web Signature (JWS) in General JSON Serialization
3
+ *
4
+ * @module
5
+ */
6
+ import type * as types from '../../types.d.ts';
7
+ /**
8
+ * Interface for General JWS Verification dynamic key resolution. No token components have been
9
+ * verified at the time of this function call.
10
+ *
11
+ * @see {@link jwks/remote.createRemoteJWKSet createRemoteJWKSet} to verify using a remote JSON Web Key Set.
12
+ */
13
+ export interface GeneralVerifyGetKey extends types.GenericGetKeyFunction<types.JWSHeaderParameters, types.FlattenedJWSInput, types.CryptoKey | types.KeyObject | types.JWK | Uint8Array> {
14
+ }
15
+ /**
16
+ * Verifies the signature and format of and afterwards decodes the General JWS.
17
+ *
18
+ * This function is exported (as a named export) from the main `'jose'` module entry point as well
19
+ * as from its subpath export `'jose/jws/general/verify'`.
20
+ *
21
+ * > [!NOTE]\
22
+ * > The function iterates over the `signatures` array in the General JWS and returns the verification
23
+ * > result of the first signature entry that can be successfully verified. The result only contains
24
+ * > the payload, protected header, and unprotected header of that successfully verified signature
25
+ * > entry. Other signature entries in the General JWS are not validated, and their headers are not
26
+ * > included in the returned result. Recipients of a General JWS should only rely on the returned
27
+ * > (verified) data.
28
+ *
29
+ * @param jws General JWS.
30
+ * @param key Key to verify the JWS with. See
31
+ * {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
32
+ * @param options JWS Verify options.
33
+ */
34
+ export declare function generalVerify(jws: types.GeneralJWSInput, key: types.CryptoKey | types.KeyObject | types.JWK | Uint8Array, options?: types.VerifyOptions): Promise<types.GeneralVerifyResult>;
35
+ /**
36
+ * @param jws General JWS.
37
+ * @param getKey Function resolving a key to verify the JWS with. See
38
+ * {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
39
+ * @param options JWS Verify options.
40
+ */
41
+ export declare function generalVerify(jws: types.GeneralJWSInput, getKey: GeneralVerifyGetKey, options?: types.VerifyOptions): Promise<types.GeneralVerifyResult & types.ResolvedKey>;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * JSON Web Token (JWT) Decryption (JWT is in JWE format)
3
+ *
4
+ * @module
5
+ */
6
+ import type * as types from '../types.d.ts';
7
+ /** Combination of JWE Decryption options and JWT Claims Set verification options. */
8
+ export interface JWTDecryptOptions extends types.DecryptOptions, types.JWTClaimVerificationOptions {
9
+ }
10
+ /**
11
+ * Interface for JWT Decryption dynamic key resolution. No token components have been verified at
12
+ * the time of this function call.
13
+ */
14
+ export interface JWTDecryptGetKey extends types.GetKeyFunction<types.CompactJWEHeaderParameters, types.FlattenedJWE> {
15
+ }
16
+ /**
17
+ * Verifies the JWT format (to be a JWE Compact format), decrypts the ciphertext, validates the JWT
18
+ * Claims Set.
19
+ *
20
+ * This function is exported (as a named export) from the main `'jose'` module entry point as well
21
+ * as from its subpath export `'jose/jwt/decrypt'`.
22
+ *
23
+ * @param jwt JSON Web Token value (encoded as JWE).
24
+ * @param key Private Key or Secret to decrypt and verify the JWT with. See
25
+ * {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
26
+ * @param options JWT Decryption and JWT Claims Set validation options.
27
+ */
28
+ export declare function jwtDecrypt<PayloadType = types.JWTPayload>(jwt: string | Uint8Array, key: types.CryptoKey | types.KeyObject | types.JWK | Uint8Array, options?: JWTDecryptOptions): Promise<types.JWTDecryptResult<PayloadType>>;
29
+ /**
30
+ * @param jwt JSON Web Token value (encoded as JWE).
31
+ * @param getKey Function resolving Private Key or Secret to decrypt and verify the JWT with. See
32
+ * {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
33
+ * @param options JWT Decryption and JWT Claims Set validation options.
34
+ */
35
+ export declare function jwtDecrypt<PayloadType = types.JWTPayload>(jwt: string | Uint8Array, getKey: JWTDecryptGetKey, options?: JWTDecryptOptions): Promise<types.JWTDecryptResult<PayloadType> & types.ResolvedKey>;
@@ -0,0 +1,91 @@
1
+ /**
2
+ * JSON Web Token (JWT) Encryption (JWT is in JWE format)
3
+ *
4
+ * @module
5
+ */
6
+ import type * as types from '../types.d.ts';
7
+ /**
8
+ * The EncryptJWT class is used to build and encrypt Compact JWE formatted JSON Web Tokens.
9
+ *
10
+ * This class is exported (as a named export) from the main `'jose'` module entry point as well as
11
+ * from its subpath export `'jose/jwt/encrypt'`.
12
+ *
13
+ */
14
+ export declare class EncryptJWT implements types.ProduceJWT {
15
+ #private;
16
+ /**
17
+ * {@link EncryptJWT} constructor
18
+ *
19
+ * @param payload The JWT Claims Set object. Defaults to an empty object.
20
+ */
21
+ constructor(payload?: types.JWTPayload);
22
+ setIssuer(issuer: string): this;
23
+ setSubject(subject: string): this;
24
+ setAudience(audience: string | string[]): this;
25
+ setJti(jwtId: string): this;
26
+ setNotBefore(input: number | string | Date): this;
27
+ setExpirationTime(input: number | string | Date): this;
28
+ setIssuedAt(input?: number | string | Date): this;
29
+ /**
30
+ * Sets the JWE Protected Header on the EncryptJWT object.
31
+ *
32
+ * @param protectedHeader JWE Protected Header. Must contain an "alg" (JWE Algorithm) and "enc"
33
+ * (JWE Encryption Algorithm) properties.
34
+ */
35
+ setProtectedHeader(protectedHeader: types.CompactJWEHeaderParameters): this;
36
+ /**
37
+ * Sets the JWE Key Management parameters to be used when encrypting.
38
+ *
39
+ * (ECDH-ES) Use of this method is needed for ECDH based algorithms to set the "apu" (Agreement
40
+ * PartyUInfo) or "apv" (Agreement PartyVInfo) parameters.
41
+ *
42
+ * @param parameters JWE Key Management parameters.
43
+ */
44
+ setKeyManagementParameters(parameters: types.JWEKeyManagementHeaderParameters): this;
45
+ /**
46
+ * Sets a content encryption key to use, by default a random suitable one is generated for the JWE
47
+ * enc" (Encryption Algorithm) Header Parameter.
48
+ *
49
+ * @deprecated You should not use this method. It is only really intended for test and vector
50
+ * validation purposes.
51
+ *
52
+ * @param cek JWE Content Encryption Key.
53
+ */
54
+ setContentEncryptionKey(cek: Uint8Array): this;
55
+ /**
56
+ * Sets the JWE Initialization Vector to use for content encryption, by default a random suitable
57
+ * one is generated for the JWE enc" (Encryption Algorithm) Header Parameter.
58
+ *
59
+ * @deprecated You should not use this method. It is only really intended for test and vector
60
+ * validation purposes.
61
+ *
62
+ * @param iv JWE Initialization Vector.
63
+ */
64
+ setInitializationVector(iv: Uint8Array): this;
65
+ /**
66
+ * Replicates the "iss" (Issuer) Claim as a JWE Protected Header Parameter.
67
+ *
68
+ * @see {@link https://www.rfc-editor.org/rfc/rfc7519#section-5.3 RFC7519#section-5.3}
69
+ */
70
+ replicateIssuerAsHeader(): this;
71
+ /**
72
+ * Replicates the "sub" (Subject) Claim as a JWE Protected Header Parameter.
73
+ *
74
+ * @see {@link https://www.rfc-editor.org/rfc/rfc7519#section-5.3 RFC7519#section-5.3}
75
+ */
76
+ replicateSubjectAsHeader(): this;
77
+ /**
78
+ * Replicates the "aud" (Audience) Claim as a JWE Protected Header Parameter.
79
+ *
80
+ * @see {@link https://www.rfc-editor.org/rfc/rfc7519#section-5.3 RFC7519#section-5.3}
81
+ */
82
+ replicateAudienceAsHeader(): this;
83
+ /**
84
+ * Encrypts and returns the JWT.
85
+ *
86
+ * @param key Public Key or Secret to encrypt the JWT with. See
87
+ * {@link https://github.com/panva/jose/issues/210#jwe-alg Algorithm Key Requirements}.
88
+ * @param options JWE Encryption options.
89
+ */
90
+ encrypt(key: types.CryptoKey | types.KeyObject | types.JWK | Uint8Array, options?: types.EncryptOptions): Promise<string>;
91
+ }
@@ -0,0 +1,43 @@
1
+ /**
2
+ * JSON Web Token (JWT) Signing (JWT is in JWS format)
3
+ *
4
+ * @module
5
+ */
6
+ import type * as types from '../types.d.ts';
7
+ /**
8
+ * The SignJWT class is used to build and sign Compact JWS formatted JSON Web Tokens.
9
+ *
10
+ * This class is exported (as a named export) from the main `'jose'` module entry point as well as
11
+ * from its subpath export `'jose/jwt/sign'`.
12
+ *
13
+ */
14
+ export declare class SignJWT implements types.ProduceJWT {
15
+ #private;
16
+ /**
17
+ * {@link SignJWT} constructor
18
+ *
19
+ * @param payload The JWT Claims Set object. Defaults to an empty object.
20
+ */
21
+ constructor(payload?: types.JWTPayload);
22
+ setIssuer(issuer: string): this;
23
+ setSubject(subject: string): this;
24
+ setAudience(audience: string | string[]): this;
25
+ setJti(jwtId: string): this;
26
+ setNotBefore(input: number | string | Date): this;
27
+ setExpirationTime(input: number | string | Date): this;
28
+ setIssuedAt(input?: number | string | Date): this;
29
+ /**
30
+ * Sets the JWS Protected Header on the SignJWT object.
31
+ *
32
+ * @param protectedHeader JWS Protected Header. Must contain an "alg" (JWS Algorithm) property.
33
+ */
34
+ setProtectedHeader(protectedHeader: types.JWTHeaderParameters): this;
35
+ /**
36
+ * Signs and returns the JWT.
37
+ *
38
+ * @param key Private Key or Secret to sign the JWT with. See
39
+ * {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
40
+ * @param options JWT Sign options.
41
+ */
42
+ sign(key: types.CryptoKey | types.KeyObject | types.JWK | Uint8Array, options?: types.SignOptions): Promise<string>;
43
+ }
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Unsecured (unsigned & unencrypted) JSON Web Tokens (JWT)
3
+ *
4
+ * @module
5
+ */
6
+ import type * as types from '../types.d.ts';
7
+ /** Result of decoding an Unsecured JWT. */
8
+ export interface UnsecuredResult<PayloadType = types.JWTPayload> {
9
+ payload: PayloadType & types.JWTPayload;
10
+ header: types.JWSHeaderParameters;
11
+ }
12
+ /**
13
+ * The UnsecuredJWT class is a utility for dealing with `{ "alg": "none" }` Unsecured JWTs.
14
+ *
15
+ * This class is exported (as a named export) from the main `'jose'` module entry point as well as
16
+ * from its subpath export `'jose/jwt/unsecured'`.
17
+ *
18
+ */
19
+ export declare class UnsecuredJWT implements types.ProduceJWT {
20
+ #private;
21
+ /**
22
+ * {@link UnsecuredJWT} constructor
23
+ *
24
+ * @param payload The JWT Claims Set object. Defaults to an empty object.
25
+ */
26
+ constructor(payload?: types.JWTPayload);
27
+ /** Encodes the Unsecured JWT. */
28
+ encode(): string;
29
+ setIssuer(issuer: string): this;
30
+ setSubject(subject: string): this;
31
+ setAudience(audience: string | string[]): this;
32
+ setJti(jwtId: string): this;
33
+ setNotBefore(input: number | string | Date): this;
34
+ setExpirationTime(input: number | string | Date): this;
35
+ setIssuedAt(input?: number | string | Date): this;
36
+ /**
37
+ * Decodes an unsecured JWT.
38
+ *
39
+ * @param jwt Unsecured JWT to decode the payload of.
40
+ * @param options JWT Claims Set validation options.
41
+ */
42
+ static decode<PayloadType = types.JWTPayload>(jwt: string, options?: types.JWTClaimVerificationOptions): UnsecuredResult<PayloadType>;
43
+ }
@@ -0,0 +1,37 @@
1
+ /**
2
+ * JSON Web Token (JWT) Verification (JWT is in JWS format)
3
+ *
4
+ * @module
5
+ */
6
+ import type * as types from '../types.d.ts';
7
+ /** Combination of JWS Verification options and JWT Claims Set verification options. */
8
+ export interface JWTVerifyOptions extends types.VerifyOptions, types.JWTClaimVerificationOptions {
9
+ }
10
+ /**
11
+ * Interface for JWT Verification dynamic key resolution. No token components have been verified at
12
+ * the time of this function call.
13
+ *
14
+ * @see {@link jwks/remote.createRemoteJWKSet createRemoteJWKSet} to verify using a remote JSON Web Key Set.
15
+ */
16
+ export interface JWTVerifyGetKey extends types.GenericGetKeyFunction<types.JWTHeaderParameters, types.FlattenedJWSInput, types.CryptoKey | types.KeyObject | types.JWK | Uint8Array> {
17
+ }
18
+ /**
19
+ * Verifies the JWT format (to be a JWS Compact format), verifies the JWS signature, validates the
20
+ * JWT Claims Set.
21
+ *
22
+ * This function is exported (as a named export) from the main `'jose'` module entry point as well
23
+ * as from its subpath export `'jose/jwt/verify'`.
24
+ *
25
+ * @param jwt JSON Web Token value (encoded as JWS).
26
+ * @param key Key to verify the JWT with. See
27
+ * {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
28
+ * @param options JWT Decryption and JWT Claims Set validation options.
29
+ */
30
+ export declare function jwtVerify<PayloadType = types.JWTPayload>(jwt: string | Uint8Array, key: types.CryptoKey | types.KeyObject | types.JWK | Uint8Array, options?: JWTVerifyOptions): Promise<types.JWTVerifyResult<PayloadType>>;
31
+ /**
32
+ * @param jwt JSON Web Token value (encoded as JWS).
33
+ * @param getKey Function resolving a key to verify the JWT with. See
34
+ * {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
35
+ * @param options JWT Decryption and JWT Claims Set validation options.
36
+ */
37
+ export declare function jwtVerify<PayloadType = types.JWTPayload>(jwt: string | Uint8Array, getKey: JWTVerifyGetKey, options?: JWTVerifyOptions): Promise<types.JWTVerifyResult<PayloadType> & types.ResolvedKey>;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Cryptographic key export functions
3
+ *
4
+ * @module
5
+ */
6
+ import type * as types from '../types.d.ts';
7
+ /**
8
+ * Exports a public {@link !CryptoKey} or {@link !KeyObject} to a PEM-encoded SPKI string format.
9
+ *
10
+ * This function is exported (as a named export) from the main `'jose'` module entry point as well
11
+ * as from its subpath export `'jose/key/export'`.
12
+ *
13
+ * @param key Key to export to a PEM-encoded SPKI string format.
14
+ */
15
+ export declare function exportSPKI(key: types.CryptoKey | types.KeyObject): Promise<string>;
16
+ /**
17
+ * Exports a private {@link !CryptoKey} or {@link !KeyObject} to a PEM-encoded PKCS8 string format.
18
+ *
19
+ * This function is exported (as a named export) from the main `'jose'` module entry point as well
20
+ * as from its subpath export `'jose/key/export'`.
21
+ *
22
+ * @param key Key to export to a PEM-encoded PKCS8 string format.
23
+ */
24
+ export declare function exportPKCS8(key: types.CryptoKey | types.KeyObject): Promise<string>;
25
+ /**
26
+ * Exports a {@link !CryptoKey}, {@link !KeyObject}, or {@link !Uint8Array} to a JWK.
27
+ *
28
+ * This function is exported (as a named export) from the main `'jose'` module entry point as well
29
+ * as from its subpath export `'jose/key/export'`.
30
+ *
31
+ * @param key Key to export as JWK.
32
+ */
33
+ export declare function exportJWK(key: types.CryptoKey | types.KeyObject | Uint8Array): Promise<types.JWK>;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Asymmetric key generation
3
+ *
4
+ * @module
5
+ */
6
+ import type * as types from '../types.d.ts';
7
+ /** Asymmetric key pair generation function result. */
8
+ export interface GenerateKeyPairResult {
9
+ /** The generated Private Key. */
10
+ privateKey: types.CryptoKey;
11
+ /** Public Key corresponding to the generated Private Key. */
12
+ publicKey: types.CryptoKey;
13
+ }
14
+ /** Asymmetric key pair generation function options. */
15
+ export interface GenerateKeyPairOptions {
16
+ /**
17
+ * The EC "crv" (Curve) or OKP "crv" (Subtype of Key Pair) value to generate. The curve must be
18
+ * both supported on the runtime as well as applicable for the given JWA algorithm identifier.
19
+ */
20
+ crv?: string;
21
+ /**
22
+ * A hint for RSA algorithms to generate an RSA key of a given `modulusLength` (Key size in bits).
23
+ * JOSE requires 2048 bits or larger. Default is 2048.
24
+ */
25
+ modulusLength?: number;
26
+ /**
27
+ * The value to use as {@link !SubtleCrypto.generateKey} `extractable` argument. Default is false.
28
+ *
29
+ */
30
+ extractable?: boolean;
31
+ }
32
+ /**
33
+ * Generates a private and a public key for a given JWA algorithm identifier. This can only generate
34
+ * asymmetric key pairs. For symmetric secrets use the `generateSecret` function.
35
+ *
36
+ * > [!NOTE]\
37
+ * > The `privateKey` is generated with `extractable` set to `false` by default. See
38
+ * > {@link GenerateKeyPairOptions.extractable} to generate an extractable `privateKey`.
39
+ *
40
+ * This function is exported (as a named export) from the main `'jose'` module entry point as well
41
+ * as from its subpath export `'jose/generate/keypair'`.
42
+ *
43
+ * @param alg JWA Algorithm Identifier to be used with the generated key pair. See
44
+ * {@link https://github.com/panva/jose/issues/210 Algorithm Key Requirements}.
45
+ * @param options Additional options passed down to the key pair generation.
46
+ */
47
+ export declare function generateKeyPair(alg: string, options?: GenerateKeyPairOptions): Promise<GenerateKeyPairResult>;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Symmetric key generation
3
+ *
4
+ * @module
5
+ */
6
+ import type * as types from '../types.d.ts';
7
+ /** Secret generation function options. */
8
+ export interface GenerateSecretOptions {
9
+ /**
10
+ * The value to use as {@link !SubtleCrypto.generateKey} `extractable` argument. Default is false.
11
+ *
12
+ * > [!NOTE]\
13
+ * > Because A128CBC-HS256, A192CBC-HS384, and A256CBC-HS512 secrets cannot be represented as
14
+ * > {@link !CryptoKey} this option has no effect for them.
15
+ */
16
+ extractable?: boolean;
17
+ }
18
+ /**
19
+ * Generates a symmetric secret key for a given JWA algorithm identifier.
20
+ *
21
+ * > [!NOTE]\
22
+ * > The secret key is generated with `extractable` set to `false` by default.
23
+ *
24
+ * > [!NOTE]\
25
+ * > Because A128CBC-HS256, A192CBC-HS384, and A256CBC-HS512 secrets cannot be represented as
26
+ * > {@link !CryptoKey} this method yields a {@link !Uint8Array} for them instead.
27
+ *
28
+ * This function is exported (as a named export) from the main `'jose'` module entry point as well
29
+ * as from its subpath export `'jose/generate/secret'`.
30
+ *
31
+ * @param alg JWA Algorithm Identifier to be used with the generated secret. See
32
+ * {@link https://github.com/panva/jose/issues/210 Algorithm Key Requirements}.
33
+ * @param options Additional options passed down to the secret generation.
34
+ */
35
+ export declare function generateSecret(alg: string, options?: GenerateSecretOptions): Promise<types.CryptoKey | Uint8Array>;
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Cryptographic key import functions
3
+ *
4
+ * @module
5
+ */
6
+ import type * as types from '../types.d.ts';
7
+ /** Key Import Function options. */
8
+ export interface KeyImportOptions {
9
+ /**
10
+ * The value to use as {@link !SubtleCrypto.importKey} `extractable` argument. Default is false for
11
+ * private keys, true otherwise.
12
+ */
13
+ extractable?: boolean;
14
+ }
15
+ /**
16
+ * Imports a PEM-encoded SPKI string as a {@link !CryptoKey}.
17
+ *
18
+ * > [!NOTE]\
19
+ * > The OID id-RSASSA-PSS (1.2.840.113549.1.1.10) is not supported in
20
+ * > {@link https://w3c.github.io/webcrypto/ Web Cryptography API}, use the OID rsaEncryption
21
+ * > (1.2.840.113549.1.1.1) instead for all RSA algorithms.
22
+ *
23
+ * This function is exported (as a named export) from the main `'jose'` module entry point as well
24
+ * as from its subpath export `'jose/key/import'`.
25
+ *
26
+ * @param spki PEM-encoded SPKI string
27
+ * @param alg JSON Web Algorithm identifier to be used with the imported key. See
28
+ * {@link https://github.com/panva/jose/issues/210 Algorithm Key Requirements}.
29
+ */
30
+ export declare function importSPKI(spki: string, alg: string, options?: KeyImportOptions): Promise<types.CryptoKey>;
31
+ /**
32
+ * Imports the SPKI from an X.509 string certificate as a {@link !CryptoKey}.
33
+ *
34
+ * > [!NOTE]\
35
+ * > The OID id-RSASSA-PSS (1.2.840.113549.1.1.10) is not supported in
36
+ * > {@link https://w3c.github.io/webcrypto/ Web Cryptography API}, use the OID rsaEncryption
37
+ * > (1.2.840.113549.1.1.1) instead for all RSA algorithms.
38
+ *
39
+ * This function is exported (as a named export) from the main `'jose'` module entry point as well
40
+ * as from its subpath export `'jose/key/import'`.
41
+ *
42
+ * @param x509 X.509 certificate string
43
+ * @param alg JSON Web Algorithm identifier to be used with the imported key. See
44
+ * {@link https://github.com/panva/jose/issues/210 Algorithm Key Requirements}.
45
+ */
46
+ export declare function importX509(x509: string, alg: string, options?: KeyImportOptions): Promise<types.CryptoKey>;
47
+ /**
48
+ * Imports a PEM-encoded PKCS#8 string as a {@link !CryptoKey}.
49
+ *
50
+ * > [!NOTE]\
51
+ * > The OID id-RSASSA-PSS (1.2.840.113549.1.1.10) is not supported in
52
+ * > {@link https://w3c.github.io/webcrypto/ Web Cryptography API}, use the OID rsaEncryption
53
+ * > (1.2.840.113549.1.1.1) instead for all RSA algorithms.
54
+ *
55
+ * This function is exported (as a named export) from the main `'jose'` module entry point as well
56
+ * as from its subpath export `'jose/key/import'`.
57
+ *
58
+ * @param pkcs8 PEM-encoded PKCS#8 string
59
+ * @param alg JSON Web Algorithm identifier to be used with the imported key. See
60
+ * {@link https://github.com/panva/jose/issues/210 Algorithm Key Requirements}.
61
+ */
62
+ export declare function importPKCS8(pkcs8: string, alg: string, options?: KeyImportOptions): Promise<types.CryptoKey>;
63
+ /**
64
+ * Imports a JWK to a {@link !CryptoKey}. Either the JWK "alg" (Algorithm) Parameter, or the optional
65
+ * "alg" argument, must be present for asymmetric JSON Web Key imports.
66
+ *
67
+ * > [!NOTE]\
68
+ * > The JSON Web Key parameters "use", "key_ops", and "ext" are also used in the {@link !CryptoKey}
69
+ * > import process.
70
+ *
71
+ * > [!NOTE]\
72
+ * > Symmetric JSON Web Keys (i.e. `kty: "oct"`) yield back an {@link !Uint8Array} instead of a
73
+ * > {@link !CryptoKey}.
74
+ *
75
+ * This function is exported (as a named export) from the main `'jose'` module entry point as well
76
+ * as from its subpath export `'jose/key/import'`.
77
+ *
78
+ * @param jwk JSON Web Key.
79
+ * @param alg JSON Web Algorithm identifier to be used with the imported key. Default is the "alg"
80
+ * property on the JWK. See
81
+ * {@link https://github.com/panva/jose/issues/210 Algorithm Key Requirements}.
82
+ */
83
+ export declare function importJWK(jwk: types.JWK, alg?: string, options?: KeyImportOptions): Promise<types.CryptoKey | Uint8Array>;