forked from gsterjov/go-libsecret
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconsts.go
263 lines (200 loc) · 8.32 KB
/
consts.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
package gosecret
import (
"github.com/godbus/dbus/v5"
)
// Constants for use with gosecret.
const (
/*
ExplicitAttrEmptyValue is the constant used in Item.ModifyAttributes to explicitly set a value as empty.
Between the surrounding with %'s, the weird name that includes "gosecret", and the UUID4...
I am fairly confident this is unique enough.
*/
ExplicitAttrEmptyValue string = "%EXPLICIT_GOSECRET_BLANK_VALUE_8A4E3D7D-F30E-4754-8C56-9C172D1400F6%"
)
// Libsecret/SecretService Dbus interfaces.
const (
// DbusService is the Dbus service bus identifier.
DbusService string = "org.freedesktop.secrets"
// DbusServiceBase is the base identifier used by interfaces.
DbusServiceBase string = "org.freedesktop.Secret"
// DbusPrompterInterface is an interface for issuing a Prompt. Yes, it should be doubled up like that.
DbusPrompterInterface string = DbusServiceBase + ".Prompt.Prompt"
/*
DbusDefaultItemType is the default type to use for Item.Type/Collection.CreateItem.
*/
DbusDefaultItemType string = DbusServiceBase + ".Generic"
)
// Libsecret/SecretService special values.
var (
// DbusRemoveAliasPath is used to remove an alias from a Collection and/or Item.
DbusRemoveAliasPath dbus.ObjectPath = dbus.ObjectPath("/")
)
// Service interface.
const (
/*
DbusInterfaceService is the Dbus interface for working with a Service.
Found at /org/freedesktop/secrets/(DbusInterfaceService)
*/
DbusInterfaceService string = DbusServiceBase + ".Service"
// Methods
/*
DbusServiceChangeLock has some references in the SecretService Dbus API but
it seems to be obsolete - undocumented, at the least.
So we don't implement it.
*/
// DbusServiceChangeLock string = DbusInterfaceService + ".ChangeLock"
// DbusServiceCreateCollection is used to create a new Collection via Service.CreateCollection.
DbusServiceCreateCollection string = DbusInterfaceService + ".CreateCollection"
// DbusServiceGetSecrets is used to fetch multiple Secret values from multiple Item items in a given Collection (via Service.GetSecrets).
DbusServiceGetSecrets string = DbusInterfaceService + ".GetSecrets"
// DbusServiceLock is used by Service.Lock.
DbusServiceLock string = DbusInterfaceService + ".Lock"
// DbusServiceLockService is [FUNCTION UNKNOWN/UNDOCUMENTED; TODO? NOT IMPLEMENTED.]
// DbusServiceLockService string = DbusInterfaceService + ".LockService"
// DbusServiceOpenSession is used by Service.OpenSession.
DbusServiceOpenSession string = DbusInterfaceService + ".OpenSession"
// DbusServiceReadAlias is used by Service.ReadAlias to return a Collection based on its aliased name.
DbusServiceReadAlias string = DbusInterfaceService + ".ReadAlias"
// DbusServiceSearchItems is used by Service.SearchItems to get arrays of locked and unlocked Item objects.
DbusServiceSearchItems string = DbusInterfaceService + ".SearchItems"
// DbusServiceSetAlias is used by Service.SetAlias to set an alias for a Collection.
DbusServiceSetAlias string = DbusInterfaceService + ".SetAlias"
// DbusServiceUnlock is used by Service.Unlock.
DbusServiceUnlock string = DbusInterfaceService + ".Unlock"
// Properties
// DbusServiceCollections is used to get a Dbus array of Collection items (Service.Collections).
DbusServiceCollections string = DbusInterfaceService + ".Collections"
)
// Session interface.
const (
/*
DbusInterfaceSession is the Dbus interface for working with a Session.
Found at /org/freedesktop/secrets/session/<session ID>/(DbusInterfaceSession)
*/
DbusInterfaceSession = DbusServiceBase + ".Session"
// Methods
// DbusSessionClose is used for Session.Close.
DbusSessionClose string = DbusInterfaceSession + ".Close"
)
// Collection interface.
const (
/*
DbusInterfaceCollection is the Dbus interface for working with a Collection.
Found at /org/freedesktop/secrets/collection/<collection name>/(DbusInterfaceCollection)
*/
DbusInterfaceCollection string = DbusServiceBase + ".Collection"
// Methods
// DbusCollectionCreateItem is used for Collection.CreateItem.
DbusCollectionCreateItem string = DbusInterfaceCollection + ".CreateItem"
// DbusCollectionDelete is used for Collection.Delete.
DbusCollectionDelete string = DbusInterfaceCollection + ".Delete"
// DbusCollectionSearchItems is used for Collection.SearchItems.
DbusCollectionSearchItems string = DbusInterfaceCollection + ".SearchItems"
// Properties
// DbusCollectionItems is a Dbus array of Item.
DbusCollectionItems string = DbusInterfaceCollection + ".Items"
// DbusCollectionLocked is a Dbus boolean for Collection.Locked.
DbusCollectionLocked string = DbusInterfaceCollection + ".Locked"
// DbusCollectionLabel is the name (label) for Collection.Label.
DbusCollectionLabel string = DbusInterfaceCollection + ".Label"
// DbusCollectionCreated is the time a Collection was created (in a UNIX Epoch uint64) for Collection.Created.
DbusCollectionCreated string = DbusInterfaceCollection + ".Created"
// DbusCollectionModified is the time a Collection was last modified (in a UNIX Epoch uint64) for Collection.Modified.
DbusCollectionModified string = DbusInterfaceCollection + ".Modified"
// TODO: Signals?
)
// Item interface.
const (
/*
DbusInterfaceItem is the Dbus interface for working with Item items.
Found at /org/freedesktop/secrets/collection/<collection name>/<item index>/(DbusInterfaceItem)
*/
DbusInterfaceItem string = DbusServiceBase + ".Item"
// Methods
// DbusItemDelete is used by Item.Delete.
DbusItemDelete string = DbusInterfaceItem + ".Delete"
// DbusItemGetSecret is used by Item.GetSecret.
DbusItemGetSecret string = DbusInterfaceItem + ".GetSecret"
// DbusItemSetSecret is used by Item.SetSecret.
DbusItemSetSecret string = DbusInterfaceItem + ".SetSecret"
// Properties
// DbusItemLocked is a Dbus boolean for Item.Locked.
DbusItemLocked string = DbusInterfaceItem + ".Locked"
/*
DbusItemAttributes contains attributes (metadata, schema, etc.) for
Item.Attributes, Item.ReplaceAttributes, and Item.ModifyAttributes.
*/
DbusItemAttributes string = DbusInterfaceItem + ".Attributes"
// DbusItemLabel is the name (label) for Item.Label.
DbusItemLabel string = DbusInterfaceItem + ".Label"
// DbusItemType is the type of Item (Item.ItemType).
DbusItemType string = DbusInterfaceItem + ".Type"
// DbusItemCreated is the time an Item was created (in a UNIX Epoch uint64) for Item.Created.
DbusItemCreated string = DbusInterfaceItem + ".Created"
// DbusItemModified is the time an Item was last modified (in a UNIX Epoch uint64) for Item.Modified.
DbusItemModified string = DbusInterfaceItem + ".Modified"
)
// Dbus paths.
const (
// DbusPath is the path for DbusService.
DbusPath string = "/org/freedesktop/secrets"
// DbusPromptPrefix is the path used for prompts comparison.
DbusPromptPrefix string = DbusPath + "/prompt/"
// DbusNewCollectionPath is used to create a new Collection.
DbusNewCollectionPath string = DbusPath + "/collection/"
// DbusNewSessionPath is used to create a new Session.
DbusNewSessionPath string = DbusPath + "/session/"
)
// FLAGS
// These are not currently used, but may be in the future.
// SERVICE
// ServiceInitFlag is a flag for Service.OpenSession.
type ServiceInitFlag int
const (
FlagServiceNone ServiceInitFlag = iota
FlagServiceOpenSession
FlagServiceLoadCollections
)
// ServiceSearchFlag is a flag for Service.SearchItems.
type ServiceSearchFlag int
const (
FlagServiceSearchNone ServiceSearchFlag = iota
FlagServiceSearchAll
FlagServiceSearchUnlock
FlagServiceSearchLoadSecrets
)
// COLLECTION
// CollectionInitFlag is a flag for Collection.SearchItems and Collection.Items.
type CollectionInitFlag int
const (
FlagCollectionNone CollectionInitFlag = iota
FlagCollectionLoadItems
)
// ITEM
// ItemInitFlag are flags for Collection.SearchItems and Collection.Items.
type ItemInitFlag int
const (
FlagItemNone ItemInitFlag = iota
FlagItemLoadSecret
)
// ItemSearchFlag are flags for Collection.CreateItem.
type ItemSearchFlag int
const (
FlagItemCreateNone ItemSearchFlag = iota
FlatItemCreateReplace
)
// ERRORS
/*
SecretServiceErrEnum are just constants for the enum'd errors;
see SecretServiceError type and ErrSecretService* vars for what
actually gets returned.
They're used for finding the appropriate matching error.
*/
type SecretServiceErrEnum int
const (
EnumErrProtocol SecretServiceErrEnum = iota
EnumErrIsLocked
EnumErrNoSuchObject
EnumErrAlreadyExists
EnumErrInvalidFileFormat
)