@peac/crypto 0.10.8 → 0.10.10

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/dist/testkit.js DELETED
@@ -1,82 +0,0 @@
1
- "use strict";
2
- /**
3
- * PEAC Crypto Test Kit
4
- *
5
- * This module contains utilities for TEST FIXTURES ONLY.
6
- * These functions are NOT exported from the main entry point.
7
- *
8
- * Import path: @peac/crypto/testkit
9
- *
10
- * SECURITY: Never use these in production. Production bundlers can
11
- * tree-shake this module away since it's a separate export path.
12
- */
13
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
- if (k2 === undefined) k2 = k;
15
- var desc = Object.getOwnPropertyDescriptor(m, k);
16
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
- desc = { enumerable: true, get: function() { return m[k]; } };
18
- }
19
- Object.defineProperty(o, k2, desc);
20
- }) : (function(o, m, k, k2) {
21
- if (k2 === undefined) k2 = k;
22
- o[k2] = m[k];
23
- }));
24
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
- Object.defineProperty(o, "default", { enumerable: true, value: v });
26
- }) : function(o, v) {
27
- o["default"] = v;
28
- });
29
- var __importStar = (this && this.__importStar) || (function () {
30
- var ownKeys = function(o) {
31
- ownKeys = Object.getOwnPropertyNames || function (o) {
32
- var ar = [];
33
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
34
- return ar;
35
- };
36
- return ownKeys(o);
37
- };
38
- return function (mod) {
39
- if (mod && mod.__esModule) return mod;
40
- var result = {};
41
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
42
- __setModuleDefault(result, mod);
43
- return result;
44
- };
45
- })();
46
- Object.defineProperty(exports, "__esModule", { value: true });
47
- exports.generateKeypairFromSeed = generateKeypairFromSeed;
48
- const ed25519 = __importStar(require("@noble/ed25519"));
49
- const errors_js_1 = require("./errors.js");
50
- /**
51
- * Generate an Ed25519 keypair from a deterministic seed.
52
- *
53
- * WARNING: FOR TEST FIXTURES ONLY. DO NOT USE IN PRODUCTION.
54
- * Production code should use generateKeypair() which uses cryptographically
55
- * secure random bytes. Seeded keys are predictable and compromise security.
56
- *
57
- * This function is intentionally in a separate module (@peac/crypto/testkit)
58
- * so that production bundlers can tree-shake it away.
59
- *
60
- * @param seed - 32-byte seed (e.g., SHA-256 hash of a known string)
61
- * @returns Private key (32 bytes) and public key (32 bytes)
62
- *
63
- * @example
64
- * ```ts
65
- * // Use only in test fixtures for reproducibility
66
- * import { generateKeypairFromSeed } from '@peac/crypto/testkit';
67
- *
68
- * const seed = sha256('peac-test-key-001');
69
- * const { privateKey, publicKey } = await generateKeypairFromSeed(seed);
70
- * ```
71
- */
72
- async function generateKeypairFromSeed(seed) {
73
- if (seed.length !== 32) {
74
- throw new errors_js_1.CryptoError('CRYPTO_INVALID_SEED_LENGTH', 'Ed25519 seed must be 32 bytes');
75
- }
76
- // In Ed25519, the private key IS the seed (32 bytes)
77
- // The public key is derived from it
78
- const privateKey = seed;
79
- const publicKey = await ed25519.getPublicKeyAsync(privateKey);
80
- return { privateKey, publicKey };
81
- }
82
- //# sourceMappingURL=testkit.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"testkit.js","sourceRoot":"","sources":["../src/testkit.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BH,0DAcC;AAvCD,wDAA0C;AAC1C,2CAA0C;AAE1C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACI,KAAK,UAAU,uBAAuB,CAAC,IAAgB;IAI5D,IAAI,IAAI,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;QACvB,MAAM,IAAI,uBAAW,CAAC,4BAA4B,EAAE,+BAA+B,CAAC,CAAC;IACvF,CAAC;IAED,qDAAqD;IACrD,oCAAoC;IACpC,MAAM,UAAU,GAAG,IAAI,CAAC;IACxB,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;IAE9D,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC;AACnC,CAAC"}