@@ -5,6 +5,9 @@ import { Matter, MtrDex } from '../core/matter.ts';
55import { components } from '../../types/keria-api-schema.ts' ;
66
77type OOBI = components [ 'schemas' ] [ 'OOBI' ] ;
8+ type KeyState = components [ 'schemas' ] [ 'KeyStateRecord' ] ;
9+ type KeyEventRecord = components [ 'schemas' ] [ 'KeyEventRecord' ] ;
10+ type AgentConfig = components [ 'schemas' ] [ 'AgentConfig' ] ;
811
912export function randomPasscode ( ) : string {
1013 const raw = libsodium . randombytes_buf ( 16 ) ;
@@ -48,9 +51,9 @@ export class Oobis {
4851 * @async
4952 * @param {string } oobi The OOBI to be resolver
5053 * @param {string } [alias] Optional name or alias to link the OOBI resolution to a contact
51- * @returns {Promise<any> } A promise to the long-running operation
54+ * @returns {Promise<Operation< any> > } A promise to the long-running operation
5255 */
53- async resolve ( oobi : string , alias ?: string ) : Promise < any > {
56+ async resolve ( oobi : string , alias ?: string ) : Promise < Operation < any > > {
5457 const path = `/oobis` ;
5558 const data : any = {
5659 url : oobi ,
@@ -85,10 +88,6 @@ export interface OperationsDeps {
8588 ) : Promise < Response > ;
8689}
8790
88- export interface AgentConfig {
89- iurls ?: string [ ] ;
90- }
91-
9291/**
9392 * Operations
9493 * @remarks
@@ -208,9 +207,9 @@ export class KeyEvents {
208207 * Retrieve key events for an identifier
209208 * @async
210209 * @param {string } pre Identifier prefix
211- * @returns {Promise<any > } A promise to the key events
210+ * @returns {Promise<KeyEventRecord[] > } A promise to the key events
212211 */
213- async get ( pre : string ) : Promise < any > {
212+ async get ( pre : string ) : Promise < KeyEventRecord [ ] > {
214213 const path = `/events?pre=${ pre } ` ;
215214 const data = null ;
216215 const method = 'GET' ;
@@ -236,9 +235,9 @@ export class KeyStates {
236235 * Retriene the key state for an identifier
237236 * @async
238237 * @param {string } pre Identifier prefix
239- * @returns {Promise<any > } A promise to the key states
238+ * @returns {Promise<KeyState[] > } A promise to the key states
240239 */
241- async get ( pre : string ) : Promise < any > {
240+ async get ( pre : string ) : Promise < KeyState [ ] > {
242241 const path = `/states?pre=${ pre } ` ;
243242 const data = null ;
244243 const method = 'GET' ;
@@ -252,7 +251,7 @@ export class KeyStates {
252251 * @param {Array<string> } pres List of identifier prefixes
253252 * @returns {Promise<any> } A promise to the key states
254253 */
255- async list ( pres : string [ ] ) : Promise < any > {
254+ async list ( pres : string [ ] ) : Promise < KeyState [ ] > {
256255 const path = `/states?${ pres . map ( ( pre ) => `pre=${ pre } ` ) . join ( '&' ) } ` ;
257256 const data = null ;
258257 const method = 'GET' ;
@@ -266,9 +265,9 @@ export class KeyStates {
266265 * @param {string } pre Identifier prefix
267266 * @param {number } [sn] Optional sequence number
268267 * @param {any } [anchor] Optional anchor
269- * @returns {Promise<any> } A promise to the long-running operation
268+ * @returns {Promise<Operation< any> > } A promise to the long-running operation
270269 */
271- async query ( pre : string , sn ?: string , anchor ?: any ) : Promise < any > {
270+ async query ( pre : string , sn ?: string , anchor ?: any ) : Promise < Operation < any > > {
272271 const path = `/queries` ;
273272 const data : any = {
274273 pre : pre ,
0 commit comments