@yaks/secrets 0.0.0-stage → 0.2.36
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 +202 -0
- package/_dist/graph.d.ts +9 -0
- package/_dist/graph.d.ts.map +1 -0
- package/_dist/mod.d.ts +67 -0
- package/_dist/mod.d.ts.map +1 -0
- package/_dist/op.d.ts +37 -0
- package/_dist/op.d.ts.map +1 -0
- package/_dist/plugin.d.ts +19 -0
- package/_dist/plugin.d.ts.map +1 -0
- package/_dist/records.d.ts +11 -0
- package/_dist/records.d.ts.map +1 -0
- package/_dist/ref.d.ts +4 -0
- package/_dist/ref.d.ts.map +1 -0
- package/_dist/reveal.d.ts +14 -0
- package/_dist/reveal.d.ts.map +1 -0
- package/_dist/sealed.d.ts +10 -0
- package/_dist/sealed.d.ts.map +1 -0
- package/_dist/sentinel.d.ts +9 -0
- package/_dist/sentinel.d.ts.map +1 -0
- package/_dist/signed.d.ts +16 -0
- package/_dist/signed.d.ts.map +1 -0
- package/_dist/vault.d.ts +49 -0
- package/_dist/vault.d.ts.map +1 -0
- package/_dist/views.d.ts +3 -0
- package/_dist/views.d.ts.map +1 -0
- package/_dist/vocab.d.ts +6 -0
- package/_dist/vocab.d.ts.map +1 -0
- package/deno.json +1 -0
- package/graph.js +12 -0
- package/graph.js.map +1 -0
- package/graph.ts +21 -0
- package/mod.js +67 -0
- package/mod.js.map +1 -0
- package/mod.ts +83 -0
- package/op.js +170 -0
- package/op.js.map +1 -0
- package/op.ts +188 -0
- package/package.json +51 -4
- package/plugin.js +429 -0
- package/plugin.js.map +1 -0
- package/plugin.ts +464 -0
- package/reads.js +51 -0
- package/reads.js.map +1 -0
- package/reads.ts +56 -0
- package/records.js +45 -0
- package/records.js.map +1 -0
- package/records.ts +58 -0
- package/ref.js +7 -0
- package/ref.js.map +1 -0
- package/ref.ts +11 -0
- package/reveal.js +50 -0
- package/reveal.js.map +1 -0
- package/reveal.ts +98 -0
- package/sealed.js +35 -0
- package/sealed.js.map +1 -0
- package/sealed.ts +31 -0
- package/sentinel.js +66 -0
- package/sentinel.js.map +1 -0
- package/sentinel.ts +97 -0
- package/signed.js +107 -0
- package/signed.js.map +1 -0
- package/signed.ts +151 -0
- package/vault.js +67 -0
- package/vault.js.map +1 -0
- package/vault.ts +130 -0
- package/views.js +27 -0
- package/views.js.map +1 -0
- package/views.ts +34 -0
- package/vocab.js +16 -0
- package/vocab.js.map +1 -0
- package/vocab.json +36 -0
- package/vocab.ts +17 -0
- package/README.md +0 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2026 Jeff Peterson
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/_dist/graph.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Graph, Plugin } from "@yaks/graph";
|
|
2
|
+
import type { Vocab } from "@yaks/vocab";
|
|
3
|
+
import type { Vault } from "./vault.js";
|
|
4
|
+
/** Secrets sealed out of every write, into the host's vault. */ export declare let plugins: (host: {
|
|
5
|
+
vault: Vault;
|
|
6
|
+
graph: Graph;
|
|
7
|
+
vocab: Vocab;
|
|
8
|
+
}) => Plugin[];
|
|
9
|
+
//# sourceMappingURL=graph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph.d.ts","sources":["../graph.ts"],"names":[],"mappings":"AAMA,cAAc,KAAK,EAAE,MAAM,2BAAgC;AAC3D,cAAc,KAAK,2BAAgC;AAEnD,cAAc,KAAK,qBAAoB;AAEvC,8DAA8D,GAC9D,OAAO,YAAI,UACT;EAAQ,OAAO;EAAO,OAAO;EAAO,OAAO;MAC1C,SAMF"}
|
package/_dist/mod.d.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @yaks/secrets — secrets that flow through the graph and are kept somewhere
|
|
3
|
+
* else.
|
|
4
|
+
*
|
|
5
|
+
* A secret is an entity wearing `secret{name, value}`. It is written with its
|
|
6
|
+
* value like anything else; the plugin takes the value out in the first phase
|
|
7
|
+
* of the write and puts the secret's handle — a random token it keeps for as
|
|
8
|
+
* long as the secret lives — where it was, and once the write commits it seals
|
|
9
|
+
* the value into a vault. The graph, its journal, its
|
|
10
|
+
* sync and its backups only ever hold the handle, which is safe to show anyone.
|
|
11
|
+
* Code that calls out is handed the sentinel instead: the handle hashed under
|
|
12
|
+
* the vault's salt, the one string a swap on the way out replaces with the
|
|
13
|
+
* value.
|
|
14
|
+
*
|
|
15
|
+
* ```ts
|
|
16
|
+
* import { loadVocab } from '@yaks/vocab'
|
|
17
|
+
* import { type Bundle, graph } from '@yaks/graph'
|
|
18
|
+
* import { ram } from '@yaks/ram'
|
|
19
|
+
* import { effectDoc } from '@yaks/effects'
|
|
20
|
+
* import { ramVault, reveal, sealed, secrets, secretsDoc } from '@yaks/secrets'
|
|
21
|
+
*
|
|
22
|
+
* let vocab = loadVocab([secretsDoc, effectDoc])
|
|
23
|
+
* let vault = ramVault()
|
|
24
|
+
* let write = (b: Bundle[]) => g.apply(b, { trusted: true })
|
|
25
|
+
* let g = graph({ storage: ram(vocab), vocab, plugins: [secrets(vault, write, vocab)] })
|
|
26
|
+
* await g.apply([sealed('MAIL_TOKEN', 'cf-token')])
|
|
27
|
+
* // g.read('.secret') → value: '[set]'
|
|
28
|
+
* // await reveal(vault, 'MAIL_TOKEN') → 'cf-token'
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* Trusted code asks for a value by name ({@link reveal}); a config names one
|
|
32
|
+
* as `{"secret": "NAME"}` (@yaks/cli). A name nothing was written for falls
|
|
33
|
+
* back to the environment source the host supplies. A kept `op://` reference
|
|
34
|
+
* stays unresolved; interactive commands can read one explicitly with
|
|
35
|
+
* `opRead` from `@yaks/secrets/op`, which starts the `op` command and so
|
|
36
|
+
* never loads where there is no operating system.
|
|
37
|
+
*
|
|
38
|
+
* This package says what a vault is ({@link Vault}) and keeps one in memory;
|
|
39
|
+
* a vault that stores somewhere lives with that storage: private files on a
|
|
40
|
+
* box in @yaks/cli, a D1 database in @yaks/d1. The host hands its vault to the
|
|
41
|
+
* plugin (`@yaks/secrets/graph`).
|
|
42
|
+
* While a value is on its way to the vault its secret wears `provisional`
|
|
43
|
+
* (@yaks/effects). A failed seal leaves `failed{reason}` (@yaks/kernel).
|
|
44
|
+
* Hosts compose these vocabularies to record sealing's progress and outcome.
|
|
45
|
+
*
|
|
46
|
+
* Rotations and removals retain previous values in the vault's trash. Active
|
|
47
|
+
* reads and sentinels cannot use trashed values. `vault.trash()` lists metadata
|
|
48
|
+
* without values. Trusted code reads a retained value with `past(id)` without
|
|
49
|
+
* changing it or activating it; it can write that value through the ordinary
|
|
50
|
+
* graph sealing path while keeping the retained version for old snapshots.
|
|
51
|
+
* `restore(id)`
|
|
52
|
+
* recovers a version, retaining any displaced
|
|
53
|
+
* active value, and `purge(id)` permanently removes only that trashed version.
|
|
54
|
+
* Hosts expose purging through a person's explicit confirmation. Restoring a
|
|
55
|
+
* graph secret with its retained handle also restores its most recent value
|
|
56
|
+
* when no active value exists.
|
|
57
|
+
*
|
|
58
|
+
* @module
|
|
59
|
+
*/ export { secretsDoc } from "./vocab.js";
|
|
60
|
+
export { carries, retryable, SECRET, secrets } from "./plugin.js";
|
|
61
|
+
export { handle, isHandle, PREFIX, SENTINEL, sentinel, sentinels, swap } from "./sentinel.js";
|
|
62
|
+
export { type Local, queue, ramVault, type Sealed, type Trashed, type Vault } from "./vault.js";
|
|
63
|
+
export { isOpRef } from "./ref.js";
|
|
64
|
+
export { peek, reveal, reveals, sentinelOf, type Sources } from "./reveal.js";
|
|
65
|
+
export { sealed, secretEid, secretEids, unsealed } from "./sealed.js";
|
|
66
|
+
export { type Records, records } from "./records.js";
|
|
67
|
+
//# sourceMappingURL=mod.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sources":["../mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0DC,GAED,SAAS,UAAU,qBAAoB;AACvC,SAAS,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,sBAAqB;AACjE,SACE,MAAM,EACN,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,IAAI,wBACgB;AACtB,SACE,KAAK,KAAK,EACV,KAAK,EACL,QAAQ,EACR,KAAK,MAAM,EACX,KAAK,OAAO,EACZ,KAAK,KAAK,qBACO;AACnB,SAAS,OAAO,mBAAkB;AAClC,SAAS,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,OAAO,sBAAqB;AAC7E,SAAS,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,sBAAqB;AACrE,SAAS,KAAK,OAAO,EAAE,OAAO,uBAAsB"}
|
package/_dist/op.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Vault } from "./vault.js";
|
|
2
|
+
/** Resolve a reference to its value. Injectable, so a test needs no `op`. */ export type OpRead = (reference: string, signal: AbortSignal) => Promise<string>;
|
|
3
|
+
type Env = (name: string) => string | undefined;
|
|
4
|
+
/** `op read`, awaited under the signal it is given. */ export declare let opRead: (environment?: Env) => OpRead;
|
|
5
|
+
/** One `op` command with its input on stdin, answered with its output. */ export type OpRun = (args: string[], input?: string) => Promise<{
|
|
6
|
+
success: boolean;
|
|
7
|
+
stdout: Uint8Array;
|
|
8
|
+
stderr: Uint8Array;
|
|
9
|
+
}>;
|
|
10
|
+
/** `op`, run with the environment {@link opRead} gives it and `input` on its
|
|
11
|
+
* stdin, so a value never rides its arguments. */ export declare let opRun: (environment?: Env) => OpRun;
|
|
12
|
+
/** Keeps a key in 1Password at `<vault>/<item>[/<field>]`: the item's field is
|
|
13
|
+
* set where the item stands, and an API credential item is made where it does
|
|
14
|
+
* not. The value goes to `op` on its stdin, inside an item's JSON, never in
|
|
15
|
+
* its arguments.
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* import { assertEquals } from '@std/assert'
|
|
19
|
+
* let calls: [string[], string | undefined][] = []
|
|
20
|
+
* let run: OpRun = (args, input) => {
|
|
21
|
+
* calls.push([args, input])
|
|
22
|
+
* let stuck = args[1] == 'get'
|
|
23
|
+
* return Promise.resolve({
|
|
24
|
+
* success: !stuck,
|
|
25
|
+
* stdout: new Uint8Array(),
|
|
26
|
+
* stderr: new TextEncoder().encode(stuck ? '"Logs" isn\'t an item' : ''),
|
|
27
|
+
* })
|
|
28
|
+
* }
|
|
29
|
+
* await opKeep(run)('Shared/Logs', 'k')
|
|
30
|
+
* assertEquals(calls[1][0], ['item', 'create', '--vault', 'Shared', '-'])
|
|
31
|
+
* assertEquals(JSON.parse(calls[1][1]!).fields[0].value, 'k')
|
|
32
|
+
* ```
|
|
33
|
+
*/ export declare let opKeep: (run?: OpRun) => any;
|
|
34
|
+
/** The `1password` keeper a host lends (@yaks/host/keepers): {@link opKeep}
|
|
35
|
+
* signed in as the service account whose token is `OP_SERVICE_ACCOUNT_TOKEN`
|
|
36
|
+
* in `vault`, else in the environment, read at each keep. */ export declare let opKeeper: (vault: Vault) => any;
|
|
37
|
+
//# sourceMappingURL=op.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"op.d.ts","sources":["../op.ts"],"names":[],"mappings":"AAQA,cAAc,KAAK,qBAAoB;AAEvC,2EAA2E,GAC3E,YAAY,UAAU,WAAW,MAAM,EAAE,QAAQ,gBAAgB,QAAQ,MAAM;KAI1E,OAAO,MAAM,MAAM,KAAK,MAAM,GAAG,SAAS;AA6B/C,qDAAqD,GACrD,OAAO,YAAI,SACR,cAAc,QAAM,OAepB;AAEH,wEAAwE,GACxE,YAAY,SACV,MAAM,MAAM,IACZ,QAAQ,MAAM,KACX;EAAU,SAAS,OAAO;EAAE,QAAQ;EAAY,QAAQ;;AAE7D;gDACgD,GAChD,OAAO,YAAI,QAAS,cAAc,QAAM,MAevC;AAmBD;;;;;;;;;;;;;;;;;;;;;CAqBC,GACD,OAAO,YAAI,SAAU,MAAK,cA0CzB;AAED;;2DAE2D,GAC3D,OAAO,YAAI,WAAY,OAAO,cAW5B"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type Write } from "@yaks/effects";
|
|
2
|
+
import type { Plugin } from "@yaks/graph";
|
|
3
|
+
import { type Clock } from "@yaks/fp";
|
|
4
|
+
import type { Vocab } from "@yaks/vocab";
|
|
5
|
+
import type { Vault } from "./vault.js";
|
|
6
|
+
export declare let SECRET: string;
|
|
7
|
+
/** Whether a batch carries a secret's value — in a `secret`, or inside a
|
|
8
|
+
* call's arguments — which only the vault may keep. A host that writes a
|
|
9
|
+
* batch down before applying it (a write log) keeps none that does. */ export declare let carries: (bundles: unknown) => boolean;
|
|
10
|
+
/** The plugin, over the vault its secrets are kept in, the door what it says
|
|
11
|
+
* about a seal is written through — the graph's own `apply()`, trusted, since
|
|
12
|
+
* `provisional` coming off is the host's word, never a client's — and the
|
|
13
|
+
* graph's vocabulary, which says what a delete takes with it. The clock says
|
|
14
|
+
* when a value held too long is let go, and waits out a vault's retry
|
|
15
|
+
* (default the runtime's). */ export declare let secrets: (vault: Vault, write: Write, vocab: Vocab, clock?: Clock) => Plugin;
|
|
16
|
+
/** A failure the vault says trying again may cure: an error carrying
|
|
17
|
+
* `retryable: true`, the flag the Workers runtime sets on its own (@yaks/d1's
|
|
18
|
+
* vault sets it for the D1 errors Cloudflare documents as transient). */ export declare let retryable: (e: unknown) => boolean;
|
|
19
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sources":["../plugin.ts"],"names":[],"mappings":"AA4CA,SAAsB,KAAK,KAAK,6BAAkC;AAClE,cAAiC,MAAM,2BAAoC;AAC3E,SAAgB,KAAK,KAAK,wBAA6D;AAIvF,cAAc,KAAK,2BAAgC;AAKnD,cAAc,KAAK,qBAAoB;AAGvC,OAAO,YAAI,eAAiB;AAgE5B;;qEAEqE,GACrE,OAAO,YAAI,UAAW,SAAS,OAAO,KAAG,OAAO,CAEM;AAqDtD;;;;;4BAK4B,GAC5B,OAAO,YAAI,UACT,OAAO,OACP,OAAO,OACP,OAAO,OACP,QAAO,UACN,OAiHF;AAgBD;;uEAEuE,GACvE,OAAO,YAAI,YAAa,GAAG,OAAO,KAAG,OAAO,CAEO"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Bundle } from "@yaks/graph";
|
|
2
|
+
import type { Vault } from "./vault.js";
|
|
3
|
+
/** Private records by key, each the secret `<prefix><key>`. */ export type Records<R extends object> = {
|
|
4
|
+
read: (key: string) => Promise<R | undefined>;
|
|
5
|
+
/** `fn` changes the record in place; a change is written back. */ update: <T>(key: string, fn: (record: R) => Promise<T>) => Promise<T>;
|
|
6
|
+
};
|
|
7
|
+
/** Records kept as secrets in this graph. `check` refuses a record that is not
|
|
8
|
+
* the shape its reader expects. */ export declare let records: <R extends object>(g: {
|
|
9
|
+
apply: (bundles: Bundle[]) => unknown;
|
|
10
|
+
}, vault: Vault, prefix: string, check?: (record: R) => void) => Records<R>;
|
|
11
|
+
//# sourceMappingURL=records.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"records.d.ts","sources":["../records.ts"],"names":[],"mappings":"AAYA,cAAc,MAAM,2BAAgC;AAGpD,cAAc,KAAK,qBAAoB;AAEvC,6DAA6D,GAC7D,YAAY,QAAQ,UAAU,MAAM;EAClC,OAAO,KAAK,MAAM,KAAK,QAAQ,IAAI,SAAS;EAC5C,gEAAgE,GAChE,SAAS,GAAG,KAAK,MAAM,EAAE,KAAK,QAAQ,MAAM,QAAQ,OAAO,QAAQ;;AAGrE;iCACiC,GACjC,OAAO,YAAI,UAAW,UAAU,MAAM,EACpC;EAAK,QAAQ,SAAS,aAAa,OAAO;GAC1C,OAAO,OACP,QAAQ,MAAM,EACd,SAAQ,QAAQ,MAAM,IAAI,KACzB,QAAQ,GA0BV"}
|
package/_dist/ref.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Whether a written value is a reference rather than a value: `op://` and at
|
|
2
|
+
* least vault, item and field. Spaces are fine — it is an argument, never a
|
|
3
|
+
* shell word — but a control character is not. */ export declare let isOpRef: (value: string) => boolean;
|
|
4
|
+
//# sourceMappingURL=ref.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ref.d.ts","sources":["../ref.ts"],"names":[],"mappings":"AAGA;;gDAEgD,GAChD,OAAO,YAAI,UAAW,OAAO,MAAM,KAAG,OAAO,CAIsB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Local, Vault } from "./vault.js";
|
|
2
|
+
/** Where a name absent from the vault may be found. */ export type Sources = {
|
|
3
|
+
env?: (name: string) => string | undefined;
|
|
4
|
+
};
|
|
5
|
+
/** A secret's value, by name. */ export declare let reveal: (vault: Vault, name: string, s?: Sources) => string | undefined | Promise<string | undefined>;
|
|
6
|
+
/** Read selected secrets by name, keeping each value's outcome independent.
|
|
7
|
+
* Both current and legacy addresses share the same storage lookup. */ export declare let reveals: (vault: Vault, names: Iterable<string>, s?: Sources) => Promise<Map<string, PromiseSettledResult<string | undefined>>>;
|
|
8
|
+
/** The sentinel for a secret, by name: its handle hashed under the vault's
|
|
9
|
+
* salt (./sentinel.ts). A name nothing was written for has none. A secret
|
|
10
|
+
* kept as several named parts (a connection's fields) has one for each
|
|
11
|
+
* `part`, its handle and the part's name hashed together; a handle holds no
|
|
12
|
+
* `#`, so none is another's. */ export declare let sentinelOf: (vault: Vault, name: string, part?: string) => Promise<string | undefined>;
|
|
13
|
+
/** A secret's value, by name, answered on the spot. */ export declare let peek: (vault: Local, name: string, s?: Sources) => string | undefined;
|
|
14
|
+
//# sourceMappingURL=reveal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reveal.d.ts","sources":["../reveal.ts"],"names":[],"mappings":"AASA,cAAc,KAAK,EAAU,KAAK,qBAAoB;AAEtD,qDAAqD,GACrD,YAAY;EACV,OAAO,MAAM,MAAM,KAAK,MAAM,GAAG,SAAS;;AAqB5C,+BAA+B,GAC/B,OAAO,YAAI,SACT,OAAO,OACP,MAAM,MAAM,EACZ,IAAG,YACF,MAAM,GAAG,SAAS,GAAG,QAAQ,MAAM,GAAG,SAAS,EACuB;AAEzE;oEACoE,GACpE,OAAO,YAAI,UACT,OAAO,OACP,OAAO,SAAS,MAAM,GACtB,IAAG,YACF,QAAQ,IAAI,MAAM,EAAE,qBAAqB,MAAM,GAAG,SAAS,IAsB7D;AAED;;;;8BAI8B,GAC9B,OAAO,YAAI,aACT,OAAO,OACP,MAAM,MAAM,EACZ,OAAO,MAAM,KACZ,QAAQ,MAAM,GAAG,SAAS,EAQ1B;AAEH,qDAAqD,GACrD,OAAO,YAAI,OACT,OAAO,OACP,MAAM,MAAM,EACZ,IAAG,YACF,MAAM,GAAG,SAAS,CAC2D"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Bundle, Eid } from "@yaks/graph";
|
|
2
|
+
/** The entity a secret is: its id is derived from its name, so one name is
|
|
3
|
+
* one secret and nobody has to look an id up. */ export declare let secretEid: (name: string) => Eid;
|
|
4
|
+
/** The two addresses of a named secret during the migration: every lookup
|
|
5
|
+
* and removal by name goes through these, so a secret is found at whichever
|
|
6
|
+
* one it is kept. */ export declare let secretEids: (name: string) => Eid[];
|
|
7
|
+
/** The bundle that writes a secret: its value, or an `op://` reference. The
|
|
8
|
+
* graph keeps the handle; the vault keeps what it stands for. */ export declare let sealed: (name: string, value: string) => Bundle;
|
|
9
|
+
/** The bundles that forget one, value and all, at either of its eids. */ export declare let unsealed: (name: string) => Bundle[];
|
|
10
|
+
//# sourceMappingURL=sealed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sealed.d.ts","sources":["../sealed.ts"],"names":[],"mappings":"AAIA,cAAc,MAAM,EAAE,GAAG,2BAAgC;AAIzD;+CAC+C,GAC/C,OAAO,YAAI,YAAa,MAAM,MAAM,KAAG,IAAoC;AAI3E;;mBAEmB,GACnB,OAAO,YAAI,aACT,MAAM,MAAM,KACX,MAAuD;AAE1D;+DAC+D,GAC/D,OAAO,YAAI,SAAU,MAAM,MAAM,EAAE,OAAO,MAAM,KAAG,OAGjD;AAEF,uEAAuE,GACvE,OAAO,YAAI,WAAY,MAAM,MAAM,KAAG,SAC+B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** What every handle starts with. */ export declare let PREFIX: string;
|
|
2
|
+
/** What every sentinel starts with. */ export declare let SENTINEL: string;
|
|
3
|
+
/** Whether a string is a handle rather than a value. */ export declare let isHandle: (s: string) => boolean;
|
|
4
|
+
/** A new handle: the prefix and 256 random bits. */ export declare let handle: () => string;
|
|
5
|
+
/** The sentinel for a handle, under a vault's salt. */ export declare let sentinel: (salt: Uint8Array, handle: string) => Promise<string>;
|
|
6
|
+
/** Every sentinel a text carries. */ export declare let sentinels: (text: string) => string[];
|
|
7
|
+
/** The text with each sentinel `values` has a value for replaced by it,
|
|
8
|
+
* verbatim: the swap on the way out. */ export declare let swap: (text: string, values: Map<string, string>) => string;
|
|
9
|
+
//# sourceMappingURL=sentinel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sentinel.d.ts","sources":["../sentinel.ts"],"names":[],"mappings":"AAuBA,mCAAmC,GACnC,OAAO,YAAI,eAAsB;AAEjC,qCAAqC,GACrC,OAAO,YAAI,iBAA0B;AAErC,sDAAsD,GACtD,OAAO,YAAI,WAAY,GAAG,MAAM,KAAG,OAAO,CAAwB;AAElE,kDAAkD,GAClD,OAAO,YAAI,cAAa,MAAM,CACoC;AA8BlE,qDAAqD,GACrD,OAAO,YAAI,WACT,MAAM,YACN,QAAQ,MAAM,KACb,QAAQ,MAAM,EAiBhB;AAKD,mCAAmC,GACnC,OAAO,YAAI,YAAa,MAAM,MAAM,KAAG,MAAM,GAA6B;AAE1E;sCACsC,GACtC,OAAO,YAAI,OAAQ,MAAM,MAAM,EAAE,QAAQ,IAAI,MAAM,EAAE,MAAM,MAAI,MAAM,CACrB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** HMAC-SHA256, the one algorithm every key here is for. */ export declare let HMAC: {
|
|
2
|
+
readonly name: string;
|
|
3
|
+
readonly hash: string;
|
|
4
|
+
};
|
|
5
|
+
/** The secret's own key, kept apart from every label's key made under it. */ export declare let secretKey: (secret: string) => Promise<CryptoKey>;
|
|
6
|
+
/** The label's own key: HMAC-SHA256 of the label under the secret. */ export declare let labelKey: (secret: string, label: string) => Promise<CryptoKey>;
|
|
7
|
+
/** A token for `value` under a key from `labelKey` or `secretKey`. */ export declare let signedWith: (k: CryptoKey, value: unknown) => Promise<string>;
|
|
8
|
+
/** The value under a mac this key made, written as signing writes it, or
|
|
9
|
+
* null. A miss uses WebCrypto's constant-time verify; a hit reuses its result
|
|
10
|
+
* and parses the value afresh. */ export declare let openedWith: <T = unknown>(k: CryptoKey, token: string) => Promise<T | null>;
|
|
11
|
+
/** A token carrying `value`, signed for `label` under `secret`. */ export declare let signed: (label: string, value: unknown, secret: string) => Promise<string>;
|
|
12
|
+
/** What a token carries, or null for anything but a well-formed token signed
|
|
13
|
+
* for this label under this secret. */ export declare let opened: <T>(label: string, token: string, secret: string) => Promise<T | null>;
|
|
14
|
+
/** What a token says it carries, read without the secret and so unverified:
|
|
15
|
+
* for a client to say whose token it holds and when it dies, never to trust. */ export declare let claimed: (token: string) => unknown;
|
|
16
|
+
//# sourceMappingURL=signed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signed.d.ts","sources":["../signed.ts"],"names":[],"mappings":"AAkBA,0DAA0D,GAC1D,OAAO,YAAI;WAAS;WAAc;EAAiB;AAcnD,2EAA2E,GAC3E,OAAO,YAAI,YAAa,QAAQ,MAAM,KAAG,QAAQ,WAQ9C;AAEH,oEAAoE,GACpE,OAAO,YAAI,WAAY,QAAQ,MAAM,EAAE,OAAO,MAAM,KAAG,QAAQ,WAe5D;AAoBH,oEAAoE,GACpE,OAAO,YAAI,aACT,GAAG,WACH,OAAO,OAAO,KACb,QAAQ,MAAM,EAShB;AAED;;gCAEgC,GAChC,OAAO,YAAI,aAAoB,IAAI,OAAO,EACxC,GAAG,WACH,OAAO,MAAM,KACZ,QAAQ,IAAI,IAAI,EAsBlB;AAED,iEAAiE,GACjE,OAAO,YAAI,SACT,OAAO,MAAM,EACb,OAAO,OAAO,EACd,QAAQ,MAAM,KACb,QAAQ,MAAM,EAAqD;AAEtE;qCACqC,GACrC,OAAO,YAAI,SAAgB,GACzB,OAAO,MAAM,EACb,OAAO,MAAM,EACb,QAAQ,MAAM,KACb,QAAQ,IAAI,IAAI,EAAwD;AAE3E;8EAC8E,GAC9E,OAAO,YAAI,UAAW,OAAO,MAAM,KAAG,OAAO,CAQ5C"}
|
package/_dist/vault.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { Eid } from "@yaks/graph";
|
|
2
|
+
/** What a vault keeps for one secret: the handle the graph holds for it and
|
|
3
|
+
* the value. References are kept separately so they cannot be sent as values. */ export type Sealed = {
|
|
4
|
+
/** the secret's name, where the write carried it */ name?: string;
|
|
5
|
+
handle: string;
|
|
6
|
+
value?: string;
|
|
7
|
+
/** An unresolved 1Password reference; runtime readers return no value. */ op?: string;
|
|
8
|
+
};
|
|
9
|
+
/** Metadata for a retained version; values stay inside the vault. */ export type Trashed = {
|
|
10
|
+
id: string;
|
|
11
|
+
eid: Eid;
|
|
12
|
+
handle: string;
|
|
13
|
+
name?: string;
|
|
14
|
+
at: number;
|
|
15
|
+
};
|
|
16
|
+
type Maybe<T> = T | Promise<T>;
|
|
17
|
+
/** A place to keep secrets. A failure trying again may cure throws an error
|
|
18
|
+
* carrying `retryable: true`, and is tried again (./plugin.ts `sealing`); any
|
|
19
|
+
* other is a defect. */ export type Vault = {
|
|
20
|
+
/** the key every sentinel this vault hands out is hashed under
|
|
21
|
+
* (./sentinel.ts) */ salt: () => Maybe<Uint8Array>;
|
|
22
|
+
read: (eid: Eid) => Maybe<Sealed | undefined>;
|
|
23
|
+
/** Read selected secrets together when the storage can share a round trip.
|
|
24
|
+
* An unreadable value can fail independently of the other rows. */ readMany?: (eids: readonly Eid[]) => Maybe<Map<Eid, PromiseSettledResult<Sealed>>>;
|
|
25
|
+
seal: (eid: Eid, sealed: Sealed) => Maybe<void>;
|
|
26
|
+
/** Retain the current value in trash, then remove it from active reads. */ drop: (eid: Eid) => Maybe<void>;
|
|
27
|
+
/** Retained versions, newest first, with no credential values. */ trash: () => Maybe<Trashed[]>;
|
|
28
|
+
/** Read a retained version privately, without changing active values or trash. */ past: (id: string) => Maybe<Sealed | undefined>;
|
|
29
|
+
/** Restore a retained version, preserving any displaced active value. */ restore: (id: string) => Maybe<boolean>;
|
|
30
|
+
/** Permanently remove one retained version after a person's choice. */ purge: (id: string) => Maybe<void>;
|
|
31
|
+
/** every secret it keeps, by entity id */ all: () => Maybe<[Eid, Sealed][]>;
|
|
32
|
+
/** run `fn` with this secret held against every other writer — the other
|
|
33
|
+
* callers in this process, and on a box the other processes too — so a
|
|
34
|
+
* read, a change and the write back are one step */ lock: <T>(eid: Eid, fn: () => Promise<T>) => Promise<T>;
|
|
35
|
+
};
|
|
36
|
+
/** A vault that answers at once: what a config read on the spot needs
|
|
37
|
+
* (./reveal.ts `peek`). A box's files and memory are both this. */ export type Local = Omit<Vault, 'read' | 'all' | 'trash' | 'past' | 'restore' | 'purge'> & {
|
|
38
|
+
read: (eid: Eid) => Sealed | undefined;
|
|
39
|
+
all: () => [Eid, Sealed][];
|
|
40
|
+
trash: () => Trashed[];
|
|
41
|
+
past: (id: string) => Sealed | undefined;
|
|
42
|
+
restore: (id: string) => boolean;
|
|
43
|
+
purge: (id: string) => void;
|
|
44
|
+
};
|
|
45
|
+
/** One lock per key, within this process: each caller waits for the one
|
|
46
|
+
* before it (@yaks/fp `locks`). */ export declare let queue: () => Vault['lock'];
|
|
47
|
+
/** A vault in memory: its secrets last as long as the process, which is right
|
|
48
|
+
* for a graph that does too, and for a test. */ export declare let ramVault: () => Local;
|
|
49
|
+
//# sourceMappingURL=vault.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vault.d.ts","sources":["../vault.ts"],"names":[],"mappings":"AAaA,cAAc,GAAG,2BAAgC;AAGjD;+EAC+E,GAC/E,YAAY;EACV,kDAAkD,GAClD,OAAO,MAAM;EACb,QAAQ,MAAM;EACd,QAAQ,MAAM;EACd,wEAAwE,GACxE,KAAK,MAAM;;AAGb,mEAAmE,GACnE,YAAY;EACV,IAAI,MAAM;EACV,KAAK;EACL,QAAQ,MAAM;EACd,OAAO,MAAM;EACb,IAAI,MAAM;;KAGP,MAAM,KAAK,IAAI,QAAQ;AAE5B;;sBAEsB,GACtB,YAAY;EACV;qBACmB,GACnB,YAAY,MAAM;EAClB,OAAO,KAAK,QAAQ,MAAM,SAAS,SAAS;EAC5C;mEACiE,GACjE,YACE,eAAe,UACZ,MAAM,IAAI,KAAK,qBAAqB;EACzC,OAAO,KAAK,KAAK,QAAQ,WAAW,MAAM,IAAI;EAC9C,yEAAyE,GACzE,OAAO,KAAK,QAAQ,MAAM,IAAI;EAC9B,gEAAgE,GAChE,aAAa,MAAM;EACnB,gFAAgF,GAChF,OAAO,IAAI,MAAM,KAAK,MAAM,SAAS,SAAS;EAC9C,uEAAuE,GACvE,UAAU,IAAI,MAAM,KAAK,MAAM,OAAO;EACtC,qEAAqE,GACrE,QAAQ,IAAI,MAAM,KAAK,MAAM,IAAI;EACjC,wCAAwC,GACxC,WAAW,OAAO,KAAK;EACvB;;oDAEkD,GAClD,OAAO,GAAG,KAAK,KAAK,UAAU,QAAQ,OAAO,QAAQ;;AAGvD;iEACiE,GACjE,YAAY,QACR,KAAK,OAAO,SAAS,QAAQ,UAAU,SAAS,YAAY;EAE5D,OAAO,KAAK,QAAQ,SAAS,SAAS;EACtC,YAAY,KAAK;EACjB,aAAa;EACb,OAAO,IAAI,MAAM,KAAK,SAAS,SAAS;EACxC,UAAU,IAAI,MAAM,KAAK,OAAO;EAChC,QAAQ,IAAI,MAAM,KAAK,IAAI;;AAG/B;iCACiC,GACjC,OAAO,YAAI,aAAY,MAAM,QAAkB;AAE/C;8CAC8C,GAC9C,OAAO,YAAI,gBAAe,MAwCzB"}
|
package/_dist/views.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"views.d.ts","sources":["../views.ts"],"names":[],"mappings":"AAGA,SAAiB,KAAK,QAAQ,4BAAiC;AAE/D,OAAO,YAAI,OAAO,SA4BhB"}
|
package/_dist/vocab.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { VocabDoc } from "@yaks/vocab";
|
|
2
|
+
/** The `secret` component. */ export declare let secretsDoc: VocabDoc;
|
|
3
|
+
/** What this package is: its manifest's description, the one place it is
|
|
4
|
+
* written, which a host stamps on each document here. */ export declare let description: string;
|
|
5
|
+
/** Every vocabulary document this plugin contributes. */ export declare let docs: VocabDoc[];
|
|
6
|
+
//# sourceMappingURL=vocab.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vocab.d.ts","sources":["../vocab.ts"],"names":[],"mappings":"AAIA,cAAc,QAAQ,2BAAgC;AAItD,4BAA4B,GAC5B,OAAO,YAAI,YAAY,SAAc;AAErC;uDACuD,GACvD,OAAO,YAAI,aAAa,MAAM,CAAuB;AAErD,uDAAuD,GACvD,OAAO,YAAI,MAAM,WAAyB"}
|
package/deno.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"publish":{"exclude":["**/*_test.ts"]},"name":"@yaks/secrets","version":"0.2.36","license":"Apache-2.0","description":"Secrets that flow through the graph and are kept somewhere else: a write's value is sealed into a vault and the graph keeps a random handle in its place.","exports":{".":"./mod.ts","./vocab":"./vocab.ts","./op":"./op.ts","./sealed":"./sealed.ts","./vault":"./vault.ts","./graph":"./graph.ts","./views":"./views.ts","./signed":"./signed.ts"},"imports":{"@yaks/secrets":"./mod.ts","@yaks/secrets/vocab":"./vocab.ts","@yaks/secrets/op":"./op.ts","@yaks/secrets/sealed":"./sealed.ts","@yaks/secrets/vault":"./vault.ts","@yaks/secrets/graph":"./graph.ts","@yaks/secrets/views":"./views.ts","@yaks/secrets/signed":"./signed.ts"}}
|
package/graph.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// The graph plugin this package contributes, exported as
|
|
2
|
+
// `@yaks/secrets/graph` — the entry point a host imports to install it, over
|
|
3
|
+
// the vault the host keeps (@yaks/cli keeps one beside its database). It takes
|
|
4
|
+
// a value out of a write before anything stores it, and seals it into the
|
|
5
|
+
// vault once the write commits (./plugin.ts).
|
|
6
|
+
import { secrets } from "./plugin.js";
|
|
7
|
+
/** Secrets sealed out of every write, into the host's vault. */ export let plugins = (host)=>[
|
|
8
|
+
secrets(host.vault, (b)=>host.graph.apply(b, {
|
|
9
|
+
trusted: true
|
|
10
|
+
}), host.vocab)
|
|
11
|
+
];
|
|
12
|
+
//# sourceMappingURL=graph.js.map
|
package/graph.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph.js","sources":["./graph.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,6EAA6E;AAC7E,+EAA+E;AAC/E,0EAA0E;AAC1E,8CAA8C;AAI9C,SAAS,OAAO,sBAAqB;AAGrC,8DAA8D,GAC9D,OAAO,IAAI,UAAU,CACnB,OACa;IACb,QACE,KAAK,KAAK,EACV,CAAC,IAAM,KAAK,KAAK,CAAC,KAAK,CAAC,GAAG;QAAE,SAAS;MAAK,IAC3C,KAAK,KAAK;GAEb,CAAA"}
|
package/graph.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// The graph plugin this package contributes, exported as
|
|
2
|
+
// `@yaks/secrets/graph` — the entry point a host imports to install it, over
|
|
3
|
+
// the vault the host keeps (@yaks/cli keeps one beside its database). It takes
|
|
4
|
+
// a value out of a write before anything stores it, and seals it into the
|
|
5
|
+
// vault once the write commits (./plugin.ts).
|
|
6
|
+
|
|
7
|
+
import type { Graph, Plugin } from 'jsr:@yaks/graph@0.2.36'
|
|
8
|
+
import type { Vocab } from 'jsr:@yaks/vocab@0.2.36'
|
|
9
|
+
import { secrets } from './plugin.js'
|
|
10
|
+
import type { Vault } from './vault.ts'
|
|
11
|
+
|
|
12
|
+
/** Secrets sealed out of every write, into the host's vault. */
|
|
13
|
+
export let plugins = (
|
|
14
|
+
host: { vault: Vault; graph: Graph; vocab: Vocab },
|
|
15
|
+
): Plugin[] => [
|
|
16
|
+
secrets(
|
|
17
|
+
host.vault,
|
|
18
|
+
(b) => host.graph.apply(b, { trusted: true }),
|
|
19
|
+
host.vocab,
|
|
20
|
+
),
|
|
21
|
+
]
|