effect 4.1.0 → 4.1.1
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.
- package/README.md +30 -0
- package/THIRD_PARTY_NOTICES.md +62 -0
- package/dist/BigDecimal.d.ts +139 -7
- package/dist/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js +83 -14
- package/dist/BigDecimal.js.map +1 -1
- package/dist/Equal.d.ts +2 -2
- package/dist/Equal.d.ts.map +1 -1
- package/dist/Equal.js +3 -3
- package/dist/Equal.js.map +1 -1
- package/dist/Hash.d.ts +3 -2
- package/dist/Hash.d.ts.map +1 -1
- package/dist/Hash.js +5 -4
- package/dist/Hash.js.map +1 -1
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +11 -8
- package/dist/Iterable.js.map +1 -1
- package/dist/Path.d.ts.map +1 -1
- package/dist/Path.js +5 -1
- package/dist/Path.js.map +1 -1
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +2 -1
- package/dist/Pool.js.map +1 -1
- package/dist/Schema.d.ts +2 -1
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +2 -1
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +4 -2
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +4 -2
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +2 -2
- package/dist/SchemaTransformation.js +2 -2
- package/dist/ai/McpClient.d.ts +171 -19
- package/dist/ai/McpClient.d.ts.map +1 -1
- package/dist/ai/McpClient.js +277 -66
- package/dist/ai/McpClient.js.map +1 -1
- package/dist/ai/McpSchema.d.ts +108 -0
- package/dist/ai/McpSchema.d.ts.map +1 -1
- package/dist/ai/McpSchema.js +99 -0
- package/dist/ai/McpSchema.js.map +1 -1
- package/dist/ai/McpServer.d.ts +120 -6
- package/dist/ai/McpServer.d.ts.map +1 -1
- package/dist/ai/McpServer.js +215 -34
- package/dist/ai/McpServer.js.map +1 -1
- package/dist/ai/Prompt.d.ts.map +1 -1
- package/dist/ai/Prompt.js +20 -11
- package/dist/ai/Prompt.js.map +1 -1
- package/dist/ai/Tool.d.ts.map +1 -1
- package/dist/ai/Tool.js +5 -7
- package/dist/ai/Tool.js.map +1 -1
- package/dist/ai/internal/mcpCore.js +72 -3
- package/dist/ai/internal/mcpCore.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2024_11_05.js +3 -1
- package/dist/ai/internal/mcpProtocol/v2024_11_05.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2025_03_26.js +3 -1
- package/dist/ai/internal/mcpProtocol/v2025_03_26.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2025_06_18.js +3 -1
- package/dist/ai/internal/mcpProtocol/v2025_06_18.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2025_11_25.js +3 -1
- package/dist/ai/internal/mcpProtocol/v2025_11_25.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2026_07_28.js +42 -7
- package/dist/ai/internal/mcpProtocol/v2026_07_28.js.map +1 -1
- package/dist/ai/internal/mcpProtocol.js +12 -0
- package/dist/ai/internal/mcpProtocol.js.map +1 -1
- package/dist/ai/internal/mcpRuntime.js +3 -3
- package/dist/ai/internal/mcpRuntime.js.map +1 -1
- package/dist/ai/internal/mcpSkills.d.ts +2 -0
- package/dist/ai/internal/mcpSkills.d.ts.map +1 -0
- package/dist/ai/internal/mcpSkills.js +428 -0
- package/dist/ai/internal/mcpSkills.js.map +1 -0
- package/dist/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/cluster/ClusterWorkflowEngine.js +15 -5
- package/dist/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/cluster/Reply.d.ts +1 -1
- package/dist/cluster/Reply.d.ts.map +1 -1
- package/dist/cluster/Reply.js.map +1 -1
- package/dist/cluster/Sharding.d.ts.map +1 -1
- package/dist/cluster/Sharding.js +4 -1
- package/dist/cluster/Sharding.js.map +1 -1
- package/dist/cluster/internal/entityManager.js +15 -7
- package/dist/cluster/internal/entityManager.js.map +1 -1
- package/dist/crypto/Aead.d.ts +2 -1
- package/dist/crypto/Aead.d.ts.map +1 -1
- package/dist/crypto/Aead.js +2 -2
- package/dist/crypto/Aead.js.map +1 -1
- package/dist/crypto/Cipher.d.ts +2 -1
- package/dist/crypto/Cipher.d.ts.map +1 -1
- package/dist/crypto/Cipher.js +2 -2
- package/dist/crypto/Cipher.js.map +1 -1
- package/dist/crypto/KeyAgreement.d.ts +3 -2
- package/dist/crypto/KeyAgreement.d.ts.map +1 -1
- package/dist/crypto/KeyAgreement.js +2 -2
- package/dist/crypto/KeyAgreement.js.map +1 -1
- package/dist/crypto/KeyFormat.d.ts +33 -1
- package/dist/crypto/KeyFormat.d.ts.map +1 -1
- package/dist/crypto/KeyFormat.js.map +1 -1
- package/dist/crypto/KeyWrap.d.ts +4 -3
- package/dist/crypto/KeyWrap.d.ts.map +1 -1
- package/dist/crypto/KeyWrap.js +2 -2
- package/dist/crypto/KeyWrap.js.map +1 -1
- package/dist/crypto/Mac.d.ts +2 -1
- package/dist/crypto/Mac.d.ts.map +1 -1
- package/dist/crypto/Mac.js +2 -2
- package/dist/crypto/Mac.js.map +1 -1
- package/dist/crypto/Signature.d.ts +3 -2
- package/dist/crypto/Signature.d.ts.map +1 -1
- package/dist/crypto/Signature.js +2 -2
- package/dist/crypto/Signature.js.map +1 -1
- package/dist/crypto/WebCrypto.d.ts +19 -0
- package/dist/crypto/WebCrypto.d.ts.map +1 -1
- package/dist/crypto/WebCrypto.js.map +1 -1
- package/dist/crypto/internal/asymmetric.js.map +1 -1
- package/dist/crypto/internal/key.js +3 -2
- package/dist/crypto/internal/key.js.map +1 -1
- package/dist/encoding/Base64Url.d.ts.map +1 -1
- package/dist/encoding/Base64Url.js +26 -3
- package/dist/encoding/Base64Url.js.map +1 -1
- package/dist/encoding/Ndjson.d.ts +5 -4
- package/dist/encoding/Ndjson.d.ts.map +1 -1
- package/dist/encoding/Ndjson.js +6 -5
- package/dist/encoding/Ndjson.js.map +1 -1
- package/dist/encoding/Sse.d.ts +3 -1
- package/dist/encoding/Sse.d.ts.map +1 -1
- package/dist/encoding/Sse.js +5 -3
- package/dist/encoding/Sse.js.map +1 -1
- package/dist/eventlog/EventLog.d.ts +7 -0
- package/dist/eventlog/EventLog.d.ts.map +1 -1
- package/dist/eventlog/EventLog.js +7 -0
- package/dist/eventlog/EventLog.js.map +1 -1
- package/dist/eventlog/EventLogServer.d.ts +7 -1
- package/dist/eventlog/EventLogServer.d.ts.map +1 -1
- package/dist/eventlog/EventLogServer.js +27 -12
- package/dist/eventlog/EventLogServer.js.map +1 -1
- package/dist/eventlog/EventLogServerEncrypted.d.ts +10 -0
- package/dist/eventlog/EventLogServerEncrypted.d.ts.map +1 -1
- package/dist/eventlog/EventLogServerEncrypted.js.map +1 -1
- package/dist/eventlog/EventLogServerUnencrypted.d.ts +17 -0
- package/dist/eventlog/EventLogServerUnencrypted.d.ts.map +1 -1
- package/dist/eventlog/EventLogServerUnencrypted.js +14 -2
- package/dist/eventlog/EventLogServerUnencrypted.js.map +1 -1
- package/dist/eventlog/EventLogSessionAuth.d.ts +21 -0
- package/dist/eventlog/EventLogSessionAuth.d.ts.map +1 -1
- package/dist/eventlog/EventLogSessionAuth.js +22 -0
- package/dist/eventlog/EventLogSessionAuth.js.map +1 -1
- package/dist/graphql/GraphQLClient.d.ts +3 -1
- package/dist/graphql/GraphQLClient.d.ts.map +1 -1
- package/dist/graphql/GraphQLClient.js.map +1 -1
- package/dist/graphql/GraphQLClientError.d.ts +14 -9
- package/dist/graphql/GraphQLClientError.d.ts.map +1 -1
- package/dist/graphql/GraphQLClientError.js +14 -21
- package/dist/graphql/GraphQLClientError.js.map +1 -1
- package/dist/graphql/GraphQLProtocol.d.ts +12 -3
- package/dist/graphql/GraphQLProtocol.d.ts.map +1 -1
- package/dist/graphql/GraphQLProtocol.js +4 -1
- package/dist/graphql/GraphQLProtocol.js.map +1 -1
- package/dist/http/HttpClient.d.ts +189 -7
- package/dist/http/HttpClient.d.ts.map +1 -1
- package/dist/http/HttpClient.js +75 -2
- package/dist/http/HttpClient.js.map +1 -1
- package/dist/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/http/HttpServerRequest.js +38 -22
- package/dist/http/HttpServerRequest.js.map +1 -1
- package/dist/http/internal/mimeTypes.d.ts +4 -1
- package/dist/http/internal/mimeTypes.d.ts.map +1 -1
- package/dist/http/internal/mimeTypes.js +4 -1
- package/dist/http/internal/mimeTypes.js.map +1 -1
- package/dist/http-api/HttpApiSchema.js +1 -1
- package/dist/http-api/HttpApiSchema.js.map +1 -1
- package/dist/internal/dateTime.js +49 -24
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/effect.js +10 -0
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/glob.js +234 -56
- package/dist/internal/glob.js.map +1 -1
- package/dist/internal/graphql.js +21 -7
- package/dist/internal/graphql.js.map +1 -1
- package/dist/internal/graphqlHeaders.d.ts +7 -0
- package/dist/internal/graphqlHeaders.d.ts.map +1 -1
- package/dist/internal/graphqlHeaders.js +11 -0
- package/dist/internal/graphqlHeaders.js.map +1 -1
- package/dist/internal/request.js +29 -42
- package/dist/internal/request.js.map +1 -1
- package/dist/internal/schema/fromJsonSchemaDocument.js +7 -8
- package/dist/internal/schema/fromJsonSchemaDocument.js.map +1 -1
- package/dist/internal/version.js +1 -1
- package/dist/jose/JoseError.d.ts +285 -0
- package/dist/jose/JoseError.d.ts.map +1 -0
- package/dist/jose/JoseError.js +269 -0
- package/dist/jose/JoseError.js.map +1 -0
- package/dist/jose/Jwe.d.ts +128 -0
- package/dist/jose/Jwe.d.ts.map +1 -0
- package/dist/jose/Jwe.js +134 -0
- package/dist/jose/Jwe.js.map +1 -0
- package/dist/jose/Jwk.d.ts +597 -0
- package/dist/jose/Jwk.d.ts.map +1 -0
- package/dist/jose/Jwk.js +503 -0
- package/dist/jose/Jwk.js.map +1 -0
- package/dist/jose/Jwks.d.ts +236 -0
- package/dist/jose/Jwks.d.ts.map +1 -0
- package/dist/jose/Jwks.js +306 -0
- package/dist/jose/Jwks.js.map +1 -0
- package/dist/jose/Jws.d.ts +177 -0
- package/dist/jose/Jws.d.ts.map +1 -0
- package/dist/jose/Jws.js +183 -0
- package/dist/jose/Jws.js.map +1 -0
- package/dist/jose/Jwt.d.ts +270 -0
- package/dist/jose/Jwt.d.ts.map +1 -0
- package/dist/jose/Jwt.js +293 -0
- package/dist/jose/Jwt.js.map +1 -0
- package/dist/jose/index.d.ts +51 -0
- package/dist/jose/index.d.ts.map +1 -0
- package/dist/jose/index.js +52 -0
- package/dist/jose/index.js.map +1 -0
- package/dist/jose/internal/compact.d.ts +2 -0
- package/dist/jose/internal/compact.d.ts.map +1 -0
- package/dist/jose/internal/compact.js +179 -0
- package/dist/jose/internal/compact.js.map +1 -0
- package/dist/net/Host.d.ts.map +1 -1
- package/dist/net/Host.js +5 -10
- package/dist/net/Host.js.map +1 -1
- package/dist/observability/OtlpSerialization.d.ts +1 -1
- package/dist/observability/OtlpSerialization.d.ts.map +1 -1
- package/dist/observability/OtlpSerialization.js +10 -4
- package/dist/observability/OtlpSerialization.js.map +1 -1
- package/dist/observability/internal/otlpProtobuf.js +3 -3
- package/dist/observability/internal/otlpProtobuf.js.map +1 -1
- package/dist/observability/internal/protobuf.js +6 -0
- package/dist/observability/internal/protobuf.js.map +1 -1
- package/dist/persistence/CircuitBreaker.d.ts +98 -38
- package/dist/persistence/CircuitBreaker.d.ts.map +1 -1
- package/dist/persistence/CircuitBreaker.js +67 -29
- package/dist/persistence/CircuitBreaker.js.map +1 -1
- package/dist/persistence/RateLimiter.d.ts +8 -0
- package/dist/persistence/RateLimiter.d.ts.map +1 -1
- package/dist/persistence/RateLimiter.js +63 -12
- package/dist/persistence/RateLimiter.js.map +1 -1
- package/dist/persistence/index.d.ts +1 -1
- package/dist/persistence/index.js +1 -1
- package/dist/reactivity/AtomRegistry.js +17 -7
- package/dist/reactivity/AtomRegistry.js.map +1 -1
- package/dist/rpc/Rpc.d.ts +1 -1
- package/dist/rpc/Rpc.d.ts.map +1 -1
- package/dist/rpc/Rpc.js.map +1 -1
- package/dist/rpc/RpcClient.d.ts +14 -2
- package/dist/rpc/RpcClient.d.ts.map +1 -1
- package/dist/rpc/RpcClient.js +38 -21
- package/dist/rpc/RpcClient.js.map +1 -1
- package/dist/rpc/RpcMessage.d.ts +3 -2
- package/dist/rpc/RpcMessage.d.ts.map +1 -1
- package/dist/rpc/RpcMessage.js.map +1 -1
- package/dist/sql/Migrator.d.ts +9 -1
- package/dist/sql/Migrator.d.ts.map +1 -1
- package/dist/sql/Migrator.js +18 -6
- package/dist/sql/Migrator.js.map +1 -1
- package/dist/sql/SqlClient.d.ts +38 -3
- package/dist/sql/SqlClient.d.ts.map +1 -1
- package/dist/sql/SqlClient.js +4 -3
- package/dist/sql/SqlClient.js.map +1 -1
- package/dist/sql/Statement.d.ts +41 -3
- package/dist/sql/Statement.d.ts.map +1 -1
- package/dist/sql/Statement.js +24 -20
- package/dist/sql/Statement.js.map +1 -1
- package/dist/workflow/Workflow.d.ts +4 -0
- package/dist/workflow/Workflow.d.ts.map +1 -1
- package/dist/workflow/Workflow.js.map +1 -1
- package/dist/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/workflow/WorkflowEngine.js +5 -0
- package/dist/workflow/WorkflowEngine.js.map +1 -1
- package/package.json +5 -1
- package/src/BigDecimal.ts +170 -16
- package/src/Equal.ts +3 -3
- package/src/Hash.ts +5 -4
- package/src/Iterable.ts +8 -5
- package/src/Path.ts +6 -1
- package/src/Pool.ts +2 -1
- package/src/Schema.ts +3 -2
- package/src/SchemaRepresentation.ts +4 -2
- package/src/SchemaTransformation.ts +2 -2
- package/src/ai/McpClient.ts +488 -91
- package/src/ai/McpSchema.ts +119 -0
- package/src/ai/McpServer.ts +261 -38
- package/src/ai/Prompt.ts +16 -11
- package/src/ai/Tool.ts +5 -10
- package/src/ai/internal/mcpCore.ts +165 -12
- package/src/ai/internal/mcpProtocol/v2024_11_05.ts +3 -1
- package/src/ai/internal/mcpProtocol/v2025_03_26.ts +3 -1
- package/src/ai/internal/mcpProtocol/v2025_06_18.ts +3 -1
- package/src/ai/internal/mcpProtocol/v2025_11_25.ts +3 -1
- package/src/ai/internal/mcpProtocol/v2026_07_28.ts +41 -7
- package/src/ai/internal/mcpProtocol.ts +15 -0
- package/src/ai/internal/mcpRuntime.ts +6 -3
- package/src/ai/internal/mcpSkills.ts +480 -0
- package/src/cluster/ClusterWorkflowEngine.ts +22 -8
- package/src/cluster/Reply.ts +1 -1
- package/src/cluster/Sharding.ts +4 -1
- package/src/cluster/internal/entityManager.ts +24 -10
- package/src/crypto/Aead.ts +3 -3
- package/src/crypto/Cipher.ts +3 -3
- package/src/crypto/KeyAgreement.ts +4 -4
- package/src/crypto/KeyFormat.ts +30 -1
- package/src/crypto/KeyWrap.ts +6 -6
- package/src/crypto/Mac.ts +3 -3
- package/src/crypto/Signature.ts +4 -4
- package/src/crypto/WebCrypto.ts +20 -0
- package/src/crypto/internal/asymmetric.ts +2 -1
- package/src/crypto/internal/key.ts +12 -5
- package/src/encoding/Base64Url.ts +27 -3
- package/src/encoding/Ndjson.ts +6 -5
- package/src/encoding/Sse.ts +5 -3
- package/src/eventlog/EventLog.ts +7 -0
- package/src/eventlog/EventLogServer.ts +31 -12
- package/src/eventlog/EventLogServerEncrypted.ts +5 -0
- package/src/eventlog/EventLogServerUnencrypted.ts +19 -2
- package/src/eventlog/EventLogSessionAuth.ts +26 -0
- package/src/graphql/GraphQLClient.ts +3 -1
- package/src/graphql/GraphQLClientError.ts +15 -22
- package/src/graphql/GraphQLProtocol.ts +12 -3
- package/src/http/HttpClient.ts +210 -11
- package/src/http/HttpServerRequest.ts +61 -23
- package/src/http/internal/mimeTypes.ts +4 -1
- package/src/http-api/HttpApiSchema.ts +1 -1
- package/src/internal/dateTime.ts +54 -24
- package/src/internal/effect.ts +6 -0
- package/src/internal/glob.ts +279 -63
- package/src/internal/graphql.ts +27 -9
- package/src/internal/graphqlHeaders.ts +13 -0
- package/src/internal/request.ts +51 -58
- package/src/internal/schema/fromJsonSchemaDocument.ts +11 -10
- package/src/internal/version.ts +1 -1
- package/src/jose/JoseError.ts +329 -0
- package/src/jose/Jwe.ts +196 -0
- package/src/jose/Jwk.ts +777 -0
- package/src/jose/Jwks.ts +418 -0
- package/src/jose/Jws.ts +312 -0
- package/src/jose/Jwt.ts +493 -0
- package/src/jose/index.ts +58 -0
- package/src/jose/internal/compact.ts +195 -0
- package/src/net/Host.ts +5 -10
- package/src/observability/OtlpSerialization.ts +13 -5
- package/src/observability/internal/otlpProtobuf.ts +6 -6
- package/src/observability/internal/protobuf.ts +10 -0
- package/src/persistence/CircuitBreaker.ts +113 -48
- package/src/persistence/RateLimiter.ts +84 -15
- package/src/persistence/index.ts +1 -1
- package/src/reactivity/AtomRegistry.ts +19 -8
- package/src/rpc/Rpc.ts +3 -1
- package/src/rpc/RpcClient.ts +44 -24
- package/src/rpc/RpcMessage.ts +3 -2
- package/src/sql/Migrator.ts +35 -18
- package/src/sql/SqlClient.ts +43 -8
- package/src/sql/Statement.ts +52 -22
- package/src/workflow/Workflow.ts +4 -0
- package/src/workflow/WorkflowEngine.ts +5 -0
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import * as Context from "../Context.ts";
|
|
2
|
+
import type * as Duration from "../Duration.ts";
|
|
3
|
+
import * as Effect from "../Effect.ts";
|
|
4
|
+
import * as HttpClient from "../http/HttpClient.ts";
|
|
5
|
+
import * as Layer from "../Layer.ts";
|
|
6
|
+
import * as Schema from "../Schema.ts";
|
|
7
|
+
import type * as Scope from "../Scope.ts";
|
|
8
|
+
import * as JoseError from "./JoseError.ts";
|
|
9
|
+
import { type AsymmetricAlgorithm, type PublicKey } from "./Jwk.ts";
|
|
10
|
+
import type * as Jws from "./Jws.ts";
|
|
11
|
+
/**
|
|
12
|
+
* Schema for a set of public JWKs.
|
|
13
|
+
*
|
|
14
|
+
* **Details**
|
|
15
|
+
*
|
|
16
|
+
* Keys of other families or curves are kept but never selected. Private or
|
|
17
|
+
* symmetric members anywhere in the set fail decoding.
|
|
18
|
+
*
|
|
19
|
+
* @stability unstable
|
|
20
|
+
* @category schemas
|
|
21
|
+
* @since 4.1.1
|
|
22
|
+
*/
|
|
23
|
+
export declare const KeySet: Schema.Struct<{
|
|
24
|
+
readonly keys: Schema.$Array<Schema.Union<readonly [Schema.Union<readonly [Schema.Struct<{
|
|
25
|
+
readonly d: Schema.optionalKey<Schema.Never>;
|
|
26
|
+
readonly p: Schema.optionalKey<Schema.Never>;
|
|
27
|
+
readonly q: Schema.optionalKey<Schema.Never>;
|
|
28
|
+
readonly dp: Schema.optionalKey<Schema.Never>;
|
|
29
|
+
readonly dq: Schema.optionalKey<Schema.Never>;
|
|
30
|
+
readonly qi: Schema.optionalKey<Schema.Never>;
|
|
31
|
+
readonly oth: Schema.optionalKey<Schema.Never>;
|
|
32
|
+
readonly k: Schema.optionalKey<Schema.Never>;
|
|
33
|
+
readonly kid: Schema.optionalKey<Schema.String>;
|
|
34
|
+
readonly alg: Schema.optionalKey<Schema.String>;
|
|
35
|
+
readonly use: Schema.optionalKey<Schema.String>;
|
|
36
|
+
readonly key_ops: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
37
|
+
readonly kty: Schema.Literal<"RSA">;
|
|
38
|
+
readonly n: Schema.String;
|
|
39
|
+
readonly e: Schema.String;
|
|
40
|
+
}>, Schema.Struct<{
|
|
41
|
+
readonly d: Schema.optionalKey<Schema.Never>;
|
|
42
|
+
readonly p: Schema.optionalKey<Schema.Never>;
|
|
43
|
+
readonly q: Schema.optionalKey<Schema.Never>;
|
|
44
|
+
readonly dp: Schema.optionalKey<Schema.Never>;
|
|
45
|
+
readonly dq: Schema.optionalKey<Schema.Never>;
|
|
46
|
+
readonly qi: Schema.optionalKey<Schema.Never>;
|
|
47
|
+
readonly oth: Schema.optionalKey<Schema.Never>;
|
|
48
|
+
readonly k: Schema.optionalKey<Schema.Never>;
|
|
49
|
+
readonly kid: Schema.optionalKey<Schema.String>;
|
|
50
|
+
readonly alg: Schema.optionalKey<Schema.String>;
|
|
51
|
+
readonly use: Schema.optionalKey<Schema.String>;
|
|
52
|
+
readonly key_ops: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
53
|
+
readonly kty: Schema.Literal<"EC">;
|
|
54
|
+
readonly crv: Schema.Literals<readonly ["P-256", "P-384", "P-521"]>;
|
|
55
|
+
readonly x: Schema.String;
|
|
56
|
+
readonly y: Schema.String;
|
|
57
|
+
}>, Schema.Struct<{
|
|
58
|
+
readonly d: Schema.optionalKey<Schema.Never>;
|
|
59
|
+
readonly p: Schema.optionalKey<Schema.Never>;
|
|
60
|
+
readonly q: Schema.optionalKey<Schema.Never>;
|
|
61
|
+
readonly dp: Schema.optionalKey<Schema.Never>;
|
|
62
|
+
readonly dq: Schema.optionalKey<Schema.Never>;
|
|
63
|
+
readonly qi: Schema.optionalKey<Schema.Never>;
|
|
64
|
+
readonly oth: Schema.optionalKey<Schema.Never>;
|
|
65
|
+
readonly k: Schema.optionalKey<Schema.Never>;
|
|
66
|
+
readonly kid: Schema.optionalKey<Schema.String>;
|
|
67
|
+
readonly alg: Schema.optionalKey<Schema.String>;
|
|
68
|
+
readonly use: Schema.optionalKey<Schema.String>;
|
|
69
|
+
readonly key_ops: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
70
|
+
readonly kty: Schema.Literal<"OKP">;
|
|
71
|
+
readonly crv: Schema.Literal<"Ed25519">;
|
|
72
|
+
readonly x: Schema.String;
|
|
73
|
+
}>]>, Schema.StructWithRest<Schema.Struct<{
|
|
74
|
+
readonly d: Schema.optionalKey<Schema.Never>;
|
|
75
|
+
readonly p: Schema.optionalKey<Schema.Never>;
|
|
76
|
+
readonly q: Schema.optionalKey<Schema.Never>;
|
|
77
|
+
readonly dp: Schema.optionalKey<Schema.Never>;
|
|
78
|
+
readonly dq: Schema.optionalKey<Schema.Never>;
|
|
79
|
+
readonly qi: Schema.optionalKey<Schema.Never>;
|
|
80
|
+
readonly oth: Schema.optionalKey<Schema.Never>;
|
|
81
|
+
readonly k: Schema.optionalKey<Schema.Never>;
|
|
82
|
+
readonly kty: Schema.String;
|
|
83
|
+
readonly crv: Schema.optionalKey<Schema.String>;
|
|
84
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>]>>;
|
|
85
|
+
}>;
|
|
86
|
+
/**
|
|
87
|
+
* A set of public JWKs.
|
|
88
|
+
*
|
|
89
|
+
* @stability unstable
|
|
90
|
+
* @category models
|
|
91
|
+
* @since 4.1.1
|
|
92
|
+
*/
|
|
93
|
+
export type KeySet = typeof KeySet.Type;
|
|
94
|
+
/**
|
|
95
|
+
* The algorithm, and optionally the key id, of the key to resolve.
|
|
96
|
+
*
|
|
97
|
+
* @stability unstable
|
|
98
|
+
* @category models
|
|
99
|
+
* @since 4.1.1
|
|
100
|
+
*/
|
|
101
|
+
export interface Selection {
|
|
102
|
+
readonly algorithm: AsymmetricAlgorithm;
|
|
103
|
+
readonly kid?: string | undefined;
|
|
104
|
+
/**
|
|
105
|
+
* The unauthenticated header when resolving a token's key. Use it only for
|
|
106
|
+
* key selection; it is authenticated only after verification succeeds.
|
|
107
|
+
*/
|
|
108
|
+
readonly protectedHeader?: Jws.ProtectedHeader | undefined;
|
|
109
|
+
}
|
|
110
|
+
declare const Jwks_base: Context.ServiceClass<Jwks, "effect/jose/Jwks", {
|
|
111
|
+
readonly resolve: (selection: Selection) => Effect.Effect<PublicKey, JoseError.JoseError>;
|
|
112
|
+
}>;
|
|
113
|
+
/**
|
|
114
|
+
* Service that resolves the verification key for a selection.
|
|
115
|
+
*
|
|
116
|
+
* @stability unstable
|
|
117
|
+
* @category services
|
|
118
|
+
* @since 4.1.1
|
|
119
|
+
*/
|
|
120
|
+
export declare class Jwks extends Jwks_base {
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Builds a `Jwks` service for a fixed key set.
|
|
124
|
+
*
|
|
125
|
+
* **Example** (Resolving a key by `kid`)
|
|
126
|
+
*
|
|
127
|
+
* ```ts import.meta.vitest
|
|
128
|
+
* import { Effect, Layer } from "effect"
|
|
129
|
+
* import { SecureRandom, Signature } from "effect/crypto"
|
|
130
|
+
* import { Jwk, Jwks } from "effect/jose"
|
|
131
|
+
*
|
|
132
|
+
* const layer = Signature.layerWebCrypto.pipe(Layer.provide(SecureRandom.layerWebCrypto))
|
|
133
|
+
*
|
|
134
|
+
* const kid = await Effect.runPromise(Effect.gen(function*() {
|
|
135
|
+
* const pair = yield* Jwk.generateKeyPair({ algorithm: "ES256", kid: "signing-1" })
|
|
136
|
+
* const jwks = yield* Jwks.makeLocal({ keys: [pair.publicKey] })
|
|
137
|
+
* const key = yield* jwks.resolve({ algorithm: "ES256", kid: "signing-1" })
|
|
138
|
+
* return key.kid
|
|
139
|
+
* }).pipe(Effect.provide(layer)))
|
|
140
|
+
* kid // => "signing-1"
|
|
141
|
+
* ```
|
|
142
|
+
*
|
|
143
|
+
* @stability unstable
|
|
144
|
+
* @category constructors
|
|
145
|
+
* @since 4.1.1
|
|
146
|
+
*/
|
|
147
|
+
export declare const makeLocal: (keySet: KeySet) => Effect.Effect<Jwks["Service"]>;
|
|
148
|
+
/**
|
|
149
|
+
* Layer that provides `Jwks` for a fixed key set.
|
|
150
|
+
*
|
|
151
|
+
* @stability unstable
|
|
152
|
+
* @category layers
|
|
153
|
+
* @since 4.1.1
|
|
154
|
+
*/
|
|
155
|
+
export declare const layerLocal: (keySet: KeySet) => Layer.Layer<Jwks>;
|
|
156
|
+
/**
|
|
157
|
+
* Options for {@link makeRemote} and {@link layerRemote}.
|
|
158
|
+
*
|
|
159
|
+
* @stability unstable
|
|
160
|
+
* @category models
|
|
161
|
+
* @since 4.1.1
|
|
162
|
+
*/
|
|
163
|
+
export interface RemoteOptions {
|
|
164
|
+
/**
|
|
165
|
+
* The HTTPS key-set URL, without credentials or a fragment. Take it from
|
|
166
|
+
* configuration, never from a token.
|
|
167
|
+
*/
|
|
168
|
+
readonly url: string;
|
|
169
|
+
/**
|
|
170
|
+
* How long a fetched key set is used. Defaults to 10 minutes.
|
|
171
|
+
*/
|
|
172
|
+
readonly timeToLive?: Duration.Input | undefined;
|
|
173
|
+
/**
|
|
174
|
+
* Minimum time before retrying after a failed fetch, or refetching for an
|
|
175
|
+
* unknown key. Defaults to 30 seconds.
|
|
176
|
+
*/
|
|
177
|
+
readonly cooldown?: Duration.Input | undefined;
|
|
178
|
+
/**
|
|
179
|
+
* Timeout for the request and reading its body. Defaults to 5 seconds.
|
|
180
|
+
*/
|
|
181
|
+
readonly timeout?: Duration.Input | undefined;
|
|
182
|
+
/**
|
|
183
|
+
* Maximum response body size. Defaults to 131072 bytes.
|
|
184
|
+
*/
|
|
185
|
+
readonly maxResponseBytes?: number | undefined;
|
|
186
|
+
/**
|
|
187
|
+
* Maximum number of keys in the set. Defaults to 64.
|
|
188
|
+
*/
|
|
189
|
+
readonly maxKeys?: number | undefined;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Builds a `Jwks` service for a remote key set, using the `HttpClient`
|
|
193
|
+
* service. Use it when the URL is only known at runtime, for example from
|
|
194
|
+
* OpenID Connect discovery.
|
|
195
|
+
*
|
|
196
|
+
* **Details**
|
|
197
|
+
*
|
|
198
|
+
* The key set is fetched on first use and reused until `timeToLive` passes.
|
|
199
|
+
* Concurrent callers share one request. A selection that finds no key fetches
|
|
200
|
+
* the set again, at most once per `cooldown`, so rotated keys are picked up
|
|
201
|
+
* without letting unknown `kid`s drive a request per token. A failed fetch
|
|
202
|
+
* fails every caller until `cooldown` passes; there is no fallback to an
|
|
203
|
+
* expired set.
|
|
204
|
+
*
|
|
205
|
+
* Only a 200 response from the configured URL is accepted, so a redirected
|
|
206
|
+
* key set is rejected. The check runs on the response, so it cannot stop a
|
|
207
|
+
* client from sending the redirected request.
|
|
208
|
+
*
|
|
209
|
+
* **Gotchas**
|
|
210
|
+
*
|
|
211
|
+
* Supply a client that does not follow redirects. `FetchHttpClient` follows
|
|
212
|
+
* them by default: provide `FetchHttpClient.RequestInit` with
|
|
213
|
+
* `{ redirect: "manual" }` on its layer so a redirect fails before any further
|
|
214
|
+
* request. Clients wrapped with `HttpClient.followRedirects` also follow them.
|
|
215
|
+
*
|
|
216
|
+
* Closing the scope interrupts any request in flight, and later resolutions
|
|
217
|
+
* fail with `KeySetUnavailable`.
|
|
218
|
+
*
|
|
219
|
+
* @stability unstable
|
|
220
|
+
* @category constructors
|
|
221
|
+
* @since 4.1.1
|
|
222
|
+
*/
|
|
223
|
+
export declare const makeRemote: (options: RemoteOptions) => Effect.Effect<{
|
|
224
|
+
readonly resolve: (selection: Selection) => Effect.Effect<PublicKey, JoseError.JoseError>;
|
|
225
|
+
}, JoseError.JoseError, HttpClient.HttpClient | Scope.Scope>;
|
|
226
|
+
/**
|
|
227
|
+
* Layer that provides `Jwks` from a remote key set built by {@link makeRemote}.
|
|
228
|
+
* Closing the layer interrupts any request in flight.
|
|
229
|
+
*
|
|
230
|
+
* @stability unstable
|
|
231
|
+
* @category layers
|
|
232
|
+
* @since 4.1.1
|
|
233
|
+
*/
|
|
234
|
+
export declare const layerRemote: (options: RemoteOptions) => Layer.Layer<Jwks, JoseError.JoseError, HttpClient.HttpClient>;
|
|
235
|
+
export {};
|
|
236
|
+
//# sourceMappingURL=Jwks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Jwks.d.ts","sourceRoot":"","sources":["../../src/jose/Jwks.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,OAAO,MAAM,eAAe,CAAA;AAExC,OAAO,KAAK,KAAK,QAAQ,MAAM,gBAAgB,CAAA;AAC/C,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AAEtC,OAAO,KAAK,UAAU,MAAM,uBAAuB,CAAA;AACnD,OAAO,KAAK,KAAK,MAAM,aAAa,CA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B;;OAEG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,QAAQ,CAAC,KAAK,GAAG,SAAS,CAAA;IAChD;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,KAAK,GAAG,SAAS,CAAA;IAC9C;;OAEG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,KAAK,GAAG,SAAS,CAAA;IAC7C;;OAEG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC9C;;OAEG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CACtC;AAiCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,UAAU;sBArMH,CAAC,SAAS,EAAE,SAAS,KAAK,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC,SAAS,CAAC;4DAmTzF,CAAA;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,YACb,aAAa,KACrB,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,SAAS,EAAE,UAAU,CAAC,UAAU,CAA4C,CAAA"}
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON Web Key Sets and the `Jwks` service that resolves verification keys
|
|
3
|
+
* from them.
|
|
4
|
+
*
|
|
5
|
+
* A key is selected by algorithm and optional `kid`. It must fit the
|
|
6
|
+
* algorithm's key family and curve, and its `alg`, `use`, and `key_ops`
|
|
7
|
+
* members must allow verification with that algorithm. No match fails with
|
|
8
|
+
* `KeyNotFound` and several matches with `AmbiguousKey`.
|
|
9
|
+
*
|
|
10
|
+
* {@link layerLocal} serves a fixed key set. {@link makeRemote} and
|
|
11
|
+
* {@link layerRemote} fetch one from an HTTPS endpoint and cache it.
|
|
12
|
+
*
|
|
13
|
+
* @stability unstable
|
|
14
|
+
* @since 4.1.1
|
|
15
|
+
*/
|
|
16
|
+
import * as Cause from "../Cause.js";
|
|
17
|
+
import * as Clock from "../Clock.js";
|
|
18
|
+
import * as Context from "../Context.js";
|
|
19
|
+
import * as Deferred from "../Deferred.js";
|
|
20
|
+
import * as Effect from "../Effect.js";
|
|
21
|
+
import * as Exit from "../Exit.js";
|
|
22
|
+
import * as HttpClient from "../http/HttpClient.js";
|
|
23
|
+
import * as Layer from "../Layer.js";
|
|
24
|
+
import * as Schema from "../Schema.js";
|
|
25
|
+
import * as Stream from "../Stream.js";
|
|
26
|
+
import { fail, invalidArgument, millis, noPrivateMembers, parseJsonObject } from "./internal/compact.js";
|
|
27
|
+
import * as JoseError from "./JoseError.js";
|
|
28
|
+
import { importPublic, PublicJwk } from "./Jwk.js";
|
|
29
|
+
// Any other key family or curve, with any other members. Private and
|
|
30
|
+
// symmetric members, including RSA factors, are still rejected.
|
|
31
|
+
const UnsupportedJwk = /*#__PURE__*/Schema.StructWithRest(Schema.Struct({
|
|
32
|
+
kty: Schema.String,
|
|
33
|
+
crv: Schema.optionalKey(Schema.String),
|
|
34
|
+
...noPrivateMembers
|
|
35
|
+
}), [Schema.Record(Schema.String, Schema.Unknown)]).check(/*#__PURE__*/Schema.makeFilter(jwk => jwk.kty !== "oct" && jwk.kty !== "RSA" && (jwk.kty !== "EC" || jwk.crv !== undefined && jwk.crv !== "P-256" && jwk.crv !== "P-384" && jwk.crv !== "P-521") && (jwk.kty !== "OKP" || jwk.crv !== undefined && jwk.crv !== "Ed25519")));
|
|
36
|
+
/**
|
|
37
|
+
* Schema for a set of public JWKs.
|
|
38
|
+
*
|
|
39
|
+
* **Details**
|
|
40
|
+
*
|
|
41
|
+
* Keys of other families or curves are kept but never selected. Private or
|
|
42
|
+
* symmetric members anywhere in the set fail decoding.
|
|
43
|
+
*
|
|
44
|
+
* @stability unstable
|
|
45
|
+
* @category schemas
|
|
46
|
+
* @since 4.1.1
|
|
47
|
+
*/
|
|
48
|
+
export const KeySet = /*#__PURE__*/Schema.Struct({
|
|
49
|
+
keys: /*#__PURE__*/Schema.Array(/*#__PURE__*/Schema.Union([PublicJwk, UnsupportedJwk]))
|
|
50
|
+
});
|
|
51
|
+
/**
|
|
52
|
+
* Service that resolves the verification key for a selection.
|
|
53
|
+
*
|
|
54
|
+
* @stability unstable
|
|
55
|
+
* @category services
|
|
56
|
+
* @since 4.1.1
|
|
57
|
+
*/
|
|
58
|
+
export class Jwks extends /*#__PURE__*/Context.Service()("effect/jose/Jwks") {}
|
|
59
|
+
const isPublicJwk = /*#__PURE__*/Schema.is(PublicJwk);
|
|
60
|
+
const keyTypes = {
|
|
61
|
+
RS256: {
|
|
62
|
+
kty: "RSA"
|
|
63
|
+
},
|
|
64
|
+
RS384: {
|
|
65
|
+
kty: "RSA"
|
|
66
|
+
},
|
|
67
|
+
RS512: {
|
|
68
|
+
kty: "RSA"
|
|
69
|
+
},
|
|
70
|
+
PS256: {
|
|
71
|
+
kty: "RSA"
|
|
72
|
+
},
|
|
73
|
+
PS384: {
|
|
74
|
+
kty: "RSA"
|
|
75
|
+
},
|
|
76
|
+
PS512: {
|
|
77
|
+
kty: "RSA"
|
|
78
|
+
},
|
|
79
|
+
ES256: {
|
|
80
|
+
kty: "EC",
|
|
81
|
+
crv: "P-256"
|
|
82
|
+
},
|
|
83
|
+
ES384: {
|
|
84
|
+
kty: "EC",
|
|
85
|
+
crv: "P-384"
|
|
86
|
+
},
|
|
87
|
+
ES512: {
|
|
88
|
+
kty: "EC",
|
|
89
|
+
crv: "P-521"
|
|
90
|
+
},
|
|
91
|
+
EdDSA: {
|
|
92
|
+
kty: "OKP",
|
|
93
|
+
crv: "Ed25519"
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
// The keys that can ever be selected, computed once per key set rather than
|
|
97
|
+
// on every lookup.
|
|
98
|
+
const supportedKeys = keySet => keySet.keys.filter(isPublicJwk);
|
|
99
|
+
const candidates = (keys, selection) => {
|
|
100
|
+
const {
|
|
101
|
+
crv,
|
|
102
|
+
kty
|
|
103
|
+
} = keyTypes[selection.algorithm];
|
|
104
|
+
return keys.filter(key => key.kty === kty && ("crv" in key ? key.crv : undefined) === crv && (selection.kid === undefined || key.kid === selection.kid) && (key.alg === undefined || key.alg === selection.algorithm) && (key.use === undefined || key.use === "sig") && (key.key_ops === undefined || key.key_ops.includes("verify")));
|
|
105
|
+
};
|
|
106
|
+
// Imports each JWK once per algorithm. Keyed weakly so replaced key sets can be collected.
|
|
107
|
+
const makeImporter = () => {
|
|
108
|
+
const imported = new WeakMap();
|
|
109
|
+
return (found, algorithm) => {
|
|
110
|
+
if (found.length === 0) return fail(new JoseError.KeyNotFound());
|
|
111
|
+
if (found.length > 1) return fail(new JoseError.AmbiguousKey());
|
|
112
|
+
const jwk = found[0];
|
|
113
|
+
const cached = imported.get(jwk)?.get(algorithm);
|
|
114
|
+
if (cached !== undefined) return Effect.succeed(cached);
|
|
115
|
+
return Effect.tap(importPublic(jwk, algorithm), key => Effect.sync(() => {
|
|
116
|
+
let byAlgorithm = imported.get(jwk);
|
|
117
|
+
if (byAlgorithm === undefined) imported.set(jwk, byAlgorithm = new Map());
|
|
118
|
+
byAlgorithm.set(algorithm, key);
|
|
119
|
+
}));
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Builds a `Jwks` service for a fixed key set.
|
|
124
|
+
*
|
|
125
|
+
* **Example** (Resolving a key by `kid`)
|
|
126
|
+
*
|
|
127
|
+
* ```ts import.meta.vitest
|
|
128
|
+
* import { Effect, Layer } from "effect"
|
|
129
|
+
* import { SecureRandom, Signature } from "effect/crypto"
|
|
130
|
+
* import { Jwk, Jwks } from "effect/jose"
|
|
131
|
+
*
|
|
132
|
+
* const layer = Signature.layerWebCrypto.pipe(Layer.provide(SecureRandom.layerWebCrypto))
|
|
133
|
+
*
|
|
134
|
+
* const kid = await Effect.runPromise(Effect.gen(function*() {
|
|
135
|
+
* const pair = yield* Jwk.generateKeyPair({ algorithm: "ES256", kid: "signing-1" })
|
|
136
|
+
* const jwks = yield* Jwks.makeLocal({ keys: [pair.publicKey] })
|
|
137
|
+
* const key = yield* jwks.resolve({ algorithm: "ES256", kid: "signing-1" })
|
|
138
|
+
* return key.kid
|
|
139
|
+
* }).pipe(Effect.provide(layer)))
|
|
140
|
+
* kid // => "signing-1"
|
|
141
|
+
* ```
|
|
142
|
+
*
|
|
143
|
+
* @stability unstable
|
|
144
|
+
* @category constructors
|
|
145
|
+
* @since 4.1.1
|
|
146
|
+
*/
|
|
147
|
+
export const makeLocal = keySet => Effect.sync(() => {
|
|
148
|
+
const keys = supportedKeys(keySet);
|
|
149
|
+
const importKey = makeImporter();
|
|
150
|
+
return Jwks.of({
|
|
151
|
+
resolve: selection => importKey(candidates(keys, selection), selection.algorithm)
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
/**
|
|
155
|
+
* Layer that provides `Jwks` for a fixed key set.
|
|
156
|
+
*
|
|
157
|
+
* @stability unstable
|
|
158
|
+
* @category layers
|
|
159
|
+
* @since 4.1.1
|
|
160
|
+
*/
|
|
161
|
+
export const layerLocal = keySet => Layer.effect(Jwks, makeLocal(keySet));
|
|
162
|
+
const unavailable = (description, cause) => new JoseError.JoseError({
|
|
163
|
+
reason: new JoseError.KeySetUnavailable({
|
|
164
|
+
description,
|
|
165
|
+
cause
|
|
166
|
+
})
|
|
167
|
+
});
|
|
168
|
+
const positiveInteger = (name, value) => Number.isSafeInteger(value) && value > 0 ? Effect.succeed(value) : invalidArgument(`${name} must be a positive integer`);
|
|
169
|
+
const positiveMillis = (name, input) => Effect.flatMap(millis(name, input), value => value > 0 ? Effect.succeed(value) : invalidArgument(`${name} must be positive`));
|
|
170
|
+
const readUrl = input => {
|
|
171
|
+
let url;
|
|
172
|
+
try {
|
|
173
|
+
url = new URL(input);
|
|
174
|
+
} catch {
|
|
175
|
+
url = undefined;
|
|
176
|
+
}
|
|
177
|
+
return url !== undefined && url.protocol === "https:" && url.username === "" && url.password === "" && url.hash === "" ? Effect.succeed(url) : invalidArgument("url must be an HTTPS URL without credentials or a fragment");
|
|
178
|
+
};
|
|
179
|
+
/**
|
|
180
|
+
* Builds a `Jwks` service for a remote key set, using the `HttpClient`
|
|
181
|
+
* service. Use it when the URL is only known at runtime, for example from
|
|
182
|
+
* OpenID Connect discovery.
|
|
183
|
+
*
|
|
184
|
+
* **Details**
|
|
185
|
+
*
|
|
186
|
+
* The key set is fetched on first use and reused until `timeToLive` passes.
|
|
187
|
+
* Concurrent callers share one request. A selection that finds no key fetches
|
|
188
|
+
* the set again, at most once per `cooldown`, so rotated keys are picked up
|
|
189
|
+
* without letting unknown `kid`s drive a request per token. A failed fetch
|
|
190
|
+
* fails every caller until `cooldown` passes; there is no fallback to an
|
|
191
|
+
* expired set.
|
|
192
|
+
*
|
|
193
|
+
* Only a 200 response from the configured URL is accepted, so a redirected
|
|
194
|
+
* key set is rejected. The check runs on the response, so it cannot stop a
|
|
195
|
+
* client from sending the redirected request.
|
|
196
|
+
*
|
|
197
|
+
* **Gotchas**
|
|
198
|
+
*
|
|
199
|
+
* Supply a client that does not follow redirects. `FetchHttpClient` follows
|
|
200
|
+
* them by default: provide `FetchHttpClient.RequestInit` with
|
|
201
|
+
* `{ redirect: "manual" }` on its layer so a redirect fails before any further
|
|
202
|
+
* request. Clients wrapped with `HttpClient.followRedirects` also follow them.
|
|
203
|
+
*
|
|
204
|
+
* Closing the scope interrupts any request in flight, and later resolutions
|
|
205
|
+
* fail with `KeySetUnavailable`.
|
|
206
|
+
*
|
|
207
|
+
* @stability unstable
|
|
208
|
+
* @category constructors
|
|
209
|
+
* @since 4.1.1
|
|
210
|
+
*/
|
|
211
|
+
export const makeRemote = /*#__PURE__*/Effect.fnUntraced(function* (options) {
|
|
212
|
+
const url = yield* readUrl(options.url);
|
|
213
|
+
const timeToLive = yield* positiveMillis("timeToLive", options.timeToLive ?? "10 minutes");
|
|
214
|
+
const cooldown = yield* millis("cooldown", options.cooldown ?? "30 seconds");
|
|
215
|
+
const timeout = yield* positiveMillis("timeout", options.timeout ?? "5 seconds");
|
|
216
|
+
const maxResponseBytes = yield* positiveInteger("maxResponseBytes", options.maxResponseBytes ?? 131072);
|
|
217
|
+
const maxKeys = yield* positiveInteger("maxKeys", options.maxKeys ?? 64);
|
|
218
|
+
const client = HttpClient.withScope(yield* HttpClient.HttpClient);
|
|
219
|
+
const scope = yield* Effect.scope;
|
|
220
|
+
const importKey = makeImporter();
|
|
221
|
+
let cache;
|
|
222
|
+
let pending;
|
|
223
|
+
let lastAttempt = -Infinity;
|
|
224
|
+
let lastFailed = false;
|
|
225
|
+
let closed = false;
|
|
226
|
+
const closedExit = Exit.fail(unavailable("The key set scope is closed"));
|
|
227
|
+
yield* Effect.addFinalizer(() => Effect.sync(() => {
|
|
228
|
+
closed = true;
|
|
229
|
+
if (pending !== undefined) Deferred.doneUnsafe(pending, closedExit);
|
|
230
|
+
}));
|
|
231
|
+
const fetch = Effect.gen(function* () {
|
|
232
|
+
const response = yield* client.get(url.href, {
|
|
233
|
+
headers: {
|
|
234
|
+
accept: "application/json"
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
if (response.status !== 200) {
|
|
238
|
+
return yield* unavailable(`The key set endpoint responded with status ${response.status}`);
|
|
239
|
+
}
|
|
240
|
+
if (response.url !== url.href) {
|
|
241
|
+
return yield* unavailable("The key set response came from another URL");
|
|
242
|
+
}
|
|
243
|
+
const body = new Uint8Array(maxResponseBytes);
|
|
244
|
+
const length = yield* Stream.runFoldEffect(response.stream, () => 0, (length, chunk) => {
|
|
245
|
+
if (chunk.length > body.length - length) {
|
|
246
|
+
return Effect.fail(unavailable(`The key set response exceeds ${maxResponseBytes} bytes`));
|
|
247
|
+
}
|
|
248
|
+
body.set(chunk, length);
|
|
249
|
+
return Effect.succeed(length + chunk.length);
|
|
250
|
+
});
|
|
251
|
+
const keySet = yield* Schema.decodeUnknownEffect(KeySet)(parseJsonObject(body.subarray(0, length))).pipe(Effect.mapError(cause => unavailable("The key set document is invalid", cause)));
|
|
252
|
+
if (keySet.keys.length > maxKeys) {
|
|
253
|
+
return yield* unavailable(`The key set has more than ${maxKeys} keys`);
|
|
254
|
+
}
|
|
255
|
+
return {
|
|
256
|
+
keys: supportedKeys(keySet),
|
|
257
|
+
expiresAt: (yield* Clock.currentTimeMillis) + timeToLive
|
|
258
|
+
};
|
|
259
|
+
}).pipe(Effect.scoped, Effect.catchTag("HttpClientError", cause => Effect.fail(unavailable("The key set request failed", cause))), Effect.timeoutOrElse({
|
|
260
|
+
duration: timeout,
|
|
261
|
+
orElse: () => Effect.fail(unavailable("The key set request timed out"))
|
|
262
|
+
}));
|
|
263
|
+
// Returns `undefined` while cooling down, which applies only to unknown-key
|
|
264
|
+
// refetches (`stale` lacked the key) and retries after a failure.
|
|
265
|
+
const refresh = (now, stale) => Effect.uninterruptibleMask(restore => Effect.suspend(() => {
|
|
266
|
+
if (closed) return closedExit;
|
|
267
|
+
if (cache !== undefined && cache !== stale && cache.expiresAt > now) return Effect.succeed(cache);
|
|
268
|
+
if (pending !== undefined) return restore(Deferred.await(pending));
|
|
269
|
+
if ((stale !== undefined || lastFailed) && now - lastAttempt < cooldown) return Effect.succeed(undefined);
|
|
270
|
+
lastAttempt = now;
|
|
271
|
+
const result = pending = Deferred.makeUnsafe();
|
|
272
|
+
return fetch.pipe(Effect.onExit(exit => Effect.sync(() => {
|
|
273
|
+
pending = undefined;
|
|
274
|
+
lastFailed = Exit.isFailure(exit);
|
|
275
|
+
if (Exit.isSuccess(exit)) cache = exit.value;
|
|
276
|
+
Deferred.doneUnsafe(result, Exit.isFailure(exit) && Cause.hasInterruptsOnly(exit.cause) ? closedExit : exit);
|
|
277
|
+
})), Effect.forkIn(scope, {
|
|
278
|
+
uninterruptible: false
|
|
279
|
+
}), Effect.andThen(restore(Deferred.await(result))));
|
|
280
|
+
}));
|
|
281
|
+
const resolve = selection => Effect.flatMap(Clock.currentTimeMillis, now => {
|
|
282
|
+
if (closed) return closedExit;
|
|
283
|
+
const lookup = snapshot => importKey(candidates(snapshot.keys, selection), selection.algorithm);
|
|
284
|
+
const current = cache;
|
|
285
|
+
if (current !== undefined && current.expiresAt > now) {
|
|
286
|
+
const found = candidates(current.keys, selection);
|
|
287
|
+
if (found.length > 0) return importKey(found, selection.algorithm);
|
|
288
|
+
// An unknown key may have been rotated in. Refetch, unless cooling down.
|
|
289
|
+
return Effect.flatMap(refresh(now, current), snapshot => snapshot === undefined ? fail(new JoseError.KeyNotFound()) : lookup(snapshot));
|
|
290
|
+
}
|
|
291
|
+
return Effect.flatMap(refresh(now), snapshot => snapshot === undefined ? Effect.fail(unavailable("The key set is cooling down after a failed fetch")) : lookup(snapshot));
|
|
292
|
+
});
|
|
293
|
+
return Jwks.of({
|
|
294
|
+
resolve
|
|
295
|
+
});
|
|
296
|
+
});
|
|
297
|
+
/**
|
|
298
|
+
* Layer that provides `Jwks` from a remote key set built by {@link makeRemote}.
|
|
299
|
+
* Closing the layer interrupts any request in flight.
|
|
300
|
+
*
|
|
301
|
+
* @stability unstable
|
|
302
|
+
* @category layers
|
|
303
|
+
* @since 4.1.1
|
|
304
|
+
*/
|
|
305
|
+
export const layerRemote = options => Layer.effect(Jwks, makeRemote(options));
|
|
306
|
+
//# sourceMappingURL=Jwks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Jwks.js","names":[],"sources":["../../src/jose/Jwks.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;AAeA,OAAO,KAAK,KAAK,MAAM,aAAa;AACpC,OAAO,KAAK,KAAK,MAAM,aAAa;AACpC,OAAO,KAAK,OAAO,MAAM,eAAe;AACxC,OAAO,KAAK,QAAQ,MAAM,gBAAgB;AAE1C,OAAO,KAAK,MAAM,MAAM,cAAc;AACtC,OAAO,KAAK,IAAI,MAAM,YAAY;AAClC,OAAO,KAAK,UAAU,MAAM,uBAAuB;AACnD,OAAO,KAAK,KAAK,MAAM,aAAa;AACpC,OAAO,KAAK,MAAM,MAAM,cA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