@mstone6969/vault 0.2.0 → 0.5.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/README.md +198 -6
- package/dist/crypto.d.ts +99 -2
- package/dist/crypto.d.ts.map +1 -1
- package/dist/errors.d.ts +122 -4
- package/dist/errors.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +447 -33
- package/dist/index.js.map +9 -7
- package/dist/providers.d.ts +131 -0
- package/dist/providers.d.ts.map +1 -0
- package/dist/stores/file.d.ts +190 -0
- package/dist/stores/file.d.ts.map +1 -0
- package/dist/stores/file.js +1 -0
- package/dist/stores/memory.d.ts +98 -7
- package/dist/stores/memory.d.ts.map +1 -1
- package/dist/stores/sqlite.d.ts +140 -9
- package/dist/stores/sqlite.d.ts.map +1 -1
- package/dist/stores/sqlite.js +47 -12
- package/dist/stores/sqlite.js.map +3 -3
- package/dist/types.d.ts +408 -17
- package/dist/types.d.ts.map +1 -1
- package/dist/vault.d.ts +554 -19
- package/dist/vault.d.ts.map +1 -1
- package/docs/README.md +10 -0
- package/docs/index/README.md +48 -0
- package/docs/index/classes/FileStore.md +341 -0
- package/docs/index/classes/MemoryStore.md +240 -0
- package/docs/index/classes/Vault.md +805 -0
- package/docs/index/classes/VaultError.md +371 -0
- package/docs/index/classes/VaultKeyError.md +370 -0
- package/docs/index/functions/envKey.md +43 -0
- package/docs/index/functions/fileKey.md +46 -0
- package/docs/index/functions/generateKey.md +39 -0
- package/docs/index/functions/importKey.md +49 -0
- package/docs/index/functions/isKeyProvider.md +43 -0
- package/docs/index/functions/open.md +67 -0
- package/docs/index/functions/randomValue.md +53 -0
- package/docs/index/functions/seal.md +56 -0
- package/docs/index/functions/staticKey.md +39 -0
- package/docs/index/type-aliases/Generator.md +58 -0
- package/docs/index/type-aliases/HistoryEntry.md +65 -0
- package/docs/index/type-aliases/KeyProvider.md +74 -0
- package/docs/index/type-aliases/PutOptions.md +141 -0
- package/docs/index/type-aliases/RekeyReport.md +37 -0
- package/docs/index/type-aliases/RotationContext.md +49 -0
- package/docs/index/type-aliases/RotationPolicy.md +142 -0
- package/docs/index/type-aliases/SecretRecord.md +214 -0
- package/docs/index/type-aliases/SecretSummary.md +56 -0
- package/docs/index/type-aliases/VaultEvent.md +95 -0
- package/docs/index/type-aliases/VaultOptions.md +142 -0
- package/docs/index/type-aliases/VaultStore.md +156 -0
- package/docs/index/variables/DEFAULT_ALPHABET.md +29 -0
- package/docs/index/variables/DEFAULT_HISTORY_LIMIT.md +28 -0
- package/docs/index/variables/DEFAULT_PREFIX.md +23 -0
- package/docs/stores/sqlite/README.md +11 -0
- package/docs/stores/sqlite/classes/SqliteStore.md +307 -0
- package/package.json +15 -5
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
[**@mstone6969/vault**](../../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@mstone6969/vault](../../README.md) / [index](../README.md) / PutOptions
|
|
6
|
+
|
|
7
|
+
# Type Alias: PutOptions
|
|
8
|
+
|
|
9
|
+
> **PutOptions** = `object`
|
|
10
|
+
|
|
11
|
+
Defined in: cron/vault/src/types.ts:275
|
|
12
|
+
|
|
13
|
+
What `put` is allowed to say about an entry beyond its value.
|
|
14
|
+
|
|
15
|
+
## Remarks
|
|
16
|
+
|
|
17
|
+
Every field left out means "as it was" on a replacing `put`, so rotating a
|
|
18
|
+
credential does not quietly forget what kind it is or when it expires. The
|
|
19
|
+
exception is `final`, which must be asked for each time.
|
|
20
|
+
|
|
21
|
+
## Example
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
await vault.put("alice", "db", "s3cret", {
|
|
25
|
+
metadata: { kind: "postgres", user: "app" },
|
|
26
|
+
rotation: { kind: "random", length: 40 },
|
|
27
|
+
expiresAt: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000),
|
|
28
|
+
})
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Properties
|
|
32
|
+
|
|
33
|
+
### metadata?
|
|
34
|
+
|
|
35
|
+
> `optional` **metadata?**: `Record`\<`string`, `string`\>
|
|
36
|
+
|
|
37
|
+
Defined in: cron/vault/src/types.ts:280
|
|
38
|
+
|
|
39
|
+
Non-secret facts to keep beside the value, returned by `list`. Replaces
|
|
40
|
+
whatever was there; leave it out to keep what the entry already has.
|
|
41
|
+
|
|
42
|
+
***
|
|
43
|
+
|
|
44
|
+
### rotation?
|
|
45
|
+
|
|
46
|
+
> `optional` **rotation?**: [`RotationPolicy`](RotationPolicy.md) \| `null`
|
|
47
|
+
|
|
48
|
+
Defined in: cron/vault/src/types.ts:289
|
|
49
|
+
|
|
50
|
+
How to produce the next value when it is rotated.
|
|
51
|
+
|
|
52
|
+
#### Remarks
|
|
53
|
+
|
|
54
|
+
Pass null to drop a policy an entry already has; leaving it out keeps it.
|
|
55
|
+
|
|
56
|
+
#### See
|
|
57
|
+
|
|
58
|
+
[RotationPolicy](RotationPolicy.md)
|
|
59
|
+
|
|
60
|
+
***
|
|
61
|
+
|
|
62
|
+
### open?
|
|
63
|
+
|
|
64
|
+
> `optional` **open?**: `boolean`
|
|
65
|
+
|
|
66
|
+
Defined in: cron/vault/src/types.ts:299
|
|
67
|
+
|
|
68
|
+
Store in the open, readable by `read`.
|
|
69
|
+
|
|
70
|
+
#### Remarks
|
|
71
|
+
|
|
72
|
+
For values that belong beside the secrets but are not secret — a host, an
|
|
73
|
+
account id. Left out, the entry keeps how it was already stored.
|
|
74
|
+
|
|
75
|
+
#### Default Value
|
|
76
|
+
|
|
77
|
+
```ts
|
|
78
|
+
false
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
***
|
|
82
|
+
|
|
83
|
+
### final?
|
|
84
|
+
|
|
85
|
+
> `optional` **final?**: `boolean`
|
|
86
|
+
|
|
87
|
+
Defined in: cron/vault/src/types.ts:309
|
|
88
|
+
|
|
89
|
+
Refuse every future replacement.
|
|
90
|
+
|
|
91
|
+
#### Remarks
|
|
92
|
+
|
|
93
|
+
Not sticky: it is taken from this call alone, so it must be repeated by
|
|
94
|
+
anything rewriting the entry — which nothing can, once it is set.
|
|
95
|
+
|
|
96
|
+
#### Default Value
|
|
97
|
+
|
|
98
|
+
```ts
|
|
99
|
+
false
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
***
|
|
103
|
+
|
|
104
|
+
### expiresAt?
|
|
105
|
+
|
|
106
|
+
> `optional` **expiresAt?**: `Date` \| `null`
|
|
107
|
+
|
|
108
|
+
Defined in: cron/vault/src/types.ts:318
|
|
109
|
+
|
|
110
|
+
When it should stop resolving.
|
|
111
|
+
|
|
112
|
+
#### Remarks
|
|
113
|
+
|
|
114
|
+
Pass null to make an expiring entry permanent again.
|
|
115
|
+
|
|
116
|
+
#### Default Value
|
|
117
|
+
|
|
118
|
+
```ts
|
|
119
|
+
null
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
***
|
|
123
|
+
|
|
124
|
+
### keepHistory?
|
|
125
|
+
|
|
126
|
+
> `optional` **keepHistory?**: `boolean`
|
|
127
|
+
|
|
128
|
+
Defined in: cron/vault/src/types.ts:328
|
|
129
|
+
|
|
130
|
+
Keep the value being replaced, up to `historyLimit`.
|
|
131
|
+
|
|
132
|
+
#### Remarks
|
|
133
|
+
|
|
134
|
+
What `rotate` sets for you; set it by hand when replacing a value
|
|
135
|
+
yourself and something may still be running on the old one.
|
|
136
|
+
|
|
137
|
+
#### Default Value
|
|
138
|
+
|
|
139
|
+
```ts
|
|
140
|
+
false
|
|
141
|
+
```
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
[**@mstone6969/vault**](../../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@mstone6969/vault](../../README.md) / [index](../README.md) / RekeyReport
|
|
6
|
+
|
|
7
|
+
# Type Alias: RekeyReport
|
|
8
|
+
|
|
9
|
+
> **RekeyReport** = `object`
|
|
10
|
+
|
|
11
|
+
Defined in: cron/vault/src/vault.ts:212
|
|
12
|
+
|
|
13
|
+
What a `rekey` did, and to what it could not do it.
|
|
14
|
+
|
|
15
|
+
## See
|
|
16
|
+
|
|
17
|
+
[Vault.rekey](../classes/Vault.md#rekey)
|
|
18
|
+
|
|
19
|
+
## Properties
|
|
20
|
+
|
|
21
|
+
### rekeyed
|
|
22
|
+
|
|
23
|
+
> **rekeyed**: `number`
|
|
24
|
+
|
|
25
|
+
Defined in: cron/vault/src/vault.ts:214
|
|
26
|
+
|
|
27
|
+
How many entries were re-sealed under the new key.
|
|
28
|
+
|
|
29
|
+
***
|
|
30
|
+
|
|
31
|
+
### failed
|
|
32
|
+
|
|
33
|
+
> **failed**: `string`[]
|
|
34
|
+
|
|
35
|
+
Defined in: cron/vault/src/vault.ts:216
|
|
36
|
+
|
|
37
|
+
Entries that would not open, by `owner/name`, left exactly as they were.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
[**@mstone6969/vault**](../../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@mstone6969/vault](../../README.md) / [index](../README.md) / RotationContext
|
|
6
|
+
|
|
7
|
+
# Type Alias: RotationContext
|
|
8
|
+
|
|
9
|
+
> **RotationContext** = `object`
|
|
10
|
+
|
|
11
|
+
Defined in: cron/vault/src/vault.ts:60
|
|
12
|
+
|
|
13
|
+
Everything a generator is told: which entry is being rotated and the
|
|
14
|
+
non-secret arguments its policy carries. Deliberately not the current value —
|
|
15
|
+
a generator that needs it can ask the vault for it.
|
|
16
|
+
|
|
17
|
+
## See
|
|
18
|
+
|
|
19
|
+
[Generator](Generator.md), [RotationPolicy.arguments](RotationPolicy.md#arguments)
|
|
20
|
+
|
|
21
|
+
## Properties
|
|
22
|
+
|
|
23
|
+
### owner
|
|
24
|
+
|
|
25
|
+
> **owner**: `string`
|
|
26
|
+
|
|
27
|
+
Defined in: cron/vault/src/vault.ts:62
|
|
28
|
+
|
|
29
|
+
Whose entry is being rotated.
|
|
30
|
+
|
|
31
|
+
***
|
|
32
|
+
|
|
33
|
+
### name
|
|
34
|
+
|
|
35
|
+
> **name**: `string`
|
|
36
|
+
|
|
37
|
+
Defined in: cron/vault/src/vault.ts:64
|
|
38
|
+
|
|
39
|
+
Which entry is being rotated.
|
|
40
|
+
|
|
41
|
+
***
|
|
42
|
+
|
|
43
|
+
### arguments
|
|
44
|
+
|
|
45
|
+
> **arguments**: `Record`\<`string`, `string`\>
|
|
46
|
+
|
|
47
|
+
Defined in: cron/vault/src/vault.ts:66
|
|
48
|
+
|
|
49
|
+
The non-secret arguments its policy carries.
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
[**@mstone6969/vault**](../../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@mstone6969/vault](../../README.md) / [index](../README.md) / RotationPolicy
|
|
6
|
+
|
|
7
|
+
# Type Alias: RotationPolicy
|
|
8
|
+
|
|
9
|
+
> **RotationPolicy** = `object`
|
|
10
|
+
|
|
11
|
+
Defined in: cron/vault/src/types.ts:57
|
|
12
|
+
|
|
13
|
+
How an entry's next value is produced.
|
|
14
|
+
|
|
15
|
+
This is a recipe, not a value: it says *how* to make the next password, never
|
|
16
|
+
what the current one is. Storing it means an entry can be rotated by anything
|
|
17
|
+
holding the vault, without that thing being told the secret it is replacing.
|
|
18
|
+
|
|
19
|
+
## Example
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
// The vault mints the next value itself.
|
|
23
|
+
await vault.put("alice", "db", "current", {
|
|
24
|
+
rotation: { kind: "random", length: 40, every: 60 * 60 * 24 * 30 },
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
// Or a function registered on the vault does, for a credential only the
|
|
28
|
+
// far end can issue.
|
|
29
|
+
await vault.put("alice", "aws", "current", {
|
|
30
|
+
rotation: { kind: "generator", generator: "aws", arguments: { user: "ci" } },
|
|
31
|
+
})
|
|
32
|
+
await vault.rotate("alice", "aws")
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## See
|
|
36
|
+
|
|
37
|
+
[PutOptions.rotation](PutOptions.md#rotation)
|
|
38
|
+
|
|
39
|
+
## Properties
|
|
40
|
+
|
|
41
|
+
### kind
|
|
42
|
+
|
|
43
|
+
> **kind**: `"random"` \| `"generator"`
|
|
44
|
+
|
|
45
|
+
Defined in: cron/vault/src/types.ts:66
|
|
46
|
+
|
|
47
|
+
`random` has the vault generate one. `generator` calls a function you
|
|
48
|
+
registered by name — for a credential only the far end can mint.
|
|
49
|
+
|
|
50
|
+
#### Remarks
|
|
51
|
+
|
|
52
|
+
`generator` names a function in the vault's `generators`; rotating with a
|
|
53
|
+
name the vault does not have fails rather than inventing a value.
|
|
54
|
+
|
|
55
|
+
***
|
|
56
|
+
|
|
57
|
+
### length?
|
|
58
|
+
|
|
59
|
+
> `optional` **length?**: `number`
|
|
60
|
+
|
|
61
|
+
Defined in: cron/vault/src/types.ts:72
|
|
62
|
+
|
|
63
|
+
random: how many characters. Default 32.
|
|
64
|
+
|
|
65
|
+
#### Default Value
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
32
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
***
|
|
72
|
+
|
|
73
|
+
### alphabet?
|
|
74
|
+
|
|
75
|
+
> `optional` **alphabet?**: `string`
|
|
76
|
+
|
|
77
|
+
Defined in: cron/vault/src/types.ts:82
|
|
78
|
+
|
|
79
|
+
random: which characters to draw from.
|
|
80
|
+
|
|
81
|
+
#### Remarks
|
|
82
|
+
|
|
83
|
+
Sampling is unbiased whatever the length, so an alphabet trimmed to what
|
|
84
|
+
a system accepts costs nothing. Needs at least two characters.
|
|
85
|
+
|
|
86
|
+
#### Default Value
|
|
87
|
+
|
|
88
|
+
`DEFAULT_ALPHABET` — the 62 ASCII letters and digits
|
|
89
|
+
|
|
90
|
+
***
|
|
91
|
+
|
|
92
|
+
### generator?
|
|
93
|
+
|
|
94
|
+
> `optional` **generator?**: `string`
|
|
95
|
+
|
|
96
|
+
Defined in: cron/vault/src/types.ts:91
|
|
97
|
+
|
|
98
|
+
generator: which registered generator to call.
|
|
99
|
+
|
|
100
|
+
#### Remarks
|
|
101
|
+
|
|
102
|
+
A name, not a function. What is written down is that an entry can be
|
|
103
|
+
rotated, not how to impersonate the thing that rotates it — the function
|
|
104
|
+
stays in the process that built the vault.
|
|
105
|
+
|
|
106
|
+
***
|
|
107
|
+
|
|
108
|
+
### arguments?
|
|
109
|
+
|
|
110
|
+
> `optional` **arguments?**: `Record`\<`string`, `string`\>
|
|
111
|
+
|
|
112
|
+
Defined in: cron/vault/src/types.ts:99
|
|
113
|
+
|
|
114
|
+
generator: non-secret arguments, e.g. which account to rotate.
|
|
115
|
+
|
|
116
|
+
#### Remarks
|
|
117
|
+
|
|
118
|
+
Stored in the clear beside the policy, so it must hold nothing secret.
|
|
119
|
+
Reaches the generator as the `arguments` of its context.
|
|
120
|
+
|
|
121
|
+
***
|
|
122
|
+
|
|
123
|
+
### every?
|
|
124
|
+
|
|
125
|
+
> `optional` **every?**: `number`
|
|
126
|
+
|
|
127
|
+
Defined in: cron/vault/src/types.ts:114
|
|
128
|
+
|
|
129
|
+
How often it wants rotating, in seconds. Nothing enforces it; `rotationDue` reports it.
|
|
130
|
+
|
|
131
|
+
#### Remarks
|
|
132
|
+
|
|
133
|
+
Measured from `rotatedAt`, or from `createdAt` for an entry never
|
|
134
|
+
rotated. Left out, the entry is never reported as due.
|
|
135
|
+
|
|
136
|
+
#### Example
|
|
137
|
+
|
|
138
|
+
```ts
|
|
139
|
+
for (const secret of await vault.rotationDue()) {
|
|
140
|
+
await vault.rotate(secret.owner, secret.name)
|
|
141
|
+
}
|
|
142
|
+
```
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
[**@mstone6969/vault**](../../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@mstone6969/vault](../../README.md) / [index](../README.md) / SecretRecord
|
|
6
|
+
|
|
7
|
+
# Type Alias: SecretRecord
|
|
8
|
+
|
|
9
|
+
> **SecretRecord** = `object`
|
|
10
|
+
|
|
11
|
+
Defined in: cron/vault/src/types.ts:127
|
|
12
|
+
|
|
13
|
+
A stored secret, as the store keeps it.
|
|
14
|
+
|
|
15
|
+
## Remarks
|
|
16
|
+
|
|
17
|
+
The shape a [VaultStore](VaultStore.md) reads and writes, and the only place the
|
|
18
|
+
sealed bytes appear. Callers of the vault get [SecretSummary](SecretSummary.md) instead.
|
|
19
|
+
A store persists these fields as given: none of them mean anything to it.
|
|
20
|
+
|
|
21
|
+
## See
|
|
22
|
+
|
|
23
|
+
[SecretSummary](SecretSummary.md)
|
|
24
|
+
|
|
25
|
+
## Properties
|
|
26
|
+
|
|
27
|
+
### owner
|
|
28
|
+
|
|
29
|
+
> **owner**: `string`
|
|
30
|
+
|
|
31
|
+
Defined in: cron/vault/src/types.ts:129
|
|
32
|
+
|
|
33
|
+
Whose it is. The vault never reaches across owners except to rekey.
|
|
34
|
+
|
|
35
|
+
***
|
|
36
|
+
|
|
37
|
+
### name
|
|
38
|
+
|
|
39
|
+
> **name**: `string`
|
|
40
|
+
|
|
41
|
+
Defined in: cron/vault/src/types.ts:137
|
|
42
|
+
|
|
43
|
+
What it is called, and how a reference finds it.
|
|
44
|
+
|
|
45
|
+
#### Remarks
|
|
46
|
+
|
|
47
|
+
Up to 64 characters of letters, numbers, dot, dash or underscore —
|
|
48
|
+
checked by the vault before it reaches a store. Unique per owner.
|
|
49
|
+
|
|
50
|
+
***
|
|
51
|
+
|
|
52
|
+
### sealed
|
|
53
|
+
|
|
54
|
+
> **sealed**: `string`
|
|
55
|
+
|
|
56
|
+
Defined in: cron/vault/src/types.ts:142
|
|
57
|
+
|
|
58
|
+
The value, sealed under this entry's data key — `iv:payload`, base64.
|
|
59
|
+
Empty when the entry is not sealed.
|
|
60
|
+
|
|
61
|
+
***
|
|
62
|
+
|
|
63
|
+
### sealedKey
|
|
64
|
+
|
|
65
|
+
> **sealedKey**: `string` \| `null`
|
|
66
|
+
|
|
67
|
+
Defined in: cron/vault/src/types.ts:153
|
|
68
|
+
|
|
69
|
+
This entry's data key, sealed under the master key.
|
|
70
|
+
|
|
71
|
+
Every value gets its own key, and only these are re-sealed when the
|
|
72
|
+
master key changes: rekeying costs one small operation per entry rather
|
|
73
|
+
than re-encrypting every byte, and one leaked data key exposes one value.
|
|
74
|
+
|
|
75
|
+
Null on entries written before envelope encryption, whose value is sealed
|
|
76
|
+
under the master key directly.
|
|
77
|
+
|
|
78
|
+
***
|
|
79
|
+
|
|
80
|
+
### plain
|
|
81
|
+
|
|
82
|
+
> **plain**: `string` \| `null`
|
|
83
|
+
|
|
84
|
+
Defined in: cron/vault/src/types.ts:161
|
|
85
|
+
|
|
86
|
+
The value in the open. Only ever set when `isSealed` is false.
|
|
87
|
+
|
|
88
|
+
#### Remarks
|
|
89
|
+
|
|
90
|
+
This is the one field a store holds that is readable without a key, so an
|
|
91
|
+
entry only lands here when `put` was told `open: true`.
|
|
92
|
+
|
|
93
|
+
***
|
|
94
|
+
|
|
95
|
+
### isSealed
|
|
96
|
+
|
|
97
|
+
> **isSealed**: `boolean`
|
|
98
|
+
|
|
99
|
+
Defined in: cron/vault/src/types.ts:171
|
|
100
|
+
|
|
101
|
+
False for entries stored in the open, which can be read back.
|
|
102
|
+
|
|
103
|
+
#### Remarks
|
|
104
|
+
|
|
105
|
+
Left out of a replacing `put`, an entry keeps whatever it already was:
|
|
106
|
+
rotating a credential should not quietly unseal it.
|
|
107
|
+
|
|
108
|
+
#### Default Value
|
|
109
|
+
|
|
110
|
+
```ts
|
|
111
|
+
true for a new entry
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
***
|
|
115
|
+
|
|
116
|
+
### isFinal
|
|
117
|
+
|
|
118
|
+
> **isFinal**: `boolean`
|
|
119
|
+
|
|
120
|
+
Defined in: cron/vault/src/types.ts:180
|
|
121
|
+
|
|
122
|
+
Written once: a store must refuse to replace it.
|
|
123
|
+
|
|
124
|
+
#### Remarks
|
|
125
|
+
|
|
126
|
+
The refusing is the vault's — a store writes what it is given. `put` on a
|
|
127
|
+
final entry throws and records a `denied` event with detail `"final"`.
|
|
128
|
+
Removing it still works; finality is about change, not deletion.
|
|
129
|
+
|
|
130
|
+
***
|
|
131
|
+
|
|
132
|
+
### expiresAt
|
|
133
|
+
|
|
134
|
+
> **expiresAt**: `Date` \| `null`
|
|
135
|
+
|
|
136
|
+
Defined in: cron/vault/src/types.ts:188
|
|
137
|
+
|
|
138
|
+
When the entry stops resolving, or null if it does not.
|
|
139
|
+
|
|
140
|
+
#### Remarks
|
|
141
|
+
|
|
142
|
+
The entry stays in the store past this moment, but `open`, `read` and
|
|
143
|
+
`resolve` refuse it. `purgeExpired` is what actually deletes it.
|
|
144
|
+
|
|
145
|
+
***
|
|
146
|
+
|
|
147
|
+
### history
|
|
148
|
+
|
|
149
|
+
> **history**: [`HistoryEntry`](HistoryEntry.md)[]
|
|
150
|
+
|
|
151
|
+
Defined in: cron/vault/src/types.ts:196
|
|
152
|
+
|
|
153
|
+
Previous values, newest first. Empty unless the entry keeps history.
|
|
154
|
+
|
|
155
|
+
#### Remarks
|
|
156
|
+
|
|
157
|
+
Filled by `rotate`, or by a `put` told `keepHistory: true`, and trimmed
|
|
158
|
+
to the vault's `historyLimit`.
|
|
159
|
+
|
|
160
|
+
***
|
|
161
|
+
|
|
162
|
+
### rotation
|
|
163
|
+
|
|
164
|
+
> **rotation**: [`RotationPolicy`](RotationPolicy.md) \| `null`
|
|
165
|
+
|
|
166
|
+
Defined in: cron/vault/src/types.ts:198
|
|
167
|
+
|
|
168
|
+
How to produce the next value, or null if nothing knows.
|
|
169
|
+
|
|
170
|
+
***
|
|
171
|
+
|
|
172
|
+
### rotatedAt
|
|
173
|
+
|
|
174
|
+
> **rotatedAt**: `Date` \| `null`
|
|
175
|
+
|
|
176
|
+
Defined in: cron/vault/src/types.ts:206
|
|
177
|
+
|
|
178
|
+
When it was last rotated, as opposed to merely replaced.
|
|
179
|
+
|
|
180
|
+
#### Remarks
|
|
181
|
+
|
|
182
|
+
Null until the first rotation, which is why `rotationDue` falls back to
|
|
183
|
+
`createdAt` when deciding whether `every` has elapsed.
|
|
184
|
+
|
|
185
|
+
***
|
|
186
|
+
|
|
187
|
+
### metadata
|
|
188
|
+
|
|
189
|
+
> **metadata**: `Record`\<`string`, `string`\>
|
|
190
|
+
|
|
191
|
+
Defined in: cron/vault/src/types.ts:211
|
|
192
|
+
|
|
193
|
+
Non-secret facts, stored in the clear and returned by `list`: what kind
|
|
194
|
+
of credential it is, which username it belongs to, a public key.
|
|
195
|
+
|
|
196
|
+
***
|
|
197
|
+
|
|
198
|
+
### createdAt
|
|
199
|
+
|
|
200
|
+
> **createdAt**: `Date`
|
|
201
|
+
|
|
202
|
+
Defined in: cron/vault/src/types.ts:213
|
|
203
|
+
|
|
204
|
+
When the entry was first stored. Survives replacement.
|
|
205
|
+
|
|
206
|
+
***
|
|
207
|
+
|
|
208
|
+
### updatedAt
|
|
209
|
+
|
|
210
|
+
> **updatedAt**: `Date`
|
|
211
|
+
|
|
212
|
+
Defined in: cron/vault/src/types.ts:215
|
|
213
|
+
|
|
214
|
+
When it last changed.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
[**@mstone6969/vault**](../../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@mstone6969/vault](../../README.md) / [index](../README.md) / SecretSummary
|
|
6
|
+
|
|
7
|
+
# Type Alias: SecretSummary
|
|
8
|
+
|
|
9
|
+
> **SecretSummary** = `Omit`\<[`SecretRecord`](SecretRecord.md), `"sealed"` \| `"sealedKey"` \| `"plain"` \| `"history"`\> & `object`
|
|
10
|
+
|
|
11
|
+
Defined in: cron/vault/src/types.ts:236
|
|
12
|
+
|
|
13
|
+
A stored secret, as callers are allowed to see it: no sealed value.
|
|
14
|
+
|
|
15
|
+
## Type Declaration
|
|
16
|
+
|
|
17
|
+
### value?
|
|
18
|
+
|
|
19
|
+
> `optional` **value?**: `string`
|
|
20
|
+
|
|
21
|
+
Present only for entries stored in the open.
|
|
22
|
+
|
|
23
|
+
#### Remarks
|
|
24
|
+
|
|
25
|
+
A sealed entry leaves this undefined however it is summarised; its value
|
|
26
|
+
only comes out of `open`.
|
|
27
|
+
|
|
28
|
+
### versions
|
|
29
|
+
|
|
30
|
+
> **versions**: `number`
|
|
31
|
+
|
|
32
|
+
How many previous values are kept.
|
|
33
|
+
|
|
34
|
+
#### Remarks
|
|
35
|
+
|
|
36
|
+
A count, not the values: `versions` on the vault opens those, one at a
|
|
37
|
+
time and only for whoever holds the key.
|
|
38
|
+
|
|
39
|
+
## Remarks
|
|
40
|
+
|
|
41
|
+
What `put`, `rotate`, `list` and `rotationDue` hand back. The sealed bytes,
|
|
42
|
+
the data key and the kept history are dropped rather than hidden, so a
|
|
43
|
+
summary can be logged or returned from an API without leaking anything the
|
|
44
|
+
master key protects.
|
|
45
|
+
|
|
46
|
+
## Example
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
for (const secret of await vault.list("alice")) {
|
|
50
|
+
console.log(secret.name, secret.metadata.kind, secret.versions)
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## See
|
|
55
|
+
|
|
56
|
+
[SecretRecord](SecretRecord.md)
|