@anthropic-ai/sdk 0.92.0 → 0.93.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/CHANGELOG.md +8 -0
- package/client.d.mts +73 -0
- package/client.d.mts.map +1 -1
- package/client.d.ts +73 -0
- package/client.d.ts.map +1 -1
- package/client.js +258 -9
- package/client.js.map +1 -1
- package/client.mjs +258 -9
- package/client.mjs.map +1 -1
- package/core/credentials.d.mts +111 -0
- package/core/credentials.d.mts.map +1 -0
- package/core/credentials.d.ts +111 -0
- package/core/credentials.d.ts.map +1 -0
- package/core/credentials.js +298 -0
- package/core/credentials.js.map +1 -0
- package/core/credentials.mjs +259 -0
- package/core/credentials.mjs.map +1 -0
- package/internal/utils/time.d.mts +3 -0
- package/internal/utils/time.d.mts.map +1 -0
- package/internal/utils/time.d.ts +3 -0
- package/internal/utils/time.d.ts.map +1 -0
- package/internal/utils/time.js +8 -0
- package/internal/utils/time.js.map +1 -0
- package/internal/utils/time.mjs +5 -0
- package/internal/utils/time.mjs.map +1 -0
- package/lib/credentials/credential-chain.d.mts +39 -0
- package/lib/credentials/credential-chain.d.mts.map +1 -0
- package/lib/credentials/credential-chain.d.ts +39 -0
- package/lib/credentials/credential-chain.d.ts.map +1 -0
- package/lib/credentials/credential-chain.js +237 -0
- package/lib/credentials/credential-chain.js.map +1 -0
- package/lib/credentials/credential-chain.mjs +200 -0
- package/lib/credentials/credential-chain.mjs.map +1 -0
- package/lib/credentials/identity-token.d.mts +11 -0
- package/lib/credentials/identity-token.d.mts.map +1 -0
- package/lib/credentials/identity-token.d.ts +11 -0
- package/lib/credentials/identity-token.d.ts.map +1 -0
- package/lib/credentials/identity-token.js +72 -0
- package/lib/credentials/identity-token.js.map +1 -0
- package/lib/credentials/identity-token.mjs +35 -0
- package/lib/credentials/identity-token.mjs.map +1 -0
- package/lib/credentials/oidc-federation.d.mts +28 -0
- package/lib/credentials/oidc-federation.d.mts.map +1 -0
- package/lib/credentials/oidc-federation.d.ts +28 -0
- package/lib/credentials/oidc-federation.d.ts.map +1 -0
- package/lib/credentials/oidc-federation.js +69 -0
- package/lib/credentials/oidc-federation.js.map +1 -0
- package/lib/credentials/oidc-federation.mjs +66 -0
- package/lib/credentials/oidc-federation.mjs.map +1 -0
- package/lib/credentials/token-cache.d.mts +54 -0
- package/lib/credentials/token-cache.d.mts.map +1 -0
- package/lib/credentials/token-cache.d.ts +54 -0
- package/lib/credentials/token-cache.d.ts.map +1 -0
- package/lib/credentials/token-cache.js +112 -0
- package/lib/credentials/token-cache.js.map +1 -0
- package/lib/credentials/token-cache.mjs +108 -0
- package/lib/credentials/token-cache.mjs.map +1 -0
- package/lib/credentials/types.d.mts +96 -0
- package/lib/credentials/types.d.mts.map +1 -0
- package/lib/credentials/types.d.ts +96 -0
- package/lib/credentials/types.d.ts.map +1 -0
- package/lib/credentials/types.js +266 -0
- package/lib/credentials/types.js.map +1 -0
- package/lib/credentials/types.mjs +224 -0
- package/lib/credentials/types.mjs.map +1 -0
- package/lib/credentials/user-oauth.d.mts +21 -0
- package/lib/credentials/user-oauth.d.mts.map +1 -0
- package/lib/credentials/user-oauth.d.ts +21 -0
- package/lib/credentials/user-oauth.d.ts.map +1 -0
- package/lib/credentials/user-oauth.js +130 -0
- package/lib/credentials/user-oauth.js.map +1 -0
- package/lib/credentials/user-oauth.mjs +94 -0
- package/lib/credentials/user-oauth.mjs.map +1 -0
- package/lib/credentials.d.mts +4 -0
- package/lib/credentials.d.mts.map +1 -0
- package/lib/credentials.d.ts +4 -0
- package/lib/credentials.d.ts.map +1 -0
- package/lib/credentials.js +8 -0
- package/lib/credentials.js.map +1 -0
- package/lib/credentials.mjs +3 -0
- package/lib/credentials.mjs.map +1 -0
- package/package.json +1 -1
- package/src/client.ts +342 -14
- package/src/core/credentials.ts +349 -0
- package/src/internal/utils/time.ts +4 -0
- package/src/lib/credentials/credential-chain.ts +284 -0
- package/src/lib/credentials/identity-token.ts +37 -0
- package/src/lib/credentials/oidc-federation.ts +112 -0
- package/src/lib/credentials/token-cache.ts +130 -0
- package/src/lib/credentials/types.ts +295 -0
- package/src/lib/credentials/user-oauth.ts +144 -0
- package/src/lib/credentials.ts +3 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { getPlatformHeaders } from "../internal/detect-platform.mjs";
|
|
2
|
+
import { readEnv } from "../internal/utils.mjs";
|
|
3
|
+
/** Current schema version written to `configs/<profile>.json`. Absent on read ⇒ "1.0". */
|
|
4
|
+
export const CONFIG_FILE_VERSION = '1.0';
|
|
5
|
+
/** Current schema version written to `credentials/<profile>.json`. Absent on read ⇒ "1.0". */
|
|
6
|
+
export const CREDENTIALS_FILE_VERSION = '1.0';
|
|
7
|
+
const PROFILE_NAME_PATTERN = /^[A-Za-z0-9_.-]+$/;
|
|
8
|
+
function validateProfileName(name) {
|
|
9
|
+
if (!name) {
|
|
10
|
+
throw new Error('profile name is empty');
|
|
11
|
+
}
|
|
12
|
+
if (name === '.' || name === '..') {
|
|
13
|
+
throw new Error(`profile name "${name}" is not allowed`);
|
|
14
|
+
}
|
|
15
|
+
if (name.includes('/') || name.includes('\\')) {
|
|
16
|
+
throw new Error(`profile name "${name}" must not contain path separators`);
|
|
17
|
+
}
|
|
18
|
+
if (!PROFILE_NAME_PATTERN.test(name)) {
|
|
19
|
+
throw new Error(`profile name "${name}" contains disallowed characters (allowed: letters, digits, '_', '.', '-')`);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Loads the Anthropic configuration for the given (or active) profile.
|
|
24
|
+
*
|
|
25
|
+
* Returns `null` when running in a browser or no configuration can be resolved.
|
|
26
|
+
* Otherwise, returns the configuration based on the config file and environment variables.
|
|
27
|
+
*
|
|
28
|
+
* **Profile resolution** (first match wins):
|
|
29
|
+
* 1. Explicit `profile` argument
|
|
30
|
+
* 2. `ANTHROPIC_PROFILE` environment variable
|
|
31
|
+
* 3. Contents of `<config_dir>/active_config` file
|
|
32
|
+
* 4. `"default"`
|
|
33
|
+
*
|
|
34
|
+
* **Config resolution:**
|
|
35
|
+
* - If `<config_dir>/configs/<profile>.json` exists, it is loaded and
|
|
36
|
+
* missing fields are filled from environment variables. Values present
|
|
37
|
+
* in the file take precedence — env vars only fill gaps:
|
|
38
|
+
* - `ANTHROPIC_BASE_URL` → `base_url`
|
|
39
|
+
* - `ANTHROPIC_ORGANIZATION_ID` → `organization_id`
|
|
40
|
+
* - `ANTHROPIC_SCOPE` → `authentication.scope`
|
|
41
|
+
* - `ANTHROPIC_FEDERATION_RULE_ID` → `authentication.federation_rule_id` (oidc_federation)
|
|
42
|
+
* - `ANTHROPIC_IDENTITY_TOKEN_FILE` → `authentication.identity_token` (oidc_federation)
|
|
43
|
+
* - `ANTHROPIC_SERVICE_ACCOUNT_ID` → `authentication.service_account_id` (oidc_federation)
|
|
44
|
+
* - If no config file exists, an `oidc_federation` config is synthesized
|
|
45
|
+
* entirely from environment variables when both `ANTHROPIC_FEDERATION_RULE_ID`
|
|
46
|
+
* and `ANTHROPIC_ORGANIZATION_ID` are set.
|
|
47
|
+
*/
|
|
48
|
+
export const loadConfig = async (profile) => {
|
|
49
|
+
var _a, _b;
|
|
50
|
+
const rootConfigPath = await getRootConfigPath();
|
|
51
|
+
if (rootConfigPath === null) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
const profileName = profile ?? (await getActiveProfileName());
|
|
55
|
+
if (profileName === null) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
validateProfileName(profileName);
|
|
59
|
+
const fs = await import('node:fs');
|
|
60
|
+
const path = await import('node:path');
|
|
61
|
+
const configPath = path.join(rootConfigPath, 'configs', `${profileName}.json`);
|
|
62
|
+
let configRaw;
|
|
63
|
+
try {
|
|
64
|
+
configRaw = await fs.promises.readFile(configPath, 'utf-8');
|
|
65
|
+
}
|
|
66
|
+
catch (err) {
|
|
67
|
+
if (err?.code !== 'ENOENT') {
|
|
68
|
+
throw new Error(`failed to read config file ${configPath}: ${err}`);
|
|
69
|
+
}
|
|
70
|
+
configRaw = null;
|
|
71
|
+
}
|
|
72
|
+
if (configRaw === null) {
|
|
73
|
+
const organizationId = readEnv('ANTHROPIC_ORGANIZATION_ID');
|
|
74
|
+
const identityTokenFile = readEnv('ANTHROPIC_IDENTITY_TOKEN_FILE');
|
|
75
|
+
const federationRuleId = readEnv('ANTHROPIC_FEDERATION_RULE_ID');
|
|
76
|
+
if (federationRuleId && organizationId) {
|
|
77
|
+
return {
|
|
78
|
+
organization_id: organizationId,
|
|
79
|
+
base_url: readEnv('ANTHROPIC_BASE_URL'),
|
|
80
|
+
authentication: {
|
|
81
|
+
type: 'oidc_federation',
|
|
82
|
+
federation_rule_id: federationRuleId,
|
|
83
|
+
service_account_id: readEnv('ANTHROPIC_SERVICE_ACCOUNT_ID'),
|
|
84
|
+
identity_token: identityTokenFile ? { source: 'file', path: identityTokenFile } : undefined,
|
|
85
|
+
scope: readEnv('ANTHROPIC_SCOPE'),
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
let config;
|
|
92
|
+
try {
|
|
93
|
+
config = JSON.parse(configRaw);
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
throw new Error(`failed to parse config file ${configPath}: ${err}`);
|
|
97
|
+
}
|
|
98
|
+
if (!config.authentication) {
|
|
99
|
+
throw new Error(`config file ${configPath} is missing "authentication"`);
|
|
100
|
+
}
|
|
101
|
+
const authType = config.authentication.type;
|
|
102
|
+
if (authType !== 'oidc_federation' && authType !== 'user_oauth') {
|
|
103
|
+
throw new Error(`authentication.type "${authType}" is not a known authentication type`);
|
|
104
|
+
}
|
|
105
|
+
// File values are authoritative; env vars only fill fields the file left unset.
|
|
106
|
+
config.organization_id ?? (config.organization_id = readEnv('ANTHROPIC_ORGANIZATION_ID'));
|
|
107
|
+
config.base_url ?? (config.base_url = readEnv('ANTHROPIC_BASE_URL'));
|
|
108
|
+
(_a = config.authentication).scope ?? (_a.scope = readEnv('ANTHROPIC_SCOPE'));
|
|
109
|
+
if (config.authentication.type === 'oidc_federation') {
|
|
110
|
+
if (!config.authentication.identity_token) {
|
|
111
|
+
const identityTokenFile = readEnv('ANTHROPIC_IDENTITY_TOKEN_FILE');
|
|
112
|
+
if (identityTokenFile) {
|
|
113
|
+
config.authentication.identity_token = {
|
|
114
|
+
source: 'file',
|
|
115
|
+
path: identityTokenFile,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
// Unlike siblings using `??= readEnv()` (which leaves `undefined`), coerce
|
|
120
|
+
// to '' so the type stays `string` (always set). The downstream required
|
|
121
|
+
// check in credential-chain rejects empty, so semantics match but types are
|
|
122
|
+
// cleaner.
|
|
123
|
+
if (!config.authentication.federation_rule_id) {
|
|
124
|
+
config.authentication.federation_rule_id = readEnv('ANTHROPIC_FEDERATION_RULE_ID') ?? '';
|
|
125
|
+
}
|
|
126
|
+
(_b = config.authentication).service_account_id ?? (_b.service_account_id = readEnv('ANTHROPIC_SERVICE_ACCOUNT_ID'));
|
|
127
|
+
}
|
|
128
|
+
return config;
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* Loads the credential material for the active profile.
|
|
132
|
+
*
|
|
133
|
+
* Returns the parsed credentials or `null` when running in a browser or
|
|
134
|
+
* no credentials file can be found.
|
|
135
|
+
*
|
|
136
|
+
* **Profile resolution** (first match wins):
|
|
137
|
+
* 1. `ANTHROPIC_PROFILE` environment variable
|
|
138
|
+
* 2. Contents of `<config_dir>/active_config` file
|
|
139
|
+
* 3. `"default"`
|
|
140
|
+
*
|
|
141
|
+
* **Credentials path resolution** (first match wins):
|
|
142
|
+
* 1. `authentication.credentials_path` from the active profile's config (via {@link loadConfig})
|
|
143
|
+
* 2. `<config_dir>/credentials/<profile>.json`
|
|
144
|
+
*/
|
|
145
|
+
export const loadCredentials = async () => {
|
|
146
|
+
const config = await loadConfig();
|
|
147
|
+
const credentialsPath = await getCredentialsPath(config);
|
|
148
|
+
if (!credentialsPath) {
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
const fs = await import('node:fs');
|
|
152
|
+
let raw;
|
|
153
|
+
try {
|
|
154
|
+
raw = await fs.promises.readFile(credentialsPath, 'utf-8');
|
|
155
|
+
}
|
|
156
|
+
catch (err) {
|
|
157
|
+
if (err?.code !== 'ENOENT') {
|
|
158
|
+
throw new Error(`failed to read credentials file ${credentialsPath}: ${err}`);
|
|
159
|
+
}
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
162
|
+
let creds;
|
|
163
|
+
try {
|
|
164
|
+
creds = JSON.parse(raw);
|
|
165
|
+
}
|
|
166
|
+
catch (err) {
|
|
167
|
+
throw new Error(`failed to parse credentials file ${credentialsPath}: ${err}`);
|
|
168
|
+
}
|
|
169
|
+
if (creds.type && creds.type !== 'oauth_token') {
|
|
170
|
+
throw new Error(`credentials file ${credentialsPath} has unsupported type "${creds.type}" (want "oauth_token")`);
|
|
171
|
+
}
|
|
172
|
+
return creds;
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* Resolves the credentials file path for the given config.
|
|
176
|
+
*
|
|
177
|
+
* Uses `authentication.credentials_path` from the config if set, otherwise
|
|
178
|
+
* falls back to `<config_dir>/credentials/<profile>.json`.
|
|
179
|
+
*
|
|
180
|
+
* Returns `null` when running in a browser or the path cannot be resolved.
|
|
181
|
+
*/
|
|
182
|
+
export const getCredentialsPath = async (config, profile) => {
|
|
183
|
+
if (config?.authentication.credentials_path) {
|
|
184
|
+
return config.authentication.credentials_path;
|
|
185
|
+
}
|
|
186
|
+
const rootConfigPath = await getRootConfigPath();
|
|
187
|
+
if (!rootConfigPath) {
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
const profileName = profile ?? (await getActiveProfileName());
|
|
191
|
+
if (!profileName) {
|
|
192
|
+
return null;
|
|
193
|
+
}
|
|
194
|
+
validateProfileName(profileName);
|
|
195
|
+
const path = await import('node:path');
|
|
196
|
+
return path.join(rootConfigPath, 'credentials', `${profileName}.json`);
|
|
197
|
+
};
|
|
198
|
+
const getRootConfigPath = async () => {
|
|
199
|
+
if (!supportsLocalConfigFiles()) {
|
|
200
|
+
return null;
|
|
201
|
+
}
|
|
202
|
+
const path = await import('node:path');
|
|
203
|
+
// ANTHROPIC_CONFIG_DIR is treated as a trusted path: it is set by the
|
|
204
|
+
// process operator, not by remote input, so it is not validated.
|
|
205
|
+
const configDir = readEnv('ANTHROPIC_CONFIG_DIR');
|
|
206
|
+
if (configDir) {
|
|
207
|
+
return configDir;
|
|
208
|
+
}
|
|
209
|
+
const os = getPlatformHeaders()['X-Stainless-OS'];
|
|
210
|
+
if (os === 'Windows') {
|
|
211
|
+
const appData = readEnv('APPDATA');
|
|
212
|
+
if (appData) {
|
|
213
|
+
return path.join(appData, 'Anthropic');
|
|
214
|
+
}
|
|
215
|
+
const userProfile = readEnv('USERPROFILE');
|
|
216
|
+
if (userProfile) {
|
|
217
|
+
return path.join(userProfile, 'AppData', 'Roaming', 'Anthropic');
|
|
218
|
+
}
|
|
219
|
+
// No usable Windows config root — return null so callers fall through to
|
|
220
|
+
// "no config available" rather than silently writing under C:\.
|
|
221
|
+
return null;
|
|
222
|
+
}
|
|
223
|
+
const xdgConfigHome = readEnv('XDG_CONFIG_HOME');
|
|
224
|
+
if (xdgConfigHome) {
|
|
225
|
+
return path.join(xdgConfigHome, 'anthropic');
|
|
226
|
+
}
|
|
227
|
+
const home = readEnv('HOME');
|
|
228
|
+
if (home) {
|
|
229
|
+
return path.join(home, '.config', 'anthropic');
|
|
230
|
+
}
|
|
231
|
+
return null;
|
|
232
|
+
};
|
|
233
|
+
const supportsLocalConfigFiles = () => {
|
|
234
|
+
const runtime = getPlatformHeaders()['X-Stainless-Runtime'];
|
|
235
|
+
return runtime === 'node' || runtime === 'deno';
|
|
236
|
+
};
|
|
237
|
+
const getActiveProfileName = async () => {
|
|
238
|
+
const rootConfigPath = await getRootConfigPath();
|
|
239
|
+
if (!rootConfigPath) {
|
|
240
|
+
return null;
|
|
241
|
+
}
|
|
242
|
+
const profileName = readEnv('ANTHROPIC_PROFILE');
|
|
243
|
+
if (profileName) {
|
|
244
|
+
return profileName;
|
|
245
|
+
}
|
|
246
|
+
const fs = await import('node:fs');
|
|
247
|
+
const path = await import('node:path');
|
|
248
|
+
const filePath = path.join(rootConfigPath, 'active_config');
|
|
249
|
+
try {
|
|
250
|
+
return (await fs.promises.readFile(filePath, 'utf-8')).trim() || 'default';
|
|
251
|
+
}
|
|
252
|
+
catch (err) {
|
|
253
|
+
if (err?.code !== 'ENOENT') {
|
|
254
|
+
throw new Error(`failed to read ${filePath}: ${err}`);
|
|
255
|
+
}
|
|
256
|
+
return 'default';
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
//# sourceMappingURL=credentials.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credentials.mjs","sourceRoot":"","sources":["../src/core/credentials.ts"],"names":[],"mappings":"OAAO,EAAE,kBAAkB,EAAE;OACtB,EAAE,OAAO,EAAE;AAElB,0FAA0F;AAC1F,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,CAAC;AACzC,8FAA8F;AAC9F,MAAM,CAAC,MAAM,wBAAwB,GAAG,KAAK,CAAC;AAgE9C,MAAM,oBAAoB,GAAG,mBAAmB,CAAC;AAEjD,SAAS,mBAAmB,CAAC,IAAY;IACvC,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;IACD,IAAI,IAAI,KAAK,GAAG,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CAAC,iBAAiB,IAAI,kBAAkB,CAAC,CAAC;IAC3D,C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O,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,SAAS,CAAC;IAC7E,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAK,GAA6B,EAAE,IAAI,KAAK,QAAQ,EAAE,CAAC;YACtD,MAAM,IAAI,KAAK,CAAC,kBAAkB,QAAQ,KAAK,GAAG,EAAE,CAAC,CAAC;QACxD,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time.d.mts","sourceRoot":"","sources":["../../src/internal/utils/time.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,wBAAgB,YAAY,IAAI,MAAM,CAErC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../src/internal/utils/time.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,wBAAgB,YAAY,IAAI,MAAM,CAErC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.nowAsSeconds = nowAsSeconds;
|
|
4
|
+
/** Current time as unix epoch seconds. */
|
|
5
|
+
function nowAsSeconds() {
|
|
6
|
+
return Math.floor(Date.now() / 1000);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=time.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time.js","sourceRoot":"","sources":["../../src/internal/utils/time.ts"],"names":[],"mappings":";;AACA,oCAEC;AAHD,0CAA0C;AAC1C,SAAgB,YAAY;IAC1B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time.mjs","sourceRoot":"","sources":["../../src/internal/utils/time.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,MAAM,UAAU,YAAY;IAC1B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Fetch } from "../../internal/builtin-types.mjs";
|
|
2
|
+
import { type AnthropicConfig } from "../../core/credentials.mjs";
|
|
3
|
+
import type { CredentialResult } from "./types.mjs";
|
|
4
|
+
/**
|
|
5
|
+
* Builds a {@link CredentialResult} from an explicit {@link AnthropicConfig}.
|
|
6
|
+
*
|
|
7
|
+
* Use this when constructing a client from an in-memory config object rather
|
|
8
|
+
* than from profile files or environment variables.
|
|
9
|
+
*
|
|
10
|
+
* For `oidc_federation`, `authentication.credentials_path` is optional —
|
|
11
|
+
* if omitted, every call performs a fresh exchange with no on-disk cache.
|
|
12
|
+
* For `user_oauth`, `authentication.credentials_path` is required (it is
|
|
13
|
+
* where the access/refresh tokens live).
|
|
14
|
+
*/
|
|
15
|
+
export type ResolverOptions = {
|
|
16
|
+
baseURL: string;
|
|
17
|
+
fetch: Fetch;
|
|
18
|
+
userAgent?: string | undefined;
|
|
19
|
+
onCacheWriteError?: ((err: unknown) => void) | undefined;
|
|
20
|
+
onSafetyWarning?: ((msg: string) => void) | undefined;
|
|
21
|
+
};
|
|
22
|
+
export declare function resolveCredentialsFromConfig(config: AnthropicConfig, options: ResolverOptions): CredentialResult;
|
|
23
|
+
/**
|
|
24
|
+
* Resolves a {@link CredentialResult} from the environment. Returns `null`
|
|
25
|
+
* when no credentials can be resolved.
|
|
26
|
+
*
|
|
27
|
+
* Resolution order:
|
|
28
|
+
*
|
|
29
|
+
* 1. Config file for the active profile (or the explicit `profile` argument)
|
|
30
|
+
* → dispatch on `authentication.type` (`oidc_federation`, `user_oauth`)
|
|
31
|
+
* 2. Environment variables `ANTHROPIC_FEDERATION_RULE_ID` +
|
|
32
|
+
* `ANTHROPIC_ORGANIZATION_ID` (+ identity token) → OIDC federation
|
|
33
|
+
* 3. Nothing matches → `null`
|
|
34
|
+
*
|
|
35
|
+
* Passing `profile` selects `<config_dir>/configs/<profile>.json` directly,
|
|
36
|
+
* skipping `ANTHROPIC_PROFILE` / `active_config` resolution.
|
|
37
|
+
*/
|
|
38
|
+
export declare function defaultCredentials(options: ResolverOptions, profile?: string): Promise<CredentialResult | null>;
|
|
39
|
+
//# sourceMappingURL=credential-chain.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credential-chain.d.mts","sourceRoot":"","sources":["../../src/lib/credentials/credential-chain.ts"],"names":[],"mappings":"OAAO,KAAK,EAAE,KAAK,EAAE;OAEd,EAIL,KAAK,eAAe,EACrB;OACM,KAAK,EAAuB,gBAAgB,EAAyB;AAY5E;;;;;;;;;;GAUG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,KAAK,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,iBAAiB,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IACzD,eAAe,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;CACvD,CAAC;AAEF,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,eAAe,GACvB,gBAAgB,CAkBlB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,eAAe,EACxB,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAsBlC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Fetch } from "../../internal/builtin-types.js";
|
|
2
|
+
import { type AnthropicConfig } from "../../core/credentials.js";
|
|
3
|
+
import type { CredentialResult } from "./types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Builds a {@link CredentialResult} from an explicit {@link AnthropicConfig}.
|
|
6
|
+
*
|
|
7
|
+
* Use this when constructing a client from an in-memory config object rather
|
|
8
|
+
* than from profile files or environment variables.
|
|
9
|
+
*
|
|
10
|
+
* For `oidc_federation`, `authentication.credentials_path` is optional —
|
|
11
|
+
* if omitted, every call performs a fresh exchange with no on-disk cache.
|
|
12
|
+
* For `user_oauth`, `authentication.credentials_path` is required (it is
|
|
13
|
+
* where the access/refresh tokens live).
|
|
14
|
+
*/
|
|
15
|
+
export type ResolverOptions = {
|
|
16
|
+
baseURL: string;
|
|
17
|
+
fetch: Fetch;
|
|
18
|
+
userAgent?: string | undefined;
|
|
19
|
+
onCacheWriteError?: ((err: unknown) => void) | undefined;
|
|
20
|
+
onSafetyWarning?: ((msg: string) => void) | undefined;
|
|
21
|
+
};
|
|
22
|
+
export declare function resolveCredentialsFromConfig(config: AnthropicConfig, options: ResolverOptions): CredentialResult;
|
|
23
|
+
/**
|
|
24
|
+
* Resolves a {@link CredentialResult} from the environment. Returns `null`
|
|
25
|
+
* when no credentials can be resolved.
|
|
26
|
+
*
|
|
27
|
+
* Resolution order:
|
|
28
|
+
*
|
|
29
|
+
* 1. Config file for the active profile (or the explicit `profile` argument)
|
|
30
|
+
* → dispatch on `authentication.type` (`oidc_federation`, `user_oauth`)
|
|
31
|
+
* 2. Environment variables `ANTHROPIC_FEDERATION_RULE_ID` +
|
|
32
|
+
* `ANTHROPIC_ORGANIZATION_ID` (+ identity token) → OIDC federation
|
|
33
|
+
* 3. Nothing matches → `null`
|
|
34
|
+
*
|
|
35
|
+
* Passing `profile` selects `<config_dir>/configs/<profile>.json` directly,
|
|
36
|
+
* skipping `ANTHROPIC_PROFILE` / `active_config` resolution.
|
|
37
|
+
*/
|
|
38
|
+
export declare function defaultCredentials(options: ResolverOptions, profile?: string): Promise<CredentialResult | null>;
|
|
39
|
+
//# sourceMappingURL=credential-chain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credential-chain.d.ts","sourceRoot":"","sources":["../../src/lib/credentials/credential-chain.ts"],"names":[],"mappings":"OAAO,KAAK,EAAE,KAAK,EAAE;OAEd,EAIL,KAAK,eAAe,EACrB;OACM,KAAK,EAAuB,gBAAgB,EAAyB;AAY5E;;;;;;;;;;GAUG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,KAAK,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,iBAAiB,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IACzD,eAAe,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;CACvD,CAAC;AAEF,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,eAAe,GACvB,gBAAgB,CAkBlB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,eAAe,EACxB,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAsBlC"}
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.resolveCredentialsFromConfig = resolveCredentialsFromConfig;
|
|
37
|
+
exports.defaultCredentials = defaultCredentials;
|
|
38
|
+
const env_1 = require("../../internal/utils/env.js");
|
|
39
|
+
const credentials_1 = require("../../core/credentials.js");
|
|
40
|
+
const types_1 = require("./types.js");
|
|
41
|
+
const time_1 = require("../../internal/utils/time.js");
|
|
42
|
+
const identity_token_1 = require("./identity-token.js");
|
|
43
|
+
const oidc_federation_1 = require("./oidc-federation.js");
|
|
44
|
+
const user_oauth_1 = require("./user-oauth.js");
|
|
45
|
+
function resolveCredentialsFromConfig(config, options) {
|
|
46
|
+
const credentialsPath = config.authentication.credentials_path ?? null;
|
|
47
|
+
const effectiveBaseURL = (config.base_url || options.baseURL).replace(/\/+$/, '');
|
|
48
|
+
const provider = buildProvider(config, credentialsPath, effectiveBaseURL, options);
|
|
49
|
+
const extraHeaders = {};
|
|
50
|
+
// Workspace scoping for oidc_federation is server-side (the federation rule
|
|
51
|
+
// encodes the workspace and the minted token is workspace-scoped), so the
|
|
52
|
+
// header is only meaningful for user_oauth.
|
|
53
|
+
if (config.workspace_id && config.authentication.type === 'user_oauth') {
|
|
54
|
+
extraHeaders['anthropic-workspace-id'] = config.workspace_id;
|
|
55
|
+
}
|
|
56
|
+
// Surface the profile's own base_url (not the options.baseURL fallback) so
|
|
57
|
+
// the client can adopt it for outbound API requests when the caller didn't
|
|
58
|
+
// pin one explicitly. Echoing options.baseURL back would defeat precedence.
|
|
59
|
+
return { provider, extraHeaders, baseURL: config.base_url || undefined };
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Resolves a {@link CredentialResult} from the environment. Returns `null`
|
|
63
|
+
* when no credentials can be resolved.
|
|
64
|
+
*
|
|
65
|
+
* Resolution order:
|
|
66
|
+
*
|
|
67
|
+
* 1. Config file for the active profile (or the explicit `profile` argument)
|
|
68
|
+
* → dispatch on `authentication.type` (`oidc_federation`, `user_oauth`)
|
|
69
|
+
* 2. Environment variables `ANTHROPIC_FEDERATION_RULE_ID` +
|
|
70
|
+
* `ANTHROPIC_ORGANIZATION_ID` (+ identity token) → OIDC federation
|
|
71
|
+
* 3. Nothing matches → `null`
|
|
72
|
+
*
|
|
73
|
+
* Passing `profile` selects `<config_dir>/configs/<profile>.json` directly,
|
|
74
|
+
* skipping `ANTHROPIC_PROFILE` / `active_config` resolution.
|
|
75
|
+
*/
|
|
76
|
+
async function defaultCredentials(options, profile) {
|
|
77
|
+
const config = await (0, credentials_1.loadConfig)(profile);
|
|
78
|
+
if (!config) {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
// For env/file-loaded configs, default credentials_path to the
|
|
82
|
+
// per-profile location so user_oauth and federation caching work.
|
|
83
|
+
// Shallow-clone first so callers that retain a reference to the loaded
|
|
84
|
+
// config don't observe the patched-in default.
|
|
85
|
+
const withPath = config.authentication.credentials_path ?
|
|
86
|
+
config
|
|
87
|
+
: {
|
|
88
|
+
...config,
|
|
89
|
+
authentication: {
|
|
90
|
+
...config.authentication,
|
|
91
|
+
credentials_path: (await (0, credentials_1.getCredentialsPath)(config, profile)) ?? undefined,
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
return resolveCredentialsFromConfig(withPath, options);
|
|
95
|
+
}
|
|
96
|
+
function buildProvider(config, credentialsPath, baseURL, options) {
|
|
97
|
+
switch (config.authentication.type) {
|
|
98
|
+
case 'oidc_federation': {
|
|
99
|
+
const auth = config.authentication;
|
|
100
|
+
const identityProvider = resolveIdentityTokenProvider(auth);
|
|
101
|
+
if (!identityProvider) {
|
|
102
|
+
throw new types_1.WorkloadIdentityError('oidc_federation config requires an identity token (set authentication.identity_token, ' +
|
|
103
|
+
'ANTHROPIC_IDENTITY_TOKEN_FILE, or ANTHROPIC_IDENTITY_TOKEN)');
|
|
104
|
+
}
|
|
105
|
+
if (!auth.federation_rule_id) {
|
|
106
|
+
throw new types_1.WorkloadIdentityError("oidc_federation config requires 'federation_rule_id'. Set it in authentication.federation_rule_id in your profile, or via ANTHROPIC_FEDERATION_RULE_ID (profile takes precedence).");
|
|
107
|
+
}
|
|
108
|
+
if (!config.organization_id) {
|
|
109
|
+
throw new types_1.WorkloadIdentityError('oidc_federation config requires organization_id (set ANTHROPIC_ORGANIZATION_ID or config.organization_id)');
|
|
110
|
+
}
|
|
111
|
+
const exchange = (0, oidc_federation_1.oidcFederationProvider)({
|
|
112
|
+
identityTokenProvider: identityProvider,
|
|
113
|
+
federationRuleId: auth.federation_rule_id,
|
|
114
|
+
organizationId: config.organization_id,
|
|
115
|
+
serviceAccountId: auth.service_account_id,
|
|
116
|
+
baseURL,
|
|
117
|
+
fetch: options.fetch,
|
|
118
|
+
userAgent: options.userAgent,
|
|
119
|
+
});
|
|
120
|
+
// If there's a credentials file path, wrap the exchange with file caching
|
|
121
|
+
// (check file for fresh token before exchanging, write back after).
|
|
122
|
+
if (credentialsPath) {
|
|
123
|
+
return cachedExchangeProvider(exchange, credentialsPath, options.onCacheWriteError, options.onSafetyWarning);
|
|
124
|
+
}
|
|
125
|
+
return exchange;
|
|
126
|
+
}
|
|
127
|
+
case 'user_oauth': {
|
|
128
|
+
if (!credentialsPath) {
|
|
129
|
+
throw new types_1.WorkloadIdentityError('user_oauth config requires authentication.credentials_path ' +
|
|
130
|
+
'(or load via a profile so it defaults to <config_dir>/credentials/<profile>.json)');
|
|
131
|
+
}
|
|
132
|
+
return (0, user_oauth_1.userOAuthProvider)({
|
|
133
|
+
credentialsPath,
|
|
134
|
+
clientId: config.authentication.client_id,
|
|
135
|
+
baseURL,
|
|
136
|
+
fetch: options.fetch,
|
|
137
|
+
userAgent: options.userAgent,
|
|
138
|
+
onSafetyWarning: options.onSafetyWarning,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
default: {
|
|
142
|
+
const t = config.authentication.type;
|
|
143
|
+
throw new types_1.WorkloadIdentityError(`authentication.type "${t}" is not a known authentication type`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Resolves the identity token provider from config fields or environment variables.
|
|
149
|
+
*
|
|
150
|
+
* Resolution order:
|
|
151
|
+
* 1. `identity_token.path` from the config (source: "file")
|
|
152
|
+
* 2. `ANTHROPIC_IDENTITY_TOKEN_FILE` env var
|
|
153
|
+
* 3. `ANTHROPIC_IDENTITY_TOKEN` env var (static value)
|
|
154
|
+
*/
|
|
155
|
+
function resolveIdentityTokenProvider(auth) {
|
|
156
|
+
if (auth.identity_token) {
|
|
157
|
+
// Cast needed to stringify an unknown source value for the error message:
|
|
158
|
+
// the on-disk JSON may contain a source this SDK version doesn't know about.
|
|
159
|
+
const source = auth.identity_token.source;
|
|
160
|
+
if (source !== 'file') {
|
|
161
|
+
throw new types_1.WorkloadIdentityError(`identity_token.source "${source}" is not supported by this SDK version (only "file")`);
|
|
162
|
+
}
|
|
163
|
+
if (!auth.identity_token.path) {
|
|
164
|
+
throw new types_1.WorkloadIdentityError(`identity_token.source "file" requires a non-empty path`);
|
|
165
|
+
}
|
|
166
|
+
return (0, identity_token_1.identityTokenFromFile)(auth.identity_token.path);
|
|
167
|
+
}
|
|
168
|
+
const tokenFile = (0, env_1.readEnv)('ANTHROPIC_IDENTITY_TOKEN_FILE');
|
|
169
|
+
if (tokenFile) {
|
|
170
|
+
return (0, identity_token_1.identityTokenFromFile)(tokenFile);
|
|
171
|
+
}
|
|
172
|
+
const tokenValue = (0, env_1.readEnv)('ANTHROPIC_IDENTITY_TOKEN');
|
|
173
|
+
if (tokenValue) {
|
|
174
|
+
return (0, identity_token_1.identityTokenFromValue)(tokenValue);
|
|
175
|
+
}
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Wraps a federation exchange provider with credential file caching.
|
|
180
|
+
* Checks the file for a fresh token before exchanging, and writes the
|
|
181
|
+
* result back after a successful exchange (best-effort, atomic replace).
|
|
182
|
+
*
|
|
183
|
+
* Note: this is not cross-process serialized — two SDK instances that
|
|
184
|
+
* miss the cache simultaneously will both perform a full exchange and
|
|
185
|
+
* the last writer wins. That is acceptable: federation exchanges are
|
|
186
|
+
* idempotent and the cache is an optimization, not a correctness gate.
|
|
187
|
+
*/
|
|
188
|
+
function cachedExchangeProvider(exchange, credentialsPath, onCacheWriteError, onSafetyWarning) {
|
|
189
|
+
return async (opts) => {
|
|
190
|
+
const fs = await Promise.resolve().then(() => __importStar(require('node:fs')));
|
|
191
|
+
await (0, types_1.checkCredentialsFileSafety)(credentialsPath, onSafetyWarning);
|
|
192
|
+
// Try cached credentials file
|
|
193
|
+
let existing;
|
|
194
|
+
try {
|
|
195
|
+
const raw = await fs.promises.readFile(credentialsPath, 'utf-8');
|
|
196
|
+
existing = JSON.parse(raw);
|
|
197
|
+
const token = existing?.['access_token'];
|
|
198
|
+
if (token && !opts?.forceRefresh) {
|
|
199
|
+
const expiresAt = existing?.['expires_at'];
|
|
200
|
+
if (expiresAt == null || (0, time_1.nowAsSeconds)() < expiresAt - types_1.MANDATORY_REFRESH_THRESHOLD_IN_SECONDS) {
|
|
201
|
+
return { token, expiresAt: expiresAt ?? null };
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
catch (err) {
|
|
206
|
+
// ENOENT or invalid-JSON → no usable cache, exchange fresh. Other
|
|
207
|
+
// errors (EACCES, EISDIR, …) indicate a broken cache path; surface to
|
|
208
|
+
// the optional hook so they're at least debuggable, then proceed.
|
|
209
|
+
const code = err?.code;
|
|
210
|
+
if (code !== 'ENOENT' && !(err instanceof SyntaxError)) {
|
|
211
|
+
onCacheWriteError?.(err);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
// Exchange for a new token
|
|
215
|
+
const result = await exchange(opts);
|
|
216
|
+
// Write cache back (best-effort). Preserve any unknown keys from the
|
|
217
|
+
// existing file (notably refresh_token, in the unlikely case this path
|
|
218
|
+
// is shared with a user_oauth profile) so the federation cache writer
|
|
219
|
+
// doesn't clobber material it didn't own.
|
|
220
|
+
try {
|
|
221
|
+
await (0, types_1.writeCredentialsFileAtomic)(credentialsPath, {
|
|
222
|
+
...(existing ?? {}),
|
|
223
|
+
version: credentials_1.CREDENTIALS_FILE_VERSION,
|
|
224
|
+
type: 'oauth_token',
|
|
225
|
+
access_token: result.token,
|
|
226
|
+
expires_at: result.expiresAt,
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
catch (err) {
|
|
230
|
+
// Best-effort caching: surface to the optional hook but never fail
|
|
231
|
+
// the exchange itself.
|
|
232
|
+
onCacheWriteError?.(err);
|
|
233
|
+
}
|
|
234
|
+
return result;
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
//# sourceMappingURL=credential-chain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