@krizaka/storage 0.0.0-stage → 0.3.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 +201 -0
- package/README.md +25 -2
- package/dist/chunk-C3LEYKGC.js +149 -0
- package/dist/chunk-C3LEYKGC.js.map +1 -0
- package/dist/chunk-W56662PQ.js +346 -0
- package/dist/chunk-W56662PQ.js.map +1 -0
- package/dist/chunk-ZWQMALDF.js +81 -0
- package/dist/chunk-ZWQMALDF.js.map +1 -0
- package/dist/index.d.ts +105 -0
- package/dist/index.js +161 -0
- package/dist/index.js.map +1 -0
- package/dist/port-6VXXuSbc.d.ts +65 -0
- package/dist/resolve.d.ts +74 -0
- package/dist/resolve.js +52 -0
- package/dist/resolve.js.map +1 -0
- package/dist/settings.d.ts +68 -0
- package/dist/settings.js +18 -0
- package/dist/settings.js.map +1 -0
- package/dist/storage-DurtrQKq.d.ts +73 -0
- package/dist/testkit.d.ts +6 -0
- package/dist/testkit.js +44 -0
- package/dist/testkit.js.map +1 -0
- package/dist/where-DKtS1O5l.d.ts +71 -0
- package/package.json +86 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @krizaka/storage
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Files behind one port for every Krizaka product. The port is named by what it does (`ObjectStore`), the provider is a value the admin chooses. No vendor SDK (plain HTTP through an injected `fetch`), no environment variable, no wall clock.
|
|
4
|
+
|
|
5
|
+
- **The port.** `put`, `get`, `head`, `delete`, `list(prefix)`, `signedUrl(key, ttl)` for a private zone, `publicUrl(key)` when a pull zone or CDN exists.
|
|
6
|
+
- **Adapters.** `remoteStore` (an HTTP zone with the shape of Bunny Storage: `AccessKey` header, `PUT`/`GET`/`DELETE`, a directory listed by its path with a trailing slash, a pull zone with token-signed links), `bucketStore` (any S3-compatible service: Signature V4, presigned GET, `ListObjectsV2`, no SDK), `folderStore` (a folder, for development, tests and the Mac apps; a key never leaves the root), `memoryObjectStore`. All run `objectStoreContract` (`@krizaka/storage/testkit`).
|
|
7
|
+
- **Rules every upload obeys** (`createStorage`): the size limit is passed in, the prefix must be declared in a `defineLayout` (an unknown prefix is refused), the bytes are checked by magic number (`sniffType`: png, jpeg, gif, webp, pdf, mp4, webm, svg), never by the extension, and a declared type that contradicts the bytes is refused. The stored name is content-hashed, `<name>.<sha10>.<ext>`, so a URL never changes content.
|
|
8
|
+
- **The admin chooses** (`@krizaka/storage/settings`): `storage.provider` (`local`, `http`, `s3`), `storage.maxMegabytes`, `storage.signedUrlSeconds`, and the non-secret coordinates (`endpoint`, `region`, `bucket`, `zone`, `prefix`, `pullHostname`, `publicBaseUrl`). Keys stay in the environment; `storeFromSettings` takes them as parameters and refuses a provider chosen without what it needs, instead of falling back to another. An admin-typed S3 endpoint goes through `checkEndpoint` (https only, no credentials, no local or private address).
|
|
9
|
+
- **Encryption at rest, the vault, regions and `where`.** `encryptedStore(inner, key)` (AES-256-GCM over any `ObjectStore`; the key is a parameter; the provider holds ciphertext; no link is handed out), `seal`/`open` (credentials in the database, `v1.` envelope), `COUNTRY_OF_REGION` (the one region table: an unlisted region is never a country; `residencyOfConfig` says « canada » only when the region and the endpoint agree, never for a Bunny-shaped zone), `where(kind, active, { fixed, devOnly })` and `storageNotice` (the sentence key of the info panel, from the configuration).
|
|
10
|
+
- **Admin over environment** (`@krizaka/storage/resolve`). `resolveStorage(env, admin)` serves every kind of data (documents, avatars: pass each its own `DeploymentStorage`): the admin's `storage.*` wins, the environment gives the secrets and the fallback when the admin left `local`. If the environment says `none` and the admin turns keeping on, it throws `StorageError` `STORAGE_KEEPING_OFF` (call it when saving the setting to refuse early): keeping is turned on in the environment, never by a setting alone. `openResolved` builds the store, encrypted when a key is given.
|
|
11
|
+
- **Signatures.** SigV4 is checked against AWS's published vectors. The token form of the HTTP zone's signed links (SHA-256 of key + path + expires, URL-safe base64) is the one Yomizaka and Orochia run against Bunny's pull zones; Bunny's documentation publishes no expected output for it.
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { createStorage, defineLayout, folderStore } from "@krizaka/storage";
|
|
15
|
+
import { limitsOf, readStorageSettings, storeFromSettings } from "@krizaka/storage/settings";
|
|
16
|
+
|
|
17
|
+
const settings = await readStorageSettings((key) => service.get(key, ctx));
|
|
18
|
+
const storage = createStorage({
|
|
19
|
+
store: storeFromSettings(settings, { accessKeyId: env.MEDIA_STORAGE_ACCESS_KEY_ID, secretAccessKey: env.MEDIA_STORAGE_SECRET }, { fetch, clock }),
|
|
20
|
+
layout: defineLayout(["people/", "site/home/"]),
|
|
21
|
+
limits: () => readStorageSettings(read).then(limitsOf),
|
|
22
|
+
});
|
|
23
|
+
const { key, url } = await storage.upload({ prefix: "people/", name: "ana.jpg", bytes, allow: ["image/jpeg", "image/png"], declaredType: file.type });
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Apache-2.0.
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import {
|
|
2
|
+
STORAGE_CODE,
|
|
3
|
+
StorageError,
|
|
4
|
+
assertKey
|
|
5
|
+
} from "./chunk-W56662PQ.js";
|
|
6
|
+
|
|
7
|
+
// src/encrypted-store.ts
|
|
8
|
+
import { createCipheriv, createDecipheriv, randomBytes } from "crypto";
|
|
9
|
+
|
|
10
|
+
// src/secret-key.ts
|
|
11
|
+
var KEY_BYTES = 32;
|
|
12
|
+
function parseSecretKey(base64, what) {
|
|
13
|
+
const key = Uint8Array.from(Buffer.from(base64, "base64"));
|
|
14
|
+
if (key.length !== KEY_BYTES) throw new StorageError(STORAGE_CODE.badSecretKey, `${what} must be ${KEY_BYTES} bytes in base64`);
|
|
15
|
+
return key;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// src/encrypted-store.ts
|
|
19
|
+
var VERSION = 1;
|
|
20
|
+
var IV_BYTES = 12;
|
|
21
|
+
var TAG_BYTES = 16;
|
|
22
|
+
var HEADER_BYTES = 1 + IV_BYTES + TAG_BYTES;
|
|
23
|
+
var parseEncryptionKey = (base64) => parseSecretKey(base64, "The encryption key");
|
|
24
|
+
function encryptedStore(inner, key) {
|
|
25
|
+
if (key.length !== 32) throw new StorageError(STORAGE_CODE.badSecretKey, "The encryption key must be 32 bytes");
|
|
26
|
+
const store = {
|
|
27
|
+
async put(k, bytes, meta) {
|
|
28
|
+
assertKey(k);
|
|
29
|
+
const iv = randomBytes(IV_BYTES);
|
|
30
|
+
const cipher = createCipheriv("aes-256-gcm", key, iv);
|
|
31
|
+
cipher.setAAD(Buffer.from(k));
|
|
32
|
+
const type = Buffer.from(meta.contentType);
|
|
33
|
+
const head = Buffer.alloc(2);
|
|
34
|
+
head.writeUInt16BE(type.length);
|
|
35
|
+
const body = Buffer.concat([cipher.update(Buffer.concat([head, type, bytes])), cipher.final()]);
|
|
36
|
+
await inner.put(k, Buffer.concat([Buffer.from([VERSION]), iv, cipher.getAuthTag(), body]), { contentType: "application/octet-stream" });
|
|
37
|
+
},
|
|
38
|
+
async get(k) {
|
|
39
|
+
assertKey(k);
|
|
40
|
+
const found = await inner.get(k);
|
|
41
|
+
if (!found) return null;
|
|
42
|
+
const raw = Buffer.from(found.bytes);
|
|
43
|
+
if (raw.length < HEADER_BYTES || raw[0] !== VERSION) throw new StorageError(STORAGE_CODE.unreadable, "Unreadable stored object");
|
|
44
|
+
try {
|
|
45
|
+
const decipher = createDecipheriv("aes-256-gcm", key, raw.subarray(1, 1 + IV_BYTES));
|
|
46
|
+
decipher.setAAD(Buffer.from(k));
|
|
47
|
+
decipher.setAuthTag(raw.subarray(1 + IV_BYTES, HEADER_BYTES));
|
|
48
|
+
const plain = Buffer.concat([decipher.update(raw.subarray(HEADER_BYTES)), decipher.final()]);
|
|
49
|
+
const typeLength = plain.readUInt16BE(0);
|
|
50
|
+
return { contentType: plain.subarray(2, 2 + typeLength).toString(), bytes: new Uint8Array(plain.subarray(2 + typeLength)) };
|
|
51
|
+
} catch {
|
|
52
|
+
throw new StorageError(STORAGE_CODE.unreadable, "The stored object failed its integrity check");
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
// The size of the plain file, read by opening it; `list` shows what the provider holds (ciphertext sizes).
|
|
56
|
+
async head(k) {
|
|
57
|
+
const found = await store.get(k);
|
|
58
|
+
return found ? { key: k, size: found.bytes.byteLength } : null;
|
|
59
|
+
},
|
|
60
|
+
delete: (k) => inner.delete(assertKey(k)),
|
|
61
|
+
list: (prefix) => inner.list(prefix),
|
|
62
|
+
signedUrl: async () => null,
|
|
63
|
+
publicUrl: () => null
|
|
64
|
+
};
|
|
65
|
+
return store;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// src/regions.ts
|
|
69
|
+
var COUNTRY_OF_REGION = {
|
|
70
|
+
// DigitalOcean (App Platform `tor`, managed databases and Spaces `tor1`): Toronto.
|
|
71
|
+
tor: "CA",
|
|
72
|
+
tor1: "CA",
|
|
73
|
+
// AWS, Oracle and Azure Canadian regions.
|
|
74
|
+
"ca-central-1": "CA",
|
|
75
|
+
"ca-west-1": "CA",
|
|
76
|
+
"ca-central": "CA",
|
|
77
|
+
"ca-east": "CA",
|
|
78
|
+
"ca-toronto-1": "CA",
|
|
79
|
+
"ca-montreal-1": "CA",
|
|
80
|
+
"canada-central": "CA",
|
|
81
|
+
canadacentral: "CA",
|
|
82
|
+
canadaeast: "CA",
|
|
83
|
+
// OVHcloud Beauharnois (Québec).
|
|
84
|
+
bhs: "CA",
|
|
85
|
+
// Bunny Storage zones (`<region>.storage.bunnycdn.com`): none is Canadian.
|
|
86
|
+
ny: "US",
|
|
87
|
+
la: "US",
|
|
88
|
+
de: "DE",
|
|
89
|
+
uk: "GB",
|
|
90
|
+
sg: "SG",
|
|
91
|
+
se: "SE",
|
|
92
|
+
// DigitalOcean regions a product might use later.
|
|
93
|
+
nyc3: "US",
|
|
94
|
+
sfo3: "US",
|
|
95
|
+
ams3: "NL",
|
|
96
|
+
fra1: "DE",
|
|
97
|
+
lon1: "GB",
|
|
98
|
+
sgp1: "SG",
|
|
99
|
+
blr1: "IN",
|
|
100
|
+
syd1: "AU"
|
|
101
|
+
};
|
|
102
|
+
var countryOf = (region) => COUNTRY_OF_REGION[region.trim().toLowerCase()];
|
|
103
|
+
var residencyOf = (region) => countryOf(region) === "CA" ? "canada" : "elsewhere";
|
|
104
|
+
function residencyOfConfig(config) {
|
|
105
|
+
if (config.provider === "http") return "elsewhere";
|
|
106
|
+
const host = config.endpoint.replace(/^[a-z]+:\/\//i, "").split("/")[0]?.toLowerCase() ?? "";
|
|
107
|
+
const labels = host.split(".").filter((label) => countryOf(label) !== void 0);
|
|
108
|
+
if (labels.some((label) => countryOf(label) !== "CA")) return "elsewhere";
|
|
109
|
+
return residencyOf(config.region);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// src/where.ts
|
|
113
|
+
var STORE_KIND = { none: "none", device: "device" };
|
|
114
|
+
function describeStore(config, options) {
|
|
115
|
+
const owner = options.owner ?? "krizaka";
|
|
116
|
+
if (config.provider === "http") return { kind: options.httpKind ?? "http", endpoint: config.endpoint, region: null, residency: "elsewhere", encrypted: options.encrypted, owner, devOnly: true };
|
|
117
|
+
return { kind: "s3", endpoint: new URL(config.endpoint).host, region: config.region, residency: residencyOfConfig(config), encrypted: options.encrypted, owner, devOnly: false };
|
|
118
|
+
}
|
|
119
|
+
function where(kind, active, options = {}) {
|
|
120
|
+
const fixed = options.fixed?.[kind];
|
|
121
|
+
if (fixed) return fixed;
|
|
122
|
+
if (kind === STORE_KIND.none) return { ...active, kind, endpoint: null, region: null, residency: "unknown", encrypted: false, devOnly: false };
|
|
123
|
+
if (kind === STORE_KIND.device) return { kind, endpoint: null, region: null, residency: "device", encrypted: false, owner: "device", devOnly: false };
|
|
124
|
+
if (kind === active.kind) return active;
|
|
125
|
+
return { kind, endpoint: null, region: null, residency: "unknown", encrypted: false, owner: "krizaka", devOnly: options.devOnly?.includes(kind) ?? false };
|
|
126
|
+
}
|
|
127
|
+
function storageNotice(d) {
|
|
128
|
+
if (d.kind === STORE_KIND.none) return { key: "none", vars: {} };
|
|
129
|
+
if (d.kind === STORE_KIND.device) return { key: "device", vars: {} };
|
|
130
|
+
if (d.devOnly) return { key: "devOnly", vars: {} };
|
|
131
|
+
if (d.owner === "workspace") return { key: "workspace", vars: { endpoint: d.endpoint ?? "", region: d.region ?? "" } };
|
|
132
|
+
if (d.residency === "canada") return { key: d.encrypted ? "krizakaCanadaEncrypted" : "krizakaCanada", vars: {} };
|
|
133
|
+
return { key: "krizakaElsewhere", vars: { region: d.region ?? "" } };
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export {
|
|
137
|
+
parseSecretKey,
|
|
138
|
+
parseEncryptionKey,
|
|
139
|
+
encryptedStore,
|
|
140
|
+
COUNTRY_OF_REGION,
|
|
141
|
+
countryOf,
|
|
142
|
+
residencyOf,
|
|
143
|
+
residencyOfConfig,
|
|
144
|
+
STORE_KIND,
|
|
145
|
+
describeStore,
|
|
146
|
+
where,
|
|
147
|
+
storageNotice
|
|
148
|
+
};
|
|
149
|
+
//# sourceMappingURL=chunk-C3LEYKGC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/encrypted-store.ts","../src/secret-key.ts","../src/regions.ts","../src/where.ts"],"sourcesContent":["import { createCipheriv, createDecipheriv, randomBytes } from \"node:crypto\";\n\nimport { assertKey } from \"./keys\";\nimport { type ObjectStore, STORAGE_CODE, StorageError } from \"./port\";\nimport { parseSecretKey } from \"./secret-key\";\n\nconst VERSION = 1;\nconst IV_BYTES = 12;\nconst TAG_BYTES = 16;\nconst HEADER_BYTES = 1 + IV_BYTES + TAG_BYTES;\n\n/** The 32-byte AES key of the encryption at rest, from its base64 form (the owner's key, passed in as a parameter). */\nexport const parseEncryptionKey = (base64: string): Uint8Array => parseSecretKey(base64, \"The encryption key\");\n\n/**\n * Encryption at rest over any `ObjectStore` (AES-256-GCM, a fresh IV per object, the object's key as authenticated data, so a file\n * moved under another name does not open). Envelope: `1 | iv(12) | tag(16) | ciphertext(contentTypeLength(2) | contentType | bytes)`.\n * The key comes in as a parameter (from the settings or the environment, read by the product's edge); the provider only ever holds\n * ciphertext. A link to ciphertext is useless to a browser, so `signedUrl` and `publicUrl` answer `null`: the application decrypts and serves.\n * @throws StorageError `STORAGE_UNREADABLE` when an object is not an envelope or fails its integrity check\n */\nexport function encryptedStore(inner: ObjectStore, key: Uint8Array): ObjectStore {\n if (key.length !== 32) throw new StorageError(STORAGE_CODE.badSecretKey, \"The encryption key must be 32 bytes\");\n const store: ObjectStore = {\n async put(k, bytes, meta) {\n assertKey(k);\n const iv = randomBytes(IV_BYTES);\n const cipher = createCipheriv(\"aes-256-gcm\", key, iv);\n cipher.setAAD(Buffer.from(k));\n const type = Buffer.from(meta.contentType);\n const head = Buffer.alloc(2);\n head.writeUInt16BE(type.length);\n const body = Buffer.concat([cipher.update(Buffer.concat([head, type, bytes])), cipher.final()]);\n await inner.put(k, Buffer.concat([Buffer.from([VERSION]), iv, cipher.getAuthTag(), body]), { contentType: \"application/octet-stream\" });\n },\n async get(k) {\n assertKey(k);\n const found = await inner.get(k);\n if (!found) return null;\n const raw = Buffer.from(found.bytes);\n if (raw.length < HEADER_BYTES || raw[0] !== VERSION) throw new StorageError(STORAGE_CODE.unreadable, \"Unreadable stored object\");\n try {\n const decipher = createDecipheriv(\"aes-256-gcm\", key, raw.subarray(1, 1 + IV_BYTES));\n decipher.setAAD(Buffer.from(k));\n decipher.setAuthTag(raw.subarray(1 + IV_BYTES, HEADER_BYTES));\n const plain = Buffer.concat([decipher.update(raw.subarray(HEADER_BYTES)), decipher.final()]);\n const typeLength = plain.readUInt16BE(0);\n return { contentType: plain.subarray(2, 2 + typeLength).toString(), bytes: new Uint8Array(plain.subarray(2 + typeLength)) };\n } catch {\n throw new StorageError(STORAGE_CODE.unreadable, \"The stored object failed its integrity check\");\n }\n },\n // The size of the plain file, read by opening it; `list` shows what the provider holds (ciphertext sizes).\n async head(k) {\n const found = await store.get(k);\n return found ? { key: k, size: found.bytes.byteLength } : null;\n },\n delete: (k) => inner.delete(assertKey(k)),\n list: (prefix) => inner.list(prefix),\n signedUrl: async () => null,\n publicUrl: () => null,\n };\n return store;\n}\n","import { STORAGE_CODE, StorageError } from \"./port\";\n\nconst KEY_BYTES = 32;\n\n/** A 32-byte key given in base64 (the form an environment variable or a secret manager holds). Anything else is refused: no weaker key is ever made up. */\nexport function parseSecretKey(base64: string, what: string): Uint8Array {\n const key = Uint8Array.from(Buffer.from(base64, \"base64\"));\n if (key.length !== KEY_BYTES) throw new StorageError(STORAGE_CODE.badSecretKey, `${what} must be ${KEY_BYTES} bytes in base64`);\n return key;\n}\n","/**\n * The country of each provider region (data: a new region is a line here, one table for every product, ADR-010). A region not listed\n * is unknown: nothing claims a country for it, and the generated residency text never says « Canada » for it.\n */\nexport const COUNTRY_OF_REGION: Readonly<Record<string, string>> = {\n // DigitalOcean (App Platform `tor`, managed databases and Spaces `tor1`): Toronto.\n tor: \"CA\",\n tor1: \"CA\",\n // AWS, Oracle and Azure Canadian regions.\n \"ca-central-1\": \"CA\",\n \"ca-west-1\": \"CA\",\n \"ca-central\": \"CA\",\n \"ca-east\": \"CA\",\n \"ca-toronto-1\": \"CA\",\n \"ca-montreal-1\": \"CA\",\n \"canada-central\": \"CA\",\n canadacentral: \"CA\",\n canadaeast: \"CA\",\n // OVHcloud Beauharnois (Québec).\n bhs: \"CA\",\n // Bunny Storage zones (`<region>.storage.bunnycdn.com`): none is Canadian.\n ny: \"US\",\n la: \"US\",\n de: \"DE\",\n uk: \"GB\",\n sg: \"SG\",\n se: \"SE\",\n // DigitalOcean regions a product might use later.\n nyc3: \"US\",\n sfo3: \"US\",\n ams3: \"NL\",\n fra1: \"DE\",\n lon1: \"GB\",\n sgp1: \"SG\",\n blr1: \"IN\",\n syd1: \"AU\",\n};\n\nexport type Residency = \"canada\" | \"elsewhere\";\n\n/** The ISO country of a provider region, or undefined when the region is not mapped. */\nexport const countryOf = (region: string): string | undefined => COUNTRY_OF_REGION[region.trim().toLowerCase()];\n\n/** Canada only when the table says so; an unmapped region is « elsewhere », never a guess in Canada's favour. */\nexport const residencyOf = (region: string): Residency => (countryOf(region) === \"CA\" ? \"canada\" : \"elsewhere\");\n\n/**\n * Residency of a configured store: the region AND the endpoint have to agree. A host that names a known region\n * (`nyc3.digitaloceanspaces.com`, `ny.storage.bunnycdn.com`) in another country than the region setting is the contradiction that\n * would let a text claim Canada falsely, so any known region label of the host that is not Canadian makes the answer « elsewhere ».\n * A Bunny-shaped zone (`http`) has no Canadian region, so it is never « canada ».\n */\nexport function residencyOfConfig(config: { provider: \"http\" | \"s3\"; endpoint: string; region: string }): Residency {\n if (config.provider === \"http\") return \"elsewhere\";\n const host = config.endpoint.replace(/^[a-z]+:\\/\\//i, \"\").split(\"/\")[0]?.toLowerCase() ?? \"\";\n const labels = host.split(\".\").filter((label) => countryOf(label) !== undefined);\n if (labels.some((label) => countryOf(label) !== \"CA\")) return \"elsewhere\";\n return residencyOf(config.region);\n}\n","import { type Residency, residencyOfConfig } from \"./regions\";\n\n/** The two kinds every product shares; the others are the product's. */\nexport const STORE_KIND = { none: \"none\", device: \"device\" } as const;\n\n/** Whose store it is: Krizaka's (the deployment's), the workspace's own, or the person's device. */\nexport type StoreOwner = \"krizaka\" | \"workspace\" | \"device\";\n\n/** Where objects live, as the product says it: computed from the configuration, never typed. */\nexport interface StoreDescriptor {\n /** The product's name for the store (`s3`, `bunny`, `database`, `none`, `device`…). */\n kind: string;\n endpoint: string | null;\n region: string | null;\n residency: Residency | \"unknown\" | \"device\";\n encrypted: boolean;\n owner: StoreOwner;\n /** For fictional and development data only: the notice says so instead of claiming a place. */\n devOnly: boolean;\n}\n\n/** The descriptor of a configured store, from its configuration alone (see `residencyOfConfig`: a Bunny-shaped zone is dev only and never Canadian). */\nexport function describeStore(config: { provider: \"http\" | \"s3\"; endpoint: string; region: string }, options: { encrypted: boolean; owner?: StoreOwner; httpKind?: string }): StoreDescriptor {\n const owner = options.owner ?? \"krizaka\";\n if (config.provider === \"http\") return { kind: options.httpKind ?? \"http\", endpoint: config.endpoint, region: null, residency: \"elsewhere\", encrypted: options.encrypted, owner, devOnly: true };\n return { kind: \"s3\", endpoint: new URL(config.endpoint).host, region: config.region, residency: residencyOfConfig(config), encrypted: options.encrypted, owner, devOnly: false };\n}\n\nexport interface WhereOptions {\n /** Stores that are not configurable but fixed places (Yomizaka's managed database in Toronto), by kind. */\n fixed?: Readonly<Record<string, StoreDescriptor>>;\n /** Kinds that exist only for development data. */\n devOnly?: readonly string[];\n}\n\n/**\n * Where an object lives, from the store kind recorded with it and the store configured now. True at every moment, per object:\n * a fixed place says what it is; `none` and `device` say so; the active store answers for its own kind; any other kind (a store\n * no longer configured) says only its kind, with an unknown residency, so nothing is claimed that nothing proves.\n */\nexport function where(kind: string, active: StoreDescriptor, options: WhereOptions = {}): StoreDescriptor {\n const fixed = options.fixed?.[kind];\n if (fixed) return fixed;\n if (kind === STORE_KIND.none) return { ...active, kind, endpoint: null, region: null, residency: \"unknown\", encrypted: false, devOnly: false };\n if (kind === STORE_KIND.device) return { kind, endpoint: null, region: null, residency: \"device\", encrypted: false, owner: \"device\", devOnly: false };\n if (kind === active.kind) return active;\n return { kind, endpoint: null, region: null, residency: \"unknown\", encrypted: false, owner: \"krizaka\", devOnly: options.devOnly?.includes(kind) ?? false };\n}\n\nexport type NoticeKey = \"none\" | \"krizakaCanadaEncrypted\" | \"krizakaCanada\" | \"krizakaElsewhere\" | \"workspace\" | \"devOnly\" | \"device\";\n\n/** Which sentence says where this object lives (« Not kept », « Kept: Krizaka (Canada, encrypted) »…), with its variables; the product's messages hold the words. */\nexport function storageNotice(d: StoreDescriptor): { key: NoticeKey; vars: Record<string, string> } {\n if (d.kind === STORE_KIND.none) return { key: \"none\", vars: {} };\n if (d.kind === STORE_KIND.device) return { key: \"device\", vars: {} };\n if (d.devOnly) return { key: \"devOnly\", vars: {} };\n if (d.owner === \"workspace\") return { key: \"workspace\", vars: { endpoint: d.endpoint ?? \"\", region: d.region ?? \"\" } };\n if (d.residency === \"canada\") return { key: d.encrypted ? \"krizakaCanadaEncrypted\" : \"krizakaCanada\", vars: {} };\n return { key: \"krizakaElsewhere\", vars: { region: d.region ?? \"\" } };\n}\n"],"mappings":";;;;;;;AAAA,SAAS,gBAAgB,kBAAkB,mBAAmB;;;ACE9D,IAAM,YAAY;AAGX,SAAS,eAAe,QAAgB,MAA0B;AACvE,QAAM,MAAM,WAAW,KAAK,OAAO,KAAK,QAAQ,QAAQ,CAAC;AACzD,MAAI,IAAI,WAAW,UAAW,OAAM,IAAI,aAAa,aAAa,cAAc,GAAG,IAAI,YAAY,SAAS,kBAAkB;AAC9H,SAAO;AACT;;;ADHA,IAAM,UAAU;AAChB,IAAM,WAAW;AACjB,IAAM,YAAY;AAClB,IAAM,eAAe,IAAI,WAAW;AAG7B,IAAM,qBAAqB,CAAC,WAA+B,eAAe,QAAQ,oBAAoB;AAStG,SAAS,eAAe,OAAoB,KAA8B;AAC/E,MAAI,IAAI,WAAW,GAAI,OAAM,IAAI,aAAa,aAAa,cAAc,qCAAqC;AAC9G,QAAM,QAAqB;AAAA,IACzB,MAAM,IAAI,GAAG,OAAO,MAAM;AACxB,gBAAU,CAAC;AACX,YAAM,KAAK,YAAY,QAAQ;AAC/B,YAAM,SAAS,eAAe,eAAe,KAAK,EAAE;AACpD,aAAO,OAAO,OAAO,KAAK,CAAC,CAAC;AAC5B,YAAM,OAAO,OAAO,KAAK,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