@workit-poa/hedera-kms-wallet 0.1.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/.env.example ADDED
@@ -0,0 +1,21 @@
1
+ # AWS credentials/region
2
+ AWS_REGION=us-east-1
3
+ # AWS_DEFAULT_REGION=us-east-1
4
+ # AWS_ACCESS_KEY_ID=
5
+ # AWS_SECRET_ACCESS_KEY=
6
+
7
+ # Hedera operator (choose one pair)
8
+ OPERATOR_ID=0.0.0
9
+ OPERATOR_KEY=
10
+ # Optional: force key parsing mode ("ecdsa" | "ed25519" | "der")
11
+ OPERATOR_KEY_TYPE=
12
+ # HEDERA_OPERATOR_ID=0.0.0
13
+ # HEDERA_OPERATOR_KEY=
14
+
15
+ # Hedera network
16
+ HEDERA_NETWORK=testnet
17
+
18
+ # Optional provisioning defaults
19
+ # Used by provisionHederaAccountForUser() when creating a new key.
20
+ HEDERA_KMS_ALIAS_PREFIX=alias/workit-user
21
+ HEDERA_KMS_KEY_DESCRIPTION_PREFIX=Workit Hedera key for user
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Workit
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,228 @@
1
+ # @workit-poa/hedera-kms-wallet
2
+
3
+ Secure Hedera wallet abstraction backed by AWS KMS asymmetric keys (`ECC_SECG_P256K1`, `SIGN_VERIFY`).
4
+
5
+ Primary references used:
6
+ - Hedera: https://docs.hedera.com/hedera/core-concepts/accounts/account-properties
7
+ - Hedera AWS KMS guide: https://docs.hedera.com/hedera/sdks-and-apis/sdks/client#how-to-sign-a-transaction-with-aws-kms
8
+ - HIP-222 (ECDSA(secp256k1) transaction signatures): https://hips.hedera.com/hip/hip-222
9
+ - AWS KMS `GetPublicKey`: https://docs.aws.amazon.com/kms/latest/APIReference/API_GetPublicKey.html
10
+ - AWS KMS + CloudTrail logging: https://docs.aws.amazon.com/kms/latest/developerguide/logging-using-cloudtrail.html
11
+
12
+ ## Architecture
13
+
14
+ Components:
15
+ - App backend (`libs/auth`) triggers provisioning + signing calls.
16
+ - AWS KMS stores and uses secp256k1 private keys for signing.
17
+ - Hedera SDK prepares/freeze/sign/submit transactions.
18
+ - Hedera Testnet/Mainnet receives signed transactions.
19
+
20
+ Data model mapping:
21
+ - `userId` -> `kmsKeyId`/`kmsKeyArn` -> `hederaAccountId` (+ public key fingerprint)
22
+
23
+ Trust boundaries:
24
+ - Client/UI never receives private key material.
25
+ - Backend runtime can only request `kms:Sign` and key metadata/public key reads.
26
+ - KMS boundary enforces non-exportability of private keys.
27
+ - New keys are created only with explicit least-privilege `policyBindings`.
28
+ - Existing/replacement key usage is verified against KMS tags (`app=workit`, `userId=<owner>`).
29
+
30
+ ## Security Controls
31
+
32
+ ### IAM least privilege
33
+
34
+ Use separate IAM roles:
35
+ - Key admin role: create/manage key lifecycle and aliases.
36
+ - Runtime signer role: sign and read public key metadata only.
37
+
38
+ Policy guidance is exposed by `kmsAccessPolicyGuidance()` in `src/kmsKeyManager.ts`.
39
+ Key creation is enforced with explicit key policy input via:
40
+ - `policyBindings` + `buildLeastPrivilegeKeyPolicy()`.
41
+
42
+ Custom `keyPolicy` overrides and `allowUnsafeDefaultKeyPolicy` bypasses are rejected.
43
+
44
+ Runtime role should allow only:
45
+ - `kms:Sign`
46
+ - `kms:GetPublicKey`
47
+ - `kms:DescribeKey`
48
+ - `kms:ListResourceTags`
49
+
50
+ Resource scope:
51
+ - Restrict to specific key ARN(s), never `*`.
52
+
53
+ ### No private keys on client
54
+
55
+ - Private key generation and custody stays inside KMS.
56
+ - Signing uses KMS `Sign` API.
57
+ - Package converts returned DER signature to Hedera-compatible raw 64-byte `(r||s)` format.
58
+
59
+ ### Audit logging / compliance
60
+
61
+ AWS CloudTrail logs KMS control-plane and cryptographic API calls.
62
+ Key events to filter in CloudTrail Event History:
63
+ - `CreateKey`
64
+ - `CreateAlias`
65
+ - `GetPublicKey`
66
+ - `Sign`
67
+ - `DescribeKey`
68
+
69
+ Fields to verify for audit evidence:
70
+ - `eventTime`
71
+ - `eventName`
72
+ - `userIdentity` (principal/role)
73
+ - `requestParameters.keyId`
74
+ - `sourceIPAddress`
75
+ - `awsRegion`
76
+
77
+ Package-level audit hook:
78
+ - Pass `auditLogger` to provisioning/key functions to emit structured operation events (`CreateKey`, `CreateAlias`, `DescribeKey`, `GetPublicKey`, `ListResourceTags`, `EnableKeyRotation`, `Sign`, `ProvisionAccount`, `RotateAccountKey`) into your SIEM/app logs.
79
+
80
+ ## Bounty Requirement Mapping
81
+
82
+ - Secure key generation/storage/rotation:
83
+ - `createUserKmsKey()` creates `ECC_SECG_P256K1` `SIGN_VERIFY` keys.
84
+ - `rotateHederaAccountKmsKey()` performs managed rotation by creating/reusing a replacement KMS key and submitting Hedera `AccountUpdateTransaction`.
85
+ - Asymmetric KMS auto-rotation limitation is handled by key replacement workflow rather than automatic in-place rotation.
86
+ - Submit a Hedera transaction:
87
+ - `examples/hedera-kms-wallet-demo/src/kms-hedera-demo.ts` submits a topic message or tinybar transfer on testnet.
88
+ - Access controls + audit logging:
89
+ - IAM policy templates via `kmsAccessPolicyGuidance()`.
90
+ - Enforced create-time key policy requirements in `createUserKmsKey()`.
91
+ - CloudTrail verification section above.
92
+ - Signing without private-key exposure:
93
+ - `createKmsHederaSigner()` calls `kms:Sign`; only public key and signatures leave KMS.
94
+ - Working prototype + docs:
95
+ - This package + `examples/hedera-kms-wallet-demo` + this README.
96
+
97
+ ## How to Run Demo
98
+
99
+ Required environment variables:
100
+ - AWS:
101
+ - `AWS_REGION`
102
+ - `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` (or attach IAM role)
103
+ - `AWS_ACCOUNT_ID` (required when creating a new KMS key)
104
+ - `KMS_KEY_ADMIN_PRINCIPAL_ARN` (required when creating a new KMS key)
105
+ - `KMS_RUNTIME_SIGNER_PRINCIPAL_ARN` (required when creating a new KMS key)
106
+ - Hedera:
107
+ - `HEDERA_NETWORK=testnet`
108
+ - `OPERATOR_ID` and `OPERATOR_KEY` (also supports `HEDERA_OPERATOR_ID`/`HEDERA_OPERATOR_KEY`)
109
+ - Optional:
110
+ - `KMS_KEY_ID` (reuse existing key)
111
+ - `HEDERA_USER_ACCOUNT_ID` (reuse existing account)
112
+ - `DEMO_MODE=topic` (default) or `DEMO_MODE=transfer`
113
+ - `HEDERA_NEW_ACCOUNT_INITIAL_HBAR=1` (required and must be `> 0` when provisioning a new demo account)
114
+
115
+ Environment file location for demo:
116
+ - Put env vars in `examples/hedera-kms-wallet-demo/.env` (preferred for this demo package)
117
+ - The demo also reads repo-root `../../.env` as fallback
118
+ - Start from `examples/hedera-kms-wallet-demo/.env.example`
119
+
120
+ Fail-fast behavior:
121
+ - Demo validates `DEMO_MODE` and `DEMO_TRANSFER_TINYBAR` before running.
122
+ - If provisioning a new account (missing `KMS_KEY_ID` or `HEDERA_USER_ACCOUNT_ID`), it fails early unless `HEDERA_NEW_ACCOUNT_INITIAL_HBAR > 0`.
123
+ - If provisioning a new account, it also fails early unless secure key policy bindings are provided (`AWS_ACCOUNT_ID`, `KMS_KEY_ADMIN_PRINCIPAL_ARN`, `KMS_RUNTIME_SIGNER_PRINCIPAL_ARN`).
124
+
125
+ Run:
126
+
127
+ ```bash
128
+ pnpm demo:kms-hedera
129
+ ```
130
+
131
+ or directly:
132
+
133
+ ```bash
134
+ pnpm --filter @workit-poa/hedera-kms-wallet-demo demo:kms-hedera
135
+ ```
136
+
137
+ Expected output includes:
138
+ - KMS key id
139
+ - compressed public key
140
+ - Hedera account id
141
+ - transaction id
142
+ - receipt status
143
+ - mirror/hashscan link
144
+
145
+ ## Testing
146
+
147
+ Run package tests (Vitest):
148
+
149
+ ```bash
150
+ pnpm --filter @workit-poa/hedera-kms-wallet test
151
+ ```
152
+
153
+ Run coverage report:
154
+
155
+ ```bash
156
+ pnpm --filter @workit-poa/hedera-kms-wallet test:coverage
157
+ ```
158
+
159
+ Environment file location for tests:
160
+ - Current unit tests are mocked and do not require env vars
161
+ - If you add env-dependent tests, use `libs/hedera-kms-wallet/.env.test`
162
+ - For machine-local secrets, use `libs/hedera-kms-wallet/.env.test.local` (gitignored)
163
+
164
+ ## Publishing
165
+
166
+ Package is configured for npm publishing:
167
+ - entrypoints: `dist/index.js` + `dist/index.d.ts`
168
+ - export map in `package.json`
169
+ - published files restricted to `dist`, `README.md`, `.env.example`, and `LICENSE`
170
+ - `pnpm --filter @workit-poa/hedera-kms-wallet prepack` runs clean + lint + tests + build
171
+
172
+ Pack and inspect:
173
+
174
+ ```bash
175
+ pnpm --filter @workit-poa/hedera-kms-wallet prepack
176
+ pnpm --filter @workit-poa/hedera-kms-wallet pack
177
+ ```
178
+
179
+ ## Integration With Workit Auth
180
+
181
+ `libs/auth/src/wallet-provisioning.ts` should call `provisionHederaAccountForUser()` and persist:
182
+ - `kmsKeyId`
183
+ - `hederaAccountId`
184
+ - `hederaPublicKeyFingerprint`
185
+
186
+ For key rotation, call `rotateHederaAccountKmsKey()` and update persisted values:
187
+ - new `kmsKeyId`
188
+ - new `hederaPublicKeyFingerprint`
189
+ - old key lifecycle status (disabled/scheduled for deletion) per your operations policy
190
+
191
+ Security default:
192
+ - Runtime flows should pass an `existingKeyId` and keep `allowKeyCreation=false`.
193
+ - Admin provisioning flows can set `allowKeyCreation=true` with explicit `policyBindings`.
194
+
195
+ ## Rotation Notes
196
+
197
+ AWS KMS automatic rotation is not currently supported for asymmetric secp256k1 signing keys.
198
+ This package provides `rotateHederaAccountKmsKey()` to execute the supported rotation workflow:
199
+ 1. Create (or reuse) replacement KMS secp256k1 signing key.
200
+ 2. Build `AccountUpdateTransaction` with the replacement public key.
201
+ 3. Co-sign update using current key and replacement key.
202
+ 4. Submit transaction and return new key metadata/fingerprint.
203
+ 5. Persist new key mapping and retire old key per policy.
204
+
205
+ Minimal example:
206
+
207
+ ```ts
208
+ import { rotateHederaAccountKmsKey } from "@workit-poa/hedera-kms-wallet";
209
+
210
+ const rotated = await rotateHederaAccountKmsKey({
211
+ userId: "user-123",
212
+ accountId: "0.0.12345",
213
+ currentKeyId: "old-kms-key-id",
214
+ policyBindings: {
215
+ accountId: process.env.AWS_ACCOUNT_ID!,
216
+ keyAdminPrincipalArn: process.env.KMS_KEY_ADMIN_PRINCIPAL_ARN!,
217
+ runtimeSignerPrincipalArn: process.env.KMS_RUNTIME_SIGNER_PRINCIPAL_ARN!
218
+ }
219
+ });
220
+ ```
221
+
222
+ ## Future Hardening
223
+
224
+ - Per-user provisioning rate limits and key quotas.
225
+ - Automated key disable/schedule-deletion workflows.
226
+ - Incident-response runbooks for compromised app credentials.
227
+ - Strong tenancy boundaries using per-tenant roles and tighter resource conditions.
228
+ - CloudTrail Lake alerts for suspicious signing patterns.
@@ -0,0 +1,50 @@
1
+ import { Client, Transaction, type TransactionReceipt, type TransactionResponse } from "@hashgraph/sdk";
2
+ import type { KmsHederaSigner } from "./kmsSigner";
3
+ export type HederaNetwork = "testnet" | "mainnet";
4
+ export interface WalletDetails {
5
+ accountId: string;
6
+ network: HederaNetwork;
7
+ evmAddress?: string;
8
+ }
9
+ export interface HederaOperatorConfig {
10
+ network?: HederaNetwork;
11
+ operatorId: string;
12
+ operatorKey: string;
13
+ }
14
+ export interface HederaSubmitResult {
15
+ transactionId: string;
16
+ receiptStatus: string;
17
+ receipt: TransactionReceipt;
18
+ mirrorLink?: string;
19
+ }
20
+ export declare function createHederaClient(config: HederaOperatorConfig): Client;
21
+ export declare function getWalletDetails(accountId: string, network?: HederaNetwork): WalletDetails;
22
+ export declare function createHederaClientFromEnv(): {
23
+ client: Client;
24
+ network: HederaNetwork;
25
+ operatorId: string;
26
+ };
27
+ export declare function addKmsSignatureToFrozenTransaction(transaction: Transaction, signer: KmsHederaSigner): Promise<void>;
28
+ export declare function executeSignedTransaction<Tx extends Transaction>(client: Client, transaction: Tx): Promise<{
29
+ response: TransactionResponse;
30
+ receipt: TransactionReceipt;
31
+ }>;
32
+ export declare function submitTopicMessageWithKmsSignature(params: {
33
+ client: Client;
34
+ signer: KmsHederaSigner;
35
+ topicMemo?: string;
36
+ message: string;
37
+ network?: HederaNetwork;
38
+ }): Promise<HederaSubmitResult & {
39
+ topicId: string;
40
+ }>;
41
+ export declare function submitTinybarTransferWithKmsSignature(params: {
42
+ client: Client;
43
+ signer: KmsHederaSigner;
44
+ fromAccountId: string;
45
+ toAccountId: string;
46
+ amountTinybar: number;
47
+ network?: HederaNetwork;
48
+ }): Promise<HederaSubmitResult>;
49
+ export declare function mirrorLinkForTransaction(network: HederaNetwork, transactionId: string): string;
50
+ //# sourceMappingURL=hederaClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hederaClient.d.ts","sourceRoot":"","sources":["../src/hederaClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EAKN,WAAW,EACX,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EAEzB,MAAM,gBAAgB,C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,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB,GAAG,OAAO,CAAC,kBAAkB,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAgCpD;AAED,wBAAsB,qCAAqC,CAAC,MAAM,EAAE;IAClE,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,eAAe,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAuB9B;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,CAK9F"}
@@ -0,0 +1,136 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createHederaClient = createHederaClient;
4
+ exports.getWalletDetails = getWalletDetails;
5
+ exports.createHederaClientFromEnv = createHederaClientFromEnv;
6
+ exports.addKmsSignatureToFrozenTransaction = addKmsSignatureToFrozenTransaction;
7
+ exports.executeSignedTransaction = executeSignedTransaction;
8
+ exports.submitTopicMessageWithKmsSignature = submitTopicMessageWithKmsSignature;
9
+ exports.submitTinybarTransferWithKmsSignature = submitTinybarTransferWithKmsSignature;
10
+ exports.mirrorLinkForTransaction = mirrorLinkForTransaction;
11
+ const sdk_1 = require("@hashgraph/sdk");
12
+ function parseNetwork(network) {
13
+ if (!network || network === "testnet")
14
+ return "testnet";
15
+ if (network === "mainnet")
16
+ return "mainnet";
17
+ throw new Error(`Unsupported HEDERA_NETWORK "${network}". Expected "testnet" or "mainnet".`);
18
+ }
19
+ function parseOperatorPrivateKey(operatorKey) {
20
+ const value = operatorKey.trim();
21
+ const hexValue = value.startsWith("0x") ? value.slice(2) : value;
22
+ const isHex = /^[0-9a-fA-F]+$/.test(hexValue);
23
+ if (isHex && sdk_1.PrivateKey.isDerKey(hexValue)) {
24
+ return sdk_1.PrivateKey.fromStringDer(hexValue);
25
+ }
26
+ const explicitType = process.env.OPERATOR_KEY_TYPE?.toLowerCase();
27
+ if (explicitType === "ecdsa" || explicitType === "secp256k1") {
28
+ return sdk_1.PrivateKey.fromStringECDSA(hexValue);
29
+ }
30
+ if (explicitType === "ed25519") {
31
+ return sdk_1.PrivateKey.fromStringED25519(hexValue);
32
+ }
33
+ if (explicitType === "der") {
34
+ return sdk_1.PrivateKey.fromStringDer(hexValue);
35
+ }
36
+ if (isHex) {
37
+ // Prefer ECDSA first to match secp256k1 wallet flow used in this project.
38
+ try {
39
+ return sdk_1.PrivateKey.fromStringECDSA(hexValue);
40
+ }
41
+ catch {
42
+ return sdk_1.PrivateKey.fromStringED25519(hexValue);
43
+ }
44
+ }
45
+ // Non-hex formats (mnemonic/legacy encodings) still require generic parsing.
46
+ return sdk_1.PrivateKey.fromString(value);
47
+ }
48
+ function createHederaClient(config) {
49
+ const network = parseNetwork(config.network);
50
+ const client = network === "mainnet" ? sdk_1.Client.forMainnet() : sdk_1.Client.forTestnet();
51
+ client.setOperator(sdk_1.AccountId.fromString(config.operatorId), parseOperatorPrivateKey(config.operatorKey));
52
+ return client;
53
+ }
54
+ function getWalletDetails(accountId, network = "testnet") {
55
+ return { accountId, network };
56
+ }
57
+ function createHederaClientFromEnv() {
58
+ const network = parseNetwork(process.env.HEDERA_NETWORK);
59
+ const operatorId = process.env.OPERATOR_ID || process.env.HEDERA_OPERATOR_ID;
60
+ const operatorKey = process.env.OPERATOR_KEY || process.env.HEDERA_OPERATOR_KEY;
61
+ if (!operatorId || !operatorKey) {
62
+ throw new Error("Missing OPERATOR_ID/OPERATOR_KEY (or HEDERA_OPERATOR_ID/HEDERA_OPERATOR_KEY)");
63
+ }
64
+ return {
65
+ client: createHederaClient({ network, operatorId, operatorKey }),
66
+ network,
67
+ operatorId
68
+ };
69
+ }
70
+ async function addKmsSignatureToFrozenTransaction(transaction, signer) {
71
+ await transaction.signWith(signer.hederaPublicKey, async (bodyBytes) => {
72
+ const signature = await signer.sign(bodyBytes);
73
+ if (signature.length !== 64) {
74
+ throw new Error("Signer must return a 64-byte (r||s) secp256k1 signature");
75
+ }
76
+ return signature;
77
+ });
78
+ }
79
+ async function executeSignedTransaction(client, transaction) {
80
+ const response = await transaction.execute(client);
81
+ const receipt = await response.getReceipt(client);
82
+ return { response, receipt };
83
+ }
84
+ async function submitTopicMessageWithKmsSignature(params) {
85
+ const { client, signer, message, topicMemo, network = "testnet" } = params;
86
+ const createTopicTx = await new sdk_1.TopicCreateTransaction()
87
+ .setTopicMemo(topicMemo ?? "workit-kms-demo-topic")
88
+ .setSubmitKey(signer.hederaPublicKey)
89
+ .freezeWith(client);
90
+ await addKmsSignatureToFrozenTransaction(createTopicTx, signer);
91
+ const { response: topicCreateResponse, receipt: topicCreateReceipt } = await executeSignedTransaction(client, createTopicTx);
92
+ const topicId = topicCreateReceipt.topicId?.toString();
93
+ if (!topicId) {
94
+ throw new Error("Topic creation did not return a topic id");
95
+ }
96
+ const submitMessageTx = await new sdk_1.TopicMessageSubmitTransaction()
97
+ .setTopicId(topicId)
98
+ .setMessage(message)
99
+ .freezeWith(client);
100
+ await addKmsSignatureToFrozenTransaction(submitMessageTx, signer);
101
+ const { response, receipt } = await executeSignedTransaction(client, submitMessageTx);
102
+ const transactionId = response.transactionId.toString();
103
+ return {
104
+ topicId,
105
+ transactionId,
106
+ receipt,
107
+ receiptStatus: receipt.status.toString(),
108
+ mirrorLink: mirrorLinkForTransaction(network, transactionId)
109
+ };
110
+ }
111
+ async function submitTinybarTransferWithKmsSignature(params) {
112
+ const { client, signer, fromAccountId, toAccountId, amountTinybar, network = "testnet" } = params;
113
+ if (!Number.isSafeInteger(amountTinybar) || amountTinybar <= 0) {
114
+ throw new Error("amountTinybar must be a positive safe integer");
115
+ }
116
+ const tx = await new sdk_1.TransferTransaction()
117
+ .addHbarTransfer(sdk_1.AccountId.fromString(fromAccountId), sdk_1.Hbar.fromTinybars(-amountTinybar))
118
+ .addHbarTransfer(sdk_1.AccountId.fromString(toAccountId), sdk_1.Hbar.fromTinybars(amountTinybar))
119
+ .freezeWith(client);
120
+ await addKmsSignatureToFrozenTransaction(tx, signer);
121
+ const { response, receipt } = await executeSignedTransaction(client, tx);
122
+ const transactionId = response.transactionId.toString();
123
+ return {
124
+ transactionId,
125
+ receipt,
126
+ receiptStatus: receipt.status.toString(),
127
+ mirrorLink: mirrorLinkForTransaction(network, transactionId)
128
+ };
129
+ }
130
+ function mirrorLinkForTransaction(network, transactionId) {
131
+ if (!transactionId.trim()) {
132
+ throw new Error("transactionId is required");
133
+ }
134
+ return `https://hashscan.io/${network}/transaction/${encodeURIComponent(transactionId)}`;
135
+ }
136
+ //# sourceMappingURL=hederaClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hederaClient.js","sourceRoot":"","sources":["../src/hederaClient.ts"],"names":[],"mappings":";;AAyEA,gDAKC;AAED,4CAEC;AAED,8DAcC;AAED,gFAQC;AAED,4DAOC;AAED,gFAsCC;AAED,sFA8BC;AAED,4DAKC;AApMD,wCAWwB;AAuBxB,SAAS,YAAY,CAAC,OAAgB;IACpC,IAAI,CAAC,OAAO,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACxD,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC5C,MAAM,IAAI,KAAK,CAAC,+BAA+B,OAAO,qCAAqC,CAAC,CAAC;AAC/F,CAAC;AAED,SAAS,uBAAuB,CAAC,WAAmB;IAClD,MAAM,KAAK,GAAG,WAAW,CAAC,IAAI,EAAE,CAAC;IACjC,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IACjE,MAAM,KAAK,GA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wB,CAAC,OAAsB,EAAE,aAAqB;IACpF,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC/C,CAAC;IACD,OAAO,uBAAuB,OAAO,gBAAgB,kBAAkB,CAAC,aAAa,CAAC,EAAE,CAAC;AAC3F,CAAC"}
@@ -0,0 +1,10 @@
1
+ export declare function spkiToUncompressedPublicKey(spkiDerBytes: Uint8Array): Buffer;
2
+ export declare function compressPublicKey(uncompressed: Uint8Array): Buffer;
3
+ export declare function derSigToRS(der: Buffer): {
4
+ r: Buffer;
5
+ s: Buffer;
6
+ };
7
+ export declare function normalizeS(s: Buffer): Buffer;
8
+ export declare function rsToRaw64(r: Buffer, s: Buffer): Buffer;
9
+ export declare function kmsDerSignatureToHederaRaw64(derSignature: Uint8Array): Buffer;
10
+ //# sourceMappingURL=hederaKeyCodec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hederaKeyCodec.d.ts","sourceRoot":"","sources":["../src/hederaKeyCodec.ts"],"names":[],"mappings":"AA8BA,wBAAgB,2BAA2B,CAAC,YAAY,EAAE,UAAU,GAAG,MAAM,CAoB5E;AAED,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,UAAU,GAAG,MAAM,CAYlE;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAgFhE;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAI5C;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAItD;AAED,wBAAgB,4BAA4B,CAAC,YAAY,EAAE,UAAU,GAAG,MAAM,CAG7E"}
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.spkiToUncompressedPublicKey = spkiToUncompressedPublicKey;
4
+ exports.compressPublicKey = compressPublicKey;
5
+ exports.derSigToRS = derSigToRS;
6
+ exports.normalizeS = normalizeS;
7
+ exports.rsToRaw64 = rsToRaw64;
8
+ exports.kmsDerSignatureToHederaRaw64 = kmsDerSignatureToHederaRaw64;
9
+ const node_crypto_1 = require("node:crypto");
10
+ const SECP256K1_N = BigInt("0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141");
11
+ const SECP256K1_HALF_N = SECP256K1_N / 2n;
12
+ function leftPad32(bytes) {
13
+ if (bytes.length === 32) {
14
+ return bytes;
15
+ }
16
+ return Buffer.concat([Buffer.alloc(32 - bytes.length, 0), bytes]);
17
+ }
18
+ function bigIntToBuffer(value) {
19
+ const hex = value.toString(16);
20
+ return Buffer.from(hex.length % 2 === 0 ? hex : `0${hex}`, "hex");
21
+ }
22
+ function parseScalar(bytes, fieldName) {
23
+ if (bytes.length === 0 || bytes.length > 32) {
24
+ throw new Error(`Invalid ${fieldName} scalar length: ${bytes.length}`);
25
+ }
26
+ const value = BigInt(`0x${bytes.toString("hex")}`);
27
+ if (value <= 0n || value >= SECP256K1_N) {
28
+ throw new Error(`Invalid ${fieldName} scalar range`);
29
+ }
30
+ return value;
31
+ }
32
+ function spkiToUncompressedPublicKey(spkiDerBytes) {
33
+ const keyObject = (0, node_crypto_1.createPublicKey)({
34
+ key: Buffer.from(spkiDerBytes),
35
+ format: "der",
36
+ type: "spki"
37
+ });
38
+ const jwk = keyObject.export({ format: "jwk" });
39
+ if (jwk.kty !== "EC" || jwk.crv !== "secp256k1" || !jwk.x || !jwk.y) {
40
+ throw new Error("Unexpected KMS key type. Expected secp256k1 EC key.");
41
+ }
42
+ const x = Buffer.from(jwk.x, "base64url");
43
+ const y = Buffer.from(jwk.y, "base64url");
44
+ if (x.length !== 32 || y.length !== 32) {
45
+ throw new Error("Invalid secp256k1 public key coordinates");
46
+ }
47
+ return Buffer.concat([Buffer.from([0x04]), x, y]);
48
+ }
49
+ function compressPublicKey(uncompressed) {
50
+ const key = Buffer.from(uncompressed);
51
+ if (key.length !== 65 || key[0] !== 0x04) {
52
+ throw new Error("Expected 65-byte uncompressed secp256k1 public key");
53
+ }
54
+ const x = key.subarray(1, 33);
55
+ const y = key.subarray(33, 65);
56
+ const prefix = (y[y.length - 1] & 1) === 0 ? 0x02 : 0x03;
57
+ return Buffer.concat([Buffer.from([prefix]), x]);
58
+ }
59
+ function derSigToRS(der) {
60
+ let offset = 0;
61
+ const readByte = () => {
62
+ const byte = der[offset];
63
+ if (byte === undefined) {
64
+ throw new Error("Invalid DER signature: unexpected end of buffer");
65
+ }
66
+ offset += 1;
67
+ return byte;
68
+ };
69
+ const readLength = () => {
70
+ const lengthByte = readByte();
71
+ if ((lengthByte & 0x80) === 0) {
72
+ return lengthByte;
73
+ }
74
+ const lengthOfLength = lengthByte & 0x7f;
75
+ if (lengthOfLength === 0 || lengthOfLength > 2) {
76
+ throw new Error("Invalid DER signature: unsupported length encoding");
77
+ }
78
+ let length = 0;
79
+ for (let i = 0; i < lengthOfLength; i += 1) {
80
+ length = (length << 8) | readByte();
81
+ }
82
+ return length;
83
+ };
84
+ const readInteger = () => {
85
+ const type = readByte();
86
+ if (type !== 0x02) {
87
+ throw new Error("Invalid DER signature: expected INTEGER");
88
+ }
89
+ const len = readLength();
90
+ if (len === 0) {
91
+ throw new Error("Invalid DER signature: empty INTEGER");
92
+ }
93
+ const value = der.subarray(offset, offset + len);
94
+ if (value.length !== len) {
95
+ throw new Error("Invalid DER signature: truncated INTEGER");
96
+ }
97
+ offset += len;
98
+ if ((value[0] & 0x80) !== 0) {
99
+ throw new Error("Invalid DER signature: negative INTEGER");
100
+ }
101
+ if (value.length > 1 && value[0] === 0x00 && (value[1] & 0x80) === 0) {
102
+ throw new Error("Invalid DER signature: non-canonical INTEGER encoding");
103
+ }
104
+ // Trim optional sign byte if present.
105
+ return value[0] === 0x00 ? value.subarray(1) : value;
106
+ };
107
+ const sequenceTag = readByte();
108
+ if (sequenceTag !== 0x30) {
109
+ throw new Error("Invalid DER signature: expected SEQUENCE");
110
+ }
111
+ const seqLen = readLength();
112
+ const seqEnd = offset + seqLen;
113
+ if (seqEnd > der.length) {
114
+ throw new Error("Invalid DER signature: truncated SEQUENCE");
115
+ }
116
+ const r = readInteger();
117
+ const s = readInteger();
118
+ if (offset !== seqEnd) {
119
+ throw new Error("Invalid DER signature: trailing bytes in sequence");
120
+ }
121
+ if (seqEnd !== der.length) {
122
+ throw new Error("Invalid DER signature: trailing bytes after sequence");
123
+ }
124
+ return { r, s };
125
+ }
126
+ function normalizeS(s) {
127
+ const sBigInt = parseScalar(s, "s");
128
+ const normalized = sBigInt > SECP256K1_HALF_N ? SECP256K1_N - sBigInt : sBigInt;
129
+ return leftPad32(bigIntToBuffer(normalized));
130
+ }
131
+ function rsToRaw64(r, s) {
132
+ const normalizedR = leftPad32(bigIntToBuffer(parseScalar(r, "r")));
133
+ const normalizedS = normalizeS(s);
134
+ return Buffer.concat([normalizedR, normalizedS]);
135
+ }
136
+ function kmsDerSignatureToHederaRaw64(derSignature) {
137
+ const { r, s } = derSigToRS(Buffer.from(derSignature));
138
+ return rsToRaw64(r, s);
139
+ }
140
+ //# sourceMappingURL=hederaKeyCodec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hederaKeyCodec.js","sourceRoot":"","sources":["../src/hederaKeyCodec.ts"],"names":[],"mappings":";;AA8BA,kEAoBC;AAED,8CAYC;AAED,gCAgFC;AAED,gCAIC;AAED,8BAIC;AAED,oEAGC;AAnKD,6CAA8C;AAE9C,MAAM,WAAW,GAAG,MAAM,CAAC,oEAAoE,CAAC,CAAC;AACjG,MAAM,gBAAgB,GAAG,WAAW,GAAG,EAAE,CAAC;AAE1C,SAAS,SAAS,CAAC,KAAa;IAC9B,IAAI,KAAK,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;QACxB,OAAO,KAAK,CAAC;IAC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AAE,CAAC,CAAC,CAAC;AACzB,CAAC"}
@@ -0,0 +1,6 @@
1
+ export * from "./hederaClient";
2
+ export * from "./hederaKeyCodec";
3
+ export * from "./kmsKeyManager";
4
+ export * from "./kmsSigner";
5
+ export * from "./walletProvisioning";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC"}