euclid-ndk 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 +201 -0
- package/README.md +603 -0
- package/dist/auth/index.d.ts +18 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +17 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/rfc9421.d.ts +112 -0
- package/dist/auth/rfc9421.d.ts.map +1 -0
- package/dist/auth/rfc9421.js +452 -0
- package/dist/auth/rfc9421.js.map +1 -0
- package/dist/auth/scheme.d.ts +46 -0
- package/dist/auth/scheme.d.ts.map +1 -0
- package/dist/auth/scheme.js +44 -0
- package/dist/auth/scheme.js.map +1 -0
- package/dist/auth/signable.d.ts +37 -0
- package/dist/auth/signable.d.ts.map +1 -0
- package/dist/auth/signable.js +70 -0
- package/dist/auth/signable.js.map +1 -0
- package/dist/auth/sigv4.d.ts +72 -0
- package/dist/auth/sigv4.d.ts.map +1 -0
- package/dist/auth/sigv4.js +227 -0
- package/dist/auth/sigv4.js.map +1 -0
- package/dist/credentials.d.ts +56 -0
- package/dist/credentials.d.ts.map +1 -0
- package/dist/credentials.js +135 -0
- package/dist/credentials.js.map +1 -0
- package/dist/dto/com.d.ts +101 -0
- package/dist/dto/com.d.ts.map +1 -0
- package/dist/dto/com.js +132 -0
- package/dist/dto/com.js.map +1 -0
- package/dist/dto/eag.d.ts +104 -0
- package/dist/dto/eag.d.ts.map +1 -0
- package/dist/dto/eag.js +70 -0
- package/dist/dto/eag.js.map +1 -0
- package/dist/dto/eam.d.ts +105 -0
- package/dist/dto/eam.d.ts.map +1 -0
- package/dist/dto/eam.js +98 -0
- package/dist/dto/eam.js.map +1 -0
- package/dist/dto/eap.d.ts +88 -0
- package/dist/dto/eap.d.ts.map +1 -0
- package/dist/dto/eap.js +54 -0
- package/dist/dto/eap.js.map +1 -0
- package/dist/dto/ekm.d.ts +109 -0
- package/dist/dto/ekm.d.ts.map +1 -0
- package/dist/dto/ekm.js +78 -0
- package/dist/dto/ekm.js.map +1 -0
- package/dist/dto/ekv.d.ts +73 -0
- package/dist/dto/ekv.d.ts.map +1 -0
- package/dist/dto/ekv.js +45 -0
- package/dist/dto/ekv.js.map +1 -0
- package/dist/dto/ens.d.ts +84 -0
- package/dist/dto/ens.d.ts.map +1 -0
- package/dist/dto/ens.js +72 -0
- package/dist/dto/ens.js.map +1 -0
- package/dist/dto/eqs.d.ts +160 -0
- package/dist/dto/eqs.d.ts.map +1 -0
- package/dist/dto/eqs.js +120 -0
- package/dist/dto/eqs.js.map +1 -0
- package/dist/dto/esm.d.ts +192 -0
- package/dist/dto/esm.d.ts.map +1 -0
- package/dist/dto/esm.js +147 -0
- package/dist/dto/esm.js.map +1 -0
- package/dist/dto/ess.d.ts +49 -0
- package/dist/dto/ess.d.ts.map +1 -0
- package/dist/dto/ess.js +30 -0
- package/dist/dto/ess.js.map +1 -0
- package/dist/dto/json.d.ts +24 -0
- package/dist/dto/json.d.ts.map +1 -0
- package/dist/dto/json.js +47 -0
- package/dist/dto/json.js.map +1 -0
- package/dist/errors.d.ts +40 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +73 -0
- package/dist/errors.js.map +1 -0
- package/dist/http/client.d.ts +96 -0
- package/dist/http/client.d.ts.map +1 -0
- package/dist/http/client.js +258 -0
- package/dist/http/client.js.map +1 -0
- package/dist/index.d.ts +93 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +110 -0
- package/dist/index.js.map +1 -0
- package/dist/modules/base.d.ts +121 -0
- package/dist/modules/base.d.ts.map +1 -0
- package/dist/modules/base.js +142 -0
- package/dist/modules/base.js.map +1 -0
- package/dist/modules/eag.d.ts +166 -0
- package/dist/modules/eag.d.ts.map +1 -0
- package/dist/modules/eag.js +189 -0
- package/dist/modules/eag.js.map +1 -0
- package/dist/modules/eam.d.ts +314 -0
- package/dist/modules/eam.d.ts.map +1 -0
- package/dist/modules/eam.js +641 -0
- package/dist/modules/eam.js.map +1 -0
- package/dist/modules/eap.d.ts +204 -0
- package/dist/modules/eap.d.ts.map +1 -0
- package/dist/modules/eap.js +218 -0
- package/dist/modules/eap.js.map +1 -0
- package/dist/modules/ekm.d.ts +182 -0
- package/dist/modules/ekm.d.ts.map +1 -0
- package/dist/modules/ekm.js +228 -0
- package/dist/modules/ekm.js.map +1 -0
- package/dist/modules/ekv.d.ts +189 -0
- package/dist/modules/ekv.d.ts.map +1 -0
- package/dist/modules/ekv.js +212 -0
- package/dist/modules/ekv.js.map +1 -0
- package/dist/modules/ens.d.ts +122 -0
- package/dist/modules/ens.d.ts.map +1 -0
- package/dist/modules/ens.js +167 -0
- package/dist/modules/ens.js.map +1 -0
- package/dist/modules/eqs.d.ts +283 -0
- package/dist/modules/eqs.d.ts.map +1 -0
- package/dist/modules/eqs.js +355 -0
- package/dist/modules/eqs.js.map +1 -0
- package/dist/modules/esm.d.ts +358 -0
- package/dist/modules/esm.d.ts.map +1 -0
- package/dist/modules/esm.js +660 -0
- package/dist/modules/esm.js.map +1 -0
- package/dist/modules/ess.d.ts +96 -0
- package/dist/modules/ess.d.ts.map +1 -0
- package/dist/modules/ess.js +110 -0
- package/dist/modules/ess.js.map +1 -0
- package/dist/url.d.ts +31 -0
- package/dist/url.d.ts.map +1 -0
- package/dist/url.js +47 -0
- package/dist/url.js.map +1 -0
- package/package.json +47 -0
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EAM - euclid's access management module: login, users, groups, accounts, namespaces, keys.
|
|
3
|
+
*
|
|
4
|
+
* Two objects. {@link EuclidEam} is the login builder: it collects the server, the credentials and
|
|
5
|
+
* the options, and hands back a session. {@link EuclidSession} is that session - the authenticated
|
|
6
|
+
* client every other call goes through, and the thing that holds the token and the access key the
|
|
7
|
+
* login produced.
|
|
8
|
+
*
|
|
9
|
+
* The split exists because logging in and being logged in need different arguments. A builder that
|
|
10
|
+
* also carried the operations would let a caller write `.listUsers()` on an object that has not
|
|
11
|
+
* authenticated yet, and a session that also carried the login options would have a namespace field
|
|
12
|
+
* that means one thing before login and another after.
|
|
13
|
+
*/
|
|
14
|
+
import { type SigningScheme } from "../auth/index.js";
|
|
15
|
+
import { type CachedCredentials } from "../credentials.js";
|
|
16
|
+
import { type Account, type AccessKey, type CreateAccessKeyResult, type Namespace, type Page, type User, type UserGroup } from "../dto/eam.js";
|
|
17
|
+
import { EuclidHttpClient, type HeaderFactory } from "../http/client.js";
|
|
18
|
+
import { type ListOptions } from "./base.js";
|
|
19
|
+
import { EuclidEag } from "./eag.js";
|
|
20
|
+
import { EuclidEap } from "./eap.js";
|
|
21
|
+
import { EuclidEkm } from "./ekm.js";
|
|
22
|
+
import { EuclidEkv } from "./ekv.js";
|
|
23
|
+
import { EuclidEns } from "./ens.js";
|
|
24
|
+
import { EuclidEqs } from "./eqs.js";
|
|
25
|
+
import { EuclidEsm } from "./esm.js";
|
|
26
|
+
import { EuclidEss } from "./ess.js";
|
|
27
|
+
export type { ListOptions } from "./base.js";
|
|
28
|
+
export declare const TARGET = "eam";
|
|
29
|
+
/**
|
|
30
|
+
* Authenticate with a signature when there is an access key to sign with, and with the bearer token
|
|
31
|
+
* otherwise. euclid accepts either for every action (`HttpActionServer::Authenticate`).
|
|
32
|
+
*/
|
|
33
|
+
export declare const AUTH_AUTO = "auto";
|
|
34
|
+
/**
|
|
35
|
+
* Always sign. Fails loudly if the session has no access key, rather than quietly falling back to a
|
|
36
|
+
* token - which is what a caller who asked for signatures wants to know about.
|
|
37
|
+
*/
|
|
38
|
+
export declare const AUTH_SIGNATURE = "signature";
|
|
39
|
+
/** Always present the bearer token, even when an access key is available. */
|
|
40
|
+
export declare const AUTH_BEARER = "bearer";
|
|
41
|
+
/** How a session authenticates: {@link AUTH_AUTO}, {@link AUTH_SIGNATURE} or {@link AUTH_BEARER}. */
|
|
42
|
+
export type AuthMode = typeof AUTH_AUTO | typeof AUTH_SIGNATURE | typeof AUTH_BEARER;
|
|
43
|
+
/** Everything {@link EuclidSession} needs to exist, which is what a login produces. */
|
|
44
|
+
export interface SessionOptions {
|
|
45
|
+
baseUrl: string;
|
|
46
|
+
token: string;
|
|
47
|
+
userId: string;
|
|
48
|
+
accountId: string;
|
|
49
|
+
region: string;
|
|
50
|
+
accessKeyId: string;
|
|
51
|
+
secretAccessKey: string;
|
|
52
|
+
isAdmin: boolean;
|
|
53
|
+
namespace: string;
|
|
54
|
+
raw: Record<string, unknown>;
|
|
55
|
+
caCertPath: string | null;
|
|
56
|
+
verify: boolean;
|
|
57
|
+
timeoutMs: number;
|
|
58
|
+
signingScheme: SigningScheme;
|
|
59
|
+
auth: AuthMode;
|
|
60
|
+
cache: boolean;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Builder for authenticating against a euclid server.
|
|
64
|
+
*
|
|
65
|
+
* ```ts
|
|
66
|
+
* const session = await EuclidEam.forServer("https://euclid.example.com")
|
|
67
|
+
* .credentials("jens", "secret")
|
|
68
|
+
* .login();
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
export declare class EuclidEam {
|
|
72
|
+
#private;
|
|
73
|
+
constructor(baseUrl: string);
|
|
74
|
+
/** Targets a euclid server, e.g. `https://euclid.example.com`. */
|
|
75
|
+
static forServer(baseUrl: string): EuclidEam;
|
|
76
|
+
/** The user ID to log in as. */
|
|
77
|
+
username(username: string): this;
|
|
78
|
+
/**
|
|
79
|
+
* The email address to log in with, when there is no user ID.
|
|
80
|
+
*
|
|
81
|
+
* The server resolves the user by ID first and only falls back to the email, so setting both
|
|
82
|
+
* silently ignores the email; {@link login} sends whichever one identifies the account.
|
|
83
|
+
*/
|
|
84
|
+
email(email: string): this;
|
|
85
|
+
/** The password. */
|
|
86
|
+
password(password: string): this;
|
|
87
|
+
/** User ID and password together. */
|
|
88
|
+
credentials(username: string, password: string): this;
|
|
89
|
+
/**
|
|
90
|
+
* The namespace to make active once login succeeds.
|
|
91
|
+
*
|
|
92
|
+
* Applied with a follow-up `change-namespace` call, mirroring euclid-cli's `eam login
|
|
93
|
+
* --namespace`, and applied whether the login was fresh or served from the cache - a cached
|
|
94
|
+
* session may have been established before this was ever asked for, or scoped to another
|
|
95
|
+
* namespace.
|
|
96
|
+
*/
|
|
97
|
+
namespace(namespace: string): this;
|
|
98
|
+
/** The path to post the login to. `/` unless a deployment puts the gateway elsewhere. */
|
|
99
|
+
loginPath(path: string): this;
|
|
100
|
+
/** A PEM CA certificate to trust alongside the system store, or null for the store alone. */
|
|
101
|
+
caCertPath(path: string | null): this;
|
|
102
|
+
/** Whether to verify the server's certificate. Turn it off for development servers only. */
|
|
103
|
+
verify(verify: boolean): this;
|
|
104
|
+
/** How long to wait for a response, in milliseconds. */
|
|
105
|
+
timeout(milliseconds: number): this;
|
|
106
|
+
/**
|
|
107
|
+
* Which signing scheme the session signs with. SigV4 unless told otherwise, as euclid's server
|
|
108
|
+
* has understood that one from the start.
|
|
109
|
+
*/
|
|
110
|
+
signingScheme(scheme: SigningScheme): this;
|
|
111
|
+
/** How the session authenticates: {@link AUTH_AUTO}, {@link AUTH_SIGNATURE} or {@link AUTH_BEARER}. */
|
|
112
|
+
auth(mode: AuthMode): this;
|
|
113
|
+
/**
|
|
114
|
+
* Whether `~/.euclid/credentials` may be read and written. On by default, which is what makes a
|
|
115
|
+
* login shared with euclid-cli, euclid-jdk and euclid-pdk.
|
|
116
|
+
*/
|
|
117
|
+
useCache(useCache: boolean): this;
|
|
118
|
+
/**
|
|
119
|
+
* Authenticates, and answers with the session every other call goes through.
|
|
120
|
+
*
|
|
121
|
+
* A still-valid cached session for this server is reused rather than re-authenticating, so
|
|
122
|
+
* calling this repeatedly costs nothing after the first time. Pass `useCache(false)` to force a
|
|
123
|
+
* fresh login.
|
|
124
|
+
*
|
|
125
|
+
* @throws {EuclidAuthenticationError} if the server refuses the credentials.
|
|
126
|
+
* @throws {Error} if no password, or neither a username nor an email, was set and there is no
|
|
127
|
+
* cached session to fall back on.
|
|
128
|
+
*/
|
|
129
|
+
login(): Promise<EuclidSession>;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* An authenticated session, and every EAM operation that needs one.
|
|
133
|
+
*
|
|
134
|
+
* Holds two credentials, because the server accepts two. The bearer token is what a login always
|
|
135
|
+
* produces; the access key and secret are what it produces when the user has one, and they are what
|
|
136
|
+
* a signature is made with. Which of the two a request presents is decided per session by
|
|
137
|
+
* {@link EuclidSession.auth} - see {@link AUTH_AUTO}.
|
|
138
|
+
*
|
|
139
|
+
* Sessions are mutable: {@link EuclidSession.changeNamespace} changes this session rather than
|
|
140
|
+
* answering with a new one, since the namespace is a property of what the caller is doing next
|
|
141
|
+
* rather than of the login.
|
|
142
|
+
*/
|
|
143
|
+
export declare class EuclidSession {
|
|
144
|
+
#private;
|
|
145
|
+
readonly baseUrl: string;
|
|
146
|
+
token: string;
|
|
147
|
+
readonly userId: string;
|
|
148
|
+
readonly accountId: string;
|
|
149
|
+
readonly region: string;
|
|
150
|
+
readonly accessKeyId: string;
|
|
151
|
+
readonly secretAccessKey: string;
|
|
152
|
+
readonly isAdmin: boolean;
|
|
153
|
+
namespace: string;
|
|
154
|
+
readonly raw: Record<string, unknown>;
|
|
155
|
+
signingScheme: SigningScheme;
|
|
156
|
+
readonly auth: AuthMode;
|
|
157
|
+
/**
|
|
158
|
+
* Where the bearer token comes from, when it does not simply come from {@link EuclidSession.token}.
|
|
159
|
+
*
|
|
160
|
+
* A process that runs for days holds a token that does not last that long. euclid rewrites an
|
|
161
|
+
* application's credentials file before the token in it expires, so an application that cached the
|
|
162
|
+
* first token it saw would start collecting 401s about an hour in. Setting this to something that
|
|
163
|
+
* re-reads that file makes the session follow the rotation, and is what the retry on "credentials
|
|
164
|
+
* expired" then has something new to retry with.
|
|
165
|
+
*/
|
|
166
|
+
tokenProvider: (() => string) | null;
|
|
167
|
+
constructor(options: SessionOptions);
|
|
168
|
+
/** This session in the shape `~/.euclid/credentials` holds it. */
|
|
169
|
+
toCachedCredentials(): CachedCredentials;
|
|
170
|
+
/** The `@authority` this session's signatures are made over, for diagnostics. */
|
|
171
|
+
get authority(): string;
|
|
172
|
+
/**
|
|
173
|
+
* Whether this session signs even the requests that would otherwise present the token.
|
|
174
|
+
*
|
|
175
|
+
* What {@link AUTH_SIGNATURE} means to a module whose action carries raw bytes: those present the
|
|
176
|
+
* token by default, and a session that asked for signatures gets them anyway. Asked of the session
|
|
177
|
+
* rather than read off {@link auth} by each module client, so that "what this mode means" is decided
|
|
178
|
+
* in one place - and so that a module client needs no value out of this module at all, which is what
|
|
179
|
+
* keeps the import between the two one-directional.
|
|
180
|
+
*/
|
|
181
|
+
get alwaysSigns(): boolean;
|
|
182
|
+
/** Releases the connections this session was holding, its module clients' included. */
|
|
183
|
+
close(): void;
|
|
184
|
+
/**
|
|
185
|
+
* ESM - euclid's storage module - on this session's credentials.
|
|
186
|
+
*
|
|
187
|
+
* The same client each time, so an application that reaches for this inside a loop pays for one
|
|
188
|
+
* connection rather than one per iteration. It follows this session: a {@link changeNamespace}
|
|
189
|
+
* between two calls scopes the second one, and a {@link tokenProvider} set here is the token it
|
|
190
|
+
* presents.
|
|
191
|
+
*/
|
|
192
|
+
esm(): EuclidEsm;
|
|
193
|
+
/** EQS - euclid's queue module - on this session's credentials. */
|
|
194
|
+
eqs(): EuclidEqs;
|
|
195
|
+
/** ENS - euclid's notification module - on this session's credentials. */
|
|
196
|
+
ens(): EuclidEns;
|
|
197
|
+
/** EKM - euclid's key management module - on this session's credentials. */
|
|
198
|
+
ekm(): EuclidEkm;
|
|
199
|
+
/** EKV - euclid's key-value store - on this session's credentials. */
|
|
200
|
+
ekv(): EuclidEkv;
|
|
201
|
+
/** EAP - euclid's application platform - on this session's credentials. */
|
|
202
|
+
eap(): EuclidEap;
|
|
203
|
+
/** ESS - euclid's secret store - on this session's credentials. */
|
|
204
|
+
ess(): EuclidEss;
|
|
205
|
+
/** EAG - euclid's API gateway - on this session's credentials. */
|
|
206
|
+
eag(): EuclidEag;
|
|
207
|
+
/** One page of users, and how many exist in total. */
|
|
208
|
+
listUsers(options?: ListOptions): Promise<Page<User>>;
|
|
209
|
+
/** Creates a user. `accountId` and `region` default to this session's own. */
|
|
210
|
+
register(userId: string, password: string, options?: {
|
|
211
|
+
email?: string;
|
|
212
|
+
accountId?: string;
|
|
213
|
+
region?: string;
|
|
214
|
+
isAdmin?: boolean;
|
|
215
|
+
}): Promise<User>;
|
|
216
|
+
/** Deletes a user. */
|
|
217
|
+
deleteUser(userId: string): Promise<void>;
|
|
218
|
+
/**
|
|
219
|
+
* Switches the namespace every namespace-scoped call is restricted to, until changed again.
|
|
220
|
+
*
|
|
221
|
+
* The server validates it against the current account and the caller's grants, so this is a round
|
|
222
|
+
* trip rather than a local assignment. An empty string clears the scope.
|
|
223
|
+
*
|
|
224
|
+
* Answers with this session, so it can be chained onto a login.
|
|
225
|
+
*/
|
|
226
|
+
changeNamespace(namespace: string): Promise<this>;
|
|
227
|
+
/**
|
|
228
|
+
* Creates an access key for this session's user.
|
|
229
|
+
*
|
|
230
|
+
* The secret comes back here and nowhere else - {@link listAccessKeys} will never show it again -
|
|
231
|
+
* so a caller that does not store it has to create another key.
|
|
232
|
+
*/
|
|
233
|
+
createAccessKey(): Promise<CreateAccessKeyResult>;
|
|
234
|
+
/** This user's own access keys, without their secrets. */
|
|
235
|
+
listAccessKeys(): Promise<AccessKey[]>;
|
|
236
|
+
/** Deletes one of this user's own access keys. */
|
|
237
|
+
deleteAccessKey(accessKeyId: string): Promise<void>;
|
|
238
|
+
/** Creates an empty user group. Administrator only. */
|
|
239
|
+
createUserGroup(name: string, description?: string): Promise<UserGroup>;
|
|
240
|
+
/** One page of user groups, and how many exist in total. */
|
|
241
|
+
listUserGroups(options?: ListOptions): Promise<Page<UserGroup>>;
|
|
242
|
+
/** Adds a user to a group. Both are ERNs. */
|
|
243
|
+
addUserToUserGroup(userGroup: string, user: string): Promise<void>;
|
|
244
|
+
/** Removes a user from a group. Both are ERNs. */
|
|
245
|
+
removeUserFromUserGroup(userGroup: string, user: string): Promise<void>;
|
|
246
|
+
/** Deletes a user group. Administrator only. */
|
|
247
|
+
deleteUserGroup(name: string): Promise<void>;
|
|
248
|
+
/**
|
|
249
|
+
* Creates an account. Administrator only - account creation is platform-level and is not
|
|
250
|
+
* delegated to account owners.
|
|
251
|
+
*/
|
|
252
|
+
createAccount(accountId: string, name: string, description?: string): Promise<Account>;
|
|
253
|
+
/** One page of accounts, and how many exist in total. */
|
|
254
|
+
listAccounts(options?: ListOptions): Promise<Page<Account>>;
|
|
255
|
+
/** Deletes an account. Administrator only, and it must have no namespaces or grants left. */
|
|
256
|
+
deleteAccount(accountId: string): Promise<void>;
|
|
257
|
+
/** Creates a namespace under an account. Requires admin rights on that account. */
|
|
258
|
+
createNamespace(accountId: string, name: string, description?: string): Promise<Namespace>;
|
|
259
|
+
/** One page of an account's namespaces, and how many exist in total. */
|
|
260
|
+
listNamespaces(accountId: string, options?: ListOptions): Promise<Page<Namespace>>;
|
|
261
|
+
/** Deletes a namespace. Requires admin rights on the account, and no grants may remain. */
|
|
262
|
+
deleteNamespace(accountId: string, name: string): Promise<void>;
|
|
263
|
+
/** Grants a user access to a namespace. Requires admin rights on the account. */
|
|
264
|
+
grantNamespaceAccess(user: string, accountId: string, namespace: string): Promise<void>;
|
|
265
|
+
/** Revokes a user's access to a namespace. Requires admin rights on the account. */
|
|
266
|
+
revokeNamespaceAccess(user: string, accountId: string, namespace: string): Promise<void>;
|
|
267
|
+
/**
|
|
268
|
+
* EAM's own metrics, as the server collects them. Answered unparsed - the shape belongs to the
|
|
269
|
+
* monitoring module rather than to EAM.
|
|
270
|
+
*/
|
|
271
|
+
metrics(): Promise<Record<string, unknown>>;
|
|
272
|
+
/**
|
|
273
|
+
* Sends any EAM action, for one this SDK does not wrap yet.
|
|
274
|
+
*
|
|
275
|
+
* Public on purpose: a server that gains an action should be reachable without waiting for a
|
|
276
|
+
* release here.
|
|
277
|
+
*/
|
|
278
|
+
call(action: string, payload?: Record<string, unknown>, timeoutMs?: number): Promise<Record<string, unknown>>;
|
|
279
|
+
/**
|
|
280
|
+
* Every header a request to one of this session's modules goes out with, signature included.
|
|
281
|
+
*
|
|
282
|
+
* Takes the target rather than assuming EAM because the target is signed: a client for another
|
|
283
|
+
* module has to sign for *its* module, and signing here rather than in each module client is what
|
|
284
|
+
* keeps one implementation of how this session authenticates.
|
|
285
|
+
*/
|
|
286
|
+
requestHeaders(target: string, action: string, body: Buffer): Record<string, string>;
|
|
287
|
+
/** Who is asking and what they are scoped to. Signed, apart from the namespace. */
|
|
288
|
+
routingHeaders(): Record<string, string>;
|
|
289
|
+
/**
|
|
290
|
+
* The authentication headers alone, rebuilt per request.
|
|
291
|
+
*
|
|
292
|
+
* Rebuilt rather than cached because a signature is only valid around the moment it was made, and
|
|
293
|
+
* because this is what the client calls again when the server says the credentials it just
|
|
294
|
+
* presented had expired.
|
|
295
|
+
*/
|
|
296
|
+
authHeaders(target: string, action: string, body: Buffer): Record<string, string>;
|
|
297
|
+
/**
|
|
298
|
+
* The bearer token, presented as an `Authorization` header.
|
|
299
|
+
*
|
|
300
|
+
* Its own method because a request is not always free to sign: a module whose action carries raw
|
|
301
|
+
* bytes presents the token whatever this session would otherwise do.
|
|
302
|
+
*/
|
|
303
|
+
bearerHeaders(): Record<string, string>;
|
|
304
|
+
/** The bearer token to present now - {@link tokenProvider}'s, or {@link token}. */
|
|
305
|
+
currentToken(): string;
|
|
306
|
+
/**
|
|
307
|
+
* A connection to this session's server, on the TLS and timeout settings it logged in with.
|
|
308
|
+
*
|
|
309
|
+
* The factory is what a request whose credentials expired in flight is rebuilt with, so a module
|
|
310
|
+
* client passes the one that rebuilds *its* headers - see {@link authHeaders}.
|
|
311
|
+
*/
|
|
312
|
+
newClient(headerFactory: HeaderFactory): EuclidHttpClient;
|
|
313
|
+
}
|
|
314
|
+
//# sourceMappingURL=eam.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eam.d.ts","sourceRoot":"","sources":["../../src/mod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