2828import java .security .DigestException ;
2929import java .util .*;
3030import java .util .concurrent .ExecutionException ;
31+ import org .cardanofoundation .signify .generated .keria .model .Identifier ;
32+ import org .cardanofoundation .signify .generated .keria .model .KeyStateRecord ;
3133
3234import static org .cardanofoundation .signify .cesr .util .CoreUtil .Versionage ;
3335import static org .cardanofoundation .signify .core .Httping .parseRangeHeaders ;
3436
35- public class Identifier {
37+ public class IdentifierController {
3638 public final IdentifierDeps client ;
3739
3840 /**
3941 * Identifier
4042 *
4143 * @param client the client dependencies
4244 */
43- public Identifier (IdentifierDeps client ) {
45+ public IdentifierController (IdentifierDeps client ) {
4446 this .client = client ;
4547 }
4648
@@ -69,7 +71,7 @@ public IdentifierListResponse list(Integer start, Integer end) throws Interrupte
6971 range .start (),
7072 range .end (),
7173 range .total (),
72- Arrays .asList (GeneratedModelMapper . read (response .body (), org . cardanofoundation . signify . generated . keria . model . Identifier [].class ))
74+ Arrays .asList (Utils . fromJson (response .body (), Identifier [].class ))
7375 );
7476 }
7577
@@ -87,7 +89,7 @@ public IdentifierListResponse list(Integer start) throws IOException, Interrupte
8789 * @param name Prefix or alias of the identifier
8890 * @return An Optional containing the HabState if found, or empty if not found
8991 */
90- public Optional <States . HabState > get (String name ) throws InterruptedException , IOException , LibsodiumException {
92+ public Optional <Identifier > get (String name ) throws InterruptedException , IOException , LibsodiumException {
9193 final String path = "/identifiers/" + URI .create (name ).toASCIIString ();
9294 final String method = "GET" ;
9395
@@ -97,7 +99,7 @@ public Optional<States.HabState> get(String name) throws InterruptedException, I
9799 return Optional .empty ();
98100 }
99101
100- return Optional .of (Utils .fromJson (response .body (), States . HabState .class ));
102+ return Optional .of (Utils .fromJson (response .body (), Identifier .class ));
101103 }
102104
103105 /**
@@ -107,7 +109,7 @@ public Optional<States.HabState> get(String name) throws InterruptedException, I
107109 * @param info Information to update for the given identifier
108110 * @return A HabState to the identifier information after updating
109111 */
110- public States . HabState update (String name , IdentifierInfo info ) throws InterruptedException , IOException , LibsodiumException {
112+ public Identifier update (String name , IdentifierInfo info ) throws InterruptedException , IOException , LibsodiumException {
111113 final String path = "/identifiers/" + name ;
112114 final String method = "PUT" ;
113115
@@ -116,7 +118,7 @@ public States.HabState update(String name, IdentifierInfo info) throws Interrupt
116118 method ,
117119 IdentifierPayloadMapper .buildUpdateNamePayload (info .getName ())
118120 );
119- return GeneratedModelMapper . read (response .body (), States . HabState .class );
121+ return Utils . fromJson (response .body (), Identifier .class );
120122 }
121123
122124 /**
@@ -289,7 +291,7 @@ public EventResult create(String name, CreateIdentifierArgs kargs) throws Interr
289291 * @throws LibsodiumException if there is an error in the cryptographic operations
290292 */
291293 public EventResult addEndRole (String name , String role , String eid , String stamp ) throws InterruptedException , DigestException , IOException , LibsodiumException {
292- States . HabState hab = this .get (name )
294+ Identifier hab = this .get (name )
293295 .orElseThrow (() -> new IllegalArgumentException ("Identifier not found: " + name ));
294296 String pre = hab .getPrefix ();
295297
@@ -340,11 +342,11 @@ public EventResult interact(String name, Object data) throws InterruptedExceptio
340342 }
341343
342344 public InteractionResponse createInteract (String name , Object data ) throws InterruptedException , DigestException , IOException , LibsodiumException {
343- States . HabState hab = this .get (name )
345+ Identifier hab = this .get (name )
344346 .orElseThrow (() -> new IllegalArgumentException ("Identifier not found: " + name ));
345347 String pre = hab .getPrefix ();
346348
347- States . State state = hab .getState ();
349+ KeyStateRecord state = hab .getState ();
348350 int sn = Integer .parseInt (state .getS (), 16 );
349351 String dig = state .getD ();
350352
@@ -379,12 +381,12 @@ public EventResult rotate(String name, RotateIdentifierArgs kargs) throws Interr
379381 String ncode = kargs .getNcode () != null ? kargs .getNcode () : MatterCodex .Ed25519_Seed .getValue ();
380382 int ncount = kargs .getNcount () != null ? kargs .getNcount () : 1 ;
381383
382- States . HabState hab = this .get (name )
384+ Identifier hab = this .get (name )
383385 .orElseThrow (() -> new IllegalArgumentException ("Identifier not found: " + name ));
384386 String pre = hab .getPrefix ();
385387 boolean delegated = !hab .getState ().getDi ().isEmpty ();
386388
387- States . State state = hab .getState ();
389+ KeyStateRecord state = hab .getState ();
388390 int count = state .getK ().size ();
389391 String dig = state .getD ();
390392 int ridx = Integer .parseInt (state .getS (), 16 ) + 1 ;
@@ -410,8 +412,8 @@ public EventResult rotate(String name, RotateIdentifierArgs kargs) throws Interr
410412 // Create new keys for next digests
411413 List <String > ncodes = kargs .getNcodes () != null ? kargs .getNcodes () : Collections .nCopies (ncount , ncode );
412414
413- List <States . State > states = kargs .getStates () == null ? new ArrayList <>() : kargs .getStates ();
414- List <States . State > rstates = kargs .getStates () == null ? new ArrayList <>() : kargs .getRstates ();
415+ List <KeyStateRecord > states = kargs .getStates () == null ? new ArrayList <>() : kargs .getStates ();
416+ List <KeyStateRecord > rstates = kargs .getStates () == null ? new ArrayList <>() : kargs .getRstates ();
415417 KeeperResult keeperResult = keeper .rotate (
416418 ncodes ,
417419 transferable ,
@@ -449,8 +451,8 @@ public EventResult rotate(String name, RotateIdentifierArgs kargs) throws Interr
449451 Map <String , Object > jsondata = new LinkedHashMap <>();
450452 jsondata .put ("rot" , serder .getKed ());
451453 jsondata .put ("sigs" , sigs );
452- jsondata .put ("smids" , !states .isEmpty () ? states .stream ().map (States . State ::getI ).toList () : null );
453- jsondata .put ("rmids" , !rstates .isEmpty () ? rstates .stream ().map (States . State ::getI ).toList () : null );
454+ jsondata .put ("smids" , !states .isEmpty () ? states .stream ().map (KeyStateRecord ::getI ).toList () : null );
455+ jsondata .put ("rmids" , !rstates .isEmpty () ? rstates .stream ().map (KeyStateRecord ::getI ).toList () : null );
454456 jsondata .put (keeper .getAlgo ().toString (), keeper .getParams ().toMap ());
455457
456458 HttpResponse <String > res = this .client .fetch (
0 commit comments