@celo/wallet-hsm-azure 8.0.2 → 8.0.4
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 +19 -0
- package/lib/azure-hsm-signer.d.ts +2 -0
- package/lib/azure-hsm-signer.js +8 -28
- package/lib/azure-hsm-wallet.d.ts +1 -0
- package/lib/azure-hsm-wallet.js +2 -3
- package/lib/azure-hsm-wallet.test.d.ts +1 -0
- package/lib/azure-key-vault-client.d.ts +2 -0
- package/lib/azure-key-vault-client.js +0 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +0 -1
- package/package.json +6 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @celo/wallet-hsm-azure
|
|
2
2
|
|
|
3
|
+
## 8.0.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`95a84a4`](https://github.com/celo-org/developer-tooling/commit/95a84a4ac6c18278e94ef98549c1606dcd5a496f), [`95a84a4`](https://github.com/celo-org/developer-tooling/commit/95a84a4ac6c18278e94ef98549c1606dcd5a496f), [`95a84a4`](https://github.com/celo-org/developer-tooling/commit/95a84a4ac6c18278e94ef98549c1606dcd5a496f)]:
|
|
8
|
+
- @celo/connect@8.0.0
|
|
9
|
+
- @celo/wallet-base@8.0.4
|
|
10
|
+
- @celo/wallet-remote@8.0.4
|
|
11
|
+
- @celo/wallet-hsm@8.0.4
|
|
12
|
+
|
|
13
|
+
## 8.0.3
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [[`fad32ac`](https://github.com/celo-org/developer-tooling/commit/fad32ac6748f7556359e62ea33ae0cf8299f1712)]:
|
|
18
|
+
- @celo/wallet-base@8.0.3
|
|
19
|
+
- @celo/wallet-hsm@8.0.3
|
|
20
|
+
- @celo/wallet-remote@8.0.3
|
|
21
|
+
|
|
3
22
|
## 8.0.2
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
2
3
|
import { RLPEncodedTx, Signer } from '@celo/connect';
|
|
3
4
|
import { EIP712TypedData } from '@celo/utils/lib/sign-typed-data-utils';
|
|
4
5
|
import { AzureKeyVaultClient } from './azure-key-vault-client';
|
|
@@ -28,3 +29,4 @@ export declare class AzureHSMSigner implements Signer {
|
|
|
28
29
|
decrypt(_ciphertext: Buffer): Promise<Buffer>;
|
|
29
30
|
computeSharedSecret(_publicKey: string): Promise<Buffer>;
|
|
30
31
|
}
|
|
32
|
+
//# sourceMappingURL=azure-hsm-signer.d.ts.map
|
package/lib/azure-hsm-signer.js
CHANGED
|
@@ -1,27 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -36,7 +13,7 @@ exports.AzureHSMSigner = void 0;
|
|
|
36
13
|
const address_1 = require("@celo/base/lib/address");
|
|
37
14
|
const sign_typed_data_utils_1 = require("@celo/utils/lib/sign-typed-data-utils");
|
|
38
15
|
const wallet_base_1 = require("@celo/wallet-base");
|
|
39
|
-
const
|
|
16
|
+
const sha3_1 = require("@noble/hashes/sha3");
|
|
40
17
|
/**
|
|
41
18
|
* Signs the EVM transaction using an HSM key in Azure Key Vault
|
|
42
19
|
*/
|
|
@@ -62,9 +39,13 @@ class AzureHSMSigner {
|
|
|
62
39
|
}
|
|
63
40
|
signPersonalMessage(data) {
|
|
64
41
|
return __awaiter(this, void 0, void 0, function* () {
|
|
65
|
-
const
|
|
66
|
-
const
|
|
67
|
-
const
|
|
42
|
+
const dataBytes = Buffer.from((0, address_1.trimLeading0x)((0, address_1.ensureLeading0x)(data)), 'hex');
|
|
43
|
+
const prefix = Buffer.from(`\x19Ethereum Signed Message:\n${dataBytes.length}`);
|
|
44
|
+
const combined = new Uint8Array(prefix.length + dataBytes.length);
|
|
45
|
+
combined.set(prefix);
|
|
46
|
+
combined.set(dataBytes, prefix.length);
|
|
47
|
+
const msgHashBuff = Buffer.from((0, sha3_1.keccak_256)(combined));
|
|
48
|
+
const signature = yield AzureHSMSigner.keyVaultClient.signMessage(msgHashBuff, this.keyName);
|
|
68
49
|
// Recovery ID should be a byte prefix
|
|
69
50
|
// https://bitcoin.stackexchange.com/questions/38351/ecdsa-v-r-s-what-is-v
|
|
70
51
|
const sigV = signature.v + 27;
|
|
@@ -103,4 +84,3 @@ class AzureHSMSigner {
|
|
|
103
84
|
}
|
|
104
85
|
}
|
|
105
86
|
exports.AzureHSMSigner = AzureHSMSigner;
|
|
106
|
-
//# sourceMappingURL=azure-hsm-signer.js.map
|
package/lib/azure-hsm-wallet.js
CHANGED
|
@@ -13,11 +13,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.AzureHSMWallet = void 0;
|
|
16
|
-
const address_1 = require("@celo/utils/lib/address");
|
|
17
16
|
const wallet_remote_1 = require("@celo/wallet-remote");
|
|
18
17
|
const debug_1 = __importDefault(require("debug"));
|
|
19
18
|
const azure_hsm_signer_1 = require("./azure-hsm-signer");
|
|
20
19
|
const azure_key_vault_client_1 = require("./azure-key-vault-client");
|
|
20
|
+
const wallet_hsm_1 = require("@celo/wallet-hsm");
|
|
21
21
|
const debug = (0, debug_1.default)('kit:wallet:aws-hsm-wallet');
|
|
22
22
|
// Azure Key Vault implementation of a RemoteWallet
|
|
23
23
|
class AzureHSMWallet extends wallet_remote_1.RemoteWallet {
|
|
@@ -65,9 +65,8 @@ class AzureHSMWallet extends wallet_remote_1.RemoteWallet {
|
|
|
65
65
|
throw new Error('AzureHSMWallet needs to be initialized first');
|
|
66
66
|
}
|
|
67
67
|
const publicKey = yield this.keyVaultClient.getPublicKey(keyName);
|
|
68
|
-
return (0,
|
|
68
|
+
return (0, wallet_hsm_1.getAddressFromPublicKey)(publicKey);
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
exports.AzureHSMWallet = AzureHSMWallet;
|
|
73
|
-
//# sourceMappingURL=azure-hsm-wallet.js.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
2
3
|
import { TokenCredential } from '@azure/identity';
|
|
3
4
|
import { Signature } from '@celo/wallet-hsm';
|
|
4
5
|
import { BigNumber } from 'bignumber.js';
|
|
@@ -27,3 +28,4 @@ export declare class AzureKeyVaultClient {
|
|
|
27
28
|
*/
|
|
28
29
|
private getCryptographyClient;
|
|
29
30
|
}
|
|
31
|
+
//# sourceMappingURL=azure-key-vault-client.d.ts.map
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -17,4 +17,3 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./azure-hsm-signer"), exports);
|
|
18
18
|
__exportStar(require("./azure-hsm-wallet"), exports);
|
|
19
19
|
__exportStar(require("./azure-key-vault-client"), exports);
|
|
20
|
-
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celo/wallet-hsm-azure",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.4",
|
|
4
4
|
"description": "Azure HSM wallet implementation",
|
|
5
5
|
"author": "Celo",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -29,12 +29,11 @@
|
|
|
29
29
|
"@azure/keyvault-keys": "^4.7.2",
|
|
30
30
|
"@azure/keyvault-secrets": "^4.7.0",
|
|
31
31
|
"@celo/base": "^7.0.3",
|
|
32
|
-
"@celo/connect": "^
|
|
32
|
+
"@celo/connect": "^8.0.0",
|
|
33
33
|
"@celo/utils": "^8.0.3",
|
|
34
|
-
"@celo/wallet-base": "^8.0.
|
|
35
|
-
"@celo/wallet-hsm": "^8.0.
|
|
36
|
-
"@celo/wallet-remote": "^8.0.
|
|
37
|
-
"@ethereumjs/util": "8.0.5",
|
|
34
|
+
"@celo/wallet-base": "^8.0.4",
|
|
35
|
+
"@celo/wallet-hsm": "^8.0.4",
|
|
36
|
+
"@celo/wallet-remote": "^8.0.4",
|
|
38
37
|
"@types/secp256k1": "^4.0.0",
|
|
39
38
|
"bignumber.js": "^9.0.0",
|
|
40
39
|
"debug": "^4.1.1"
|
|
@@ -45,8 +44,7 @@
|
|
|
45
44
|
"@noble/curves": "1.3.0",
|
|
46
45
|
"@noble/hashes": "1.3.3",
|
|
47
46
|
"@types/debug": "^4.1.12",
|
|
48
|
-
"dotenv": "^8.2.0"
|
|
49
|
-
"web3": "1.10.4"
|
|
47
|
+
"dotenv": "^8.2.0"
|
|
50
48
|
},
|
|
51
49
|
"engines": {
|
|
52
50
|
"node": ">=20"
|