Skip to content

Commit b8ec0cd

Browse files
committed
Digitwin refactor dev iteration
- simplify hiveoview session management - introduce 'cid' connectionIDs to manage multiple connections from the same device. (eg, browser tabs) - switch to Paseto tokens for authentication.
1 parent 446effd commit b8ec0cd

File tree

114 files changed

+2006
-2716
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+2006
-2716
lines changed

api/go/authn/authnAdmin.go

+29-29
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Package authn with types and interfaces for using this service with agent 'authn'
22
// DO NOT EDIT. This file is auto generated by tdd2api. Any changes will be overwritten.
3-
// Generated 28 Oct 24 14:22 PDT.
3+
// Generated 31 Oct 24 09:59 PDT.
44
package authn
55

66
import "errors"
@@ -22,17 +22,17 @@ const AdminDThingID = "dtw:authn:admin"
2222
// Thing names
2323
const (
2424
AdminPropNrClients = "nrClients"
25-
AdminEventAdded = "added"
2625
AdminEventRemoved = "removed"
27-
AdminActionGetClientProfile = "getClientProfile"
28-
AdminActionGetProfiles = "getProfiles"
29-
AdminActionRemoveClient = "removeClient"
30-
AdminActionSetClientPassword = "setClientPassword"
26+
AdminEventAdded = "added"
3127
AdminActionAddAgent = "addAgent"
3228
AdminActionAddConsumer = "addConsumer"
3329
AdminActionAddService = "addService"
34-
AdminActionNewAgentToken = "newAgentToken"
30+
AdminActionGetClientProfile = "getClientProfile"
31+
AdminActionGetProfiles = "getProfiles"
32+
AdminActionRemoveClient = "removeClient"
3533
AdminActionUpdateClientProfile = "updateClientProfile"
34+
AdminActionNewAgentToken = "newAgentToken"
35+
AdminActionSetClientPassword = "setClientPassword"
3636
)
3737

