-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #263 from Uniswap/rcmpbell/add_kms_cosigner_work
feat: add KMS stack
- Loading branch information
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import * as cdk from 'aws-cdk-lib'; | ||
import { CfnOutput, RemovalPolicy } from 'aws-cdk-lib'; | ||
import { KeySpec, KeyUsage } from 'aws-cdk-lib/aws-kms'; | ||
import { Construct } from 'constructs'; | ||
|
||
export class KmsStack extends cdk.NestedStack { | ||
public readonly key: cdk.aws_kms.Key; | ||
|
||
constructor(parent: Construct, name: string) { | ||
super(parent, name); | ||
|
||
/** | ||
* Unless absolutely necessary, DO NOT change this construct. | ||
* This uses the 'Retain' DeletionPolicy, which will cause the resource to be retained | ||
* in the account, but orphaned from the stack if the Key construct is ever changed. | ||
*/ | ||
this.key = new cdk.aws_kms.Key(this, name, { | ||
removalPolicy: RemovalPolicy.RETAIN, | ||
keySpec: KeySpec.ECC_SECG_P256K1, | ||
keyUsage: KeyUsage.SIGN_VERIFY, | ||
alias: name, | ||
}); | ||
|
||
new CfnOutput(this, `${name}KeyId`, { | ||
value: this.key.keyId, | ||
}); | ||
} | ||
} |