@pacspace-io/sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +192 -0
- package/dist/client.d.ts +61 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +225 -0
- package/dist/client.js.map +1 -0
- package/dist/errors/index.d.ts +69 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +126 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/index.d.ts +64 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +68 -0
- package/dist/index.js.map +1 -0
- package/dist/resources/balance.d.ts +148 -0
- package/dist/resources/balance.d.ts.map +1 -0
- package/dist/resources/balance.js +231 -0
- package/dist/resources/balance.js.map +1 -0
- package/dist/types/balance.d.ts +218 -0
- package/dist/types/balance.d.ts.map +1 -0
- package/dist/types/balance.js +3 -0
- package/dist/types/balance.js.map +1 -0
- package/dist/types/common.d.ts +21 -0
- package/dist/types/common.d.ts.map +1 -0
- package/dist/types/common.js +3 -0
- package/dist/types/common.js.map +1 -0
- package/dist/types/config.d.ts +54 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +3 -0
- package/dist/types/config.js.map +1 -0
- package/dist/utils/polling.d.ts +32 -0
- package/dist/utils/polling.d.ts.map +1 -0
- package/dist/utils/polling.js +56 -0
- package/dist/utils/polling.js.map +1 -0
- package/dist/utils/retry.d.ts +14 -0
- package/dist/utils/retry.d.ts.map +1 -0
- package/dist/utils/retry.js +21 -0
- package/dist/utils/retry.js.map +1 -0
- package/dist/webhooks/index.d.ts +3 -0
- package/dist/webhooks/index.d.ts.map +1 -0
- package/dist/webhooks/index.js +6 -0
- package/dist/webhooks/index.js.map +1 -0
- package/dist/webhooks/types.d.ts +99 -0
- package/dist/webhooks/types.d.ts.map +1 -0
- package/dist/webhooks/types.js +6 -0
- package/dist/webhooks/types.js.map +1 -0
- package/dist/webhooks/verify.d.ts +104 -0
- package/dist/webhooks/verify.d.ts.map +1 -0
- package/dist/webhooks/verify.js +167 -0
- package/dist/webhooks/verify.js.map +1 -0
- package/package.json +46 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import type { WebhookEvent, WebhookHeaders } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Options for webhook verification.
|
|
4
|
+
*/
|
|
5
|
+
export interface VerifyOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Maximum age (seconds) of the timestamp before rejecting.
|
|
8
|
+
* Protects against replay attacks.
|
|
9
|
+
* @default 300 (5 minutes)
|
|
10
|
+
*/
|
|
11
|
+
tolerance?: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* PacSpace Webhook verification and middleware.
|
|
15
|
+
*
|
|
16
|
+
* Provides HMAC-SHA256 signature verification for webhook payloads
|
|
17
|
+
* using the algorithm documented at:
|
|
18
|
+
* https://docs.pacspace.io/webhooks/signature-verification
|
|
19
|
+
*/
|
|
20
|
+
export declare class Webhooks {
|
|
21
|
+
private readonly secret;
|
|
22
|
+
/**
|
|
23
|
+
* @param secret - Your webhook signing secret (from the PacSpace dashboard).
|
|
24
|
+
*/
|
|
25
|
+
constructor(secret: string);
|
|
26
|
+
/**
|
|
27
|
+
* Verify a webhook payload and return the typed event.
|
|
28
|
+
*
|
|
29
|
+
* @param signature - The `X-PacSpace-Signature` header value.
|
|
30
|
+
* @param timestamp - The `X-PacSpace-Timestamp` header value.
|
|
31
|
+
* @param rawBody - The raw request body as a string (before JSON parsing).
|
|
32
|
+
* @param options - Verification options (timestamp tolerance).
|
|
33
|
+
* @returns The parsed and verified webhook event.
|
|
34
|
+
* @throws WebhookVerificationError if verification fails.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* const event = pac.webhooks.verify(
|
|
39
|
+
* req.headers['x-pacspace-signature'],
|
|
40
|
+
* req.headers['x-pacspace-timestamp'],
|
|
41
|
+
* req.rawBody,
|
|
42
|
+
* );
|
|
43
|
+
*
|
|
44
|
+
* if (event.event === 'delta.verified') {
|
|
45
|
+
* console.log(event.data.receiptId);
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
verify(signature: string, timestamp: string, rawBody: string, options?: VerifyOptions): WebhookEvent;
|
|
50
|
+
/**
|
|
51
|
+
* Verify using a headers object (convenience method).
|
|
52
|
+
*
|
|
53
|
+
* Extracts `x-pacspace-signature` and `x-pacspace-timestamp` from headers.
|
|
54
|
+
*
|
|
55
|
+
* @param headers - Headers object (Express req.headers or similar).
|
|
56
|
+
* @param rawBody - The raw request body as a string.
|
|
57
|
+
* @param options - Verification options.
|
|
58
|
+
* @returns The parsed and verified webhook event.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```typescript
|
|
62
|
+
* const event = pac.webhooks.verifyFromHeaders(req.headers, req.rawBody);
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
verifyFromHeaders(headers: WebhookHeaders | Record<string, string | string[] | undefined>, rawBody: string, options?: VerifyOptions): WebhookEvent;
|
|
66
|
+
/**
|
|
67
|
+
* Create an Express/Connect-compatible middleware for webhook verification.
|
|
68
|
+
*
|
|
69
|
+
* The middleware:
|
|
70
|
+
* 1. Verifies the HMAC signature
|
|
71
|
+
* 2. Validates the timestamp
|
|
72
|
+
* 3. Attaches the parsed event to `req.pacspaceEvent`
|
|
73
|
+
* 4. Calls `next()` on success, or responds with 401 on failure
|
|
74
|
+
*
|
|
75
|
+
* **Important:** Ensure raw body parsing is enabled before this middleware.
|
|
76
|
+
*
|
|
77
|
+
* @param options - Verification options.
|
|
78
|
+
* @returns Express middleware function.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```typescript
|
|
82
|
+
* // Capture raw body (required for signature verification)
|
|
83
|
+
* app.use('/webhooks', express.json({
|
|
84
|
+
* verify: (req, _res, buf) => { req.rawBody = buf.toString(); }
|
|
85
|
+
* }));
|
|
86
|
+
*
|
|
87
|
+
* app.post('/webhooks/pacspace', pac.webhooks.middleware(), (req, res) => {
|
|
88
|
+
* const event = req.pacspaceEvent;
|
|
89
|
+
* console.log(`Received ${event.event}:`, event.data);
|
|
90
|
+
* res.status(200).json({ received: true });
|
|
91
|
+
* });
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
middleware(options?: VerifyOptions): (req: any, res: any, next: any) => void;
|
|
95
|
+
/**
|
|
96
|
+
* Validate that the timestamp is within the tolerance window.
|
|
97
|
+
*/
|
|
98
|
+
private validateTimestamp;
|
|
99
|
+
/**
|
|
100
|
+
* Extract a header value from a headers object (handles arrays).
|
|
101
|
+
*/
|
|
102
|
+
private getHeader;
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=verify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../src/webhooks/verify.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,YAAY,EAEZ,cAAc,EACf,MAAM,SAAS,CAAC;AAEjB;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;GAMG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAEhC;;OAEG;gBACS,MAAM,EAAE,MAAM;IAS1B;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,MAAM,CACJ,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,aAAa,GACtB,YAAY;IAyCf;;;;;;;;;;;;;;OAcG;IACH,iBAAiB,CACf,OAAO,EAAE,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,EACvE,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,aAAa,GACtB,YAAY;IAkBf;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,UAAU,CAAC,OAAO,CAAC,EAAE,aAAa,IACxB,KAAK,GAAG,EAAE,KAAK,GAAG,EAAE,MAAM,GAAG;IAgBvC;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAkBzB;;OAEG;IACH,OAAO,CAAC,SAAS;CAOlB"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Webhooks = void 0;
|
|
4
|
+
const crypto_1 = require("crypto");
|
|
5
|
+
const errors_1 = require("../errors");
|
|
6
|
+
/**
|
|
7
|
+
* PacSpace Webhook verification and middleware.
|
|
8
|
+
*
|
|
9
|
+
* Provides HMAC-SHA256 signature verification for webhook payloads
|
|
10
|
+
* using the algorithm documented at:
|
|
11
|
+
* https://docs.pacspace.io/webhooks/signature-verification
|
|
12
|
+
*/
|
|
13
|
+
class Webhooks {
|
|
14
|
+
/**
|
|
15
|
+
* @param secret - Your webhook signing secret (from the PacSpace dashboard).
|
|
16
|
+
*/
|
|
17
|
+
constructor(secret) {
|
|
18
|
+
if (!secret) {
|
|
19
|
+
throw new errors_1.WebhookVerificationError('Webhook secret is required. Get it from your PacSpace dashboard.');
|
|
20
|
+
}
|
|
21
|
+
this.secret = secret;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Verify a webhook payload and return the typed event.
|
|
25
|
+
*
|
|
26
|
+
* @param signature - The `X-PacSpace-Signature` header value.
|
|
27
|
+
* @param timestamp - The `X-PacSpace-Timestamp` header value.
|
|
28
|
+
* @param rawBody - The raw request body as a string (before JSON parsing).
|
|
29
|
+
* @param options - Verification options (timestamp tolerance).
|
|
30
|
+
* @returns The parsed and verified webhook event.
|
|
31
|
+
* @throws WebhookVerificationError if verification fails.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* const event = pac.webhooks.verify(
|
|
36
|
+
* req.headers['x-pacspace-signature'],
|
|
37
|
+
* req.headers['x-pacspace-timestamp'],
|
|
38
|
+
* req.rawBody,
|
|
39
|
+
* );
|
|
40
|
+
*
|
|
41
|
+
* if (event.event === 'delta.verified') {
|
|
42
|
+
* console.log(event.data.receiptId);
|
|
43
|
+
* }
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
verify(signature, timestamp, rawBody, options) {
|
|
47
|
+
if (!signature || !timestamp || !rawBody) {
|
|
48
|
+
throw new errors_1.WebhookVerificationError('Missing required parameters: signature, timestamp, and rawBody are all required.');
|
|
49
|
+
}
|
|
50
|
+
// Validate timestamp to prevent replay attacks
|
|
51
|
+
this.validateTimestamp(timestamp, options?.tolerance ?? 300);
|
|
52
|
+
// Reconstruct the signed content: "{timestamp}.{rawBody}"
|
|
53
|
+
const signedContent = `${timestamp}.${rawBody}`;
|
|
54
|
+
// Compute HMAC-SHA256
|
|
55
|
+
const expectedSignature = 'v1=' +
|
|
56
|
+
(0, crypto_1.createHmac)('sha256', this.secret).update(signedContent).digest('hex');
|
|
57
|
+
// Constant-time comparison
|
|
58
|
+
const expected = Buffer.from(expectedSignature);
|
|
59
|
+
const received = Buffer.from(signature);
|
|
60
|
+
if (expected.length !== received.length ||
|
|
61
|
+
!(0, crypto_1.timingSafeEqual)(expected, received)) {
|
|
62
|
+
throw new errors_1.WebhookVerificationError('Signature mismatch. Ensure you are using the correct webhook secret and the raw (unparsed) request body.');
|
|
63
|
+
}
|
|
64
|
+
// Parse and return the event
|
|
65
|
+
try {
|
|
66
|
+
return JSON.parse(rawBody);
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
throw new errors_1.WebhookVerificationError('Failed to parse webhook payload as JSON.');
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Verify using a headers object (convenience method).
|
|
74
|
+
*
|
|
75
|
+
* Extracts `x-pacspace-signature` and `x-pacspace-timestamp` from headers.
|
|
76
|
+
*
|
|
77
|
+
* @param headers - Headers object (Express req.headers or similar).
|
|
78
|
+
* @param rawBody - The raw request body as a string.
|
|
79
|
+
* @param options - Verification options.
|
|
80
|
+
* @returns The parsed and verified webhook event.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```typescript
|
|
84
|
+
* const event = pac.webhooks.verifyFromHeaders(req.headers, req.rawBody);
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
verifyFromHeaders(headers, rawBody, options) {
|
|
88
|
+
const signature = this.getHeader(headers, 'x-pacspace-signature');
|
|
89
|
+
const timestamp = this.getHeader(headers, 'x-pacspace-timestamp');
|
|
90
|
+
if (!signature) {
|
|
91
|
+
throw new errors_1.WebhookVerificationError('Missing X-PacSpace-Signature header.');
|
|
92
|
+
}
|
|
93
|
+
if (!timestamp) {
|
|
94
|
+
throw new errors_1.WebhookVerificationError('Missing X-PacSpace-Timestamp header.');
|
|
95
|
+
}
|
|
96
|
+
return this.verify(signature, timestamp, rawBody, options);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Create an Express/Connect-compatible middleware for webhook verification.
|
|
100
|
+
*
|
|
101
|
+
* The middleware:
|
|
102
|
+
* 1. Verifies the HMAC signature
|
|
103
|
+
* 2. Validates the timestamp
|
|
104
|
+
* 3. Attaches the parsed event to `req.pacspaceEvent`
|
|
105
|
+
* 4. Calls `next()` on success, or responds with 401 on failure
|
|
106
|
+
*
|
|
107
|
+
* **Important:** Ensure raw body parsing is enabled before this middleware.
|
|
108
|
+
*
|
|
109
|
+
* @param options - Verification options.
|
|
110
|
+
* @returns Express middleware function.
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* ```typescript
|
|
114
|
+
* // Capture raw body (required for signature verification)
|
|
115
|
+
* app.use('/webhooks', express.json({
|
|
116
|
+
* verify: (req, _res, buf) => { req.rawBody = buf.toString(); }
|
|
117
|
+
* }));
|
|
118
|
+
*
|
|
119
|
+
* app.post('/webhooks/pacspace', pac.webhooks.middleware(), (req, res) => {
|
|
120
|
+
* const event = req.pacspaceEvent;
|
|
121
|
+
* console.log(`Received ${event.event}:`, event.data);
|
|
122
|
+
* res.status(200).json({ received: true });
|
|
123
|
+
* });
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
middleware(options) {
|
|
127
|
+
return (req, res, next) => {
|
|
128
|
+
try {
|
|
129
|
+
const rawBody = req.rawBody || JSON.stringify(req.body);
|
|
130
|
+
const event = this.verifyFromHeaders(req.headers, rawBody, options);
|
|
131
|
+
req.pacspaceEvent = event;
|
|
132
|
+
next();
|
|
133
|
+
}
|
|
134
|
+
catch (err) {
|
|
135
|
+
if (err instanceof errors_1.WebhookVerificationError) {
|
|
136
|
+
res.status(401).json({ error: err.message });
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
next(err);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Validate that the timestamp is within the tolerance window.
|
|
146
|
+
*/
|
|
147
|
+
validateTimestamp(timestamp, toleranceSeconds) {
|
|
148
|
+
const webhookTime = parseInt(timestamp, 10);
|
|
149
|
+
if (isNaN(webhookTime)) {
|
|
150
|
+
throw new errors_1.WebhookVerificationError(`Invalid timestamp: "${timestamp}". Expected a Unix timestamp in seconds.`);
|
|
151
|
+
}
|
|
152
|
+
const currentTime = Math.floor(Date.now() / 1000);
|
|
153
|
+
const age = Math.abs(currentTime - webhookTime);
|
|
154
|
+
if (age > toleranceSeconds) {
|
|
155
|
+
throw new errors_1.WebhookVerificationError(`Timestamp too old (${age}s > ${toleranceSeconds}s tolerance). This may be a replay attack, or your server clock is skewed.`);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Extract a header value from a headers object (handles arrays).
|
|
160
|
+
*/
|
|
161
|
+
getHeader(headers, key) {
|
|
162
|
+
const value = headers[key] ?? headers[key.toLowerCase()];
|
|
163
|
+
return Array.isArray(value) ? value[0] : value;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
exports.Webhooks = Webhooks;
|
|
167
|
+
//# sourceMappingURL=verify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify.js","sourceRoot":"","sources":["../../src/webhooks/verify.ts"],"names":[],"mappings":";;;AAAA,mCAAqD;AACrD,sCAAqD;AAmBrD;;;;;;GAMG;AACH,MAAa,QAAQ;IAGnB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,iCAAwB,CAChC,kEAAkE,CACnE,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,MAAM,CACJ,SAAiB,EACjB,SAAiB,EACjB,OAAe,EACf,OAAuB;QAEvB,IAAI,CAAC,SAAS,IAAI,CAAC,SAAS,IAAI,CAAC,OAAO,EAAE,CAAC;YACzC,MAAM,IAAI,iCAAwB,CAChC,kFAAkF,CACnF,CAAC;QACJ,CAAC;QAED,+CAA+C;QAC/C,IAAI,CAAC,iBAAiB,CAAC,SAAS,EAAE,OAAO,EAAE,SAAS,IAAI,GAAG,CAAC,CAAC;QAE7D,0DAA0D;QAC1D,MAAM,aAAa,GAAG,GAAG,SAAS,IAAI,OAAO,EAAE,CAAC;QAEhD,sBAAsB;QACtB,MAAM,iBAAiB,GACrB,KAAK;YACL,IAAA,mBAAU,EAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAExE,2BAA2B;QAC3B,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAChD,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS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C,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IACjD,CAAC;CACF;AArMD,4BAqMC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pacspace-io/sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Official PacSpace Balance API SDK — zero-dependency TypeScript client",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"default": "./dist/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./webhooks": {
|
|
13
|
+
"types": "./dist/webhooks/index.d.ts",
|
|
14
|
+
"default": "./dist/webhooks/index.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsc",
|
|
22
|
+
"dev": "tsc --watch",
|
|
23
|
+
"clean": "rm -rf dist",
|
|
24
|
+
"lint": "eslint \"src/**/*.{ts,tsx}\"",
|
|
25
|
+
"test": "vitest run",
|
|
26
|
+
"test:watch": "vitest"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"typescript": "^5.3.0",
|
|
30
|
+
"vitest": "^1.6.1"
|
|
31
|
+
},
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=18.0.0"
|
|
34
|
+
},
|
|
35
|
+
"keywords": [
|
|
36
|
+
"pacspace",
|
|
37
|
+
"balance-api",
|
|
38
|
+
"blockchain",
|
|
39
|
+
"settlement",
|
|
40
|
+
"sdk"
|
|
41
|
+
],
|
|
42
|
+
"license": "MIT",
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public"
|
|
45
|
+
}
|
|
46
|
+
}
|