Skip to content

Commit a6e5b87

Browse files
committed
support role
1 parent ef82040 commit a6e5b87

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

eth/signer_awskms.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,17 @@ type KmsSigner struct {
3737

3838
// region and keyAlias must be valid, eg. us-west-1 alias/mytestkey
3939
// if awsKey, awsSec are empty string, will use aws sdk auto search
40-
func NewKmsSigner(region, keyAlias, awsKey, awsSec string, chainId *big.Int) (*KmsSigner, error) {
40+
func NewKmsSigner(region, keyAlias, awsKey, awsSec, profile string, chainId *big.Int) (*KmsSigner, error) {
4141
cfg := &aws.Config{
4242
Region: aws.String(region),
4343
}
44-
if awsKey != "" && awsSec != "" {
44+
45+
if profile != "" {
46+
cfg.Credentials = credentials.NewSharedCredentials("", profile)
47+
} else if awsKey != "" && awsSec != "" {
4548
cfg.Credentials = credentials.NewStaticCredentials(awsKey, awsSec, "")
49+
} else {
50+
// default use role
4651
}
4752
sess, err := session.NewSession(cfg)
4853
if err != nil {

0 commit comments

Comments
 (0)