@novasamatech/host-container 0.6.15 → 0.6.16

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.
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Derives 32 bytes of deterministic entropy using the three-layer
3
+ * BLAKE2b-256 scheme specified in RFC-0007.
4
+ *
5
+ * @param rootAccountSecret - Raw BIP-39 entropy bytes of the root account
6
+ * @param productId - Identifier of the calling product (arbitrary-length string)
7
+ * @param key - Caller-chosen key, up to 32 bytes
8
+ */
9
+ export declare function deriveProductEntropy(rootAccountSecret: Uint8Array, productId: string, key: Uint8Array): Uint8Array;
@@ -0,0 +1,24 @@
1
+ import { blake2b } from '@noble/hashes/blake2.js';
2
+ function blake2b256Keyed(message, key) {
3
+ return blake2b(message, { dkLen: 32, key });
4
+ }
5
+ function blake2b256(message) {
6
+ return blake2b(message, { dkLen: 32 });
7
+ }
8
+ /**
9
+ * Derives 32 bytes of deterministic entropy using the three-layer
10
+ * BLAKE2b-256 scheme specified in RFC-0007.
11
+ *
12
+ * @param rootAccountSecret - Raw BIP-39 entropy bytes of the root account
13
+ * @param productId - Identifier of the calling product (arbitrary-length string)
14
+ * @param key - Caller-chosen key, up to 32 bytes
15
+ */
16
+ export function deriveProductEntropy(rootAccountSecret, productId, key) {
17
+ if (key.length === 0 || key.length > 32) {
18
+ throw new Error(`"key" must be between 1 and 32 bytes, got ${key.length}`);
19
+ }
20
+ const textEncoder = new TextEncoder();
21
+ const rootEntropySource = blake2b256Keyed(rootAccountSecret, textEncoder.encode('product-entropy-derivation'));
22
+ const perProductEntropy = blake2b256Keyed(rootEntropySource, blake2b256(textEncoder.encode(productId)));
23
+ return blake2b256Keyed(perProductEntropy, key);
24
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@novasamatech/host-container",
3
3
  "type": "module",
4
- "version": "0.6.15",
4
+ "version": "0.6.16",
5
5
  "description": "Host container for hosting and managing products within the Polkadot ecosystem.",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
@@ -27,11 +27,11 @@
27
27
  "dependencies": {
28
28
  "@polkadot-api/utils": "^0.2.0",
29
29
  "@polkadot-api/json-rpc-provider": "^0.0.4",
30
- "@novasamatech/host-api": "0.6.15",
30
+ "@novasamatech/host-api": "0.6.16",
31
31
  "nanoid": "5.1.7"
32
32
  },
33
33
  "devDependencies": {
34
- "electron": "^41.0.2"
34
+ "electron": "^41.1.0"
35
35
  },
36
36
  "publishConfig": {
37
37
  "access": "public"