@@ -73,6 +73,7 @@ export async function registerHttpRoutes(
7373 type : "object" ,
7474 properties : {
7575 w3id : { type : "string" } ,
76+ evaultId : { type : [ "string" , "null" ] } ,
7677 keyBindingCertificates : {
7778 type : "array" ,
7879 items : { type : "string" } ,
@@ -114,15 +115,19 @@ export async function registerHttpRoutes(
114115
115116 // Generate key binding certificates for each public key
116117 const keyBindingCertificates : string [ ] = [ ] ;
117- const registryUrl = process . env . PUBLIC_REGISTRY_URL || process . env . REGISTRY_URL ;
118+ const registryUrl =
119+ process . env . PUBLIC_REGISTRY_URL || process . env . REGISTRY_URL ;
118120 const sharedSecret = process . env . REGISTRY_SHARED_SECRET ;
119121
120122 if ( registryUrl && sharedSecret && publicKeys . length > 0 ) {
121123 try {
122124 for ( const publicKey of publicKeys ) {
123125 try {
124126 const response = await axios . post (
125- new URL ( "/key-binding-certificate" , registryUrl ) . toString ( ) ,
127+ new URL (
128+ "/key-binding-certificate" ,
129+ registryUrl ,
130+ ) . toString ( ) ,
126131 {
127132 ename : eName ,
128133 publicKey : publicKey ,
@@ -132,10 +137,12 @@ export async function registerHttpRoutes(
132137 Authorization : `Bearer ${ sharedSecret } ` ,
133138 } ,
134139 timeout : 10000 ,
135- }
140+ } ,
136141 ) ;
137142 if ( response . data ?. token ) {
138- keyBindingCertificates . push ( response . data . token ) ;
143+ keyBindingCertificates . push (
144+ response . data . token ,
145+ ) ;
139146 }
140147 } catch ( error ) {
141148 console . error (
@@ -154,8 +161,44 @@ export async function registerHttpRoutes(
154161 }
155162 }
156163
164+ // Resolve eName via Registry (same logic as /resolve) to get evault id
165+ let evaultId : string | null = null ;
166+ const registryUrlForResolve =
167+ process . env . PUBLIC_REGISTRY_URL || process . env . REGISTRY_URL ;
168+ if ( registryUrlForResolve ) {
169+ try {
170+ const resolveResponse = await axios . get < {
171+ ename : string ;
172+ uri : string ;
173+ evault : string ;
174+ originalUri ?: string ;
175+ resolved ?: boolean ;
176+ } > (
177+ new URL (
178+ `/resolve?w3id=${ encodeURIComponent ( eName ) } ` ,
179+ registryUrlForResolve ,
180+ ) . toString ( ) ,
181+ { timeout : 10000 } ,
182+ ) ;
183+ if ( resolveResponse . data ?. evault ) {
184+ evaultId = resolveResponse . data . evault ;
185+ }
186+ } catch ( error ) {
187+ // 404 or network error: evault not registered for this eName, or registry unavailable
188+ if (
189+ axios . isAxiosError ( error ) &&
190+ error . response ?. status !== 404
191+ ) {
192+ console . error (
193+ "Error resolving eName via Registry for whois evaultId:" ,
194+ error . message ,
195+ ) ;
196+ }
197+ }
198+ }
157199 const result = {
158200 w3id : eName ,
201+ evaultId,
159202 keyBindingCertificates : keyBindingCertificates ,
160203 } ;
161204 return result ;
@@ -182,8 +225,14 @@ export async function registerHttpRoutes(
182225 querystring : {
183226 type : "object" ,
184227 properties : {
185- limit : { type : "string" , description : "Page size (default 20, max 100)" } ,
186- cursor : { type : "string" , description : "Opaque cursor for next page" } ,
228+ limit : {
229+ type : "string" ,
230+ description : "Page size (default 20, max 100)" ,
231+ } ,
232+ cursor : {
233+ type : "string" ,
234+ description : "Opaque cursor for next page" ,
235+ } ,
187236 } ,
188237 } ,
189238 response : {
@@ -243,14 +292,17 @@ export async function registerHttpRoutes(
243292
244293 try {
245294 const limit = Math . min (
246- Math . max ( 1 , parseInt ( request . query . limit || "20" , 10 ) || 20 ) ,
295+ Math . max (
296+ 1 ,
297+ Number . parseInt ( request . query . limit || "20" , 10 ) || 20 ,
298+ ) ,
247299 100 ,
248300 ) ;
249301 const cursor = request . query . cursor ?? null ;
250- const result = await dbService . getEnvelopeOperationLogs (
251- eName ,
252- { limit , cursor } ,
253- ) ;
302+ const result = await dbService . getEnvelopeOperationLogs ( eName , {
303+ limit ,
304+ cursor,
305+ } ) ;
254306 return {
255307 logs : result . logs ,
256308 nextCursor : result . nextCursor ,
0 commit comments