We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 30e7914 commit 6c15df4Copy full SHA for 6c15df4
src/server/utils/wallets/awsKmsArn.ts
@@ -2,7 +2,13 @@
2
* Split an AWS KMS ARN into its parts.
3
*/
4
export function splitAwsKmsArn(arn: string) {
5
+ // arn:aws:kms:<region>:<account-id>:key/<key-id>
6
const parts = arn.split(":");
7
+ const keyId = parts[parts.length - 1].split("/")[1];
8
+
9
+ if (!keyId) {
10
+ throw new Error("Invalid AWS KMS ARN");
11
+ }
12
13
if (parts.length < 6) {
14
throw new Error("Invalid AWS KMS ARN");
@@ -11,7 +17,7 @@ export function splitAwsKmsArn(arn: string) {
17
return {
18
region: parts[3],
19
accountId: parts[4],
- keyId: parts[parts.length - 1],
20
+ keyId,
15
21
};
16
22
}
23
0 commit comments