@certysign/sdk 2.0.0 → 2.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/README.md +398 -213
- package/package.json +2 -1
- package/src/index.js +20 -2
- package/src/lib/SignatureEmbedder.js +520 -119
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@certysign/sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Official Node.js SDK for CertySign — hash-based digital signing, X.509 certificates, and PKI services. Documents never leave your system.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"axios": "^1.6.0",
|
|
36
36
|
"form-data": "^4.0.0",
|
|
37
|
+
"node-forge": "^1.3.3",
|
|
37
38
|
"pdf-lib": "^1.17.1"
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|
package/src/index.js
CHANGED
|
@@ -84,7 +84,8 @@ class CertySignClient {
|
|
|
84
84
|
environment = 'production',
|
|
85
85
|
timeout,
|
|
86
86
|
retries,
|
|
87
|
-
debug = false
|
|
87
|
+
debug = false,
|
|
88
|
+
tsaUrl,
|
|
88
89
|
} = options;
|
|
89
90
|
|
|
90
91
|
if (!publicKey) throw new Error('CertySignClient: publicKey is required');
|
|
@@ -118,11 +119,15 @@ class CertySignClient {
|
|
|
118
119
|
this.sessions = new SigningSessionResource(this._http); // Multi-recipient signing sessions
|
|
119
120
|
this.dashboard = new DashboardResource(this._http); // SDK usage analytics
|
|
120
121
|
this.hasher = new DocumentHasher(); // Local document hashing
|
|
121
|
-
|
|
122
|
+
|
|
123
|
+
// TSA URL: explicit > environment-derived
|
|
124
|
+
const resolvedTsaUrl = tsaUrl ?? CertySignClient.TSA_URLS[environment] ?? null;
|
|
125
|
+
this.embedder = new SignatureEmbedder({ tsaUrl: resolvedTsaUrl }); // PAdES-T when TSA URL available
|
|
122
126
|
|
|
123
127
|
this.publicKey = publicKey;
|
|
124
128
|
this.environment = environment;
|
|
125
129
|
this.baseUrl = resolvedBaseUrl;
|
|
130
|
+
this.tsaUrl = resolvedTsaUrl;
|
|
126
131
|
}
|
|
127
132
|
|
|
128
133
|
/**
|
|
@@ -138,6 +143,19 @@ class CertySignClient {
|
|
|
138
143
|
};
|
|
139
144
|
}
|
|
140
145
|
|
|
146
|
+
/**
|
|
147
|
+
* Environment → TSA URL mapping.
|
|
148
|
+
* Override via the `tsaUrl` constructor option.
|
|
149
|
+
*/
|
|
150
|
+
static get TSA_URLS() {
|
|
151
|
+
return {
|
|
152
|
+
production: 'https://tsa.certysign.io',
|
|
153
|
+
staging: 'https://tsa-staging.certysign.io',
|
|
154
|
+
development: 'http://localhost:5015',
|
|
155
|
+
test: 'http://localhost:5015'
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
|
|
141
159
|
/**
|
|
142
160
|
* Verify that the API key is valid and return the key metadata.
|
|
143
161
|
* Useful as a "ping" / health check at startup.
|