@rabbitlock/runtime 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/LICENSE +21 -0
- package/README.md +38 -0
- package/package.json +25 -0
- package/pkg/package.json +14 -0
- package/pkg/rabbitlock_crypto.d.ts +133 -0
- package/pkg/rabbitlock_crypto.js +971 -0
- package/pkg/rabbitlock_crypto_bg.js +849 -0
- package/pkg/rabbitlock_crypto_bg.wasm +0 -0
- package/pkg/rabbitlock_crypto_bg.wasm.d.ts +30 -0
- package/rabbitlock-env.mjs +163 -0
- package/rabbitlock_env.py +83 -0
- package/runtime.test.mjs +110 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Prismworks AI
|
|
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,38 @@
|
|
|
1
|
+
# @rabbitlock/runtime
|
|
2
|
+
|
|
3
|
+
Minimal RabbitLock runtime helpers for decrypting `env.sops.json` into runtime env vars.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @rabbitlock/runtime
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
export RABBITLOCK_SEED_HEX=...
|
|
15
|
+
rabbitlock-env --in env.sops.json --export
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
rabbitlock-env --in env.sops.json --json
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
rabbitlock-env --in env.sops.json --write-env .env
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Python helper
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
from rabbitlock_env import load_env_dict, load_env_into_os
|
|
30
|
+
|
|
31
|
+
env = load_env_dict(seed_hex="...", sops_path="env.sops.json")
|
|
32
|
+
load_env_into_os(seed_hex="...", sops_path="env.sops.json")
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Notes
|
|
36
|
+
|
|
37
|
+
- This package bundles the Wasm crypto artifacts in `pkg/`.
|
|
38
|
+
- The CLI reads the SOPS file from the current working directory unless `--in` is provided.
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rabbitlock/runtime",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "RabbitLock runtime CLI for decrypting SOPS JSON to env vars.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"rabbitlock-env": "rabbitlock-env.mjs"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"rabbitlock-env.mjs",
|
|
11
|
+
"rabbitlock_env.py",
|
|
12
|
+
"pkg/",
|
|
13
|
+
"runtime.test.mjs",
|
|
14
|
+
"README.md",
|
|
15
|
+
"LICENSE"
|
|
16
|
+
],
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/prismworks-ai/rabbitlock-runtime.git"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"test": "node --test runtime.test.mjs"
|
|
24
|
+
}
|
|
25
|
+
}
|
package/pkg/package.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "rabbitlock-crypto",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"files": [
|
|
5
|
+
"rabbitlock_crypto_bg.wasm",
|
|
6
|
+
"rabbitlock_crypto.js",
|
|
7
|
+
"rabbitlock_crypto.d.ts"
|
|
8
|
+
],
|
|
9
|
+
"module": "rabbitlock_crypto.js",
|
|
10
|
+
"types": "rabbitlock_crypto.d.ts",
|
|
11
|
+
"sideEffects": [
|
|
12
|
+
"./snippets/*"
|
|
13
|
+
]
|
|
14
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
export function create_zip_archive(files_js: any): Uint8Array;
|
|
5
|
+
|
|
6
|
+
export function decrypt_and_verify_sops(json_input: string, private_key: string): string;
|
|
7
|
+
|
|
8
|
+
export function decrypt_binary_hybrid(data: Uint8Array, secret_key_hex: string): Uint8Array;
|
|
9
|
+
|
|
10
|
+
export function decrypt_data_key(json_input: string, private_key: string): string;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Decrypt and return the full decrypted SOPS file as JSON string
|
|
14
|
+
* Returns: JSON string with decrypted values (sops metadata still encrypted)
|
|
15
|
+
*/
|
|
16
|
+
export function decrypt_sops_content(json_input: string, private_key: string): string;
|
|
17
|
+
|
|
18
|
+
export function derive_hybrid_keypair(seed_hex: string): string;
|
|
19
|
+
|
|
20
|
+
export function encrypt_binary_hybrid(data: Uint8Array, recipient_pubkey_hex: string): Uint8Array;
|
|
21
|
+
|
|
22
|
+
export function encrypt_sops_json(plain_json: string, data_key_hex: string): string;
|
|
23
|
+
|
|
24
|
+
export function encrypt_sops_json_for_recipient(plain_json: string, recipient_pubkey_hex: string): string;
|
|
25
|
+
|
|
26
|
+
export function greet(name: string): string;
|
|
27
|
+
|
|
28
|
+
export function parse_and_verify_sops(json_input: string): string;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Decapsulate a shared secret using your private key
|
|
32
|
+
* secret_key_hex: 2432 bytes as hex
|
|
33
|
+
* ciphertext_hex: 1120 bytes as hex
|
|
34
|
+
* Returns: shared_secret_hex (64 hex chars = 32 bytes)
|
|
35
|
+
*/
|
|
36
|
+
export function pq_decapsulate(secret_key_hex: string, ciphertext_hex: string): string;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Encapsulate a shared secret for a recipient's hybrid public key
|
|
40
|
+
* pub_key_hex: 1216 bytes (32 X25519 + 1184 ML-KEM) as hex
|
|
41
|
+
* Returns: "shared_secret_hex:ciphertext_hex"
|
|
42
|
+
*/
|
|
43
|
+
export function pq_encapsulate(pub_key_hex: string): string;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Generate a new hybrid keypair (X25519 + ML-KEM-768)
|
|
47
|
+
* Returns: "secret_key_hex:public_key_hex"
|
|
48
|
+
*/
|
|
49
|
+
export function pq_generate_keypair(): string;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Get the size constants for documentation
|
|
53
|
+
* Get the size constants for documentation
|
|
54
|
+
*/
|
|
55
|
+
export function pq_get_sizes(): string;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Decapsulate a shared secret using an ML-KEM-768 secret key (PQ-only)
|
|
59
|
+
* secret_key_hex: 2400 bytes as hex
|
|
60
|
+
* ciphertext_hex: 1088 bytes as hex
|
|
61
|
+
* Returns: shared_secret_hex (64 hex chars = 32 bytes)
|
|
62
|
+
*/
|
|
63
|
+
export function pq_mlkem_decapsulate(secret_key_hex: string, ciphertext_hex: string): string;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Encapsulate a shared secret for an ML-KEM-768 public key (PQ-only)
|
|
67
|
+
* pub_key_hex: 1184 bytes as hex
|
|
68
|
+
* Returns: "shared_secret_hex:ciphertext_hex"
|
|
69
|
+
*/
|
|
70
|
+
export function pq_mlkem_encapsulate(pub_key_hex: string): string;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Generate a new ML-KEM-768 keypair (PQ-only)
|
|
74
|
+
* Returns: "secret_key_hex:public_key_hex"
|
|
75
|
+
*/
|
|
76
|
+
export function pq_mlkem_generate_keypair(): string;
|
|
77
|
+
|
|
78
|
+
export function verify_sops_integrity(json_input: string, data_key_hex: string): string;
|
|
79
|
+
|
|
80
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
81
|
+
|
|
82
|
+
export interface InitOutput {
|
|
83
|
+
readonly memory: WebAssembly.Memory;
|
|
84
|
+
readonly greet: (a: number, b: number) => [number, number];
|
|
85
|
+
readonly parse_and_verify_sops: (a: number, b: number) => [number, number];
|
|
86
|
+
readonly derive_hybrid_keypair: (a: number, b: number) => [number, number, number, number];
|
|
87
|
+
readonly verify_sops_integrity: (a: number, b: number, c: number, d: number) => [number, number];
|
|
88
|
+
readonly decrypt_data_key: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
89
|
+
readonly decrypt_and_verify_sops: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
90
|
+
readonly decrypt_sops_content: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
91
|
+
readonly encrypt_sops_json: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
92
|
+
readonly encrypt_sops_json_for_recipient: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
93
|
+
readonly pq_generate_keypair: () => [number, number];
|
|
94
|
+
readonly pq_encapsulate: (a: number, b: number) => [number, number, number, number];
|
|
95
|
+
readonly pq_decapsulate: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
96
|
+
readonly pq_mlkem_generate_keypair: () => [number, number];
|
|
97
|
+
readonly pq_mlkem_encapsulate: (a: number, b: number) => [number, number, number, number];
|
|
98
|
+
readonly pq_mlkem_decapsulate: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
99
|
+
readonly pq_get_sizes: () => [number, number];
|
|
100
|
+
readonly create_zip_archive: (a: any) => [number, number, number, number];
|
|
101
|
+
readonly encrypt_binary_hybrid: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
102
|
+
readonly decrypt_binary_hybrid: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
103
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
104
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
105
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
106
|
+
readonly __externref_table_alloc: () => number;
|
|
107
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
108
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
109
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
110
|
+
readonly __wbindgen_start: () => void;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
117
|
+
* a precompiled `WebAssembly.Module`.
|
|
118
|
+
*
|
|
119
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
120
|
+
*
|
|
121
|
+
* @returns {InitOutput}
|
|
122
|
+
*/
|
|
123
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
127
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
128
|
+
*
|
|
129
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
130
|
+
*
|
|
131
|
+
* @returns {Promise<InitOutput>}
|
|
132
|
+
*/
|
|
133
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|