@otskit/client 0.1.2 → 0.2.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/LICENSE +21 -21
- package/README.md +5 -3
- package/dist/index.cjs +18 -1
- package/dist/index.d.cts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +16 -1
- package/package.json +1 -1
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 alexalves87
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 alexalves87
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -7,10 +7,12 @@
|
|
|
7
7
|
> TypeScript/JavaScript client for OpenTimestamps with enterprise-grade resilience patterns
|
|
8
8
|
|
|
9
9
|
[](https://github.com/OTSkit/OTSkit-client/actions/workflows/ci.yml)
|
|
10
|
+
[](https://github.com/OTSkit/OTSkit-client/actions/workflows/codeql.yml)
|
|
10
11
|
[](https://www.npmjs.com/package/@otskit/client)
|
|
11
|
-
[](https://www.npmjs.com/package/@otskit/client)
|
|
13
|
+
[](https://www.typescriptlang.org/)
|
|
14
|
+
[](https://nodejs.org)
|
|
15
|
+
[](LICENSE)
|
|
14
16
|
|
|
15
17
|
`@otskit/client` is the official client SDK for submitting, upgrading, and verifying [OpenTimestamps](https://opentimestamps.org) proofs. It sits on top of [@otskit/core](https://github.com/OTSkit/OTSkit-core) — the low-level protocol engine — and wraps it in a high-level API with production-ready resilience patterns built in.
|
|
16
18
|
|
package/dist/index.cjs
CHANGED
|
@@ -44,6 +44,8 @@ __export(index_exports, {
|
|
|
44
44
|
UpgradeError: () => UpgradeError,
|
|
45
45
|
UrlWhitelist: () => UrlWhitelist,
|
|
46
46
|
ValidationError: () => ValidationError,
|
|
47
|
+
hashBuffer: () => hashBuffer,
|
|
48
|
+
hashFile: () => hashFile,
|
|
47
49
|
verifyAgainstBlockheader: () => verifyAgainstBlockheader,
|
|
48
50
|
verifyTimestampAttestation: () => verifyTimestampAttestation
|
|
49
51
|
});
|
|
@@ -443,7 +445,7 @@ var ResilientNetworkLayer = class {
|
|
|
443
445
|
}
|
|
444
446
|
};
|
|
445
447
|
|
|
446
|
-
//
|
|
448
|
+
// ../otskit-core/dist/index.js
|
|
447
449
|
var DeserializationError = class extends Error {
|
|
448
450
|
constructor(message) {
|
|
449
451
|
super(message);
|
|
@@ -2418,6 +2420,19 @@ var OpenTimestampsClient = class {
|
|
|
2418
2420
|
this.networkLayer.resetAllCircuits();
|
|
2419
2421
|
}
|
|
2420
2422
|
};
|
|
2423
|
+
|
|
2424
|
+
// src/utils/hash.ts
|
|
2425
|
+
var import_crypto = require("crypto");
|
|
2426
|
+
var import_fs = require("fs");
|
|
2427
|
+
function hashBuffer(data) {
|
|
2428
|
+
return (0, import_crypto.createHash)("sha256").update(data).digest();
|
|
2429
|
+
}
|
|
2430
|
+
function hashFile(path) {
|
|
2431
|
+
return new Promise((resolve, reject) => {
|
|
2432
|
+
const hash = (0, import_crypto.createHash)("sha256");
|
|
2433
|
+
(0, import_fs.createReadStream)(path).on("data", (chunk) => hash.update(chunk)).on("end", () => resolve(hash.digest())).on("error", reject);
|
|
2434
|
+
});
|
|
2435
|
+
}
|
|
2421
2436
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2422
2437
|
0 && (module.exports = {
|
|
2423
2438
|
CalendarClient,
|
|
@@ -2444,6 +2459,8 @@ var OpenTimestampsClient = class {
|
|
|
2444
2459
|
UpgradeError,
|
|
2445
2460
|
UrlWhitelist,
|
|
2446
2461
|
ValidationError,
|
|
2462
|
+
hashBuffer,
|
|
2463
|
+
hashFile,
|
|
2447
2464
|
verifyAgainstBlockheader,
|
|
2448
2465
|
verifyTimestampAttestation
|
|
2449
2466
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -358,4 +358,7 @@ declare class EsploraClient {
|
|
|
358
358
|
*/
|
|
359
359
|
declare function verifyTimestampAttestation(digest: Uint8Array, attestation: Attestation, explorer: EsploraClient, signal?: AbortSignal): Promise<number>;
|
|
360
360
|
|
|
361
|
-
|
|
361
|
+
declare function hashBuffer(data: Buffer | Uint8Array): Buffer;
|
|
362
|
+
declare function hashFile(path: string): Promise<Buffer>;
|
|
363
|
+
|
|
364
|
+
export { type BackoffStrategy, CalendarClient, CalendarResponseTooLargeError, CircuitBreakerError, type CircuitBreakerOptions, CircuitState, type ClientOptions, CommitmentNotFoundError, DEFAULT_AGGREGATORS, DEFAULT_CALENDARS, DEFAULT_CALENDAR_WHITELIST, DEFAULT_RESILIENCE, EsploraClient, type EsploraClientOptions, EsploraResponseError, type JitterType, type Logger, MAX_CALENDAR_RESPONSE_SIZE, MAX_ESPLORA_RESPONSE_SIZE, NetworkError, OpenTimestampsClient, OpenTimestampsClientError, type OperationOptions, PUBLIC_ESPLORA_URL, type ResilienceOptions, ResilientNetworkLayer, type RetryOptions, StampError, UpgradeError, UrlWhitelist, ValidationError, type VerificationResult, hashBuffer, hashFile, verifyTimestampAttestation };
|
package/dist/index.d.ts
CHANGED
|
@@ -358,4 +358,7 @@ declare class EsploraClient {
|
|
|
358
358
|
*/
|
|
359
359
|
declare function verifyTimestampAttestation(digest: Uint8Array, attestation: Attestation, explorer: EsploraClient, signal?: AbortSignal): Promise<number>;
|
|
360
360
|
|
|
361
|
-
|
|
361
|
+
declare function hashBuffer(data: Buffer | Uint8Array): Buffer;
|
|
362
|
+
declare function hashFile(path: string): Promise<Buffer>;
|
|
363
|
+
|
|
364
|
+
export { type BackoffStrategy, CalendarClient, CalendarResponseTooLargeError, CircuitBreakerError, type CircuitBreakerOptions, CircuitState, type ClientOptions, CommitmentNotFoundError, DEFAULT_AGGREGATORS, DEFAULT_CALENDARS, DEFAULT_CALENDAR_WHITELIST, DEFAULT_RESILIENCE, EsploraClient, type EsploraClientOptions, EsploraResponseError, type JitterType, type Logger, MAX_CALENDAR_RESPONSE_SIZE, MAX_ESPLORA_RESPONSE_SIZE, NetworkError, OpenTimestampsClient, OpenTimestampsClientError, type OperationOptions, PUBLIC_ESPLORA_URL, type ResilienceOptions, ResilientNetworkLayer, type RetryOptions, StampError, UpgradeError, UrlWhitelist, ValidationError, type VerificationResult, hashBuffer, hashFile, verifyTimestampAttestation };
|
package/dist/index.js
CHANGED
|
@@ -392,7 +392,7 @@ var ResilientNetworkLayer = class {
|
|
|
392
392
|
}
|
|
393
393
|
};
|
|
394
394
|
|
|
395
|
-
//
|
|
395
|
+
// ../otskit-core/dist/index.js
|
|
396
396
|
var DeserializationError = class extends Error {
|
|
397
397
|
constructor(message) {
|
|
398
398
|
super(message);
|
|
@@ -2367,6 +2367,19 @@ var OpenTimestampsClient = class {
|
|
|
2367
2367
|
this.networkLayer.resetAllCircuits();
|
|
2368
2368
|
}
|
|
2369
2369
|
};
|
|
2370
|
+
|
|
2371
|
+
// src/utils/hash.ts
|
|
2372
|
+
import { createHash } from "crypto";
|
|
2373
|
+
import { createReadStream } from "fs";
|
|
2374
|
+
function hashBuffer(data) {
|
|
2375
|
+
return createHash("sha256").update(data).digest();
|
|
2376
|
+
}
|
|
2377
|
+
function hashFile(path) {
|
|
2378
|
+
return new Promise((resolve, reject) => {
|
|
2379
|
+
const hash = createHash("sha256");
|
|
2380
|
+
createReadStream(path).on("data", (chunk) => hash.update(chunk)).on("end", () => resolve(hash.digest())).on("error", reject);
|
|
2381
|
+
});
|
|
2382
|
+
}
|
|
2370
2383
|
export {
|
|
2371
2384
|
CalendarClient,
|
|
2372
2385
|
CalendarResponseTooLargeError,
|
|
@@ -2392,6 +2405,8 @@ export {
|
|
|
2392
2405
|
UpgradeError,
|
|
2393
2406
|
UrlWhitelist,
|
|
2394
2407
|
ValidationError,
|
|
2408
|
+
hashBuffer,
|
|
2409
|
+
hashFile,
|
|
2395
2410
|
verifyAgainstBlockheader,
|
|
2396
2411
|
verifyTimestampAttestation
|
|
2397
2412
|
};
|