@vercel/oidc-aws-credentials-provider 3.1.0 → 3.1.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/CHANGELOG.md
CHANGED
package/docs/README.md
CHANGED
|
@@ -1,58 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
## Table of contents
|
|
1
|
+
**@vercel/oidc-aws-credentials-provider**
|
|
4
2
|
|
|
5
|
-
|
|
3
|
+
---
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
# @vercel/oidc-aws-credentials-provider
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
## Interfaces
|
|
10
8
|
|
|
11
|
-
- [
|
|
9
|
+
- [AwsCredentialsProviderInit](interfaces/AwsCredentialsProviderInit.md)
|
|
12
10
|
|
|
13
11
|
## Functions
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
▸ **awsCredentialsProvider**(`init`): `AwsCredentialIdentityProvider`
|
|
18
|
-
|
|
19
|
-
Obtains the Vercel OIDC token and creates an AWS credential provider function
|
|
20
|
-
that gets AWS credentials by calling STS AssumeRoleWithWebIdentity API.
|
|
21
|
-
|
|
22
|
-
**`Example`**
|
|
23
|
-
|
|
24
|
-
```js
|
|
25
|
-
import * as s3 from '@aws-sdk/client-s3';
|
|
26
|
-
import { awsCredentialsProvider } from '@vercel/functions/oidc';
|
|
27
|
-
|
|
28
|
-
const s3Client = new s3.S3Client({
|
|
29
|
-
credentials: awsCredentialsProvider({
|
|
30
|
-
roleArn: 'arn:aws:iam::1234567890:role/RoleA',
|
|
31
|
-
clientConfig: { region: 'us-west-2' },
|
|
32
|
-
clientPlugins: [addFooHeadersPlugin],
|
|
33
|
-
roleAssumerWithWebIdentity: customRoleAssumer,
|
|
34
|
-
roleSessionName: 'session_123',
|
|
35
|
-
providerId: 'graph.facebook.com',
|
|
36
|
-
policyArns: [{ arn: 'arn:aws:iam::1234567890:policy/SomePolicy' }],
|
|
37
|
-
policy:
|
|
38
|
-
'{"Statement": [{"Effect": "Allow", "Action": "s3:ListBucket", "Resource": "*"}]}',
|
|
39
|
-
durationSeconds: 7200,
|
|
40
|
-
}),
|
|
41
|
-
});
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
#### Parameters
|
|
45
|
-
|
|
46
|
-
| Name | Type | Description |
|
|
47
|
-
| :----- | :----------------------------------------------------------------------- | :------------------------- |
|
|
48
|
-
| `init` | [`AwsCredentialsProviderInit`](interfaces/AwsCredentialsProviderInit.md) | The initialization object. |
|
|
49
|
-
|
|
50
|
-
#### Returns
|
|
51
|
-
|
|
52
|
-
`AwsCredentialIdentityProvider`
|
|
53
|
-
|
|
54
|
-
A function that provides AWS credentials.
|
|
55
|
-
|
|
56
|
-
#### Defined in
|
|
57
|
-
|
|
58
|
-
[packages/oidc-aws-credentials-provider/src/aws-credentials-provider.ts:61](https://github.com/vercel/vercel/blob/main/packages/oidc-aws-credentials-provider/src/aws-credentials-provider.ts#L61)
|
|
13
|
+
- [awsCredentialsProvider](functions/awsCredentialsProvider.md)
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
[**@vercel/oidc-aws-credentials-provider**](../README.md)
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Function: awsCredentialsProvider()
|
|
6
|
+
|
|
7
|
+
> **awsCredentialsProvider**(`init`): `AwsCredentialIdentityProvider`
|
|
8
|
+
|
|
9
|
+
Defined in: [packages/oidc-aws-credentials-provider/src/aws-credentials-provider.ts:61](https://github.com/vercel/vercel/blob/main/packages/oidc-aws-credentials-provider/src/aws-credentials-provider.ts#L61)
|
|
10
|
+
|
|
11
|
+
Obtains the Vercel OIDC token and creates an AWS credential provider function
|
|
12
|
+
that gets AWS credentials by calling STS AssumeRoleWithWebIdentity API.
|
|
13
|
+
|
|
14
|
+
## Parameters
|
|
15
|
+
|
|
16
|
+
### init
|
|
17
|
+
|
|
18
|
+
[`AwsCredentialsProviderInit`](../interfaces/AwsCredentialsProviderInit.md)
|
|
19
|
+
|
|
20
|
+
The initialization object.
|
|
21
|
+
|
|
22
|
+
## Returns
|
|
23
|
+
|
|
24
|
+
`AwsCredentialIdentityProvider`
|
|
25
|
+
|
|
26
|
+
A function that provides AWS credentials.
|
|
27
|
+
|
|
28
|
+
## Example
|
|
29
|
+
|
|
30
|
+
```js
|
|
31
|
+
import * as s3 from '@aws-sdk/client-s3';
|
|
32
|
+
import { awsCredentialsProvider } from '@vercel/functions/oidc';
|
|
33
|
+
|
|
34
|
+
const s3Client = new s3.S3Client({
|
|
35
|
+
credentials: awsCredentialsProvider({
|
|
36
|
+
roleArn: 'arn:aws:iam::1234567890:role/RoleA',
|
|
37
|
+
clientConfig: { region: 'us-west-2' },
|
|
38
|
+
clientPlugins: [addFooHeadersPlugin],
|
|
39
|
+
roleAssumerWithWebIdentity: customRoleAssumer,
|
|
40
|
+
roleSessionName: 'session_123',
|
|
41
|
+
providerId: 'graph.facebook.com',
|
|
42
|
+
policyArns: [{ arn: 'arn:aws:iam::1234567890:policy/SomePolicy' }],
|
|
43
|
+
policy:
|
|
44
|
+
'{"Statement": [{"Effect": "Allow", "Action": "s3:ListBucket", "Resource": "*"}]}',
|
|
45
|
+
durationSeconds: 7200,
|
|
46
|
+
}),
|
|
47
|
+
});
|
|
48
|
+
```
|
|
@@ -1,78 +1,64 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
The init object for the `awsCredentialsProvider` function.
|
|
1
|
+
[**@vercel/oidc-aws-credentials-provider**](../README.md)
|
|
4
2
|
|
|
5
|
-
|
|
3
|
+
---
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
# Interface: AwsCredentialsProviderInit
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
Defined in: [packages/oidc-aws-credentials-provider/src/aws-credentials-provider.ts:21](https://github.com/vercel/vercel/blob/main/packages/oidc-aws-credentials-provider/src/aws-credentials-provider.ts#L21)
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
The init object for the `awsCredentialsProvider` function.
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
## Extends
|
|
14
12
|
|
|
15
|
-
- [
|
|
16
|
-
- [clientPlugins](AwsCredentialsProviderInit.md#clientplugins)
|
|
17
|
-
- [durationSeconds](AwsCredentialsProviderInit.md#durationseconds)
|
|
18
|
-
- [logger](AwsCredentialsProviderInit.md#logger)
|
|
19
|
-
- [parentClientConfig](AwsCredentialsProviderInit.md#parentclientconfig)
|
|
20
|
-
- [policy](AwsCredentialsProviderInit.md#policy)
|
|
21
|
-
- [policyArns](AwsCredentialsProviderInit.md#policyarns)
|
|
22
|
-
- [providerId](AwsCredentialsProviderInit.md#providerid)
|
|
23
|
-
- [roleArn](AwsCredentialsProviderInit.md#rolearn)
|
|
24
|
-
- [roleAssumerWithWebIdentity](AwsCredentialsProviderInit.md#roleassumerwithwebidentity)
|
|
25
|
-
- [roleSessionName](AwsCredentialsProviderInit.md#rolesessionname)
|
|
13
|
+
- [`Omit`](https://www.typescriptlang.org/docs/handbook/utility-types.html#omittype-keys)\<`FromWebTokenInit`, `"webIdentityToken"`\>
|
|
26
14
|
|
|
27
15
|
## Properties
|
|
28
16
|
|
|
29
|
-
### clientConfig
|
|
17
|
+
### clientConfig?
|
|
18
|
+
|
|
19
|
+
> `optional` **clientConfig?**: `any`
|
|
30
20
|
|
|
31
|
-
|
|
21
|
+
Defined in: node_modules/.pnpm/@aws-sdk+credential-provider-web-identity@3.609.0_@aws-sdk+client-sts@3.806.0/node_modules/@aws-sdk/credential-provider-web-identity/dist-types/fromWebToken.d.ts:135
|
|
32
22
|
|
|
33
23
|
Custom STS client configurations overriding the default ones.
|
|
34
24
|
|
|
35
25
|
#### Inherited from
|
|
36
26
|
|
|
37
|
-
Omit.clientConfig
|
|
38
|
-
|
|
39
|
-
#### Defined in
|
|
40
|
-
|
|
41
|
-
node*modules/.pnpm/@aws-sdk+credential-provider-web-identity@3.609.0*@aws-sdk+client-sts@3.806.0/node_modules/@aws-sdk/credential-provider-web-identity/dist-types/fromWebToken.d.ts:135
|
|
27
|
+
`Omit.clientConfig`
|
|
42
28
|
|
|
43
29
|
---
|
|
44
30
|
|
|
45
|
-
### clientPlugins
|
|
31
|
+
### clientPlugins?
|
|
46
32
|
|
|
47
|
-
|
|
33
|
+
> `optional` **clientPlugins?**: `Pluggable`\<`any`, `any`\>[]
|
|
34
|
+
|
|
35
|
+
Defined in: node_modules/.pnpm/@aws-sdk+credential-provider-web-identity@3.609.0_@aws-sdk+client-sts@3.806.0/node_modules/@aws-sdk/credential-provider-web-identity/dist-types/fromWebToken.d.ts:139
|
|
48
36
|
|
|
49
37
|
Custom STS client middleware plugin to modify the client default behavior.
|
|
50
38
|
|
|
51
39
|
#### Inherited from
|
|
52
40
|
|
|
53
|
-
Omit.clientPlugins
|
|
54
|
-
|
|
55
|
-
#### Defined in
|
|
56
|
-
|
|
57
|
-
node*modules/.pnpm/@aws-sdk+credential-provider-web-identity@3.609.0*@aws-sdk+client-sts@3.806.0/node_modules/@aws-sdk/credential-provider-web-identity/dist-types/fromWebToken.d.ts:139
|
|
41
|
+
`Omit.clientPlugins`
|
|
58
42
|
|
|
59
43
|
---
|
|
60
44
|
|
|
61
|
-
### durationSeconds
|
|
45
|
+
### durationSeconds?
|
|
62
46
|
|
|
63
|
-
|
|
47
|
+
> `optional` **durationSeconds?**: `number`
|
|
64
48
|
|
|
65
49
|
The duration, in seconds, of the role session. Defaults to 3600 seconds.
|
|
66
50
|
|
|
67
51
|
#### Inherited from
|
|
68
52
|
|
|
69
|
-
Omit.durationSeconds
|
|
53
|
+
`Omit.durationSeconds`
|
|
70
54
|
|
|
71
55
|
---
|
|
72
56
|
|
|
73
|
-
### logger
|
|
57
|
+
### logger?
|
|
58
|
+
|
|
59
|
+
> `optional` **logger?**: `Logger`
|
|
74
60
|
|
|
75
|
-
|
|
61
|
+
Defined in: node_modules/.pnpm/@aws-sdk+types@3.609.0/node_modules/@aws-sdk/types/dist-types/credentials.d.ts:31
|
|
76
62
|
|
|
77
63
|
This logger is only used to provide information
|
|
78
64
|
on what credential providers were used during resolution.
|
|
@@ -81,17 +67,17 @@ It does not log credentials.
|
|
|
81
67
|
|
|
82
68
|
#### Inherited from
|
|
83
69
|
|
|
84
|
-
Omit.logger
|
|
70
|
+
`Omit.logger`
|
|
85
71
|
|
|
86
|
-
|
|
72
|
+
---
|
|
87
73
|
|
|
88
|
-
|
|
74
|
+
### ~~parentClientConfig?~~
|
|
89
75
|
|
|
90
|
-
|
|
76
|
+
> `optional` **parentClientConfig?**: `object`
|
|
91
77
|
|
|
92
|
-
|
|
78
|
+
Defined in: node_modules/.pnpm/@aws-sdk+types@3.609.0/node_modules/@aws-sdk/types/dist-types/credentials.d.ts:45
|
|
93
79
|
|
|
94
|
-
|
|
80
|
+
**`Internal`**
|
|
95
81
|
|
|
96
82
|
Present if the credential provider was created by calling
|
|
97
83
|
the defaultCredentialProvider in a client's middleware, having
|
|
@@ -102,118 +88,108 @@ an inner client used by the credential provider may need
|
|
|
102
88
|
to match its default partition or region with that of
|
|
103
89
|
the outer client.
|
|
104
90
|
|
|
105
|
-
|
|
91
|
+
#### Index Signature
|
|
106
92
|
|
|
107
|
-
|
|
93
|
+
\[`key`: `string`\]: `unknown`
|
|
108
94
|
|
|
109
|
-
####
|
|
95
|
+
#### ~~region?~~
|
|
110
96
|
|
|
111
|
-
|
|
97
|
+
> `optional` **region?**: `string` \| `Provider`\<`string`\>
|
|
112
98
|
|
|
113
|
-
####
|
|
99
|
+
#### Deprecated
|
|
114
100
|
|
|
115
|
-
|
|
116
|
-
| :-------- | :-------------------------------- |
|
|
117
|
-
| `region?` | `string` \| `Provider`<`string`\> |
|
|
101
|
+
- not truly deprecated, marked as a warning to not use this.
|
|
118
102
|
|
|
119
103
|
#### Inherited from
|
|
120
104
|
|
|
121
|
-
Omit.parentClientConfig
|
|
122
|
-
|
|
123
|
-
#### Defined in
|
|
124
|
-
|
|
125
|
-
node_modules/.pnpm/@aws-sdk+types@3.609.0/node_modules/@aws-sdk/types/dist-types/credentials.d.ts:45
|
|
105
|
+
`Omit.parentClientConfig`
|
|
126
106
|
|
|
127
107
|
---
|
|
128
108
|
|
|
129
|
-
### policy
|
|
109
|
+
### policy?
|
|
130
110
|
|
|
131
|
-
|
|
111
|
+
> `optional` **policy?**: `string`
|
|
132
112
|
|
|
133
113
|
An IAM policy in JSON format that you want to use as an inline session policy.
|
|
134
114
|
|
|
135
115
|
#### Inherited from
|
|
136
116
|
|
|
137
|
-
Omit.policy
|
|
117
|
+
`Omit.policy`
|
|
138
118
|
|
|
139
119
|
---
|
|
140
120
|
|
|
141
|
-
### policyArns
|
|
121
|
+
### policyArns?
|
|
142
122
|
|
|
143
|
-
|
|
123
|
+
> `optional` **policyArns?**: `object`[]
|
|
144
124
|
|
|
145
125
|
ARNs of the IAM managed policies that you want to use as managed session policies.
|
|
146
126
|
|
|
127
|
+
#### arn?
|
|
128
|
+
|
|
129
|
+
> `optional` **arn?**: `string`
|
|
130
|
+
|
|
147
131
|
#### Inherited from
|
|
148
132
|
|
|
149
|
-
Omit.policyArns
|
|
133
|
+
`Omit.policyArns`
|
|
150
134
|
|
|
151
135
|
---
|
|
152
136
|
|
|
153
|
-
### providerId
|
|
137
|
+
### providerId?
|
|
154
138
|
|
|
155
|
-
|
|
139
|
+
> `optional` **providerId?**: `string`
|
|
156
140
|
|
|
157
141
|
The fully qualified host component of the domain name of the identity provider.
|
|
158
142
|
|
|
159
143
|
#### Inherited from
|
|
160
144
|
|
|
161
|
-
Omit.providerId
|
|
145
|
+
`Omit.providerId`
|
|
162
146
|
|
|
163
147
|
---
|
|
164
148
|
|
|
165
149
|
### roleArn
|
|
166
150
|
|
|
167
|
-
|
|
151
|
+
> **roleArn**: `string`
|
|
168
152
|
|
|
169
153
|
ARN of the role that the caller is assuming.
|
|
170
154
|
|
|
171
155
|
#### Inherited from
|
|
172
156
|
|
|
173
|
-
Omit.roleArn
|
|
157
|
+
`Omit.roleArn`
|
|
174
158
|
|
|
175
159
|
---
|
|
176
160
|
|
|
177
|
-
### roleAssumerWithWebIdentity
|
|
161
|
+
### roleAssumerWithWebIdentity?
|
|
178
162
|
|
|
179
|
-
|
|
163
|
+
> `optional` **roleAssumerWithWebIdentity?**: (`params`) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`AwsCredentialIdentity`\>
|
|
180
164
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
▸ (`params`): [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<`AwsCredentialIdentity`\>
|
|
165
|
+
Defined in: node_modules/.pnpm/@aws-sdk+credential-provider-web-identity@3.609.0_@aws-sdk+client-sts@3.806.0/node_modules/@aws-sdk/credential-provider-web-identity/dist-types/fromWebToken.d.ts:130
|
|
184
166
|
|
|
185
167
|
A function that assumes a role with web identity and returns a promise fulfilled with credentials for the assumed role.
|
|
186
168
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
| Name | Type |
|
|
190
|
-
| :------- | :-------------------------------- |
|
|
191
|
-
| `params` | `AssumeRoleWithWebIdentityParams` |
|
|
169
|
+
#### Parameters
|
|
192
170
|
|
|
193
|
-
#####
|
|
171
|
+
##### params
|
|
194
172
|
|
|
195
|
-
|
|
173
|
+
`AssumeRoleWithWebIdentityParams`
|
|
196
174
|
|
|
197
|
-
####
|
|
175
|
+
#### Returns
|
|
198
176
|
|
|
199
|
-
|
|
177
|
+
[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`AwsCredentialIdentity`\>
|
|
200
178
|
|
|
201
|
-
####
|
|
179
|
+
#### Inherited from
|
|
202
180
|
|
|
203
|
-
|
|
181
|
+
`Omit.roleAssumerWithWebIdentity`
|
|
204
182
|
|
|
205
183
|
---
|
|
206
184
|
|
|
207
|
-
### roleSessionName
|
|
185
|
+
### roleSessionName?
|
|
208
186
|
|
|
209
|
-
|
|
187
|
+
> `optional` **roleSessionName?**: `string`
|
|
188
|
+
|
|
189
|
+
Defined in: node_modules/.pnpm/@aws-sdk+credential-provider-web-identity@3.609.0_@aws-sdk+client-sts@3.806.0/node_modules/@aws-sdk/credential-provider-web-identity/dist-types/fromWebToken.d.ts:123
|
|
210
190
|
|
|
211
191
|
An identifier for the assumed role session.
|
|
212
192
|
|
|
213
193
|
#### Inherited from
|
|
214
194
|
|
|
215
|
-
Omit.roleSessionName
|
|
216
|
-
|
|
217
|
-
#### Defined in
|
|
218
|
-
|
|
219
|
-
node*modules/.pnpm/@aws-sdk+credential-provider-web-identity@3.609.0*@aws-sdk+client-sts@3.806.0/node_modules/@aws-sdk/credential-provider-web-identity/dist-types/fromWebToken.d.ts:123
|
|
195
|
+
`Omit.roleSessionName`
|
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"require": "./dist/index.js"
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
|
-
"version": "3.1.
|
|
17
|
+
"version": "3.1.1",
|
|
18
18
|
"repository": {
|
|
19
19
|
"directory": "packages/oidc-aws-credentials-provider",
|
|
20
20
|
"type": "git",
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"@smithy/types": "3.3.0",
|
|
29
29
|
"prettier": "3.8.3",
|
|
30
30
|
"tinyspawn": "1.3.1",
|
|
31
|
-
"typedoc": "0.
|
|
32
|
-
"typedoc-plugin-markdown": "
|
|
33
|
-
"typedoc-plugin-mdn-links": "
|
|
31
|
+
"typedoc": "0.28.19",
|
|
32
|
+
"typedoc-plugin-markdown": "4.11.0",
|
|
33
|
+
"typedoc-plugin-mdn-links": "5.1.1",
|
|
34
34
|
"vitest": "2.0.1"
|
|
35
35
|
},
|
|
36
36
|
"engines": {
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@aws-sdk/credential-provider-web-identity": "^3.609.0",
|
|
45
|
-
"@vercel/oidc": "3.4.
|
|
45
|
+
"@vercel/oidc": "3.4.1"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
48
|
"pretest": "pnpm run build:code",
|