@t-0/provider-sdk 1.1.29 → 1.1.30
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 +22 -5
- package/lib/cjs/client/client.d.ts +4 -14
- package/lib/cjs/client/client.js +2 -38
- package/lib/cjs/client/signer.d.ts +1 -3
- package/lib/cjs/client/signer.js +7 -34
- package/lib/cjs/common/client/client.d.ts +14 -0
- package/lib/cjs/common/client/client.js +42 -0
- package/lib/cjs/common/client/signer.d.ts +3 -0
- package/lib/cjs/common/client/signer.js +36 -0
- package/lib/cjs/common/crypto/hash.d.ts +2 -0
- package/lib/cjs/common/crypto/hash.js +17 -0
- package/lib/cjs/common/crypto/index.d.ts +5 -0
- package/lib/cjs/common/crypto/index.js +14 -0
- package/lib/cjs/common/crypto/keys.d.ts +2 -0
- package/lib/cjs/common/crypto/keys.js +23 -0
- package/lib/cjs/common/crypto/request.d.ts +20 -0
- package/lib/cjs/common/crypto/request.js +51 -0
- package/lib/cjs/common/crypto/verify.d.ts +1 -0
- package/lib/cjs/common/crypto/verify.js +19 -0
- package/lib/cjs/common/health.d.ts +21 -0
- package/lib/cjs/common/health.js +45 -0
- package/lib/cjs/common/health_pb.d.ts +157 -0
- package/lib/cjs/common/health_pb.js +90 -0
- package/lib/cjs/common/node.d.ts +3 -0
- package/lib/cjs/common/node.js +15 -0
- package/lib/cjs/common/service.d.ts +37 -0
- package/lib/cjs/common/service.js +85 -0
- package/lib/cjs/common/validate.d.ts +25 -0
- package/lib/cjs/common/validate.js +42 -0
- package/lib/cjs/common/validation.d.ts +26 -0
- package/lib/cjs/common/validation.js +57 -0
- package/lib/cjs/crypto/hash.d.ts +1 -2
- package/lib/cjs/crypto/hash.js +15 -15
- package/lib/cjs/crypto/index.d.ts +1 -5
- package/lib/cjs/crypto/index.js +15 -12
- package/lib/cjs/crypto/keys.d.ts +1 -2
- package/lib/cjs/crypto/keys.js +15 -17
- package/lib/cjs/crypto/request.d.ts +1 -20
- package/lib/cjs/crypto/request.js +15 -47
- package/lib/cjs/crypto/verify.d.ts +1 -1
- package/lib/cjs/crypto/verify.js +15 -17
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.js +1 -0
- package/lib/cjs/service/health.d.ts +4 -21
- package/lib/cjs/service/health.js +5 -41
- package/lib/cjs/service/health_pb.d.ts +1 -157
- package/lib/cjs/service/health_pb.js +15 -88
- package/lib/cjs/service/node.d.ts +1 -3
- package/lib/cjs/service/node.js +15 -13
- package/lib/cjs/service/service.d.ts +6 -20
- package/lib/cjs/service/service.js +5 -84
- package/lib/cjs/service/validate.d.ts +1 -25
- package/lib/cjs/service/validate.js +15 -40
- package/lib/cjs/service/validate_response.d.ts +9 -18
- package/lib/cjs/service/validate_response.js +19 -57
- package/lib/cjs/version.d.ts +1 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/client/client.d.ts +3 -13
- package/lib/esm/client/client.js +2 -35
- package/lib/esm/client/signer.d.ts +1 -3
- package/lib/esm/client/signer.js +1 -32
- package/lib/esm/common/client/client.d.ts +14 -0
- package/lib/esm/common/client/client.js +36 -0
- package/lib/esm/common/client/signer.d.ts +3 -0
- package/lib/esm/common/client/signer.js +32 -0
- package/lib/esm/common/crypto/hash.d.ts +2 -0
- package/lib/esm/common/crypto/hash.js +13 -0
- package/lib/esm/common/crypto/index.d.ts +5 -0
- package/lib/esm/common/crypto/index.js +4 -0
- package/lib/esm/common/crypto/keys.d.ts +2 -0
- package/lib/esm/common/crypto/keys.js +19 -0
- package/lib/esm/common/crypto/request.d.ts +20 -0
- package/lib/esm/common/crypto/request.js +47 -0
- package/lib/esm/common/crypto/verify.d.ts +1 -0
- package/lib/esm/common/crypto/verify.js +16 -0
- package/lib/esm/common/health.d.ts +21 -0
- package/lib/esm/common/health.js +41 -0
- package/lib/esm/common/health_pb.d.ts +157 -0
- package/lib/esm/common/health_pb.js +87 -0
- package/lib/esm/common/node.d.ts +3 -0
- package/lib/esm/common/node.js +11 -0
- package/lib/esm/common/service.d.ts +37 -0
- package/lib/esm/common/service.js +78 -0
- package/lib/esm/common/validate.d.ts +25 -0
- package/lib/esm/common/validate.js +38 -0
- package/lib/esm/common/validation.d.ts +26 -0
- package/lib/esm/common/validation.js +54 -0
- package/lib/esm/crypto/hash.d.ts +1 -2
- package/lib/esm/crypto/hash.js +1 -13
- package/lib/esm/crypto/index.d.ts +1 -5
- package/lib/esm/crypto/index.js +1 -4
- package/lib/esm/crypto/keys.d.ts +1 -2
- package/lib/esm/crypto/keys.js +1 -15
- package/lib/esm/crypto/request.d.ts +1 -20
- package/lib/esm/crypto/request.js +1 -45
- package/lib/esm/crypto/verify.d.ts +1 -1
- package/lib/esm/crypto/verify.js +1 -16
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/service/health.d.ts +4 -21
- package/lib/esm/service/health.js +3 -41
- package/lib/esm/service/health_pb.d.ts +1 -157
- package/lib/esm/service/health_pb.js +1 -87
- package/lib/esm/service/node.d.ts +1 -3
- package/lib/esm/service/node.js +1 -11
- package/lib/esm/service/service.d.ts +6 -20
- package/lib/esm/service/service.js +4 -81
- package/lib/esm/service/validate.d.ts +1 -25
- package/lib/esm/service/validate.js +1 -38
- package/lib/esm/service/validate_response.d.ts +9 -18
- package/lib/esm/service/validate_response.js +15 -54
- package/lib/esm/version.d.ts +1 -1
- package/lib/esm/version.js +1 -1
- package/lib/tsconfig.cjs.tsbuildinfo +1 -1
- package/lib/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { secp256k1 } from '@noble/curves/secp256k1.js';
|
|
2
|
+
export function verifySignature(publicKey, digest, signature) {
|
|
3
|
+
if (digest.length !== 32) {
|
|
4
|
+
return false;
|
|
5
|
+
}
|
|
6
|
+
if (signature.length !== 64 && signature.length !== 65) {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
const sig64 = signature.length === 65 ? signature.subarray(0, 64) : signature;
|
|
10
|
+
try {
|
|
11
|
+
return secp256k1.verify(sig64, digest, publicKey, { prehash: false });
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type ServiceImpl } from "@connectrpc/connect";
|
|
2
|
+
import { Health } from "./health_pb.js";
|
|
3
|
+
/**
|
|
4
|
+
* Headers carrying the identity of the SDK answering the probe. They ride on
|
|
5
|
+
* the health response and nowhere else: `HealthCheckResponse` has a single
|
|
6
|
+
* status field and `check` names its service in the request, so the contract
|
|
7
|
+
* itself has no room for this — and taxing every callback with headers only the
|
|
8
|
+
* probe reads would be worse.
|
|
9
|
+
*/
|
|
10
|
+
export declare const SDK_ECOSYSTEM_HEADER = "T0-Sdk-Ecosystem";
|
|
11
|
+
export declare const SDK_VERSION_HEADER = "T0-Sdk-Version";
|
|
12
|
+
/**
|
|
13
|
+
* Reports SERVING for the services registered on this server and NOT_FOUND for
|
|
14
|
+
* anything else. The set is frozen at registration; nothing is computed per
|
|
15
|
+
* request.
|
|
16
|
+
*
|
|
17
|
+
* `watch` is absent on purpose: it is server-streaming, and the body-hash
|
|
18
|
+
* signature scheme these servers run behind has no story for streams. Omitting
|
|
19
|
+
* it from a partial `ServiceImpl` makes connect-es answer UNIMPLEMENTED.
|
|
20
|
+
*/
|
|
21
|
+
export declare const createHealthServiceImpl: (services: string[], version?: string) => Partial<ServiceImpl<typeof Health>>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { create } from "@bufbuild/protobuf";
|
|
2
|
+
import { Code, ConnectError } from "@connectrpc/connect";
|
|
3
|
+
import { HealthCheckResponse_ServingStatus, HealthCheckResponseSchema, } from "./health_pb.js";
|
|
4
|
+
/**
|
|
5
|
+
* Headers carrying the identity of the SDK answering the probe. They ride on
|
|
6
|
+
* the health response and nowhere else: `HealthCheckResponse` has a single
|
|
7
|
+
* status field and `check` names its service in the request, so the contract
|
|
8
|
+
* itself has no room for this — and taxing every callback with headers only the
|
|
9
|
+
* probe reads would be worse.
|
|
10
|
+
*/
|
|
11
|
+
export const SDK_ECOSYSTEM_HEADER = "T0-Sdk-Ecosystem";
|
|
12
|
+
export const SDK_VERSION_HEADER = "T0-Sdk-Version";
|
|
13
|
+
const SDK_ECOSYSTEM = "node";
|
|
14
|
+
/**
|
|
15
|
+
* Reports SERVING for the services registered on this server and NOT_FOUND for
|
|
16
|
+
* anything else. The set is frozen at registration; nothing is computed per
|
|
17
|
+
* request.
|
|
18
|
+
*
|
|
19
|
+
* `watch` is absent on purpose: it is server-streaming, and the body-hash
|
|
20
|
+
* signature scheme these servers run behind has no story for streams. Omitting
|
|
21
|
+
* it from a partial `ServiceImpl` makes connect-es answer UNIMPLEMENTED.
|
|
22
|
+
*/
|
|
23
|
+
export const createHealthServiceImpl = (services, version) => {
|
|
24
|
+
const registered = new Set(services);
|
|
25
|
+
const serving = create(HealthCheckResponseSchema, {
|
|
26
|
+
status: HealthCheckResponse_ServingStatus.SERVING,
|
|
27
|
+
});
|
|
28
|
+
return {
|
|
29
|
+
check(req, ctx) {
|
|
30
|
+
ctx.responseHeader.set(SDK_ECOSYSTEM_HEADER, SDK_ECOSYSTEM);
|
|
31
|
+
if (version) {
|
|
32
|
+
ctx.responseHeader.set(SDK_VERSION_HEADER, version);
|
|
33
|
+
}
|
|
34
|
+
const { service } = req;
|
|
35
|
+
if (service !== "" && !registered.has(service)) {
|
|
36
|
+
throw new ConnectError(`unknown service '${service}'`, Code.NotFound);
|
|
37
|
+
}
|
|
38
|
+
return serving;
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
};
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
|
|
2
|
+
import type { Message } from "@bufbuild/protobuf";
|
|
3
|
+
/**
|
|
4
|
+
* Describes the file grpc/health/v1/health.proto.
|
|
5
|
+
*/
|
|
6
|
+
export declare const file_grpc_health_v1_health: GenFile;
|
|
7
|
+
/**
|
|
8
|
+
* @generated from message grpc.health.v1.HealthCheckRequest
|
|
9
|
+
*/
|
|
10
|
+
export type HealthCheckRequest = Message<"grpc.health.v1.HealthCheckRequest"> & {
|
|
11
|
+
/**
|
|
12
|
+
* @generated from field: string service = 1;
|
|
13
|
+
*/
|
|
14
|
+
service: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Describes the message grpc.health.v1.HealthCheckRequest.
|
|
18
|
+
* Use `create(HealthCheckRequestSchema)` to create a new message.
|
|
19
|
+
*/
|
|
20
|
+
export declare const HealthCheckRequestSchema: GenMessage<HealthCheckRequest>;
|
|
21
|
+
/**
|
|
22
|
+
* @generated from message grpc.health.v1.HealthCheckResponse
|
|
23
|
+
*/
|
|
24
|
+
export type HealthCheckResponse = Message<"grpc.health.v1.HealthCheckResponse"> & {
|
|
25
|
+
/**
|
|
26
|
+
* @generated from field: grpc.health.v1.HealthCheckResponse.ServingStatus status = 1;
|
|
27
|
+
*/
|
|
28
|
+
status: HealthCheckResponse_ServingStatus;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Describes the message grpc.health.v1.HealthCheckResponse.
|
|
32
|
+
* Use `create(HealthCheckResponseSchema)` to create a new message.
|
|
33
|
+
*/
|
|
34
|
+
export declare const HealthCheckResponseSchema: GenMessage<HealthCheckResponse>;
|
|
35
|
+
/**
|
|
36
|
+
* @generated from enum grpc.health.v1.HealthCheckResponse.ServingStatus
|
|
37
|
+
*/
|
|
38
|
+
export declare enum HealthCheckResponse_ServingStatus {
|
|
39
|
+
/**
|
|
40
|
+
* @generated from enum value: UNKNOWN = 0;
|
|
41
|
+
*/
|
|
42
|
+
UNKNOWN = 0,
|
|
43
|
+
/**
|
|
44
|
+
* @generated from enum value: SERVING = 1;
|
|
45
|
+
*/
|
|
46
|
+
SERVING = 1,
|
|
47
|
+
/**
|
|
48
|
+
* @generated from enum value: NOT_SERVING = 2;
|
|
49
|
+
*/
|
|
50
|
+
NOT_SERVING = 2,
|
|
51
|
+
/**
|
|
52
|
+
* Used only by the Watch method.
|
|
53
|
+
*
|
|
54
|
+
* @generated from enum value: SERVICE_UNKNOWN = 3;
|
|
55
|
+
*/
|
|
56
|
+
SERVICE_UNKNOWN = 3
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Describes the enum grpc.health.v1.HealthCheckResponse.ServingStatus.
|
|
60
|
+
*/
|
|
61
|
+
export declare const HealthCheckResponse_ServingStatusSchema: GenEnum<HealthCheckResponse_ServingStatus>;
|
|
62
|
+
/**
|
|
63
|
+
* @generated from message grpc.health.v1.HealthListRequest
|
|
64
|
+
*/
|
|
65
|
+
export type HealthListRequest = Message<"grpc.health.v1.HealthListRequest"> & {};
|
|
66
|
+
/**
|
|
67
|
+
* Describes the message grpc.health.v1.HealthListRequest.
|
|
68
|
+
* Use `create(HealthListRequestSchema)` to create a new message.
|
|
69
|
+
*/
|
|
70
|
+
export declare const HealthListRequestSchema: GenMessage<HealthListRequest>;
|
|
71
|
+
/**
|
|
72
|
+
* @generated from message grpc.health.v1.HealthListResponse
|
|
73
|
+
*/
|
|
74
|
+
export type HealthListResponse = Message<"grpc.health.v1.HealthListResponse"> & {
|
|
75
|
+
/**
|
|
76
|
+
* statuses contains all the services and their respective status.
|
|
77
|
+
*
|
|
78
|
+
* @generated from field: map<string, grpc.health.v1.HealthCheckResponse> statuses = 1;
|
|
79
|
+
*/
|
|
80
|
+
statuses: {
|
|
81
|
+
[key: string]: HealthCheckResponse;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Describes the message grpc.health.v1.HealthListResponse.
|
|
86
|
+
* Use `create(HealthListResponseSchema)` to create a new message.
|
|
87
|
+
*/
|
|
88
|
+
export declare const HealthListResponseSchema: GenMessage<HealthListResponse>;
|
|
89
|
+
/**
|
|
90
|
+
* Health is gRPC's mechanism for checking whether a server is able to handle
|
|
91
|
+
* RPCs. Its semantics are documented in
|
|
92
|
+
* https://github.com/grpc/grpc/blob/master/doc/health-checking.md.
|
|
93
|
+
*
|
|
94
|
+
* @generated from service grpc.health.v1.Health
|
|
95
|
+
*/
|
|
96
|
+
export declare const Health: GenService<{
|
|
97
|
+
/**
|
|
98
|
+
* Check gets the health of the specified service. If the requested service
|
|
99
|
+
* is unknown, the call will fail with status NOT_FOUND. If the caller does
|
|
100
|
+
* not specify a service name, the server should respond with its overall
|
|
101
|
+
* health status.
|
|
102
|
+
*
|
|
103
|
+
* Clients should set a deadline when calling Check, and can declare the
|
|
104
|
+
* server unhealthy if they do not receive a timely response.
|
|
105
|
+
*
|
|
106
|
+
* @generated from rpc grpc.health.v1.Health.Check
|
|
107
|
+
*/
|
|
108
|
+
check: {
|
|
109
|
+
methodKind: "unary";
|
|
110
|
+
input: typeof HealthCheckRequestSchema;
|
|
111
|
+
output: typeof HealthCheckResponseSchema;
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* List provides a non-atomic snapshot of the health of all the available
|
|
115
|
+
* services.
|
|
116
|
+
*
|
|
117
|
+
* The server may respond with a RESOURCE_EXHAUSTED error if too many services
|
|
118
|
+
* exist.
|
|
119
|
+
*
|
|
120
|
+
* Clients should set a deadline when calling List, and can declare the server
|
|
121
|
+
* unhealthy if they do not receive a timely response.
|
|
122
|
+
*
|
|
123
|
+
* Clients should keep in mind that the list of health services exposed by an
|
|
124
|
+
* application can change over the lifetime of the process.
|
|
125
|
+
*
|
|
126
|
+
* @generated from rpc grpc.health.v1.Health.List
|
|
127
|
+
*/
|
|
128
|
+
list: {
|
|
129
|
+
methodKind: "unary";
|
|
130
|
+
input: typeof HealthListRequestSchema;
|
|
131
|
+
output: typeof HealthListResponseSchema;
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* Performs a watch for the serving status of the requested service.
|
|
135
|
+
* The server will immediately send back a message indicating the current
|
|
136
|
+
* serving status. It will then subsequently send a new message whenever
|
|
137
|
+
* the service's serving status changes.
|
|
138
|
+
*
|
|
139
|
+
* If the requested service is unknown when the call is received, the
|
|
140
|
+
* server will send a message setting the serving status to
|
|
141
|
+
* SERVICE_UNKNOWN but will *not* terminate the call. If at some
|
|
142
|
+
* future point, the serving status of the service becomes known, the
|
|
143
|
+
* server will send a new message with the service's serving status.
|
|
144
|
+
*
|
|
145
|
+
* If the call terminates with status UNIMPLEMENTED, then clients
|
|
146
|
+
* should assume this method is not supported and should not retry the
|
|
147
|
+
* call. If the call terminates with any other status (including OK),
|
|
148
|
+
* clients should retry the call with appropriate exponential backoff.
|
|
149
|
+
*
|
|
150
|
+
* @generated from rpc grpc.health.v1.Health.Watch
|
|
151
|
+
*/
|
|
152
|
+
watch: {
|
|
153
|
+
methodKind: "server_streaming";
|
|
154
|
+
input: typeof HealthCheckRequestSchema;
|
|
155
|
+
output: typeof HealthCheckResponseSchema;
|
|
156
|
+
};
|
|
157
|
+
}>;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// Vendored generated stubs for grpc.health.v1 -- do not edit by hand.
|
|
2
|
+
//
|
|
3
|
+
// Source: buf.build/grpc/grpc, grpc/health/v1/health.proto
|
|
4
|
+
// Plugin: buf.build/bufbuild/es:v2.12.0 (kept in step with the root
|
|
5
|
+
// buf.gen.yaml pin -- plugin and @bufbuild/protobuf runtime must
|
|
6
|
+
// agree on major).
|
|
7
|
+
//
|
|
8
|
+
// Regenerate with the following, which keeps this header and replaces
|
|
9
|
+
// everything from the gRPC copyright line down. Do not just `mv` the generated
|
|
10
|
+
// file over this one -- that would delete these instructions along with it.
|
|
11
|
+
//
|
|
12
|
+
// cd node/sdk
|
|
13
|
+
// buf generate buf.build/grpc/grpc --path grpc/health/v1/health.proto \
|
|
14
|
+
// --template '{"version":"v2","plugins":[{"remote":"buf.build/bufbuild/es:v2.12.0","out":"gen-health","opt":["target=ts","import_extension=js"]}]}'
|
|
15
|
+
// sed '/^\/\/ Copyright 2015 The gRPC Authors/,$d' src/common/health_pb.ts > gen-health/header
|
|
16
|
+
// cat gen-health/header gen-health/grpc/health/v1/health_pb.ts > src/common/health_pb.ts
|
|
17
|
+
// rm -rf gen-health
|
|
18
|
+
//
|
|
19
|
+
// Vendored rather than depended on: the equivalent package
|
|
20
|
+
// `@buf/grpc_grpc.bufbuild_es` is published only on the Buf Schema Registry, and
|
|
21
|
+
// reaching it needs registry config that a published npm package cannot hand its
|
|
22
|
+
// consumers -- so depending on it 404'd every downstream install. Rationale in
|
|
23
|
+
// docs/HEALTH_SERVICE.md.
|
|
24
|
+
//
|
|
25
|
+
// Lives under src/common/ (not src/common/gen/) so the buf-regenerated gen/
|
|
26
|
+
// tree stays independent.
|
|
27
|
+
import { enumDesc, fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2";
|
|
28
|
+
/**
|
|
29
|
+
* Describes the file grpc/health/v1/health.proto.
|
|
30
|
+
*/
|
|
31
|
+
export const file_grpc_health_v1_health = /*@__PURE__*/ fileDesc("ChtncnBjL2hlYWx0aC92MS9oZWFsdGgucHJvdG8SDmdycGMuaGVhbHRoLnYxIiUKEkhlYWx0aENoZWNrUmVxdWVzdBIPCgdzZXJ2aWNlGAEgASgJIqkBChNIZWFsdGhDaGVja1Jlc3BvbnNlEkEKBnN0YXR1cxgBIAEoDjIxLmdycGMuaGVhbHRoLnYxLkhlYWx0aENoZWNrUmVzcG9uc2UuU2VydmluZ1N0YXR1cyJPCg1TZXJ2aW5nU3RhdHVzEgsKB1VOS05PV04QABILCgdTRVJWSU5HEAESDwoLTk9UX1NFUlZJTkcQAhITCg9TRVJWSUNFX1VOS05PV04QAyITChFIZWFsdGhMaXN0UmVxdWVzdCKuAQoSSGVhbHRoTGlzdFJlc3BvbnNlEkIKCHN0YXR1c2VzGAEgAygLMjAuZ3JwYy5oZWFsdGgudjEuSGVhbHRoTGlzdFJlc3BvbnNlLlN0YXR1c2VzRW50cnkaVAoNU3RhdHVzZXNFbnRyeRILCgNrZXkYASABKAkSMgoFdmFsdWUYAiABKAsyIy5ncnBjLmhlYWx0aC52MS5IZWFsdGhDaGVja1Jlc3BvbnNlOgI4ATL9AQoGSGVhbHRoElAKBUNoZWNrEiIuZ3JwYy5oZWFsdGgudjEuSGVhbHRoQ2hlY2tSZXF1ZXN0GiMuZ3JwYy5oZWFsdGgudjEuSGVhbHRoQ2hlY2tSZXNwb25zZRJNCgRMaXN0EiEuZ3JwYy5oZWFsdGgudjEuSGVhbHRoTGlzdFJlcXVlc3QaIi5ncnBjLmhlYWx0aC52MS5IZWFsdGhMaXN0UmVzcG9uc2USUgoFV2F0Y2gSIi5ncnBjLmhlYWx0aC52MS5IZWFsdGhDaGVja1JlcXVlc3QaIy5ncnBjLmhlYWx0aC52MS5IZWFsdGhDaGVja1Jlc3BvbnNlMAFCcAoRaW8uZ3JwYy5oZWFsdGgudjFCC0hlYWx0aFByb3RvUAFaLGdvb2dsZS5nb2xhbmcub3JnL2dycGMvaGVhbHRoL2dycGNfaGVhbHRoX3YxogIMR3JwY0hlYWx0aFYxqgIOR3JwYy5IZWFsdGguVjFiBnByb3RvMw");
|
|
32
|
+
/**
|
|
33
|
+
* Describes the message grpc.health.v1.HealthCheckRequest.
|
|
34
|
+
* Use `create(HealthCheckRequestSchema)` to create a new message.
|
|
35
|
+
*/
|
|
36
|
+
export const HealthCheckRequestSchema = /*@__PURE__*/ messageDesc(file_grpc_health_v1_health, 0);
|
|
37
|
+
/**
|
|
38
|
+
* Describes the message grpc.health.v1.HealthCheckResponse.
|
|
39
|
+
* Use `create(HealthCheckResponseSchema)` to create a new message.
|
|
40
|
+
*/
|
|
41
|
+
export const HealthCheckResponseSchema = /*@__PURE__*/ messageDesc(file_grpc_health_v1_health, 1);
|
|
42
|
+
/**
|
|
43
|
+
* @generated from enum grpc.health.v1.HealthCheckResponse.ServingStatus
|
|
44
|
+
*/
|
|
45
|
+
export var HealthCheckResponse_ServingStatus;
|
|
46
|
+
(function (HealthCheckResponse_ServingStatus) {
|
|
47
|
+
/**
|
|
48
|
+
* @generated from enum value: UNKNOWN = 0;
|
|
49
|
+
*/
|
|
50
|
+
HealthCheckResponse_ServingStatus[HealthCheckResponse_ServingStatus["UNKNOWN"] = 0] = "UNKNOWN";
|
|
51
|
+
/**
|
|
52
|
+
* @generated from enum value: SERVING = 1;
|
|
53
|
+
*/
|
|
54
|
+
HealthCheckResponse_ServingStatus[HealthCheckResponse_ServingStatus["SERVING"] = 1] = "SERVING";
|
|
55
|
+
/**
|
|
56
|
+
* @generated from enum value: NOT_SERVING = 2;
|
|
57
|
+
*/
|
|
58
|
+
HealthCheckResponse_ServingStatus[HealthCheckResponse_ServingStatus["NOT_SERVING"] = 2] = "NOT_SERVING";
|
|
59
|
+
/**
|
|
60
|
+
* Used only by the Watch method.
|
|
61
|
+
*
|
|
62
|
+
* @generated from enum value: SERVICE_UNKNOWN = 3;
|
|
63
|
+
*/
|
|
64
|
+
HealthCheckResponse_ServingStatus[HealthCheckResponse_ServingStatus["SERVICE_UNKNOWN"] = 3] = "SERVICE_UNKNOWN";
|
|
65
|
+
})(HealthCheckResponse_ServingStatus || (HealthCheckResponse_ServingStatus = {}));
|
|
66
|
+
/**
|
|
67
|
+
* Describes the enum grpc.health.v1.HealthCheckResponse.ServingStatus.
|
|
68
|
+
*/
|
|
69
|
+
export const HealthCheckResponse_ServingStatusSchema = /*@__PURE__*/ enumDesc(file_grpc_health_v1_health, 1, 0);
|
|
70
|
+
/**
|
|
71
|
+
* Describes the message grpc.health.v1.HealthListRequest.
|
|
72
|
+
* Use `create(HealthListRequestSchema)` to create a new message.
|
|
73
|
+
*/
|
|
74
|
+
export const HealthListRequestSchema = /*@__PURE__*/ messageDesc(file_grpc_health_v1_health, 2);
|
|
75
|
+
/**
|
|
76
|
+
* Describes the message grpc.health.v1.HealthListResponse.
|
|
77
|
+
* Use `create(HealthListResponseSchema)` to create a new message.
|
|
78
|
+
*/
|
|
79
|
+
export const HealthListResponseSchema = /*@__PURE__*/ messageDesc(file_grpc_health_v1_health, 3);
|
|
80
|
+
/**
|
|
81
|
+
* Health is gRPC's mechanism for checking whether a server is able to handle
|
|
82
|
+
* RPCs. Its semantics are documented in
|
|
83
|
+
* https://github.com/grpc/grpc/blob/master/doc/health-checking.md.
|
|
84
|
+
*
|
|
85
|
+
* @generated from service grpc.health.v1.Health
|
|
86
|
+
*/
|
|
87
|
+
export const Health = /*@__PURE__*/ serviceDesc(file_grpc_health_v1_health, 0);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { keccak_256 } from "@noble/hashes/sha3.js";
|
|
2
|
+
export const signatureValidation = (next) => (req, resp) => {
|
|
3
|
+
const hasher = keccak_256.create();
|
|
4
|
+
req.hasher = hasher;
|
|
5
|
+
req.on("data", (chunk) => {
|
|
6
|
+
if (chunk instanceof Buffer) {
|
|
7
|
+
hasher.update(chunk);
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
next(req, resp);
|
|
11
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ConnectRouter } from "@connectrpc/connect";
|
|
2
|
+
import type { Interceptor } from "@connectrpc/connect";
|
|
3
|
+
import type { DescService, Registry } from "@bufbuild/protobuf";
|
|
4
|
+
import type { ServiceImpl } from "@connectrpc/connect";
|
|
5
|
+
import { type Logger } from "./validation.js";
|
|
6
|
+
export interface CreateServiceOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Logger used by the SDK for error-level events (currently:
|
|
9
|
+
* response-validation failures from the interceptor safety net). The same
|
|
10
|
+
* logger will be used for any future server-wide SDK log sites.
|
|
11
|
+
*
|
|
12
|
+
* If omitted, the SDK logs to `console.error` with a JSON-encoded payload.
|
|
13
|
+
*/
|
|
14
|
+
logger?: Logger;
|
|
15
|
+
/**
|
|
16
|
+
* Protobuf registry for resolving custom protovalidate predefined-rule
|
|
17
|
+
* extensions. Pass a registry built with `createRegistry(fileDescriptor)`
|
|
18
|
+
* when your protos define custom predefined rules.
|
|
19
|
+
*/
|
|
20
|
+
registry?: Registry;
|
|
21
|
+
/**
|
|
22
|
+
* SDK version stamped on health-check responses via the `T0-Sdk-Version`
|
|
23
|
+
* header. Omit to suppress the header.
|
|
24
|
+
*/
|
|
25
|
+
version?: string;
|
|
26
|
+
}
|
|
27
|
+
export declare const REQUEST_VALIDITY_MILLIS = 60000;
|
|
28
|
+
interface Router {
|
|
29
|
+
service: <T extends DescService, I extends ServiceImpl<T>>(service: T, implementation: I) => void;
|
|
30
|
+
}
|
|
31
|
+
export declare const createService: (networkPublicKey: string | Buffer, registerRoutes: (router: Router) => void, options?: CreateServiceOptions) => {
|
|
32
|
+
routes: (router: ConnectRouter) => void;
|
|
33
|
+
interceptors: Interceptor[];
|
|
34
|
+
grpcWeb: boolean;
|
|
35
|
+
contextValues: (req: any) => import("@connectrpc/connect").ContextValues;
|
|
36
|
+
};
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { Code, ConnectError, createContextKey, createContextValues } from "@connectrpc/connect";
|
|
2
|
+
import NetworkHeaders from "./headers.js";
|
|
3
|
+
import { verifySignature } from './crypto/verify.js';
|
|
4
|
+
import { createValidationInterceptor } from "./validation.js";
|
|
5
|
+
import { Health } from "./health_pb.js";
|
|
6
|
+
import { createHealthServiceImpl } from "./health.js";
|
|
7
|
+
export const REQUEST_VALIDITY_MILLIS = 60000;
|
|
8
|
+
const createSignatureVerification = (networkPublicKey) => (next) => async (req) => {
|
|
9
|
+
const ts = decodeNum(getHeader(req, NetworkHeaders.SignatureTimestamp));
|
|
10
|
+
if (Date.now() - ts > 60000) {
|
|
11
|
+
throw new ConnectError(`${NetworkHeaders.SignatureTimestamp} must be within ${REQUEST_VALIDITY_MILLIS} milliseconds from now`, Code.InvalidArgument);
|
|
12
|
+
}
|
|
13
|
+
const publicKey = decodeHex(getHeader(req, NetworkHeaders.PublicKey));
|
|
14
|
+
if (networkPublicKey.compare(publicKey) !== 0) {
|
|
15
|
+
throw new ConnectError(`${NetworkHeaders.PublicKey} value is not network public key`, Code.Unauthenticated);
|
|
16
|
+
}
|
|
17
|
+
const signature = decodeHex(getHeader(req, NetworkHeaders.Signature));
|
|
18
|
+
const hasher = req.contextValues.get(kHash);
|
|
19
|
+
const tsBuf = Buffer.alloc(8);
|
|
20
|
+
tsBuf.writeBigUInt64LE(BigInt(ts)); // 64‑bit little‑endian timestamp
|
|
21
|
+
const digest = hasher
|
|
22
|
+
.update(tsBuf)
|
|
23
|
+
.digest();
|
|
24
|
+
if (!verifySignature(publicKey, digest, signature)) {
|
|
25
|
+
throw new ConnectError(`${NetworkHeaders.Signature} has invalid signature`, Code.Unauthenticated);
|
|
26
|
+
}
|
|
27
|
+
return await next(req);
|
|
28
|
+
};
|
|
29
|
+
export const createService = (networkPublicKey, registerRoutes, options) => {
|
|
30
|
+
if (typeof networkPublicKey == "string") {
|
|
31
|
+
networkPublicKey = decodeHex(networkPublicKey);
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
routes: (router) => {
|
|
35
|
+
const collected = [];
|
|
36
|
+
const origService = router.service.bind(router);
|
|
37
|
+
const wrappedRouter = {
|
|
38
|
+
service: (desc, impl) => {
|
|
39
|
+
collected.push(desc.typeName);
|
|
40
|
+
origService(desc, impl);
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
registerRoutes(wrappedRouter);
|
|
44
|
+
collected.push(Health.typeName);
|
|
45
|
+
origService(Health, createHealthServiceImpl(collected, options?.version));
|
|
46
|
+
},
|
|
47
|
+
interceptors: [createSignatureVerification(networkPublicKey), createValidationInterceptor({ logger: options?.logger, registry: options?.registry })],
|
|
48
|
+
grpcWeb: false,
|
|
49
|
+
contextValues: (req) => {
|
|
50
|
+
return createContextValues().set(kHash, req.hasher);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
const kHash = createContextKey(undefined);
|
|
55
|
+
function getHeader(req, header) {
|
|
56
|
+
const raw = req.header.get(header);
|
|
57
|
+
if (!raw) {
|
|
58
|
+
throw new ConnectError(`missing required header '${header}'`, Code.InvalidArgument);
|
|
59
|
+
}
|
|
60
|
+
return raw;
|
|
61
|
+
}
|
|
62
|
+
function decodeHex(value) {
|
|
63
|
+
value = value.startsWith('0x') ? value.slice(2) : value;
|
|
64
|
+
try {
|
|
65
|
+
return Buffer.from(value, "hex");
|
|
66
|
+
}
|
|
67
|
+
catch (e) {
|
|
68
|
+
throw new ConnectError(`invalid header format. '${value}' must be hex encoded`, Code.InvalidArgument);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function decodeNum(value) {
|
|
72
|
+
try {
|
|
73
|
+
return parseInt(value);
|
|
74
|
+
}
|
|
75
|
+
catch (e) {
|
|
76
|
+
throw new ConnectError(`invalid header format. '${value}' must be a number`, Code.InvalidArgument);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { DescMessage, MessageShape } from "@bufbuild/protobuf";
|
|
2
|
+
/**
|
|
3
|
+
* Shared protovalidate validator instance for the public {@link validate} helper.
|
|
4
|
+
* Construction is cheap, but reusing one instance avoids repeated compilation
|
|
5
|
+
* of the same rules.
|
|
6
|
+
*/
|
|
7
|
+
export declare const validator: import("@bufbuild/protovalidate").Validator;
|
|
8
|
+
/**
|
|
9
|
+
* Validates a response message against its buf.validate proto annotations.
|
|
10
|
+
*
|
|
11
|
+
* On success, returns the message unchanged (typed). On failure, throws a
|
|
12
|
+
* {@link ConnectError} with {@link Code.Internal} and a message matching the
|
|
13
|
+
* shape emitted by the SDK's response-validation interceptor — so propagating
|
|
14
|
+
* the error from a handler produces the same wire response as not calling
|
|
15
|
+
* `validate` at all.
|
|
16
|
+
*
|
|
17
|
+
* Intended use:
|
|
18
|
+
* ```ts
|
|
19
|
+
* return validate(PayOutResponseSchema, { result: { case: "accepted", value: {} } });
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* Catch the error to convert it into a domain-level failure (e.g. the `Failed`
|
|
23
|
+
* arm of a `oneof result`) instead of an opaque `Code.Internal`.
|
|
24
|
+
*/
|
|
25
|
+
export declare function validate<Desc extends DescMessage>(schema: Desc, msg: MessageShape<Desc>): MessageShape<Desc>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Code, ConnectError } from "@connectrpc/connect";
|
|
2
|
+
import { createValidator } from "@bufbuild/protovalidate";
|
|
3
|
+
/**
|
|
4
|
+
* Shared protovalidate validator instance for the public {@link validate} helper.
|
|
5
|
+
* Construction is cheap, but reusing one instance avoids repeated compilation
|
|
6
|
+
* of the same rules.
|
|
7
|
+
*/
|
|
8
|
+
export const validator = createValidator();
|
|
9
|
+
/**
|
|
10
|
+
* Validates a response message against its buf.validate proto annotations.
|
|
11
|
+
*
|
|
12
|
+
* On success, returns the message unchanged (typed). On failure, throws a
|
|
13
|
+
* {@link ConnectError} with {@link Code.Internal} and a message matching the
|
|
14
|
+
* shape emitted by the SDK's response-validation interceptor — so propagating
|
|
15
|
+
* the error from a handler produces the same wire response as not calling
|
|
16
|
+
* `validate` at all.
|
|
17
|
+
*
|
|
18
|
+
* Intended use:
|
|
19
|
+
* ```ts
|
|
20
|
+
* return validate(PayOutResponseSchema, { result: { case: "accepted", value: {} } });
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* Catch the error to convert it into a domain-level failure (e.g. the `Failed`
|
|
24
|
+
* arm of a `oneof result`) instead of an opaque `Code.Internal`.
|
|
25
|
+
*/
|
|
26
|
+
export function validate(schema, msg) {
|
|
27
|
+
const result = validator.validate(schema, msg);
|
|
28
|
+
if (result.kind === "invalid") {
|
|
29
|
+
const details = result.violations
|
|
30
|
+
.map((v) => `${v.field?.toString() ?? ""}: ${v.message}`)
|
|
31
|
+
.join("; ");
|
|
32
|
+
throw new ConnectError(`response validation failed: ${details}`, Code.Internal);
|
|
33
|
+
}
|
|
34
|
+
if (result.kind === "error") {
|
|
35
|
+
throw new ConnectError(`response validation error: ${result.error.message}`, Code.Internal);
|
|
36
|
+
}
|
|
37
|
+
return msg;
|
|
38
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Interceptor } from "@connectrpc/connect";
|
|
2
|
+
import type { Registry } from "@bufbuild/protobuf";
|
|
3
|
+
/**
|
|
4
|
+
* Minimal logger contract accepted by the SDK. Providers may pass `console`
|
|
5
|
+
* directly, or adapt their preferred logger (e.g. pino) with:
|
|
6
|
+
*
|
|
7
|
+
* { error: (msg, fields) => pinoInstance.error(fields, msg) }
|
|
8
|
+
*/
|
|
9
|
+
export interface Logger {
|
|
10
|
+
error(msg: string, fields?: Record<string, unknown>): void;
|
|
11
|
+
}
|
|
12
|
+
export interface ValidationInterceptorOptions {
|
|
13
|
+
logger?: Logger;
|
|
14
|
+
registry?: Registry;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Creates a ConnectRPC interceptor that validates requests and responses
|
|
18
|
+
* against buf.validate proto annotations.
|
|
19
|
+
*
|
|
20
|
+
* Invalid requests return Code.InvalidArgument; invalid responses return
|
|
21
|
+
* Code.Internal.
|
|
22
|
+
*
|
|
23
|
+
* Pass a `registry` when your protos define custom predefined rules
|
|
24
|
+
* (proto2 `extend buf.validate.*Rules`).
|
|
25
|
+
*/
|
|
26
|
+
export declare function createValidationInterceptor(loggerOrOptions?: Logger | ValidationInterceptorOptions): Interceptor;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Code, ConnectError } from "@connectrpc/connect";
|
|
2
|
+
import { createValidator } from "@bufbuild/protovalidate";
|
|
3
|
+
import { createValidateInterceptor } from "@connectrpc/validate";
|
|
4
|
+
const defaultLogger = {
|
|
5
|
+
error: (msg, fields) =>
|
|
6
|
+
// eslint-disable-next-line no-console
|
|
7
|
+
console.error(JSON.stringify({ msg, ...(fields ?? {}) })),
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Creates a ConnectRPC interceptor that validates requests and responses
|
|
11
|
+
* against buf.validate proto annotations.
|
|
12
|
+
*
|
|
13
|
+
* Invalid requests return Code.InvalidArgument; invalid responses return
|
|
14
|
+
* Code.Internal.
|
|
15
|
+
*
|
|
16
|
+
* Pass a `registry` when your protos define custom predefined rules
|
|
17
|
+
* (proto2 `extend buf.validate.*Rules`).
|
|
18
|
+
*/
|
|
19
|
+
export function createValidationInterceptor(loggerOrOptions) {
|
|
20
|
+
const opts = loggerOrOptions && typeof loggerOrOptions.error === "function"
|
|
21
|
+
? { logger: loggerOrOptions }
|
|
22
|
+
: loggerOrOptions ?? {};
|
|
23
|
+
const logger = opts.logger ?? defaultLogger;
|
|
24
|
+
const validator = createValidator(opts.registry ? { registry: opts.registry } : undefined);
|
|
25
|
+
const requestInterceptor = createValidateInterceptor({ validator });
|
|
26
|
+
return (next) => async (req) => {
|
|
27
|
+
const resp = await requestInterceptor(next)(req);
|
|
28
|
+
const schema = req.method.output;
|
|
29
|
+
const msg = resp.message;
|
|
30
|
+
const result = validator.validate(schema, msg);
|
|
31
|
+
if (result.kind === "invalid") {
|
|
32
|
+
const violations = result.violations.map((v) => ({
|
|
33
|
+
field: v.field?.toString() ?? "",
|
|
34
|
+
message: v.message,
|
|
35
|
+
}));
|
|
36
|
+
const details = violations.map((v) => `${v.field}: ${v.message}`).join("; ");
|
|
37
|
+
logger.error("response validation failed", {
|
|
38
|
+
rpc_method: `${req.service.typeName}/${req.method.name}`,
|
|
39
|
+
response_type: schema.typeName,
|
|
40
|
+
violations,
|
|
41
|
+
});
|
|
42
|
+
throw new ConnectError(`response validation failed: ${details}`, Code.Internal);
|
|
43
|
+
}
|
|
44
|
+
if (result.kind === "error") {
|
|
45
|
+
logger.error("response validation error", {
|
|
46
|
+
rpc_method: `${req.service.typeName}/${req.method.name}`,
|
|
47
|
+
response_type: schema.typeName,
|
|
48
|
+
error: result.error.message,
|
|
49
|
+
});
|
|
50
|
+
throw new ConnectError(`response validation error: ${result.error.message}`, Code.Internal);
|
|
51
|
+
}
|
|
52
|
+
return resp;
|
|
53
|
+
};
|
|
54
|
+
}
|
package/lib/esm/crypto/hash.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export declare function computeDigest(body: Uint8Array, timestampMs: number): Buffer;
|
|
1
|
+
export * from "../common/crypto/hash.js";
|
package/lib/esm/crypto/hash.js
CHANGED
|
@@ -1,13 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export function keccak256(...inputs) {
|
|
3
|
-
const h = keccak_256.create();
|
|
4
|
-
for (const input of inputs) {
|
|
5
|
-
h.update(input);
|
|
6
|
-
}
|
|
7
|
-
return Buffer.from(h.digest());
|
|
8
|
-
}
|
|
9
|
-
export function computeDigest(body, timestampMs) {
|
|
10
|
-
const tsBuf = Buffer.alloc(8);
|
|
11
|
-
tsBuf.writeBigUInt64LE(BigInt(timestampMs));
|
|
12
|
-
return keccak256(body, tsBuf);
|
|
13
|
-
}
|
|
1
|
+
export * from "../common/crypto/hash.js";
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export { keccak256, computeDigest } from './hash.js';
|
|
3
|
-
export { parsePublicKey, publicKeysEqual } from './keys.js';
|
|
4
|
-
export { createRequestVerifier, DEFAULT_TOLERANCE_MS } from './request.js';
|
|
5
|
-
export type { CreateVerifierOptions, VerifyRequest, VerifyRequestResult, VerifyRequestFailure, RequestVerifier } from './request.js';
|
|
1
|
+
export * from "../common/crypto/index.js";
|
package/lib/esm/crypto/index.js
CHANGED
|
@@ -1,4 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export { keccak256, computeDigest } from './hash.js';
|
|
3
|
-
export { parsePublicKey, publicKeysEqual } from './keys.js';
|
|
4
|
-
export { createRequestVerifier, DEFAULT_TOLERANCE_MS } from './request.js';
|
|
1
|
+
export * from "../common/crypto/index.js";
|
package/lib/esm/crypto/keys.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export declare function publicKeysEqual(a: Uint8Array, b: Uint8Array): boolean;
|
|
1
|
+
export * from "../common/crypto/keys.js";
|