@qnsp/tenant-sdk 0.3.0 → 0.3.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/.turbo/turbo-build.log +4 -0
- package/LICENSE +21 -7
- package/README.md +17 -51
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +187 -10
- package/dist/index.js.map +1 -1
- package/package.json +58 -39
- package/src/index.test.ts +68 -1
- package/src/index.ts +189 -10
- package/tsconfig.tsbuildinfo +1 -1
package/LICENSE
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Apache License
|
|
1
|
+
Apache License
|
|
2
2
|
Version 2.0, January 2004
|
|
3
3
|
http://www.apache.org/licenses/
|
|
4
4
|
|
|
@@ -48,11 +48,11 @@ Apache License
|
|
|
48
48
|
"Contribution" shall mean any work of authorship, including
|
|
49
49
|
the original version of the Work and any modifications or additions
|
|
50
50
|
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
51
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
52
52
|
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
53
|
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
the Licensor or its representatives, including but not limited to
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
56
|
communication on electronic mailing lists, source code control systems,
|
|
57
57
|
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
58
|
Licensor for the purpose of discussing and improving the Work, but
|
|
@@ -60,7 +60,7 @@ Apache License
|
|
|
60
60
|
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
61
|
|
|
62
62
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
63
|
+
on behalf of whom a Contribution has been received by the Licensor and
|
|
64
64
|
subsequently incorporated within the Work.
|
|
65
65
|
|
|
66
66
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
@@ -106,7 +106,7 @@ Apache License
|
|
|
106
106
|
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
107
|
distribution, then any Derivative Works that You distribute must
|
|
108
108
|
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding
|
|
109
|
+
within such NOTICE file, excluding any notices that do not
|
|
110
110
|
pertain to any part of the Derivative Works, in at least one
|
|
111
111
|
of the following places: within a NOTICE text file distributed
|
|
112
112
|
as part of the Derivative Works; within the Source form or
|
|
@@ -145,7 +145,7 @@ Apache License
|
|
|
145
145
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
146
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
147
|
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
149
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
150
|
appropriateness of using or redistributing the Work and assume any
|
|
151
151
|
risks associated with Your exercise of permissions under this License.
|
|
@@ -174,3 +174,17 @@ Apache License
|
|
|
174
174
|
of your accepting any such warranty or additional liability.
|
|
175
175
|
|
|
176
176
|
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2024-2026 CUI Labs Pte. Ltd.
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# @qnsp/tenant-sdk
|
|
2
2
|
|
|
3
|
-
TypeScript client for the QNSP
|
|
4
|
-
|
|
3
|
+
TypeScript SDK client for the QNSP tenant-service API. Provides tenant lifecycle and subscription management.
|
|
4
|
+
|
|
5
|
+
Part of the [Quantum-Native Security Platform (QNSP)](https://qnsp.cuilabs.io).
|
|
5
6
|
|
|
6
7
|
## Installation
|
|
7
8
|
|
|
@@ -9,66 +10,31 @@ domains, compliance tags, metadata, and PQC security envelopes.
|
|
|
9
10
|
pnpm add @qnsp/tenant-sdk
|
|
10
11
|
```
|
|
11
12
|
|
|
12
|
-
##
|
|
13
|
-
|
|
14
|
-
Provide a tenant-scoped **service token** via `apiKey`. Requests require PQC security envelopes and
|
|
15
|
-
signatures generated by the control plane; the SDK forwards your payloads but does not sign them.
|
|
16
|
-
|
|
17
|
-
```ts
|
|
18
|
-
import { TenantClient } from "@qnsp/tenant-sdk";
|
|
19
|
-
|
|
20
|
-
const tenants = new TenantClient({
|
|
21
|
-
baseUrl: "https://api.qnsp.cuilabs.io/proxy/tenant",
|
|
22
|
-
apiKey: process.env.QNSP_SERVICE_TOKEN!,
|
|
23
|
-
});
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## Tier requirements
|
|
27
|
-
|
|
28
|
-
Tenant management APIs are available on every tier. Higher tiers add more tenant seats or compliance
|
|
29
|
-
features, but there are no SDK-side restrictions.
|
|
30
|
-
|
|
31
|
-
## Usage example
|
|
13
|
+
## Quick Start
|
|
32
14
|
|
|
33
|
-
```
|
|
15
|
+
```typescript
|
|
34
16
|
import { TenantClient } from "@qnsp/tenant-sdk";
|
|
35
17
|
|
|
36
18
|
const tenants = new TenantClient({
|
|
37
|
-
baseUrl: "https://api.qnsp.cuilabs.io
|
|
38
|
-
apiKey:
|
|
19
|
+
baseUrl: "https://api.qnsp.cuilabs.io",
|
|
20
|
+
apiKey: "YOUR_API_KEY",
|
|
39
21
|
});
|
|
40
22
|
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
slug: "cui-labs",
|
|
44
|
-
plan: "dev-pro",
|
|
45
|
-
region: "global",
|
|
46
|
-
security: {
|
|
47
|
-
controlPlaneTokenSha256: "...",
|
|
48
|
-
pqcSignatures: [],
|
|
49
|
-
hardwareProvider: null,
|
|
50
|
-
attestationStatus: null,
|
|
51
|
-
attestationProof: null,
|
|
52
|
-
},
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
const list = await tenants.listTenants({ limit: 25 });
|
|
23
|
+
const tenant = await tenants.getTenant("your-tenant-id");
|
|
24
|
+
const list = await tenants.listTenants({ limit: 20 });
|
|
56
25
|
```
|
|
57
26
|
|
|
58
|
-
##
|
|
27
|
+
## Documentation
|
|
59
28
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
29
|
+
- [SDK Reference](https://docs.qnsp.cuilabs.io/sdk/tenant-sdk)
|
|
30
|
+
- [API Documentation](https://docs.qnsp.cuilabs.io/api)
|
|
31
|
+
- [Getting Started](https://docs.qnsp.cuilabs.io/quickstart)
|
|
63
32
|
|
|
64
|
-
##
|
|
33
|
+
## Requirements
|
|
65
34
|
|
|
66
|
-
-
|
|
67
|
-
- [
|
|
68
|
-
- [Tier limits](../shared-kernel/src/tier-limits.ts)
|
|
35
|
+
- Node.js >= 20.0.0
|
|
36
|
+
- A QNSP account and API key ([sign up free](https://cloud.qnsp.cuilabs.io/signup))
|
|
69
37
|
|
|
70
38
|
## License
|
|
71
39
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
© 2025 QNSP - CUI LABS, Singapore
|
|
40
|
+
[Apache-2.0](./LICENSE)
|
package/dist/index.d.ts
CHANGED
|
@@ -117,6 +117,13 @@ export interface TierAlgorithmConfig {
|
|
|
117
117
|
}
|
|
118
118
|
/**
|
|
119
119
|
* Default algorithms per crypto policy tier.
|
|
120
|
+
* These match the definitions in packages/security/src/crypto-policy.ts
|
|
121
|
+
* and determine which algorithms appear in the portal's Generate Key dropdown.
|
|
122
|
+
*
|
|
123
|
+
* default: All supported PQC algorithms (NIST-finalized + candidates via liboqs)
|
|
124
|
+
* strict: NIST-finalized/selected at higher security levels
|
|
125
|
+
* maximum: Highest-security NIST-finalized only
|
|
126
|
+
* government: FIPS-finalized only (no draft standards)
|
|
120
127
|
*/
|
|
121
128
|
export declare const CRYPTO_POLICY_ALGORITHMS: Record<CryptoPolicyTier, TierAlgorithmConfig>;
|
|
122
129
|
/**
|
|
@@ -205,6 +212,9 @@ export declare class TenantClient {
|
|
|
205
212
|
private readonly config;
|
|
206
213
|
private readonly telemetry;
|
|
207
214
|
private readonly targetService;
|
|
215
|
+
private activationPromise;
|
|
216
|
+
private readonly activationConfig;
|
|
217
|
+
private ensureActivated;
|
|
208
218
|
constructor(config: TenantClientConfig);
|
|
209
219
|
private request;
|
|
210
220
|
private requestWithRetry;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACX,qBAAqB,EACrB,2BAA2B,EAE3B,MAAM,oBAAoB,CAAC;AAI5B;;;;;GAKG;AAEH,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,CAAC,EAAE,qBAAqB,GAAG,2BAA2B,CAAC;IACzE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,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hooks";
|
|
2
|
+
import { activateSdk } from "@qnsp/sdk-activation";
|
|
2
3
|
import { createTenantClientTelemetry, isTenantClientTelemetry } from "./observability.js";
|
|
3
4
|
import { validateUUID } from "./validation.js";
|
|
4
5
|
/**
|
|
5
6
|
* Default algorithms per crypto policy tier.
|
|
7
|
+
* These match the definitions in packages/security/src/crypto-policy.ts
|
|
8
|
+
* and determine which algorithms appear in the portal's Generate Key dropdown.
|
|
9
|
+
*
|
|
10
|
+
* default: All supported PQC algorithms (NIST-finalized + candidates via liboqs)
|
|
11
|
+
* strict: NIST-finalized/selected at higher security levels
|
|
12
|
+
* maximum: Highest-security NIST-finalized only
|
|
13
|
+
* government: FIPS-finalized only (no draft standards)
|
|
6
14
|
*/
|
|
7
15
|
export const CRYPTO_POLICY_ALGORITHMS = {
|
|
8
16
|
default: {
|
|
9
|
-
kemAlgorithms: [
|
|
10
|
-
|
|
17
|
+
kemAlgorithms: [
|
|
18
|
+
// FIPS 203 — ML-KEM (NIST finalized)
|
|
19
|
+
"kyber-512",
|
|
20
|
+
"kyber-768",
|
|
21
|
+
"kyber-1024",
|
|
22
|
+
// HQC (NIST selected March 2025)
|
|
23
|
+
"hqc-128",
|
|
24
|
+
"hqc-192",
|
|
25
|
+
"hqc-256",
|
|
26
|
+
// BIKE (NIST Round 4 candidate)
|
|
27
|
+
"bike-l1",
|
|
28
|
+
"bike-l3",
|
|
29
|
+
"bike-l5",
|
|
30
|
+
// Classic McEliece (ISO standard)
|
|
31
|
+
"mceliece-348864",
|
|
32
|
+
"mceliece-460896",
|
|
33
|
+
"mceliece-6688128",
|
|
34
|
+
"mceliece-6960119",
|
|
35
|
+
"mceliece-8192128",
|
|
36
|
+
// FrodoKEM (ISO standard)
|
|
37
|
+
"frodokem-640-aes",
|
|
38
|
+
"frodokem-640-shake",
|
|
39
|
+
"frodokem-976-aes",
|
|
40
|
+
"frodokem-976-shake",
|
|
41
|
+
"frodokem-1344-aes",
|
|
42
|
+
"frodokem-1344-shake",
|
|
43
|
+
// NTRU (lattice-based)
|
|
44
|
+
"ntru-hps-2048-509",
|
|
45
|
+
"ntru-hps-2048-677",
|
|
46
|
+
"ntru-hps-4096-821",
|
|
47
|
+
"ntru-hps-4096-1229",
|
|
48
|
+
"ntru-hrss-701",
|
|
49
|
+
"ntru-hrss-1373",
|
|
50
|
+
// NTRU-Prime
|
|
51
|
+
"sntrup761",
|
|
52
|
+
],
|
|
53
|
+
signatureAlgorithms: [
|
|
54
|
+
// FIPS 204 — ML-DSA (NIST finalized)
|
|
55
|
+
"dilithium-2",
|
|
56
|
+
"dilithium-3",
|
|
57
|
+
"dilithium-5",
|
|
58
|
+
// FIPS 205 — SLH-DSA (NIST finalized, SHA-2 variants)
|
|
59
|
+
"sphincs-sha2-128f-simple",
|
|
60
|
+
"sphincs-sha2-128s-simple",
|
|
61
|
+
"sphincs-sha2-192f-simple",
|
|
62
|
+
"sphincs-sha2-192s-simple",
|
|
63
|
+
"sphincs-sha2-256f-simple",
|
|
64
|
+
"sphincs-sha2-256s-simple",
|
|
65
|
+
// FIPS 205 — SLH-DSA (NIST finalized, SHAKE variants)
|
|
66
|
+
"sphincs-shake-128f-simple",
|
|
67
|
+
"sphincs-shake-128s-simple",
|
|
68
|
+
"sphincs-shake-192f-simple",
|
|
69
|
+
"sphincs-shake-192s-simple",
|
|
70
|
+
"sphincs-shake-256f-simple",
|
|
71
|
+
"sphincs-shake-256s-simple",
|
|
72
|
+
// FN-DSA / Falcon (FIPS 206 draft)
|
|
73
|
+
"falcon-512",
|
|
74
|
+
"falcon-1024",
|
|
75
|
+
// MAYO (NIST Additional Signatures Round 2)
|
|
76
|
+
"mayo-1",
|
|
77
|
+
"mayo-2",
|
|
78
|
+
"mayo-3",
|
|
79
|
+
"mayo-5",
|
|
80
|
+
// CROSS (NIST Additional Signatures Round 2)
|
|
81
|
+
"cross-rsdp-128-balanced",
|
|
82
|
+
"cross-rsdp-128-fast",
|
|
83
|
+
"cross-rsdp-128-small",
|
|
84
|
+
"cross-rsdp-192-balanced",
|
|
85
|
+
"cross-rsdp-192-fast",
|
|
86
|
+
"cross-rsdp-192-small",
|
|
87
|
+
"cross-rsdp-256-balanced",
|
|
88
|
+
"cross-rsdp-256-fast",
|
|
89
|
+
"cross-rsdp-256-small",
|
|
90
|
+
"cross-rsdpg-128-balanced",
|
|
91
|
+
"cross-rsdpg-128-fast",
|
|
92
|
+
"cross-rsdpg-128-small",
|
|
93
|
+
"cross-rsdpg-192-balanced",
|
|
94
|
+
"cross-rsdpg-192-fast",
|
|
95
|
+
"cross-rsdpg-192-small",
|
|
96
|
+
"cross-rsdpg-256-balanced",
|
|
97
|
+
"cross-rsdpg-256-fast",
|
|
98
|
+
"cross-rsdpg-256-small",
|
|
99
|
+
// UOV (NIST Additional Signatures Round 2)
|
|
100
|
+
"ov-Is",
|
|
101
|
+
"ov-Ip",
|
|
102
|
+
"ov-III",
|
|
103
|
+
"ov-V",
|
|
104
|
+
"ov-Is-pkc",
|
|
105
|
+
"ov-Ip-pkc",
|
|
106
|
+
"ov-III-pkc",
|
|
107
|
+
"ov-V-pkc",
|
|
108
|
+
"ov-Is-pkc-skc",
|
|
109
|
+
"ov-Ip-pkc-skc",
|
|
110
|
+
"ov-III-pkc-skc",
|
|
111
|
+
"ov-V-pkc-skc",
|
|
112
|
+
// SNOVA (NIST Additional Signatures Round 2)
|
|
113
|
+
"snova-24-5-4",
|
|
114
|
+
"snova-24-5-4-shake",
|
|
115
|
+
"snova-24-5-4-esk",
|
|
116
|
+
"snova-24-5-4-shake-esk",
|
|
117
|
+
"snova-25-8-3",
|
|
118
|
+
"snova-37-17-2",
|
|
119
|
+
"snova-37-8-4",
|
|
120
|
+
"snova-24-5-5",
|
|
121
|
+
"snova-56-25-2",
|
|
122
|
+
"snova-49-11-3",
|
|
123
|
+
"snova-60-10-4",
|
|
124
|
+
"snova-29-6-5",
|
|
125
|
+
],
|
|
11
126
|
defaultKemAlgorithm: "kyber-768",
|
|
12
127
|
defaultSignatureAlgorithm: "dilithium-3",
|
|
13
128
|
},
|
|
14
129
|
strict: {
|
|
15
|
-
kemAlgorithms: ["kyber-768", "kyber-1024"],
|
|
16
|
-
signatureAlgorithms: [
|
|
130
|
+
kemAlgorithms: ["kyber-768", "kyber-1024", "hqc-192", "hqc-256"],
|
|
131
|
+
signatureAlgorithms: [
|
|
132
|
+
"dilithium-3",
|
|
133
|
+
"dilithium-5",
|
|
134
|
+
"falcon-1024",
|
|
135
|
+
"sphincs-sha2-256f-simple",
|
|
136
|
+
"sphincs-sha2-256s-simple",
|
|
137
|
+
"sphincs-shake-256f-simple",
|
|
138
|
+
"sphincs-shake-256s-simple",
|
|
139
|
+
],
|
|
17
140
|
defaultKemAlgorithm: "kyber-768",
|
|
18
141
|
defaultSignatureAlgorithm: "dilithium-3",
|
|
19
142
|
},
|
|
20
143
|
maximum: {
|
|
21
|
-
kemAlgorithms: ["kyber-1024"],
|
|
22
|
-
signatureAlgorithms: [
|
|
144
|
+
kemAlgorithms: ["kyber-1024", "hqc-256"],
|
|
145
|
+
signatureAlgorithms: [
|
|
146
|
+
"dilithium-5",
|
|
147
|
+
"falcon-1024",
|
|
148
|
+
"sphincs-sha2-256f-simple",
|
|
149
|
+
"sphincs-shake-256f-simple",
|
|
150
|
+
],
|
|
23
151
|
defaultKemAlgorithm: "kyber-1024",
|
|
24
152
|
defaultSignatureAlgorithm: "dilithium-5",
|
|
25
153
|
},
|
|
26
154
|
government: {
|
|
27
155
|
kemAlgorithms: ["kyber-1024"],
|
|
28
|
-
signatureAlgorithms: ["dilithium-5", "sphincs-shake-256f-simple"],
|
|
156
|
+
signatureAlgorithms: ["dilithium-5", "sphincs-sha2-256f-simple", "sphincs-shake-256f-simple"],
|
|
29
157
|
defaultKemAlgorithm: "kyber-1024",
|
|
30
158
|
defaultSignatureAlgorithm: "dilithium-5",
|
|
31
159
|
},
|
|
@@ -158,19 +286,41 @@ export class TenantClient {
|
|
|
158
286
|
config;
|
|
159
287
|
telemetry;
|
|
160
288
|
targetService;
|
|
289
|
+
activationPromise = null;
|
|
290
|
+
activationConfig;
|
|
291
|
+
async ensureActivated() {
|
|
292
|
+
if (!this.activationPromise) {
|
|
293
|
+
this.activationPromise = activateSdk(this.activationConfig).then(() => undefined);
|
|
294
|
+
}
|
|
295
|
+
await this.activationPromise;
|
|
296
|
+
}
|
|
161
297
|
constructor(config) {
|
|
162
298
|
if (!config.apiKey || config.apiKey.trim().length === 0) {
|
|
163
299
|
throw new Error("QNSP Tenant SDK: apiKey is required. " +
|
|
164
300
|
"Get your free API key at https://cloud.qnsp.cuilabs.io/signup — " +
|
|
165
|
-
"no credit card required (FREE tier:
|
|
301
|
+
"no credit card required (FREE tier: 10 GB storage, 50,000 API calls/month). " +
|
|
166
302
|
"Docs: https://docs.qnsp.cuilabs.io/sdk/tenant-sdk");
|
|
167
303
|
}
|
|
168
304
|
const baseUrl = config.baseUrl.replace(/\/$/, "");
|
|
169
|
-
// Enforce HTTPS in production (allow HTTP
|
|
305
|
+
// Enforce HTTPS in production (allow HTTP for localhost in development and
|
|
306
|
+
// for internal service-mesh hostnames — e.g. *.internal — which are on a
|
|
307
|
+
// private VPC network and do not require TLS termination at the transport layer).
|
|
170
308
|
if (!baseUrl.startsWith("https://")) {
|
|
171
309
|
const isLocalhost = baseUrl.startsWith("http://localhost") || baseUrl.startsWith("http://127.0.0.1");
|
|
310
|
+
let isInternalService = false;
|
|
311
|
+
try {
|
|
312
|
+
const parsed = new URL(baseUrl);
|
|
313
|
+
isInternalService =
|
|
314
|
+
parsed.protocol === "http:" &&
|
|
315
|
+
(parsed.hostname.endsWith(".internal") ||
|
|
316
|
+
parsed.hostname === "localhost" ||
|
|
317
|
+
parsed.hostname === "127.0.0.1");
|
|
318
|
+
}
|
|
319
|
+
catch {
|
|
320
|
+
// ignore; invalid URL will be caught later by fetch
|
|
321
|
+
}
|
|
172
322
|
const isDevelopment = process.env["NODE_ENV"] === "development" || process.env["NODE_ENV"] === "test";
|
|
173
|
-
if (!isLocalhost || !isDevelopment) {
|
|
323
|
+
if ((!isLocalhost || !isDevelopment) && !isInternalService) {
|
|
174
324
|
throw new Error("baseUrl must use HTTPS in production. HTTP is only allowed for localhost in development.");
|
|
175
325
|
}
|
|
176
326
|
}
|
|
@@ -192,6 +342,12 @@ export class TenantClient {
|
|
|
192
342
|
catch {
|
|
193
343
|
this.targetService = "tenant-service";
|
|
194
344
|
}
|
|
345
|
+
this.activationConfig = {
|
|
346
|
+
apiKey: config.apiKey,
|
|
347
|
+
sdkId: "tenant-sdk",
|
|
348
|
+
sdkVersion: "0.3.0",
|
|
349
|
+
platformUrl: config.baseUrl,
|
|
350
|
+
};
|
|
195
351
|
}
|
|
196
352
|
async request(method, path, options) {
|
|
197
353
|
return this.requestWithRetry(method, path, options, 0);
|
|
@@ -296,6 +452,7 @@ export class TenantClient {
|
|
|
296
452
|
* Requires PQC-signed security envelope and optional signature.
|
|
297
453
|
*/
|
|
298
454
|
async createTenant(request) {
|
|
455
|
+
await this.ensureActivated();
|
|
299
456
|
// Validation is handled by the service, but we validate format here for early feedback
|
|
300
457
|
return this.request("POST", "/tenant/v1/tenants", {
|
|
301
458
|
body: {
|
|
@@ -319,6 +476,7 @@ export class TenantClient {
|
|
|
319
476
|
*/
|
|
320
477
|
async updateTenant(id, request) {
|
|
321
478
|
validateUUID(id, "id");
|
|
479
|
+
await this.ensureActivated();
|
|
322
480
|
return this.request("PATCH", `/tenant/v1/tenants/${id}`, {
|
|
323
481
|
body: {
|
|
324
482
|
...(request.plan !== undefined ? { plan: request.plan } : {}),
|
|
@@ -338,6 +496,7 @@ export class TenantClient {
|
|
|
338
496
|
*/
|
|
339
497
|
async getTenant(id) {
|
|
340
498
|
validateUUID(id, "id");
|
|
499
|
+
await this.ensureActivated();
|
|
341
500
|
return this.request("GET", `/tenant/v1/tenants/${id}`, {
|
|
342
501
|
operation: "getTenant",
|
|
343
502
|
});
|
|
@@ -347,6 +506,7 @@ export class TenantClient {
|
|
|
347
506
|
* Returns a list of tenants and an optional next cursor for pagination.
|
|
348
507
|
*/
|
|
349
508
|
async listTenants(options) {
|
|
509
|
+
await this.ensureActivated();
|
|
350
510
|
const params = new URLSearchParams();
|
|
351
511
|
if (options?.limit !== undefined) {
|
|
352
512
|
params.set("limit", String(options.limit));
|
|
@@ -367,6 +527,7 @@ export class TenantClient {
|
|
|
367
527
|
*/
|
|
368
528
|
async getTenantCryptoPolicy(tenantId) {
|
|
369
529
|
validateUUID(tenantId, "tenantId");
|
|
530
|
+
await this.ensureActivated();
|
|
370
531
|
return this.request("GET", `/tenant/v1/tenants/${tenantId}/crypto-policy`, {
|
|
371
532
|
operation: "getTenantCryptoPolicy",
|
|
372
533
|
});
|
|
@@ -377,6 +538,7 @@ export class TenantClient {
|
|
|
377
538
|
*/
|
|
378
539
|
async getTenantCryptoPolicyV1(tenantId) {
|
|
379
540
|
validateUUID(tenantId, "tenantId");
|
|
541
|
+
await this.ensureActivated();
|
|
380
542
|
return this.request("GET", `/tenant/v1/tenants/${tenantId}/crypto-policy-v1`, {
|
|
381
543
|
operation: "getTenantCryptoPolicyV1",
|
|
382
544
|
});
|
|
@@ -386,6 +548,7 @@ export class TenantClient {
|
|
|
386
548
|
*/
|
|
387
549
|
async listTenantCryptoPolicyV1History(tenantId, options) {
|
|
388
550
|
validateUUID(tenantId, "tenantId");
|
|
551
|
+
await this.ensureActivated();
|
|
389
552
|
const params = new URLSearchParams();
|
|
390
553
|
if (options?.limit !== undefined) {
|
|
391
554
|
params.set("limit", String(options.limit));
|
|
@@ -404,6 +567,7 @@ export class TenantClient {
|
|
|
404
567
|
*/
|
|
405
568
|
async upsertTenantCryptoPolicy(tenantId, policy) {
|
|
406
569
|
validateUUID(tenantId, "tenantId");
|
|
570
|
+
await this.ensureActivated();
|
|
407
571
|
return this.request("PUT", `/tenant/v1/tenants/${tenantId}/crypto-policy`, {
|
|
408
572
|
body: {
|
|
409
573
|
policyTier: policy.policyTier,
|
|
@@ -426,6 +590,7 @@ export class TenantClient {
|
|
|
426
590
|
*/
|
|
427
591
|
async updateTenantCryptoPolicyV1(tenantId, policy, etag) {
|
|
428
592
|
validateUUID(tenantId, "tenantId");
|
|
593
|
+
await this.ensureActivated();
|
|
429
594
|
if (!etag) {
|
|
430
595
|
throw new Error("etag is required for updateTenantCryptoPolicyV1");
|
|
431
596
|
}
|
|
@@ -442,6 +607,7 @@ export class TenantClient {
|
|
|
442
607
|
*/
|
|
443
608
|
async enableTier0Legacy(tenantId, input, etag) {
|
|
444
609
|
validateUUID(tenantId, "tenantId");
|
|
610
|
+
await this.ensureActivated();
|
|
445
611
|
if (!etag) {
|
|
446
612
|
throw new Error("etag is required for enableTier0Legacy");
|
|
447
613
|
}
|
|
@@ -458,6 +624,7 @@ export class TenantClient {
|
|
|
458
624
|
*/
|
|
459
625
|
async disableTier0Legacy(tenantId, etag) {
|
|
460
626
|
validateUUID(tenantId, "tenantId");
|
|
627
|
+
await this.ensureActivated();
|
|
461
628
|
if (!etag) {
|
|
462
629
|
throw new Error("etag is required for disableTier0Legacy");
|
|
463
630
|
}
|
|
@@ -474,6 +641,7 @@ export class TenantClient {
|
|
|
474
641
|
*/
|
|
475
642
|
async enableTier4Experimental(tenantId, input, etag) {
|
|
476
643
|
validateUUID(tenantId, "tenantId");
|
|
644
|
+
await this.ensureActivated();
|
|
477
645
|
if (!etag) {
|
|
478
646
|
throw new Error("etag is required for enableTier4Experimental");
|
|
479
647
|
}
|
|
@@ -490,6 +658,7 @@ export class TenantClient {
|
|
|
490
658
|
*/
|
|
491
659
|
async rollbackTenantCryptoPolicyV1(tenantId, input, etag) {
|
|
492
660
|
validateUUID(tenantId, "tenantId");
|
|
661
|
+
await this.ensureActivated();
|
|
493
662
|
if (!etag) {
|
|
494
663
|
throw new Error("etag is required for rollbackTenantCryptoPolicyV1");
|
|
495
664
|
}
|
|
@@ -512,6 +681,8 @@ export class TenantClient {
|
|
|
512
681
|
* Convenience method that fetches the policy and returns the allowed algorithms.
|
|
513
682
|
*/
|
|
514
683
|
async getAllowedKemAlgorithms(tenantId) {
|
|
684
|
+
validateUUID(tenantId, "tenantId");
|
|
685
|
+
await this.ensureActivated();
|
|
515
686
|
const policy = await this.getTenantCryptoPolicy(tenantId);
|
|
516
687
|
if (policy.customAllowedKemAlgorithms && policy.customAllowedKemAlgorithms.length > 0) {
|
|
517
688
|
return policy.customAllowedKemAlgorithms;
|
|
@@ -523,6 +694,8 @@ export class TenantClient {
|
|
|
523
694
|
* Convenience method that fetches the policy and returns the allowed algorithms.
|
|
524
695
|
*/
|
|
525
696
|
async getAllowedSignatureAlgorithms(tenantId) {
|
|
697
|
+
validateUUID(tenantId, "tenantId");
|
|
698
|
+
await this.ensureActivated();
|
|
526
699
|
const policy = await this.getTenantCryptoPolicy(tenantId);
|
|
527
700
|
if (policy.customAllowedSignatureAlgorithms &&
|
|
528
701
|
policy.customAllowedSignatureAlgorithms.length > 0) {
|
|
@@ -534,6 +707,8 @@ export class TenantClient {
|
|
|
534
707
|
* Get the default KEM algorithm for a tenant based on their crypto policy tier.
|
|
535
708
|
*/
|
|
536
709
|
async getDefaultKemAlgorithm(tenantId) {
|
|
710
|
+
validateUUID(tenantId, "tenantId");
|
|
711
|
+
await this.ensureActivated();
|
|
537
712
|
const policy = await this.getTenantCryptoPolicy(tenantId);
|
|
538
713
|
return CRYPTO_POLICY_ALGORITHMS[policy.policyTier].defaultKemAlgorithm;
|
|
539
714
|
}
|
|
@@ -541,6 +716,8 @@ export class TenantClient {
|
|
|
541
716
|
* Get the default signature algorithm for a tenant based on their crypto policy tier.
|
|
542
717
|
*/
|
|
543
718
|
async getDefaultSignatureAlgorithm(tenantId) {
|
|
719
|
+
validateUUID(tenantId, "tenantId");
|
|
720
|
+
await this.ensureActivated();
|
|
544
721
|
const policy = await this.getTenantCryptoPolicy(tenantId);
|
|
545
722
|
return CRYPTO_POLICY_ALGORITHMS[policy.policyTier].defaultSignatureAlgorithm;
|
|
546
723
|
}
|