@git-stunts/git-cas 5.3.2 → 6.0.1
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/ADVANCED_GUIDE.md +1027 -0
- package/ARCHITECTURE.md +514 -0
- package/CHANGELOG.md +449 -5
- package/CODE_OF_CONDUCT.md +33 -0
- package/GUIDE.md +926 -0
- package/README.md +106 -366
- package/SECURITY.md +993 -0
- package/SUPPORT.md +54 -0
- package/UPGRADING.md +299 -0
- package/bin/actions.js +70 -21
- package/bin/agent/cli.js +51 -0
- package/bin/agent/commands/doctor.js +99 -0
- package/bin/agent/commands/index.js +1489 -0
- package/bin/agent/input.js +619 -0
- package/bin/agent/passphrase-source.js +123 -0
- package/bin/agent/protocol.js +193 -0
- package/bin/build-version.js +64 -0
- package/bin/credentials.js +425 -0
- package/bin/git-cas.js +595 -449
- package/bin/passphrase-source.js +266 -0
- package/bin/restore-output-target.js +28 -0
- package/bin/ui/blocks/asset-card.js +109 -0
- package/bin/ui/blocks/health-dashboard.js +149 -0
- package/bin/ui/blocks/heatmap-block.js +67 -0
- package/bin/ui/blocks/merkle-explorer.js +163 -0
- package/bin/ui/blocks/operation-feed.js +176 -0
- package/bin/ui/blocks/wizard-block.js +168 -0
- package/bin/ui/components/short-sha.js +36 -0
- package/bin/ui/context.js +56 -1
- package/bin/ui/dashboard-cmds.js +1578 -13
- package/bin/ui/dashboard-view.js +612 -145
- package/bin/ui/dashboard.js +1255 -212
- package/bin/ui/encryption-card.js +69 -26
- package/bin/ui/heatmap.js +26 -54
- package/bin/ui/history-timeline.js +51 -19
- package/bin/ui/manifest-view.js +115 -60
- package/bin/ui/merkle-dag.js +83 -0
- package/bin/ui/progress.js +15 -9
- package/bin/ui/repo-treemap.js +328 -0
- package/bin/ui/shaders/bak-sneppen.js +180 -0
- package/bin/ui/shaders/fractal-zoom.js +99 -0
- package/bin/ui/shaders/merkle-tree.js +142 -0
- package/bin/ui/shaders/organic-flow.js +96 -0
- package/bin/ui/shaders/phase-portrait.js +93 -0
- package/bin/ui/store-wizard.js +367 -0
- package/bin/ui/theme.js +155 -0
- package/bin/ui/vault-report.js +495 -0
- package/build-info.json +4 -0
- package/docs/API.md +2254 -0
- package/docs/ENCRYPTION_MODES.md +33 -0
- package/docs/EXTENDING.md +174 -0
- package/docs/STORE_RESTORE_PIPELINE.md +199 -0
- package/docs/THREAT_MODEL.md +269 -0
- package/docs/VAULT_INTERNALS.md +251 -0
- package/docs/WALKTHROUGH.md +1868 -0
- package/docs/demo.gif +0 -0
- package/docs/releases/v6.0.0.md +104 -0
- package/examples/README.md +260 -0
- package/index.d.ts +273 -80
- package/index.js +220 -59
- package/package.json +35 -6
- package/scripts/migrate-encryption.js +680 -0
- package/src/domain/bytes/ByteLayout.js +96 -0
- package/src/domain/encoding/base64.js +91 -0
- package/src/domain/encoding/hex.js +14 -0
- package/src/domain/encoding/utf8.js +123 -0
- package/src/domain/encryption/schemes.js +132 -0
- package/src/domain/errors/CannotRemoveLastRecipientError.js +10 -0
- package/src/domain/errors/CasError.d.ts +28 -0
- package/src/domain/errors/CasError.js +43 -6
- package/src/domain/errors/Codes.js +54 -0
- package/src/domain/errors/DekUnwrapFailedError.js +10 -0
- package/src/domain/errors/GitError.js +10 -0
- package/src/domain/errors/GitPlumbingInitializationError.js +10 -0
- package/src/domain/errors/IntegrityError.js +10 -0
- package/src/domain/errors/InvalidChunkingStrategyError.js +10 -0
- package/src/domain/errors/InvalidOidError.js +10 -0
- package/src/domain/errors/InvalidOptionsError.js +10 -0
- package/src/domain/errors/ManifestIntegrityError.js +10 -0
- package/src/domain/errors/ManifestNotFoundError.js +10 -0
- package/src/domain/errors/NoMatchingRecipientError.js +10 -0
- package/src/domain/errors/PersistenceCapabilityRequiredError.js +10 -0
- package/src/domain/errors/PortNotImplementedError.js +10 -0
- package/src/domain/errors/RecipientAlreadyExistsError.js +10 -0
- package/src/domain/errors/RecipientNotFoundError.js +10 -0
- package/src/domain/errors/RestoreTooLargeError.js +10 -0
- package/src/domain/errors/RotationNotSupportedError.js +10 -0
- package/src/domain/errors/createCasError.js +68 -0
- package/src/domain/errors/index.js +20 -0
- package/src/domain/helpers/buildKdfMetadata.js +4 -2
- package/src/domain/helpers/codecBytes.js +34 -0
- package/src/domain/helpers/gitRefErrors.js +84 -0
- package/src/domain/helpers/scryptMaxmem.js +22 -0
- package/src/domain/outcomes/RestoreFailure.js +15 -0
- package/src/domain/outcomes/RestoreOutcome.js +11 -0
- package/src/domain/outcomes/RestoreSuccess.js +34 -0
- package/src/domain/outcomes/StoreFailure.js +15 -0
- package/src/domain/outcomes/StoreOutcome.js +11 -0
- package/src/domain/outcomes/StoreSuccess.js +17 -0
- package/src/domain/schemas/ManifestSchema.d.ts +40 -9
- package/src/domain/schemas/ManifestSchema.js +67 -13
- package/src/domain/services/CasService.d.ts +153 -53
- package/src/domain/services/CasService.js +322 -837
- package/src/domain/services/ChunkRepository.js +268 -0
- package/src/domain/services/CompressionStreams.js +72 -0
- package/src/domain/services/ConvergentEncryption.js +128 -0
- package/src/domain/services/GitTreeBuilder.js +86 -0
- package/src/domain/services/IntegrityVerifier.js +199 -0
- package/src/domain/services/KeyResolver.js +49 -42
- package/src/domain/services/ManifestDiff.js +56 -0
- package/src/domain/services/ManifestRepository.js +286 -0
- package/src/domain/services/PrefetchWindow.js +48 -0
- package/src/domain/services/RecipientService.js +157 -0
- package/src/domain/services/RedactingObservability.js +169 -0
- package/src/domain/services/RestorePipeline.js +68 -0
- package/src/domain/services/StorePipeline.js +201 -0
- package/src/domain/services/VaultKeyVerifier.js +101 -0
- package/src/domain/services/VaultMetadataCodec.js +206 -0
- package/src/domain/services/VaultMutationRetryPolicy.js +105 -0
- package/src/domain/services/VaultPersistence.js +410 -0
- package/src/domain/services/VaultPrivacyIndex.js +191 -0
- package/src/domain/services/VaultService.js +749 -251
- package/src/domain/services/VaultStateCache.js +225 -0
- package/src/domain/services/VaultTreeCodec.js +121 -0
- package/src/domain/services/rotateVaultPassphrase.js +37 -20
- package/src/domain/strategies/Aad.js +39 -0
- package/src/domain/strategies/FramedRecordCodec.js +204 -0
- package/src/domain/strategies/RestoreCompressed.js +40 -0
- package/src/domain/strategies/RestoreConvergent.js +44 -0
- package/src/domain/strategies/RestoreFramed.js +55 -0
- package/src/domain/strategies/RestorePlain.js +37 -0
- package/src/domain/strategies/RestoreStrategy.js +35 -0
- package/src/domain/strategies/RestoreWhole.js +135 -0
- package/src/domain/strategies/StoreConvergent.js +28 -0
- package/src/domain/strategies/StoreFramed.js +39 -0
- package/src/domain/strategies/StorePlain.js +20 -0
- package/src/domain/strategies/StoreStrategy.js +61 -0
- package/src/domain/strategies/StoreWhole.js +34 -0
- package/src/domain/value-objects/Chunk.js +1 -2
- package/src/domain/value-objects/EncryptionMetadata.js +87 -0
- package/src/domain/value-objects/Manifest.d.ts +40 -4
- package/src/domain/value-objects/Manifest.js +61 -20
- package/src/domain/value-objects/Oid.js +45 -0
- package/src/domain/value-objects/Slug.js +124 -0
- package/src/domain/value-objects/StoreEncryptionConfig.js +114 -0
- package/src/helpers/aesGcmMeta.js +55 -0
- package/src/helpers/canonicalBase64.js +1 -0
- package/src/helpers/kdfPolicy.js +194 -0
- package/src/infrastructure/adapters/BunCryptoAdapter.js +124 -8
- package/src/infrastructure/adapters/FileIOHelper.js +180 -13
- package/src/infrastructure/adapters/GitPersistenceAdapter.js +235 -42
- package/src/infrastructure/adapters/GitPlumbingFactoryAdapter.js +62 -0
- package/src/infrastructure/adapters/GitRefAdapter.js +19 -6
- package/src/infrastructure/adapters/NodeCompressionAdapter.js +64 -0
- package/src/infrastructure/adapters/NodeCryptoAdapter.js +130 -10
- package/src/infrastructure/adapters/WebCryptoAdapter.js +187 -77
- package/src/infrastructure/chunkers/CdcChunker.js +53 -19
- package/src/infrastructure/chunkers/FixedChunker.js +15 -7
- package/src/infrastructure/chunkers/resolveChunker.js +10 -6
- package/src/infrastructure/codecs/CborCodec.js +3 -3
- package/src/infrastructure/codecs/JsonCodec.js +5 -5
- package/src/infrastructure/createGitPlumbing.js +22 -0
- package/src/package-version.js +1 -0
- package/src/ports/ChunkingPort.js +3 -3
- package/src/ports/CodecPort.js +4 -4
- package/src/ports/CompressionPort.js +57 -0
- package/src/ports/CryptoPort.js +138 -50
- package/src/ports/GitPersistencePort.js +32 -2
- package/src/ports/GitPlumbingFactoryPort.js +16 -0
- package/src/ports/GitRefPort.js +1 -1
- package/src/types/ambient.d.ts +10 -5
- package/test/CONVENTIONS.md +94 -0
- package/test/cycles/README.md +13 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure byte-array layout helpers for protocol code.
|
|
3
|
+
*
|
|
4
|
+
* These functions intentionally use only ECMAScript typed-array operations.
|
|
5
|
+
* Runtime-specific byte subclasses such as Node's Uint8Array belong in adapters.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @param {unknown} value
|
|
10
|
+
* @returns {value is Uint8Array}
|
|
11
|
+
*/
|
|
12
|
+
export function isBytes(value) {
|
|
13
|
+
return value instanceof Uint8Array;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @param {unknown} value
|
|
18
|
+
* @param {string} [name]
|
|
19
|
+
* @returns {Uint8Array}
|
|
20
|
+
*/
|
|
21
|
+
export function assertBytes(value, name = 'value') {
|
|
22
|
+
if (!isBytes(value)) {
|
|
23
|
+
throw new TypeError(`${name} must be a Uint8Array`);
|
|
24
|
+
}
|
|
25
|
+
return value;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Normalizes a source chunk accepted by core byte streams.
|
|
30
|
+
* @param {unknown} chunk
|
|
31
|
+
* @returns {Uint8Array}
|
|
32
|
+
*/
|
|
33
|
+
export function normalizeByteChunk(chunk) {
|
|
34
|
+
if (isBytes(chunk)) {
|
|
35
|
+
return chunk;
|
|
36
|
+
}
|
|
37
|
+
throw new TypeError('CAS source chunks must be Uint8Array');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @param {Uint8Array[]} chunks
|
|
42
|
+
* @param {number} [totalLength]
|
|
43
|
+
* @returns {Uint8Array}
|
|
44
|
+
*/
|
|
45
|
+
export function concatBytes(chunks, totalLength) {
|
|
46
|
+
const length = totalLength ?? chunks.reduce((sum, chunk) => sum + chunk.length, 0);
|
|
47
|
+
const result = new Uint8Array(length);
|
|
48
|
+
let offset = 0;
|
|
49
|
+
for (const chunk of chunks) {
|
|
50
|
+
result.set(chunk, offset);
|
|
51
|
+
offset += chunk.length;
|
|
52
|
+
}
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* @param {{ source: Uint8Array, target: Uint8Array, targetOffset: number, sourceStart?: number, sourceEnd?: number }} options
|
|
58
|
+
*/
|
|
59
|
+
export function copyBytes({
|
|
60
|
+
source,
|
|
61
|
+
target,
|
|
62
|
+
targetOffset,
|
|
63
|
+
sourceStart = 0,
|
|
64
|
+
sourceEnd = source.length,
|
|
65
|
+
}) {
|
|
66
|
+
target.set(source.subarray(sourceStart, sourceEnd), targetOffset);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* @param {Uint8Array} bytes
|
|
71
|
+
* @param {number} [offset]
|
|
72
|
+
* @returns {number}
|
|
73
|
+
*/
|
|
74
|
+
export function readUint32BE(bytes, offset = 0) {
|
|
75
|
+
return (
|
|
76
|
+
((bytes[offset] << 24) >>> 0) +
|
|
77
|
+
(bytes[offset + 1] << 16) +
|
|
78
|
+
(bytes[offset + 2] << 8) +
|
|
79
|
+
bytes[offset + 3]
|
|
80
|
+
) >>> 0;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* @param {Uint8Array} target
|
|
85
|
+
* @param {number} offset
|
|
86
|
+
* @param {number} value
|
|
87
|
+
*/
|
|
88
|
+
export function writeUint32BE(target, offset, value) {
|
|
89
|
+
if (!Number.isInteger(value) || value < 0 || value > 0xffffffff) {
|
|
90
|
+
throw new RangeError(`uint32 value out of range: ${value}`);
|
|
91
|
+
}
|
|
92
|
+
target[offset] = (value >>> 24) & 0xff;
|
|
93
|
+
target[offset + 1] = (value >>> 16) & 0xff;
|
|
94
|
+
target[offset + 2] = (value >>> 8) & 0xff;
|
|
95
|
+
target[offset + 3] = value & 0xff;
|
|
96
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
const ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
2
|
+
const CANONICAL_BASE64_RE = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;
|
|
3
|
+
|
|
4
|
+
/** @type {Map<string, number>} */
|
|
5
|
+
const DECODE = new Map([...ALPHABET].map((char, index) => [char, index]));
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @param {Uint8Array} bytes
|
|
9
|
+
* @returns {string}
|
|
10
|
+
*/
|
|
11
|
+
export function encodeBase64(bytes) {
|
|
12
|
+
let out = '';
|
|
13
|
+
let i = 0;
|
|
14
|
+
for (; i + 2 < bytes.length; i += 3) {
|
|
15
|
+
const n = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];
|
|
16
|
+
out += ALPHABET[(n >>> 18) & 0x3f];
|
|
17
|
+
out += ALPHABET[(n >>> 12) & 0x3f];
|
|
18
|
+
out += ALPHABET[(n >>> 6) & 0x3f];
|
|
19
|
+
out += ALPHABET[n & 0x3f];
|
|
20
|
+
}
|
|
21
|
+
if (i < bytes.length) {
|
|
22
|
+
const remaining = bytes.length - i;
|
|
23
|
+
const n = (bytes[i] << 16) | (remaining === 2 ? bytes[i + 1] << 8 : 0);
|
|
24
|
+
out += ALPHABET[(n >>> 18) & 0x3f];
|
|
25
|
+
out += ALPHABET[(n >>> 12) & 0x3f];
|
|
26
|
+
out += remaining === 2 ? ALPHABET[(n >>> 6) & 0x3f] : '=';
|
|
27
|
+
out += '=';
|
|
28
|
+
}
|
|
29
|
+
return out;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @param {string} value
|
|
34
|
+
* @returns {number}
|
|
35
|
+
*/
|
|
36
|
+
export function base64DecodedLength(value) {
|
|
37
|
+
if (!CANONICAL_BASE64_RE.test(value)) {
|
|
38
|
+
throw new TypeError('value must be canonical base64');
|
|
39
|
+
}
|
|
40
|
+
if (value.length === 0) {
|
|
41
|
+
return 0;
|
|
42
|
+
}
|
|
43
|
+
const padding = value.endsWith('==') ? 2 : value.endsWith('=') ? 1 : 0;
|
|
44
|
+
return (value.length / 4) * 3 - padding;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @param {string} value
|
|
49
|
+
* @returns {Uint8Array}
|
|
50
|
+
*/
|
|
51
|
+
export function decodeBase64(value) {
|
|
52
|
+
const out = new Uint8Array(base64DecodedLength(value));
|
|
53
|
+
let outPos = 0;
|
|
54
|
+
|
|
55
|
+
for (let i = 0; i < value.length; i += 4) {
|
|
56
|
+
const c0 = decodeChar(value[i]);
|
|
57
|
+
const c1 = decodeChar(value[i + 1]);
|
|
58
|
+
const c2 = value[i + 2] === '=' ? 0 : decodeChar(value[i + 2]);
|
|
59
|
+
const c3 = value[i + 3] === '=' ? 0 : decodeChar(value[i + 3]);
|
|
60
|
+
const n = (c0 << 18) | (c1 << 12) | (c2 << 6) | c3;
|
|
61
|
+
|
|
62
|
+
if (outPos < out.length) { out[outPos++] = (n >>> 16) & 0xff; }
|
|
63
|
+
if (outPos < out.length) { out[outPos++] = (n >>> 8) & 0xff; }
|
|
64
|
+
if (outPos < out.length) { out[outPos++] = n & 0xff; }
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return out;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* @param {string} value
|
|
72
|
+
* @returns {boolean}
|
|
73
|
+
*/
|
|
74
|
+
export function isCanonicalBase64(value) {
|
|
75
|
+
if (typeof value !== 'string' || !CANONICAL_BASE64_RE.test(value)) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
return encodeBase64(decodeBase64(value)) === value;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* @param {string} char
|
|
83
|
+
* @returns {number}
|
|
84
|
+
*/
|
|
85
|
+
function decodeChar(char) {
|
|
86
|
+
const decoded = DECODE.get(char);
|
|
87
|
+
if (decoded === undefined) {
|
|
88
|
+
throw new TypeError('value must be canonical base64');
|
|
89
|
+
}
|
|
90
|
+
return decoded;
|
|
91
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const HEX = '0123456789abcdef';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @param {Uint8Array} bytes
|
|
5
|
+
* @returns {string}
|
|
6
|
+
*/
|
|
7
|
+
export function encodeHex(bytes) {
|
|
8
|
+
let out = '';
|
|
9
|
+
for (const byte of bytes) {
|
|
10
|
+
out += HEX[(byte >>> 4) & 0x0f];
|
|
11
|
+
out += HEX[byte & 0x0f];
|
|
12
|
+
}
|
|
13
|
+
return out;
|
|
14
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
const REPLACEMENT = 0xfffd;
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @param {string} value
|
|
5
|
+
* @returns {number}
|
|
6
|
+
*/
|
|
7
|
+
export function utf8ByteLength(value) {
|
|
8
|
+
let length = 0;
|
|
9
|
+
for (let i = 0; i < value.length; i++) {
|
|
10
|
+
const codePoint = value.codePointAt(i);
|
|
11
|
+
if (codePoint === undefined) { break; }
|
|
12
|
+
if (codePoint > 0xffff) { i++; }
|
|
13
|
+
length += utf8CodePointLength(codePoint);
|
|
14
|
+
}
|
|
15
|
+
return length;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @param {string} value
|
|
20
|
+
* @returns {Uint8Array}
|
|
21
|
+
*/
|
|
22
|
+
export function utf8Encode(value) {
|
|
23
|
+
const out = new Uint8Array(utf8ByteLength(value));
|
|
24
|
+
let offset = 0;
|
|
25
|
+
|
|
26
|
+
for (let i = 0; i < value.length; i++) {
|
|
27
|
+
const codePoint = value.codePointAt(i);
|
|
28
|
+
if (codePoint === undefined) { break; }
|
|
29
|
+
if (codePoint > 0xffff) { i++; }
|
|
30
|
+
offset = writeCodePoint(out, offset, codePoint);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return out;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @param {Uint8Array} bytes
|
|
38
|
+
* @returns {string}
|
|
39
|
+
*/
|
|
40
|
+
// eslint-disable-next-line complexity
|
|
41
|
+
export function utf8Decode(bytes) {
|
|
42
|
+
const parts = [];
|
|
43
|
+
let chunk = '';
|
|
44
|
+
|
|
45
|
+
for (let i = 0; i < bytes.length;) {
|
|
46
|
+
const first = bytes[i++];
|
|
47
|
+
let codePoint = REPLACEMENT;
|
|
48
|
+
|
|
49
|
+
if (first < 0x80) {
|
|
50
|
+
codePoint = first;
|
|
51
|
+
} else if ((first & 0xe0) === 0xc0 && i < bytes.length) {
|
|
52
|
+
const b1 = bytes[i++];
|
|
53
|
+
const candidate = ((first & 0x1f) << 6) | (b1 & 0x3f);
|
|
54
|
+
codePoint = (b1 & 0xc0) === 0x80 && candidate >= 0x80 ? candidate : REPLACEMENT;
|
|
55
|
+
} else if ((first & 0xf0) === 0xe0 && i + 1 < bytes.length) {
|
|
56
|
+
const b1 = bytes[i++];
|
|
57
|
+
const b2 = bytes[i++];
|
|
58
|
+
const candidate = ((first & 0x0f) << 12) | ((b1 & 0x3f) << 6) | (b2 & 0x3f);
|
|
59
|
+
codePoint = (b1 & 0xc0) === 0x80 && (b2 & 0xc0) === 0x80 && candidate >= 0x800
|
|
60
|
+
? candidate
|
|
61
|
+
: REPLACEMENT;
|
|
62
|
+
} else if ((first & 0xf8) === 0xf0 && i + 2 < bytes.length) {
|
|
63
|
+
const b1 = bytes[i++];
|
|
64
|
+
const b2 = bytes[i++];
|
|
65
|
+
const b3 = bytes[i++];
|
|
66
|
+
const candidate = ((first & 0x07) << 18) | ((b1 & 0x3f) << 12) | ((b2 & 0x3f) << 6) | (b3 & 0x3f);
|
|
67
|
+
codePoint = (
|
|
68
|
+
(b1 & 0xc0) === 0x80 &&
|
|
69
|
+
(b2 & 0xc0) === 0x80 &&
|
|
70
|
+
(b3 & 0xc0) === 0x80 &&
|
|
71
|
+
candidate >= 0x10000 &&
|
|
72
|
+
candidate <= 0x10ffff
|
|
73
|
+
) ? candidate : REPLACEMENT;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
chunk += String.fromCodePoint(codePoint);
|
|
77
|
+
if (chunk.length > 8192) {
|
|
78
|
+
parts.push(chunk);
|
|
79
|
+
chunk = '';
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (chunk.length > 0) {
|
|
84
|
+
parts.push(chunk);
|
|
85
|
+
}
|
|
86
|
+
return parts.join('');
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* @param {number} codePoint
|
|
91
|
+
* @returns {number}
|
|
92
|
+
*/
|
|
93
|
+
function utf8CodePointLength(codePoint) {
|
|
94
|
+
if (codePoint < 0x80) { return 1; }
|
|
95
|
+
if (codePoint < 0x800) { return 2; }
|
|
96
|
+
if (codePoint < 0x10000) { return 3; }
|
|
97
|
+
return 4;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* @param {Uint8Array} out
|
|
102
|
+
* @param {number} offset
|
|
103
|
+
* @param {number} codePoint
|
|
104
|
+
* @returns {number}
|
|
105
|
+
*/
|
|
106
|
+
function writeCodePoint(out, offset, codePoint) {
|
|
107
|
+
if (codePoint < 0x80) {
|
|
108
|
+
out[offset++] = codePoint;
|
|
109
|
+
} else if (codePoint < 0x800) {
|
|
110
|
+
out[offset++] = 0xc0 | (codePoint >>> 6);
|
|
111
|
+
out[offset++] = 0x80 | (codePoint & 0x3f);
|
|
112
|
+
} else if (codePoint < 0x10000) {
|
|
113
|
+
out[offset++] = 0xe0 | (codePoint >>> 12);
|
|
114
|
+
out[offset++] = 0x80 | ((codePoint >>> 6) & 0x3f);
|
|
115
|
+
out[offset++] = 0x80 | (codePoint & 0x3f);
|
|
116
|
+
} else {
|
|
117
|
+
out[offset++] = 0xf0 | (codePoint >>> 18);
|
|
118
|
+
out[offset++] = 0x80 | ((codePoint >>> 12) & 0x3f);
|
|
119
|
+
out[offset++] = 0x80 | ((codePoint >>> 6) & 0x3f);
|
|
120
|
+
out[offset++] = 0x80 | (codePoint & 0x3f);
|
|
121
|
+
}
|
|
122
|
+
return offset;
|
|
123
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { ErrorCodes } from '../errors/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Single source of truth for encryption scheme identifiers.
|
|
4
|
+
*
|
|
5
|
+
* Current schemes only. Legacy schemes are recognized solely to produce
|
|
6
|
+
* actionable error messages pointing users to the migration script.
|
|
7
|
+
*/
|
|
8
|
+
import CasError from '../errors/CasError.js';
|
|
9
|
+
|
|
10
|
+
// ---------------------------------------------------------------------------
|
|
11
|
+
// Current schemes — the only values src/ ever produces or accepts
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
|
|
14
|
+
export const SCHEME_WHOLE = 'whole';
|
|
15
|
+
export const SCHEME_FRAMED = 'framed';
|
|
16
|
+
export const SCHEME_CONVERGENT = 'convergent';
|
|
17
|
+
|
|
18
|
+
export const CURRENT_SCHEMES = new Set([
|
|
19
|
+
SCHEME_WHOLE,
|
|
20
|
+
SCHEME_FRAMED,
|
|
21
|
+
SCHEME_CONVERGENT,
|
|
22
|
+
]);
|
|
23
|
+
|
|
24
|
+
// ---------------------------------------------------------------------------
|
|
25
|
+
// Legacy schemes — recognized only to explode with guidance
|
|
26
|
+
// ---------------------------------------------------------------------------
|
|
27
|
+
|
|
28
|
+
const LEGACY_SCHEMES = new Set([
|
|
29
|
+
'whole-v1',
|
|
30
|
+
'whole-v2',
|
|
31
|
+
'framed-v1',
|
|
32
|
+
'framed-v2',
|
|
33
|
+
'convergent-v1',
|
|
34
|
+
]);
|
|
35
|
+
|
|
36
|
+
// ---------------------------------------------------------------------------
|
|
37
|
+
// Assertions
|
|
38
|
+
// ---------------------------------------------------------------------------
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Throws if the scheme is legacy or unknown. Pass-through for current schemes.
|
|
42
|
+
*
|
|
43
|
+
* @param {string} scheme
|
|
44
|
+
* @throws {CasError} LEGACY_SCHEME if a v1/v2 scheme is encountered.
|
|
45
|
+
* @throws {CasError} INVALID_ENCRYPTION_SCHEME if completely unknown.
|
|
46
|
+
*/
|
|
47
|
+
export function assertCurrentScheme(scheme) {
|
|
48
|
+
if (CURRENT_SCHEMES.has(scheme)) { return; }
|
|
49
|
+
|
|
50
|
+
if (LEGACY_SCHEMES.has(scheme)) {
|
|
51
|
+
throw new CasError(
|
|
52
|
+
`Legacy encryption scheme "${scheme}" is no longer supported. ` +
|
|
53
|
+
'Run scripts/migrate-encryption.js to upgrade this manifest.',
|
|
54
|
+
ErrorCodes.LEGACY_SCHEME,
|
|
55
|
+
{ scheme },
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
throw new CasError(
|
|
60
|
+
`Unknown encryption scheme "${scheme}"`,
|
|
61
|
+
ErrorCodes.INVALID_ENCRYPTION_SCHEME,
|
|
62
|
+
{ scheme },
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Returns true if the scheme string is a recognized legacy identifier.
|
|
68
|
+
*
|
|
69
|
+
* @param {string} scheme
|
|
70
|
+
* @returns {boolean}
|
|
71
|
+
*/
|
|
72
|
+
export function isLegacyScheme(scheme) {
|
|
73
|
+
return LEGACY_SCHEMES.has(scheme);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// ---------------------------------------------------------------------------
|
|
77
|
+
// Legacy → current mapping
|
|
78
|
+
// ---------------------------------------------------------------------------
|
|
79
|
+
|
|
80
|
+
/** @type {Record<string, string>} */
|
|
81
|
+
const LEGACY_SCHEME_MAP = {
|
|
82
|
+
'whole-v1': SCHEME_WHOLE,
|
|
83
|
+
'whole-v2': SCHEME_WHOLE,
|
|
84
|
+
'framed-v1': SCHEME_FRAMED,
|
|
85
|
+
'framed-v2': SCHEME_FRAMED,
|
|
86
|
+
'convergent-v1': SCHEME_CONVERGENT,
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Maps a legacy scheme identifier to its current name.
|
|
91
|
+
* Returns `null` if the input is not a recognized legacy scheme.
|
|
92
|
+
*
|
|
93
|
+
* @param {string} scheme
|
|
94
|
+
* @returns {string|null}
|
|
95
|
+
*/
|
|
96
|
+
export function mapToCurrentScheme(scheme) {
|
|
97
|
+
return LEGACY_SCHEME_MAP[scheme] ?? null;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Returns true if the legacy scheme used no AAD (all v1 variants).
|
|
102
|
+
*
|
|
103
|
+
* @param {string} scheme - A legacy scheme identifier.
|
|
104
|
+
* @returns {boolean}
|
|
105
|
+
*/
|
|
106
|
+
export function isLegacyNoAad(scheme) {
|
|
107
|
+
return scheme === 'whole-v1' ||
|
|
108
|
+
scheme === 'framed-v1' ||
|
|
109
|
+
scheme === 'convergent-v1';
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// ---------------------------------------------------------------------------
|
|
113
|
+
// Pipeline classification
|
|
114
|
+
// ---------------------------------------------------------------------------
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* @typedef {'pre-chunk'|'post-chunk'} TransformPosition
|
|
118
|
+
*/
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Returns where in the pipeline a scheme's encryption happens.
|
|
122
|
+
*
|
|
123
|
+
* - `pre-chunk`: encryption wraps the source stream BEFORE chunking (whole, framed)
|
|
124
|
+
* - `post-chunk`: encryption is applied to each chunk AFTER chunking (convergent)
|
|
125
|
+
*
|
|
126
|
+
* @param {string} scheme - A current scheme identifier.
|
|
127
|
+
* @returns {TransformPosition}
|
|
128
|
+
*/
|
|
129
|
+
export function schemePipelinePosition(scheme) {
|
|
130
|
+
assertCurrentScheme(scheme);
|
|
131
|
+
return scheme === SCHEME_CONVERGENT ? 'post-chunk' : 'pre-chunk';
|
|
132
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import CasError from './CasError.js';
|
|
2
|
+
import { ErrorCodes } from './Codes.js';
|
|
3
|
+
|
|
4
|
+
export default class CannotRemoveLastRecipientError extends CasError {
|
|
5
|
+
static code = ErrorCodes.CANNOT_REMOVE_LAST_RECIPIENT;
|
|
6
|
+
|
|
7
|
+
constructor(message, meta = {}) {
|
|
8
|
+
super(message, CannotRemoveLastRecipientError.code, meta);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface CasErrorOptions {
|
|
2
|
+
message: string;
|
|
3
|
+
code: string;
|
|
4
|
+
meta?: Record<string, unknown>;
|
|
5
|
+
documentationUrl?: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface SerializedCasError {
|
|
9
|
+
name: string;
|
|
10
|
+
message: string;
|
|
11
|
+
code: string;
|
|
12
|
+
documentationUrl?: string;
|
|
13
|
+
meta?: Record<string, unknown>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default class CasError extends Error {
|
|
17
|
+
code: string;
|
|
18
|
+
meta: Record<string, unknown>;
|
|
19
|
+
documentationUrl?: string;
|
|
20
|
+
|
|
21
|
+
constructor(
|
|
22
|
+
messageOrOptions: string | CasErrorOptions,
|
|
23
|
+
code?: string,
|
|
24
|
+
meta?: Record<string, unknown>,
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
toJSON(): SerializedCasError;
|
|
28
|
+
}
|
|
@@ -6,17 +6,54 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export default class CasError extends Error {
|
|
8
8
|
/**
|
|
9
|
-
* @param {string
|
|
10
|
-
* @param {string} code - Machine-readable error code (
|
|
9
|
+
* @param {string|{ message: string, code: string, meta?: Object, documentationUrl?: string }} messageOrOptions - Error message or structured options.
|
|
10
|
+
* @param {string} [code] - Machine-readable error code (for example, ErrorCodes.INTEGRITY_ERROR).
|
|
11
11
|
* @param {Object} [meta={}] - Arbitrary metadata for diagnostics.
|
|
12
12
|
*/
|
|
13
|
-
constructor(
|
|
14
|
-
|
|
13
|
+
constructor(messageOrOptions, code, meta = {}) {
|
|
14
|
+
const normalized = normalizeCasErrorArgs(messageOrOptions, code, meta);
|
|
15
|
+
super(normalized.message);
|
|
15
16
|
this.name = this.constructor.name;
|
|
16
|
-
this.code = code;
|
|
17
|
-
this.meta = meta;
|
|
17
|
+
this.code = normalized.code;
|
|
18
|
+
this.meta = normalized.meta;
|
|
19
|
+
if (normalized.documentationUrl) {
|
|
20
|
+
this.documentationUrl = normalized.documentationUrl;
|
|
21
|
+
}
|
|
18
22
|
if (Error.captureStackTrace) {
|
|
19
23
|
Error.captureStackTrace(this, this.constructor);
|
|
20
24
|
}
|
|
21
25
|
}
|
|
26
|
+
|
|
27
|
+
toJSON() {
|
|
28
|
+
const serialized = {
|
|
29
|
+
name: this.name,
|
|
30
|
+
message: this.message,
|
|
31
|
+
code: this.code,
|
|
32
|
+
};
|
|
33
|
+
if (this.documentationUrl) {
|
|
34
|
+
serialized.documentationUrl = this.documentationUrl;
|
|
35
|
+
}
|
|
36
|
+
if (this.meta && typeof this.meta === 'object' && Object.keys(this.meta).length > 0) {
|
|
37
|
+
serialized.meta = this.meta;
|
|
38
|
+
}
|
|
39
|
+
return serialized;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @param {string|{ message: string, code: string, meta?: Object, documentationUrl?: string }} messageOrOptions
|
|
45
|
+
* @param {string|undefined} code
|
|
46
|
+
* @param {Object} meta
|
|
47
|
+
* @returns {{ message: string, code: string, meta: Object, documentationUrl?: string }}
|
|
48
|
+
*/
|
|
49
|
+
function normalizeCasErrorArgs(messageOrOptions, code, meta) {
|
|
50
|
+
if (typeof messageOrOptions === 'object' && messageOrOptions !== null) {
|
|
51
|
+
return {
|
|
52
|
+
message: messageOrOptions.message,
|
|
53
|
+
code: messageOrOptions.code,
|
|
54
|
+
meta: messageOrOptions.meta ?? {},
|
|
55
|
+
documentationUrl: messageOrOptions.documentationUrl,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
return { message: messageOrOptions, code, meta };
|
|
22
59
|
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
const ErrorCodes = Object.freeze({
|
|
2
|
+
CANNOT_REMOVE_LAST_RECIPIENT: 'CANNOT_REMOVE_LAST_RECIPIENT',
|
|
3
|
+
DECRYPTION_BUFFER_EXCEEDED: 'DECRYPTION_BUFFER_EXCEEDED',
|
|
4
|
+
DEK_UNWRAP_FAILED: 'DEK_UNWRAP_FAILED',
|
|
5
|
+
ENCRYPTION_BUFFER_EXCEEDED: 'ENCRYPTION_BUFFER_EXCEEDED',
|
|
6
|
+
GIT_ERROR: 'GIT_ERROR',
|
|
7
|
+
GIT_PLUMBING_INITIALIZATION_FAILED: 'GIT_PLUMBING_INITIALIZATION_FAILED',
|
|
8
|
+
GIT_REF_NOT_FOUND: 'GIT_REF_NOT_FOUND',
|
|
9
|
+
INTEGRITY_ERROR: 'INTEGRITY_ERROR',
|
|
10
|
+
INVALID_CHUNKING_STRATEGY: 'INVALID_CHUNKING_STRATEGY',
|
|
11
|
+
INVALID_ENCRYPTION_SCHEME: 'INVALID_ENCRYPTION_SCHEME',
|
|
12
|
+
INVALID_KEY_LENGTH: 'INVALID_KEY_LENGTH',
|
|
13
|
+
INVALID_KEY_TYPE: 'INVALID_KEY_TYPE',
|
|
14
|
+
INVALID_NONCE_LENGTH: 'INVALID_NONCE_LENGTH',
|
|
15
|
+
INVALID_OID: 'INVALID_OID',
|
|
16
|
+
INVALID_OPTIONS: 'INVALID_OPTIONS',
|
|
17
|
+
INVALID_SLUG: 'INVALID_SLUG',
|
|
18
|
+
INVALID_TAG_LENGTH: 'INVALID_TAG_LENGTH',
|
|
19
|
+
KDF_POLICY_VIOLATION: 'KDF_POLICY_VIOLATION',
|
|
20
|
+
LEGACY_SCHEME: 'LEGACY_SCHEME',
|
|
21
|
+
MANIFEST_INTEGRITY_ERROR: 'MANIFEST_INTEGRITY_ERROR',
|
|
22
|
+
MANIFEST_NOT_FOUND: 'MANIFEST_NOT_FOUND',
|
|
23
|
+
MISSING_KEY: 'MISSING_KEY',
|
|
24
|
+
NO_MATCHING_RECIPIENT: 'NO_MATCHING_RECIPIENT',
|
|
25
|
+
PERSISTENCE_CAPABILITY_REQUIRED: 'PERSISTENCE_CAPABILITY_REQUIRED',
|
|
26
|
+
PORT_NOT_IMPLEMENTED: 'PORT_NOT_IMPLEMENTED',
|
|
27
|
+
RECIPIENT_ALREADY_EXISTS: 'RECIPIENT_ALREADY_EXISTS',
|
|
28
|
+
RECIPIENT_NOT_FOUND: 'RECIPIENT_NOT_FOUND',
|
|
29
|
+
RESTORE_TOO_LARGE: 'RESTORE_TOO_LARGE',
|
|
30
|
+
ROTATION_NOT_SUPPORTED: 'ROTATION_NOT_SUPPORTED',
|
|
31
|
+
SECURITY_BOUNDARY_VIOLATION: 'SECURITY_BOUNDARY_VIOLATION',
|
|
32
|
+
STORE_ERROR: 'STORE_ERROR',
|
|
33
|
+
STREAM_ERROR: 'STREAM_ERROR',
|
|
34
|
+
STREAM_NOT_CONSUMED: 'STREAM_NOT_CONSUMED',
|
|
35
|
+
TREE_PARSE_ERROR: 'TREE_PARSE_ERROR',
|
|
36
|
+
VAULT_CONFLICT: 'VAULT_CONFLICT',
|
|
37
|
+
VAULT_DEPENDENCY_INVALID: 'VAULT_DEPENDENCY_INVALID',
|
|
38
|
+
VAULT_ENCRYPTION_ALREADY_CONFIGURED: 'VAULT_ENCRYPTION_ALREADY_CONFIGURED',
|
|
39
|
+
VAULT_ENTRY_EXISTS: 'VAULT_ENTRY_EXISTS',
|
|
40
|
+
VAULT_ENTRY_NOT_FOUND: 'VAULT_ENTRY_NOT_FOUND',
|
|
41
|
+
VAULT_HEAD_INVALID: 'VAULT_HEAD_INVALID',
|
|
42
|
+
VAULT_METADATA_INVALID: 'VAULT_METADATA_INVALID',
|
|
43
|
+
VAULT_NONCE_EXHAUSTED: 'VAULT_NONCE_EXHAUSTED',
|
|
44
|
+
VAULT_PRIVACY_INDEX_INVALID: 'VAULT_PRIVACY_INDEX_INVALID',
|
|
45
|
+
VAULT_PRIVACY_INDEX_MISSING: 'VAULT_PRIVACY_INDEX_MISSING',
|
|
46
|
+
VAULT_PRIVACY_KEY_REQUIRED: 'VAULT_PRIVACY_KEY_REQUIRED',
|
|
47
|
+
VAULT_PRIVACY_REQUIRES_ENCRYPTION: 'VAULT_PRIVACY_REQUIRES_ENCRYPTION',
|
|
48
|
+
VAULT_REF_MISSING: 'VAULT_REF_MISSING',
|
|
49
|
+
VAULT_REF_UPDATE_FAILED: 'VAULT_REF_UPDATE_FAILED',
|
|
50
|
+
VAULT_RETRY_POLICY_INVALID: 'VAULT_RETRY_POLICY_INVALID',
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export { ErrorCodes };
|
|
54
|
+
export default ErrorCodes;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import CasError from './CasError.js';
|
|
2
|
+
import { ErrorCodes } from './Codes.js';
|
|
3
|
+
|
|
4
|
+
export default class DekUnwrapFailedError extends CasError {
|
|
5
|
+
static code = ErrorCodes.DEK_UNWRAP_FAILED;
|
|
6
|
+
|
|
7
|
+
constructor(message, meta = {}) {
|
|
8
|
+
super(message, DekUnwrapFailedError.code, meta);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import CasError from './CasError.js';
|
|
2
|
+
import { ErrorCodes } from './Codes.js';
|
|
3
|
+
|
|
4
|
+
export default class GitPlumbingInitializationError extends CasError {
|
|
5
|
+
static code = ErrorCodes.GIT_PLUMBING_INITIALIZATION_FAILED;
|
|
6
|
+
|
|
7
|
+
constructor(message, meta = {}) {
|
|
8
|
+
super(message, GitPlumbingInitializationError.code, meta);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import CasError from './CasError.js';
|
|
2
|
+
import { ErrorCodes } from './Codes.js';
|
|
3
|
+
|
|
4
|
+
export default class IntegrityError extends CasError {
|
|
5
|
+
static code = ErrorCodes.INTEGRITY_ERROR;
|
|
6
|
+
|
|
7
|
+
constructor(message, meta = {}) {
|
|
8
|
+
super(message, IntegrityError.code, meta);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import CasError from './CasError.js';
|
|
2
|
+
import { ErrorCodes } from './Codes.js';
|
|
3
|
+
|
|
4
|
+
export default class InvalidChunkingStrategyError extends CasError {
|
|
5
|
+
static code = ErrorCodes.INVALID_CHUNKING_STRATEGY;
|
|
6
|
+
|
|
7
|
+
constructor(message, meta = {}) {
|
|
8
|
+
super(message, InvalidChunkingStrategyError.code, meta);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import CasError from './CasError.js';
|
|
2
|
+
import { ErrorCodes } from './Codes.js';
|
|
3
|
+
|
|
4
|
+
export default class InvalidOidError extends CasError {
|
|
5
|
+
static code = ErrorCodes.INVALID_OID;
|
|
6
|
+
|
|
7
|
+
constructor(message, meta = {}) {
|
|
8
|
+
super(message, InvalidOidError.code, meta);
|
|
9
|
+
}
|
|
10
|
+
}
|