@registrystack/client 0.26.1 → 0.27.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 +22 -0
- package/evidence/client.d.ts +77 -8
- package/index.js +7 -6
- package/native.js +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -15,6 +15,28 @@ const registry = new breg.BaseRegistryClient({
|
|
|
15
15
|
});
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
+
A TypeScript consumer also needs the Node type definitions, and must name
|
|
19
|
+
them. The published declarations use `Buffer`, a Node.js global, and
|
|
20
|
+
TypeScript 6 does not load installed `@types` packages on its own, so a
|
|
21
|
+
project compiling against the declarations reports `TS2591` on every use of
|
|
22
|
+
`Buffer` until it has both installed the package and listed it in
|
|
23
|
+
`compilerOptions.types`:
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
npm install --save-dev "@types/node"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```json
|
|
30
|
+
{
|
|
31
|
+
"compilerOptions": {
|
|
32
|
+
"types": ["node"]
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The package does not declare that dependency itself, because a JavaScript
|
|
38
|
+
consumer does not need it.
|
|
39
|
+
|
|
18
40
|
Each product remains in its own namespace because its routing,
|
|
19
41
|
authentication, errors, and verification rules are different. The package
|
|
20
42
|
uses one platform-specific native dependency containing all four bindings.
|
package/evidence/client.d.ts
CHANGED
|
@@ -4,6 +4,12 @@
|
|
|
4
4
|
// `__test__/drift.test.js`, against the real module.
|
|
5
5
|
export * from './index'
|
|
6
6
|
|
|
7
|
+
import {
|
|
8
|
+
EvidenceClient as NativeEvidenceClient,
|
|
9
|
+
PreparedEvidenceRequest,
|
|
10
|
+
PreparedEvidenceRequestBatch,
|
|
11
|
+
} from './index'
|
|
12
|
+
|
|
7
13
|
/** The signed response encoding closed before one request is sent. */
|
|
8
14
|
export type EvidenceResponseFormat = 'signed-jws' | 'sd-jwt-vc'
|
|
9
15
|
|
|
@@ -24,17 +30,22 @@ export type ProgressiveSubjectContinuity =
|
|
|
24
30
|
|
|
25
31
|
export interface ProgressiveVerifiedResult {
|
|
26
32
|
readonly evidence: unknown
|
|
27
|
-
|
|
33
|
+
/** The exchange's trace identifier, `null` when the response carried none. */
|
|
34
|
+
readonly traceId: string | null
|
|
28
35
|
readonly values: Readonly<Record<string, unknown>>
|
|
29
36
|
readonly value: unknown
|
|
30
37
|
readonly subjectContinuity: ProgressiveSubjectContinuity
|
|
31
38
|
}
|
|
32
39
|
|
|
40
|
+
/** A signed-JWS result. The credential member of the native result is `null`. */
|
|
33
41
|
export interface ProgressiveVerifiedAssertion extends ProgressiveVerifiedResult {
|
|
34
42
|
readonly assertion: Buffer
|
|
43
|
+
readonly credential: null
|
|
35
44
|
}
|
|
36
45
|
|
|
46
|
+
/** An SD-JWT VC result. The assertion member of the native result is `null`. */
|
|
37
47
|
export interface ProgressiveVerifiedAudienceScopedCredential extends ProgressiveVerifiedResult {
|
|
48
|
+
readonly assertion: null
|
|
38
49
|
readonly credential: string
|
|
39
50
|
}
|
|
40
51
|
|
|
@@ -53,20 +64,78 @@ export type AudienceScopedRequest = {
|
|
|
53
64
|
bindingReceipt?: SubjectBindingReceipt
|
|
54
65
|
}
|
|
55
66
|
|
|
56
|
-
/**
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
67
|
+
/**
|
|
68
|
+
* The pinned verification key set, as a JWKS document. It is a trust input:
|
|
69
|
+
* the client never fetches one to verify a response it already holds.
|
|
70
|
+
*/
|
|
71
|
+
export interface TrustedJwks {
|
|
72
|
+
keys: ReadonlyArray<Readonly<Record<string, unknown>>>
|
|
73
|
+
readonly [field: string]: unknown
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* A private-key-JWT client-credentials exchange the client performs for
|
|
78
|
+
* itself. `clientKey` holds the private half; it stays in this process and
|
|
79
|
+
* reaches nothing but the token endpoint.
|
|
80
|
+
*/
|
|
81
|
+
export interface PrivateKeyJwtConfig {
|
|
82
|
+
tokenEndpoint: string
|
|
83
|
+
clientId: string
|
|
84
|
+
clientKey: Readonly<Record<string, unknown>>
|
|
85
|
+
audience?: string
|
|
86
|
+
assertionLifetimeSeconds?: number
|
|
87
|
+
refreshMarginSeconds?: number
|
|
88
|
+
requestTimeoutMs?: number
|
|
89
|
+
connectTimeoutMs?: number
|
|
90
|
+
userAgent?: string
|
|
91
|
+
/** Additional trust roots for the token endpoint, as a PEM bundle. */
|
|
92
|
+
trustedRootCertificates?: string
|
|
60
93
|
}
|
|
61
94
|
|
|
62
|
-
/**
|
|
63
|
-
|
|
95
|
+
/**
|
|
96
|
+
* Exactly one credential source. A configuration naming both is refused, so a
|
|
97
|
+
* merge of two authentication settings cannot silently pick one.
|
|
98
|
+
*/
|
|
99
|
+
export type EvidenceTokenConfig =
|
|
100
|
+
| { static: string }
|
|
101
|
+
| { privateKeyJwt: PrivateKeyJwtConfig }
|
|
102
|
+
|
|
103
|
+
/** The configuration `new EvidenceClient(...)` reads. */
|
|
104
|
+
export interface EvidenceClientConfig {
|
|
105
|
+
baseUrl: string
|
|
106
|
+
trustedJwks: TrustedJwks
|
|
107
|
+
revokedKeyIds: ReadonlyArray<string>
|
|
108
|
+
token: EvidenceTokenConfig
|
|
109
|
+
requestTimeoutMs?: number
|
|
110
|
+
connectTimeoutMs?: number
|
|
111
|
+
userAgent?: string
|
|
112
|
+
/** Additional trust roots for the deployment, as a PEM bundle. */
|
|
113
|
+
trustedRootCertificates?: string
|
|
114
|
+
maxResponseBytes?: number
|
|
115
|
+
maxMetadataBytes?: number
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* The client `client.js` exports, which subclasses the generated one so every
|
|
120
|
+
* mapped failure normalizes to an `EvidenceClientError`. Declaring it as a
|
|
121
|
+
* subclass, rather than as an interface of the same name, is what keeps the
|
|
122
|
+
* generated construct signature reachable: a same-named interface would
|
|
123
|
+
* shadow the re-exported class and leave `new EvidenceClient(...)` untyped.
|
|
124
|
+
*
|
|
125
|
+
* The members below only narrow generated declarations that cross as
|
|
126
|
+
* JSON-shaped `any`; every other member is inherited unchanged.
|
|
127
|
+
*/
|
|
128
|
+
export declare class EvidenceClient extends NativeEvidenceClient {
|
|
129
|
+
constructor(config: EvidenceClientConfig)
|
|
130
|
+
prepare(spec: EvidenceRequestSpec): PreparedEvidenceRequest
|
|
131
|
+
prepareBatch(spec: EvidenceRequestBatchSpec): PreparedEvidenceRequestBatch
|
|
132
|
+
request(request: AudienceScopedRequest): Promise<ProgressiveResult>
|
|
64
133
|
/**
|
|
65
134
|
* Read an application-owned profile. `privateKeyJwk` is optional and is
|
|
66
135
|
* intended for an in-memory secret-manager result; it is never retained by
|
|
67
136
|
* the JavaScript wrapper.
|
|
68
137
|
*/
|
|
69
|
-
|
|
138
|
+
static fromProfile(path: string, privateKeyJwk?: Readonly<Record<string, unknown>>): EvidenceClient
|
|
70
139
|
}
|
|
71
140
|
|
|
72
141
|
/**
|
package/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
module.exports
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
// One assignment per namespace, never a `module.exports` object literal: Node
|
|
4
|
+
// scans this file for these statements to synthesise the named exports an ESM
|
|
5
|
+
// consumer imports, and `require()` sees the same four properties either way.
|
|
6
|
+
exports.discovery = require('./discovery/client');
|
|
7
|
+
exports.evidence = require('./evidence/client');
|
|
8
|
+
exports.relay = require('./relay/client');
|
|
9
|
+
exports.breg = require('./breg/client');
|
package/native.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@registrystack/client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0",
|
|
4
4
|
"description": "Unified Node.js client for Registry Stack products.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"publishConfig": {
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"typescript": "6.0.3"
|
|
43
43
|
},
|
|
44
44
|
"optionalDependencies": {
|
|
45
|
-
"@registrystack/client-darwin-arm64": "0.
|
|
46
|
-
"@registrystack/client-linux-arm64-gnu": "0.
|
|
47
|
-
"@registrystack/client-linux-x64-gnu": "0.
|
|
45
|
+
"@registrystack/client-darwin-arm64": "0.27.0",
|
|
46
|
+
"@registrystack/client-linux-arm64-gnu": "0.27.0",
|
|
47
|
+
"@registrystack/client-linux-x64-gnu": "0.27.0"
|
|
48
48
|
}
|
|
49
49
|
}
|