3838
//--- Argument and Response struct for action of Thing 'dtw:authn:admin' ---
@@ -239,15 +239,6 @@ func NewHandleAdminAction(svc IAdminService) func(consumerID, dThingID, name str
239239
var status = vocab.ProgressStatusCompleted
240240
var output any
241241
switch actionName {
242-
case "addAgent":
243-
args := AdminAddAgentArgs{}
244-
err = utils.DecodeAsObject(input, &args)
245-
if err == nil {
246-
output, err = svc.AddAgent(consumerID, args)
247-
} else {
248-
err = errors.New("bad function argument: " + err.Error())
249-
}
250-
break
251242
case "addConsumer":
252243
args := AdminAddConsumerArgs{}
253244
err = utils.DecodeAsObject(input, &args)
@@ -266,45 +257,45 @@ func NewHandleAdminAction(svc IAdminService) func(consumerID, dThingID, name str
266257
err = errors.New("bad function argument: " + err.Error())
267258
}
268259
break
269-
case "newAgentToken":
260+
case "getClientProfile":
270261
var args string
271262
err = utils.DecodeAsObject(input, &args)
272263
if err == nil {
273-
output, err = svc.NewAgentToken(consumerID, args)
264+
output, err = svc.GetClientProfile(consumerID, args)
274265
} else {
275266
err = errors.New("bad function argument: " + err.Error())
276267
}
277268
break
278-
case "updateClientProfile":
279-
var args ClientProfile
280-
err = utils.DecodeAsObject(input, &args)
269+
case "getProfiles":
281270
if err == nil {
282-
err = svc.UpdateClientProfile(consumerID, args)
271+
output, err = svc.GetProfiles(consumerID)
283272
} else {
284273
err = errors.New("bad function argument: " + err.Error())
285274
}
286275
break
287-
case "getClientProfile":
276+
case "removeClient":
288277
var args string
289278
err = utils.DecodeAsObject(input, &args)
290279
if err == nil {
291-
output, err = svc.GetClientProfile(consumerID, args)
280+
err = svc.RemoveClient(consumerID, args)
292281
} else {
293282
err = errors.New("bad function argument: " + err.Error())
294283
}
295284
break
296-
case "getProfiles":
285+
case "updateClientProfile":
286+
var args ClientProfile
287+
err = utils.DecodeAsObject(input, &args)
297288
if err == nil {
298-
output, err = svc.GetProfiles(consumerID)
289+
err = svc.UpdateClientProfile(consumerID, args)
299290
} else {
300291
err = errors.New("bad function argument: " + err.Error())
301292
}
302293
break
303-
case "removeClient":
304-
var args string
294+
case "addAgent":
295+
args := AdminAddAgentArgs{}
305296
err = utils.DecodeAsObject(input, &args)
306297
if err == nil {
307-
err = svc.RemoveClient(consumerID, args)
298+
output, err = svc.AddAgent(consumerID, args)
308299
} else {
309300
err = errors.New("bad function argument: " + err.Error())
310301
}
@@ -318,6 +309,15 @@ func NewHandleAdminAction(svc IAdminService) func(consumerID, dThingID, name str
318309
err = errors.New("bad function argument: " + err.Error())
319310
}
320311
break
312+
case "newAgentToken":
313+
var args string
314+
err = utils.DecodeAsObject(input, &args)
315+
if err == nil {
316+
output, err = svc.NewAgentToken(consumerID, args)
317+
} else {
318+
err = errors.New("bad function argument: " + err.Error())
319+
}
320+
break
321321
default:
322322
err = errors.New("Unknown Method '" + actionName + "' of service '" + dThingID + "'")
323323
status = vocab.ProgressStatusFailed

api/go/authn/authnUser.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Package authn with types and interfaces for using this service with agent 'authn'
22
// DO NOT EDIT. This file is auto generated by tdd2api. Any changes will be overwritten.
3-
// Generated 28 Oct 24 14:22 PDT.
3+
// Generated 31 Oct 24 09:59 PDT.
44
package authn
55

66
import "errors"
@@ -21,13 +21,13 @@ const UserDThingID = "dtw:authn:user"
2121

2222
// Thing names
2323
const (
24+
UserActionRefreshToken = "refreshToken"
25+
UserActionUpdateName = "updateName"
26+
UserActionUpdatePassword = "updatePassword"
2427
UserActionUpdatePubKey = "updatePubKey"
2528
UserActionGetProfile = "getProfile"
2629
UserActionLogin = "login"
2730
UserActionLogout = "logout"
28-
UserActionRefreshToken = "refreshToken"
29-
UserActionUpdateName = "updateName"
30-
UserActionUpdatePassword = "updatePassword"
3131
)
3232

3333
//--- Schema definitions of Thing 'dtw:authn:user' ---

api/go/authz/authzAdmin.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Package authz with types and interfaces for using this service with agent 'authz'
22
// DO NOT EDIT. This file is auto generated by tdd2api. Any changes will be overwritten.
3-
// Generated 28 Oct 24 14:22 PDT.
3+
// Generated 31 Oct 24 09:59 PDT.
44
package authz
55

66
import "errors"
@@ -85,20 +85,20 @@ func NewHandleAdminAction(svc IAdminService) func(consumerID, dThingID, name str
8585
var status = vocab.ProgressStatusCompleted
8686
var output any
8787
switch actionName {
88-
case "setClientRole":
89-
args := AdminSetClientRoleArgs{}
88+
case "getClientRole":
89+
var args string
9090
err = utils.DecodeAsObject(input, &args)
9191
if err == nil {
92-
err = svc.SetClientRole(consumerID, args)
92+
output, err = svc.GetClientRole(consumerID, args)
9393
} else {
9494
err = errors.New("bad function argument: " + err.Error())
9595
}
9696
break
97-
case "getClientRole":
98-
var args string
97+
case "setClientRole":
98+
args := AdminSetClientRoleArgs{}
9999
err = utils.DecodeAsObject(input, &args)
100100
if err == nil {
101-
output, err = svc.GetClientRole(consumerID, args)
101+
err = svc.SetClientRole(consumerID, args)
102102
} else {
103103
err = errors.New("bad function argument: " + err.Error())
104104
}

api/go/authz/authzUser.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Package authz with types and interfaces for using this service with agent 'authz'
22
// DO NOT EDIT. This file is auto generated by tdd2api. Any changes will be overwritten.
3-
// Generated 28 Oct 24 14:22 PDT.
3+
// Generated 31 Oct 24 09:59 PDT.
44
package authz
55

66
import "errors"

api/go/digitwin/digitwinDirectory.go

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Package digitwin with types and interfaces for using this service with agent 'digitwin'
22
// DO NOT EDIT. This file is auto generated by tdd2api. Any changes will be overwritten.
3-
// Generated 28 Oct 24 14:22 PDT.
3+
// Generated 31 Oct 24 09:59 PDT.
44
package digitwin
55

66
import "errors"
@@ -122,38 +122,38 @@ func NewHandleDirectoryAction(svc IDirectoryService) func(consumerID, dThingID,
122122
var status = vocab.ProgressStatusCompleted
123123
var output any
124124
switch actionName {
125-
case "readTD":
125+
case "removeTD":
126126
var args string
127127
err = utils.DecodeAsObject(input, &args)
128128
if err == nil {
129-
output, err = svc.ReadTD(consumerID, args)
129+
err = svc.RemoveTD(consumerID, args)
130130
} else {
131131
err = errors.New("bad function argument: " + err.Error())
132132
}
133133
break
134-
case "readAllTDs":
135-
args := DirectoryReadAllTDsArgs{}
134+
case "updateTD":
135+
var args string
136136
err = utils.DecodeAsObject(input, &args)
137137
if err == nil {
138-
output, err = svc.ReadAllTDs(consumerID, args)
138+
err = svc.UpdateTD(consumerID, args)
139139
} else {
140140
err = errors.New("bad function argument: " + err.Error())
141141
}
142142
break
143-
case "removeTD":
143+
case "readTD":
144144
var args string
145145
err = utils.DecodeAsObject(input, &args)
146146
if err == nil {
147-
err = svc.RemoveTD(consumerID, args)
147+
output, err = svc.ReadTD(consumerID, args)
148148
} else {
149149
err = errors.New("bad function argument: " + err.Error())
150150
}
151151
break
152-
case "updateTD":
153-
var args string
152+
case "readAllTDs":
153+
args := DirectoryReadAllTDsArgs{}
154154
err = utils.DecodeAsObject(input, &args)
155155
if err == nil {
156-
err = svc.UpdateTD(consumerID, args)
156+
output, err = svc.ReadAllTDs(consumerID, args)
157157
} else {
158158
err = errors.New("bad function argument: " + err.Error())
159159
}

api/go/digitwin/digitwinValues.go

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Package digitwin with types and interfaces for using this service with agent 'digitwin'
22
// DO NOT EDIT. This file is auto generated by tdd2api. Any changes will be overwritten.
3-
// Generated 28 Oct 24 14:22 PDT.
3+
// Generated 31 Oct 24 09:59 PDT.
44
package digitwin
55

66
import "errors"
@@ -22,12 +22,12 @@ const ValuesDThingID = "dtw:digitwin:values"
2222
// Thing names
2323
const (
2424
ValuesEventProgress = "progress"
25+
ValuesActionReadAllEvents = "readAllEvents"
2526
ValuesActionReadAllProperties = "readAllProperties"
2627
ValuesActionReadEvent = "readEvent"
2728
ValuesActionReadProperty = "readProperty"
2829
ValuesActionQueryAction = "queryAction"
2930
ValuesActionQueryAllActions = "queryAllActions"
30-
ValuesActionReadAllEvents = "readAllEvents"
3131
)
3232

3333
//--- Schema definitions of Thing 'dtw:digitwin:values' ---
@@ -253,6 +253,15 @@ func NewHandleValuesAction(svc IValuesService) func(consumerID, dThingID, name s
253253
var status = vocab.ProgressStatusCompleted
254254
var output any
255255
switch actionName {
256+
case "queryAction":
257+
args := ValuesQueryActionArgs{}
258+
err = utils.DecodeAsObject(input, &args)
259+
if err == nil {
260+
output, err = svc.QueryAction(consumerID, args)
261+
} else {
262+
err = errors.New("bad function argument: " + err.Error())
263+
}
264+
break
256265
case "queryAllActions":
257266
var args string
258267
err = utils.DecodeAsObject(input, &args)
@@ -298,15 +307,6 @@ func NewHandleValuesAction(svc IValuesService) func(consumerID, dThingID, name s
298307
err = errors.New("bad function argument: " + err.Error())
299308
}
300309
break
301-
case "queryAction":
302-
args := ValuesQueryActionArgs{}
303-
err = utils.DecodeAsObject(input, &args)
304-
if err == nil {
305-
output, err = svc.QueryAction(consumerID, args)
306-
} else {
307-
err = errors.New("bad function argument: " + err.Error())
308-
}
309-
break
310310
default:
311311
err = errors.New("Unknown Method '" + actionName + "' of service '" + dThingID + "'")
312312
status = vocab.ProgressStatusFailed

0 commit comments

Comments
 (0)