@@ -70,8 +70,10 @@ proc openSession(bus:Bus): ObjectPath =
70
70
SERVICE_INTERFACE,
71
71
" OpenSession" ,
72
72
)
73
- msg.append(" plain" )
74
- msg.append(newVariant[string ](" " ))
73
+ {.gcsafe.}:
74
+ msg.append(" plain" )
75
+ {.gcsafe.}:
76
+ msg.append(newVariant[string ](" " ))
75
77
let open_result = bus.call(msg)
76
78
result = open_result[^ 1 ].objectPathValueOrFail(" in openSession" )
77
79
doAssert $ result != " "
@@ -83,7 +85,8 @@ proc unlock(bus:Bus, thing:ObjectPath) =
83
85
SERVICE_INTERFACE,
84
86
" Unlock" ,
85
87
)
86
- unlock_msg.append(@ [thing])
88
+ {.gcsafe.}:
89
+ unlock_msg.append(@ [thing])
87
90
let unlock_result = bus.call(unlock_msg)
88
91
doAssert $ (unlock_result[0 ].arrayValue[0 ].objectPathValueOrFail(" in unlock" )) == $ thing
89
92
doAssert $ (unlock_result[1 ].objectPathValueOrFail(" in unlock" )) == " /" # special value indicating no prompt needed
@@ -146,18 +149,21 @@ proc setPassword*(service: string, username: string, password: string) {.gcsafe,
146
149
(SS_PREFIX & " Item.Attributes" ).asDbusValue(),
147
150
newVariant(inner).asDbusValue()
148
151
)
149
- create_msg.append(outer)
152
+ {.gcsafe.}:
153
+ create_msg.append(outer)
150
154
# TODO : this is where in-transit encryption would happen
151
- create_msg.append(
152
- DbusValue(kind: dtStruct, structValues: @ [
153
- session_object_path.asDbusValue(),
154
- " " .toByteArray().asDbusValue(),
155
- password.toByteArray().asDbusValue(),
156
- " text/plain" .asDbusValue(),
157
- ])
158
- )
155
+ {.gcsafe.}:
156
+ create_msg.append(
157
+ DbusValue(kind: dtStruct, structValues: @ [
158
+ session_object_path.asDbusValue(),
159
+ " " .toByteArray().asDbusValue(),
160
+ password.toByteArray().asDbusValue(),
161
+ " text/plain" .asDbusValue(),
162
+ ])
163
+ )
159
164
# create_msg.append(password)
160
- create_msg.append(true )
165
+ {.gcsafe.}:
166
+ create_msg.append(true )
161
167
discard bus.call(create_msg)
162
168
163
169
proc getPassword* (service: string , username: string ): Option[string ] {.gcsafe, raises: [KeyringError, DbusException, ValueError, Exception].} =
@@ -177,7 +183,8 @@ proc getPassword*(service: string, username: string): Option[string] {.gcsafe, r
177
183
" service" : service,
178
184
" username" : username,
179
185
}.toTable()
180
- search_msg.append(attrs)
186
+ {.gcsafe.}:
187
+ search_msg.append(attrs)
181
188
var found_item_path:ObjectPath
182
189
try :
183
190
let search_result = bus.call(search_msg)
@@ -195,7 +202,8 @@ proc getPassword*(service: string, username: string): Option[string] {.gcsafe, r
195
202
ITEM_INTERFACE,
196
203
" GetSecret" ,
197
204
)
198
- get_msg.append(session_object_path)
205
+ {.gcsafe.}:
206
+ get_msg.append(session_object_path)
199
207
try :
200
208
let get_result = bus.call(get_msg)
201
209
let secret = get_result[0 ]
@@ -221,7 +229,8 @@ proc deletePassword*(service: string, username: string) {.gcsafe, raises: [Keyri
221
229
" service" : service,
222
230
" username" : username,
223
231
}.toTable()
224
- search_msg.append(attrs)
232
+ {.gcsafe.}:
233
+ search_msg.append(attrs)
225
234
var found_item_path:ObjectPath
226
235
let search_result = bus.call(search_msg)
227
236
doAssert search_result[0 ].kind == dtArray
0 commit comments