From bcf7b8b6450219b4ebd5abf12267d4632a285104 Mon Sep 17 00:00:00 2001 From: Rodolfo Miranda Date: Sat, 30 Mar 2024 00:52:21 -0300 Subject: [PATCH 01/15] rename and delete aid --- examples/integration-scripts/salty.test.ts | 9 +++++ src/keri/app/aiding.ts | 38 +++++++++++++++++++--- 2 files changed, 43 insertions(+), 4 deletions(-) diff --git a/examples/integration-scripts/salty.test.ts b/examples/integration-scripts/salty.test.ts index 95b88d19..115afe9f 100644 --- a/examples/integration-scripts/salty.test.ts +++ b/examples/integration-scripts/salty.test.ts @@ -166,6 +166,15 @@ test('salty', async () => { assert.equal(serder.pre, ixn.pre); assert.equal(serder.ked['d'], ixn.ked['d']); + const renameResult = await client1 + .identifiers() + .rename('aid1', 'aidRenamed'); + assert.equal(renameResult.name, 'aidRenamed'); + aids = await client1.identifiers().list(); + console.log('aids', aids); + aid = aids.aids.pop(); + assert.equal(aid.name, 'aidRenamed'); + await assertOperations(client1); console.log('Salty test passed'); diff --git a/src/keri/app/aiding.ts b/src/keri/app/aiding.ts index c0bad4d1..cea0c8a5 100644 --- a/src/keri/app/aiding.ts +++ b/src/keri/app/aiding.ts @@ -119,6 +119,36 @@ export class Identifier { return await res.json(); } + /** + * Get information for a managed identifier + * @async + * @param {string} name Name or alias of the identifier + * @param {string} newName New name or alias of the identifier + * @returns {Promise} A promise to the identifier information + */ + async rename(name: string, newName: string): Promise { + const path = `/identifiers/${name}`; + const data = { name: newName }; + const method = 'PUT'; + const res = await this.client.fetch(path, method, data); + console.log(res.status); + return res.json(); + } + + /** + * Delete a managed identifier + * @async + * @param {string} name Name or alias of the identifier + * @returns {Promise} A promise to the identifier information + */ + async delete(name: string): Promise { + const path = `/identifiers/${name}`; + const method = 'DELETE'; + const res = await this.client.fetch(path, method, null); + console.log(res.status); + return; + } + /** * Create a managed identifier * @async @@ -277,8 +307,8 @@ export class Identifier { jsondata[keeper.algo] = keeper.params(); const res = await this.client.fetch( - '/identifiers/' + name + '?type=ixn', - 'PUT', + '/identifiers/' + name + '/events', + 'POST', jsondata ); return new EventResult(serder, sigs, res); @@ -375,8 +405,8 @@ export class Identifier { jsondata[keeper.algo] = keeper.params(); const res = await this.client.fetch( - '/identifiers/' + name, - 'PUT', + '/identifiers/' + name + '/events', + 'POST', jsondata ); return new EventResult(serder, sigs, res); From 844a45d7d9408be86f03e678a140e699ef8a3eb7 Mon Sep 17 00:00:00 2001 From: Rodolfo Miranda Date: Sat, 30 Mar 2024 08:50:31 -0300 Subject: [PATCH 02/15] fix tests --- test/app/aiding.test.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/app/aiding.test.ts b/test/app/aiding.test.ts index 898ce65d..3328a76c 100644 --- a/test/app/aiding.test.ts +++ b/test/app/aiding.test.ts @@ -160,8 +160,8 @@ describe('Aiding', () => { await client.identifiers().rotate('aid1'); const lastCall = client.getLastMockRequest(); - assert.equal(lastCall.path, '/identifiers/aid1'); - assert.equal(lastCall.method, 'PUT'); + assert.equal(lastCall.path, '/identifiers/aid1/events'); + assert.equal(lastCall.method, 'POST'); assert.deepEqual(lastCall.body.rot, { v: 'KERI10JSON000160_', t: 'rot', @@ -206,8 +206,8 @@ describe('Aiding', () => { await client.identifiers().rotate('aid1'); const lastCall = client.getLastMockRequest(); - assert.equal(lastCall.path, '/identifiers/aid1'); - assert.equal(lastCall.method, 'PUT'); + assert.equal(lastCall.path, '/identifiers/aid1/events'); + assert.equal(lastCall.method, 'POST'); expect(lastCall.body.rot).toMatchObject({ v: 'KERI10JSON000160_', t: 'rot', @@ -232,8 +232,8 @@ describe('Aiding', () => { const lastCall = client.getLastMockRequest(); - expect(lastCall.path).toEqual('/identifiers/aid1?type=ixn'); - expect(lastCall.method).toEqual('PUT'); + expect(lastCall.path).toEqual('/identifiers/aid1/events'); + expect(lastCall.method).toEqual('POST'); expect(lastCall.body.ixn).toMatchObject({ v: 'KERI10JSON000138_', t: 'ixn', @@ -274,8 +274,8 @@ describe('Aiding', () => { const lastCall = client.getLastMockRequest(); - expect(lastCall.path).toEqual('/identifiers/aid1?type=ixn'); - expect(lastCall.method).toEqual('PUT'); + expect(lastCall.path).toEqual('/identifiers/aid1/events'); + expect(lastCall.method).toEqual('POST'); expect(lastCall.body.ixn).toMatchObject({ s: 'b', a: data, From f492dba81fbe8ec85aff5e3587cf02e22aefeff1 Mon Sep 17 00:00:00 2001 From: Rodolfo Miranda Date: Sat, 30 Mar 2024 09:08:23 -0300 Subject: [PATCH 03/15] integration tests --- examples/integration-scripts/salty.test.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/examples/integration-scripts/salty.test.ts b/examples/integration-scripts/salty.test.ts index 115afe9f..731c9107 100644 --- a/examples/integration-scripts/salty.test.ts +++ b/examples/integration-scripts/salty.test.ts @@ -171,10 +171,18 @@ test('salty', async () => { .rename('aid1', 'aidRenamed'); assert.equal(renameResult.name, 'aidRenamed'); aids = await client1.identifiers().list(); - console.log('aids', aids); + assert.equal(aids.aids.length, 3); aid = aids.aids.pop(); assert.equal(aid.name, 'aidRenamed'); + await client1 + .identifiers() + .delete('aidRenamed'); + aids = await client1.identifiers().list(); + assert.equal(aids.aids.length, 2); + aid = aids.aids.pop(); + assert.equal(aid.name, 'aid3'); + await assertOperations(client1); console.log('Salty test passed'); From efda9784e074983c909a29443bbc561ea3b0b628 Mon Sep 17 00:00:00 2001 From: Rodolfo Miranda Date: Sat, 30 Mar 2024 09:27:31 -0300 Subject: [PATCH 04/15] add tests --- test/app/aiding.test.ts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/test/app/aiding.test.ts b/test/app/aiding.test.ts index 3328a76c..26224c1a 100644 --- a/test/app/aiding.test.ts +++ b/test/app/aiding.test.ts @@ -431,4 +431,32 @@ describe('Aiding', () => { args !== null; // avoids TS6133 }); }); + + it('Can rename salty identifier', async () => { + const aid1 = await createMockIdentifierState('aid1', bran, {}); + client.fetch.mockResolvedValueOnce(Response.json(aid1)); + client.fetch.mockResolvedValueOnce(Response.json({})); + + const aidRenamed = await client.identifiers().rename('aid1','aidRenamed'); + client.fetch.mockResolvedValueOnce(Response.json(aidRenamed)); + client.fetch.mockResolvedValueOnce(Response.json({})); + const lastCall = client.getLastMockRequest(); + assert.equal(lastCall.path, '/identifiers/aid1'); + assert.equal(lastCall.method, 'PUT'); + assert.deepEqual(lastCall.body, { + name: 'aidRenamed', + }); + }); + + it('Can delete salty identifier', async () => { + const aid1 = await createMockIdentifierState('aid1', bran, {}); + client.fetch.mockResolvedValueOnce(Response.json(aid1)); + client.fetch.mockResolvedValueOnce(Response.json({})); + + await client.identifiers().delete('aid1'); + client.fetch.mockResolvedValueOnce(Response.json({})); + const lastCall = client.getLastMockRequest(); + assert.equal(lastCall.path, '/identifiers/aid1'); + assert.equal(lastCall.method, 'DELETE'); + }); }); From 79513d1acb83ded4a73f29b5b4314b10cad48162 Mon Sep 17 00:00:00 2001 From: Rodolfo Miranda Date: Sat, 30 Mar 2024 09:28:56 -0300 Subject: [PATCH 05/15] prettier --- examples/integration-scripts/salty.test.ts | 4 +--- test/app/aiding.test.ts | 4 +++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/integration-scripts/salty.test.ts b/examples/integration-scripts/salty.test.ts index 731c9107..25027bf1 100644 --- a/examples/integration-scripts/salty.test.ts +++ b/examples/integration-scripts/salty.test.ts @@ -175,9 +175,7 @@ test('salty', async () => { aid = aids.aids.pop(); assert.equal(aid.name, 'aidRenamed'); - await client1 - .identifiers() - .delete('aidRenamed'); + await client1.identifiers().delete('aidRenamed'); aids = await client1.identifiers().list(); assert.equal(aids.aids.length, 2); aid = aids.aids.pop(); diff --git a/test/app/aiding.test.ts b/test/app/aiding.test.ts index 26224c1a..fecff27d 100644 --- a/test/app/aiding.test.ts +++ b/test/app/aiding.test.ts @@ -437,7 +437,9 @@ describe('Aiding', () => { client.fetch.mockResolvedValueOnce(Response.json(aid1)); client.fetch.mockResolvedValueOnce(Response.json({})); - const aidRenamed = await client.identifiers().rename('aid1','aidRenamed'); + const aidRenamed = await client + .identifiers() + .rename('aid1', 'aidRenamed'); client.fetch.mockResolvedValueOnce(Response.json(aidRenamed)); client.fetch.mockResolvedValueOnce(Response.json({})); const lastCall = client.getLastMockRequest(); From 7e333b41e1b5c5680ebb36843f64ca9b915cb49f Mon Sep 17 00:00:00 2001 From: Rodolfo Miranda Date: Sat, 6 Apr 2024 01:15:05 -0300 Subject: [PATCH 06/15] remove log --- src/keri/app/aiding.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/keri/app/aiding.ts b/src/keri/app/aiding.ts index cea0c8a5..df879b13 100644 --- a/src/keri/app/aiding.ts +++ b/src/keri/app/aiding.ts @@ -131,7 +131,6 @@ export class Identifier { const data = { name: newName }; const method = 'PUT'; const res = await this.client.fetch(path, method, data); - console.log(res.status); return res.json(); } @@ -144,8 +143,7 @@ export class Identifier { async delete(name: string): Promise { const path = `/identifiers/${name}`; const method = 'DELETE'; - const res = await this.client.fetch(path, method, null); - console.log(res.status); + await this.client.fetch(path, method, null); return; } From cd945c78b8b41d31f24a3b87ec9d982f2f273e59 Mon Sep 17 00:00:00 2001 From: Rodolfo Miranda Date: Wed, 10 Apr 2024 22:42:22 -0300 Subject: [PATCH 07/15] fix smids as states --- src/keri/app/aiding.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/keri/app/aiding.ts b/src/keri/app/aiding.ts index df879b13..7a07115d 100644 --- a/src/keri/app/aiding.ts +++ b/src/keri/app/aiding.ts @@ -254,14 +254,8 @@ export class Identifier { icp: serder.ked, sigs: sigs, proxy: proxy, - smids: - states != undefined - ? states.map((state) => state.i) - : undefined, - rmids: - rstates != undefined - ? rstates.map((state) => state.i) - : undefined, + smids: states, + rmids: states }; jsondata[algo] = keeper.params(); From 28967d4d356307ff334a53a12f115aab99eb9e44 Mon Sep 17 00:00:00 2001 From: Rodolfo Miranda Date: Wed, 10 Apr 2024 22:44:17 -0300 Subject: [PATCH 08/15] pretty --- src/keri/app/aiding.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/keri/app/aiding.ts b/src/keri/app/aiding.ts index 7a07115d..452e4280 100644 --- a/src/keri/app/aiding.ts +++ b/src/keri/app/aiding.ts @@ -255,7 +255,7 @@ export class Identifier { sigs: sigs, proxy: proxy, smids: states, - rmids: states + rmids: states, }; jsondata[algo] = keeper.params(); From f4697afa5dc460fdf12708581b73be15d9e5f92b Mon Sep 17 00:00:00 2001 From: Rodolfo Miranda Date: Thu, 11 Apr 2024 15:53:32 -0300 Subject: [PATCH 09/15] add url encoding --- src/keri/app/aiding.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/keri/app/aiding.ts b/src/keri/app/aiding.ts index 452e4280..5112e2a2 100644 --- a/src/keri/app/aiding.ts +++ b/src/keri/app/aiding.ts @@ -127,7 +127,7 @@ export class Identifier { * @returns {Promise} A promise to the identifier information */ async rename(name: string, newName: string): Promise { - const path = `/identifiers/${name}`; + const path = `/identifiers/${encodeURIComponent(name)}`; const data = { name: newName }; const method = 'PUT'; const res = await this.client.fetch(path, method, data); @@ -141,7 +141,7 @@ export class Identifier { * @returns {Promise} A promise to the identifier information */ async delete(name: string): Promise { - const path = `/identifiers/${name}`; + const path = `/identifiers/${encodeURIComponent(name)}`; const method = 'DELETE'; await this.client.fetch(path, method, null); return; @@ -299,7 +299,7 @@ export class Identifier { jsondata[keeper.algo] = keeper.params(); const res = await this.client.fetch( - '/identifiers/' + name + '/events', + `/identifiers/${encodeURIComponent(name)}/events`, 'POST', jsondata ); @@ -397,7 +397,7 @@ export class Identifier { jsondata[keeper.algo] = keeper.params(); const res = await this.client.fetch( - '/identifiers/' + name + '/events', + `/identifiers/${encodeURIComponent(name)}/events`, 'POST', jsondata ); @@ -434,7 +434,7 @@ export class Identifier { }; const res = this.client.fetch( - '/identifiers/' + name + '/endroles', + `/identifiers/${encodeURIComponent(name)}/endroles`, 'POST', jsondata ); @@ -474,7 +474,7 @@ export class Identifier { */ async members(name: string): Promise { const res = await this.client.fetch( - '/identifiers/' + name + '/members', + `/identifiers/${encodeURIComponent(name)}/members`, 'GET', undefined ); From 6af502f606ebc169aff0133ebc93a89aeb87a5f7 Mon Sep 17 00:00:00 2001 From: Rodolfo Miranda Date: Fri, 12 Apr 2024 10:23:07 -0400 Subject: [PATCH 10/15] use keria 0.2.0-dev0 --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c1744229..9464a18c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -57,7 +57,7 @@ jobs: strategy: matrix: os: ['ubuntu-latest'] - keria-version: ['latest'] + keria-version: ['0.2.0-dev0'] node-version: ['20'] env: KERIA_IMAGE_TAG: ${{ matrix.keria-version }} From 8452298f3725d2832dbc3748fef891110179e56a Mon Sep 17 00:00:00 2001 From: Rodolfo Miranda Date: Sat, 13 Apr 2024 06:42:34 -0700 Subject: [PATCH 11/15] order of credential properties --- .../integration-scripts/credentials.test.ts | 18 +++++++++--------- examples/integration-scripts/salty.test.ts | 6 +++--- .../singlesig-vlei-issuance.test.ts | 4 ++-- src/keri/app/credentialing.ts | 1 + 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/examples/integration-scripts/credentials.test.ts b/examples/integration-scripts/credentials.test.ts index e1e871d7..2811dda1 100644 --- a/examples/integration-scripts/credentials.test.ts +++ b/examples/integration-scripts/credentials.test.ts @@ -380,12 +380,19 @@ test('single signature credentials', async () => { const result = await holderClient .credentials() .issue(holderAid.name, { + ri: holderRegistry.regk, + s: LE_SCHEMA_SAID, a: { i: legalEntityAid.prefix, LEI: '5493001KJTIIGC8Y1R17', }, - ri: holderRegistry.regk, - s: LE_SCHEMA_SAID, + e: Saider.saidify({ + d: '', + qvi: { + n: qviCredential.sad.d, + s: qviCredential.sad.s, + }, + })[1], r: Saider.saidify({ d: '', usageDisclaimer: { @@ -395,13 +402,6 @@ test('single signature credentials', async () => { l: 'All information in a valid, unexpired, and non-revoked vLEI Credential, as defined in the associated Ecosystem Governance Framework, is accurate as of the date the validation process was complete. The vLEI Credential has been issued to the legal entity or person named in the vLEI Credential as the subject; and the qualified vLEI Issuer exercised reasonable care to perform the validation process set forth in the vLEI Ecosystem Governance Framework.', }, })[1], - e: Saider.saidify({ - d: '', - qvi: { - n: qviCredential.sad.d, - s: qviCredential.sad.s, - }, - })[1], }); await waitOperation(holderClient, result.op); diff --git a/examples/integration-scripts/salty.test.ts b/examples/integration-scripts/salty.test.ts index 25027bf1..9de613fc 100644 --- a/examples/integration-scripts/salty.test.ts +++ b/examples/integration-scripts/salty.test.ts @@ -156,13 +156,13 @@ test('salty', async () => { const events = client1.keyEvents(); const log = await events.get(aid['prefix']); assert.equal(log.length, 3); - let serder = new signify.Serder(log[0]); + let serder = new signify.Serder(log[0].ked); assert.equal(serder.pre, icp.pre); assert.equal(serder.ked['d'], icp.ked['d']); - serder = new signify.Serder(log[1]); + serder = new signify.Serder(log[1].ked); assert.equal(serder.pre, rot.pre); assert.equal(serder.ked['d'], rot.ked['d']); - serder = new signify.Serder(log[2]); + serder = new signify.Serder(log[2].ked); assert.equal(serder.pre, ixn.pre); assert.equal(serder.ked['d'], ixn.ked['d']); diff --git a/examples/integration-scripts/singlesig-vlei-issuance.test.ts b/examples/integration-scripts/singlesig-vlei-issuance.test.ts index 6aacbc51..51660e06 100644 --- a/examples/integration-scripts/singlesig-vlei-issuance.test.ts +++ b/examples/integration-scripts/singlesig-vlei-issuance.test.ts @@ -506,16 +506,16 @@ async function getOrIssueCredential( } const issResult = await issuerClient.credentials().issue(issuerAid.name, { + u: privacy ? new Salter({}).qb64 : undefined, ri: issuerRegistry.regk, s: schema, - u: privacy ? new Salter({}).qb64 : undefined, a: { i: recipientAid.prefix, u: privacy ? new Salter({}).qb64 : undefined, ...credData, }, - r: rules, e: source, + r: rules }); await waitOperation(issuerClient, issResult.op); diff --git a/src/keri/app/credentialing.ts b/src/keri/app/credentialing.ts index 4d231087..6cb0101a 100644 --- a/src/keri/app/credentialing.ts +++ b/src/keri/app/credentialing.ts @@ -211,6 +211,7 @@ export class Credentials { const [, acdc] = Saider.saidify({ v: versify(Ident.ACDC, undefined, Serials.JSON, 0), d: '', + u: args.u, i: args.i ?? hab.prefix, ...args, a: subject, From 6e7ca46e99cf7b7a8d39e577bc22a1d3eb9ea136 Mon Sep 17 00:00:00 2001 From: Rodolfo Miranda Date: Sat, 13 Apr 2024 06:43:41 -0700 Subject: [PATCH 12/15] smids and rmids as states in rot --- src/keri/app/aiding.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/keri/app/aiding.ts b/src/keri/app/aiding.ts index bb2847d5..fbe28177 100644 --- a/src/keri/app/aiding.ts +++ b/src/keri/app/aiding.ts @@ -385,14 +385,8 @@ export class Identifier { const jsondata: any = { rot: serder.ked, sigs: sigs, - smids: - states != undefined - ? states.map((state) => state.i) - : undefined, - rmids: - rstates != undefined - ? rstates.map((state) => state.i) - : undefined, + smids: states, + rmids: rstates }; jsondata[keeper.algo] = keeper.params(); From 7eefa434add3ebeda37ae8d4080f73914f610657 Mon Sep 17 00:00:00 2001 From: Rodolfo Miranda Date: Sat, 13 Apr 2024 07:04:07 -0700 Subject: [PATCH 13/15] prettier --- examples/integration-scripts/singlesig-vlei-issuance.test.ts | 2 +- src/keri/app/aiding.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/integration-scripts/singlesig-vlei-issuance.test.ts b/examples/integration-scripts/singlesig-vlei-issuance.test.ts index 51660e06..7636c6c0 100644 --- a/examples/integration-scripts/singlesig-vlei-issuance.test.ts +++ b/examples/integration-scripts/singlesig-vlei-issuance.test.ts @@ -515,7 +515,7 @@ async function getOrIssueCredential( ...credData, }, e: source, - r: rules + r: rules, }); await waitOperation(issuerClient, issResult.op); diff --git a/src/keri/app/aiding.ts b/src/keri/app/aiding.ts index fbe28177..c90b6222 100644 --- a/src/keri/app/aiding.ts +++ b/src/keri/app/aiding.ts @@ -386,7 +386,7 @@ export class Identifier { rot: serder.ked, sigs: sigs, smids: states, - rmids: rstates + rmids: rstates, }; jsondata[keeper.algo] = keeper.params(); From f742ec21106400ac4de5be7f9e955a3f9e85042b Mon Sep 17 00:00:00 2001 From: Rodolfo Miranda Date: Wed, 17 Apr 2024 15:20:41 -0700 Subject: [PATCH 14/15] mmissing URL encodings --- examples/integration-scripts/utils/test-setup.ts | 4 ++-- src/keri/app/coring.ts | 2 +- src/keri/app/credentialing.ts | 14 +++++++------- src/keri/app/exchanging.ts | 2 +- src/keri/app/grouping.ts | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/examples/integration-scripts/utils/test-setup.ts b/examples/integration-scripts/utils/test-setup.ts index ea9760f1..e0ed1734 100644 --- a/examples/integration-scripts/utils/test-setup.ts +++ b/examples/integration-scripts/utils/test-setup.ts @@ -121,8 +121,8 @@ export async function getEndRoles( ): Promise { const path = role !== undefined - ? `/identifiers/${alias}/endroles/${role}` - : `/identifiers/${alias}/endroles`; + ? `/identifiers/${encodeURIComponent(alias)}/endroles/${role}` + : `/identifiers/${encodeURIComponent(alias)}/endroles`; const response: Response = await client.fetch(path, 'GET', null); if (!response.ok) throw new Error(await response.text()); const result = await response.json(); diff --git a/src/keri/app/coring.ts b/src/keri/app/coring.ts index fd5a1161..def7ceda 100644 --- a/src/keri/app/coring.ts +++ b/src/keri/app/coring.ts @@ -34,7 +34,7 @@ export class Oobis { * @returns {Promise} A promise to the OOBI(s) */ async get(name: string, role: string = 'agent'): Promise { - const path = `/identifiers/${name}/oobis?role=${role}`; + const path = `/identifiers/${encodeURIComponent(name)}/oobis?role=${role}`; const method = 'GET'; const res = await this.client.fetch(path, method, null); return await res.json(); diff --git a/src/keri/app/credentialing.ts b/src/keri/app/credentialing.ts index 6cb0101a..e57ccc23 100644 --- a/src/keri/app/credentialing.ts +++ b/src/keri/app/credentialing.ts @@ -353,7 +353,7 @@ export class Credentials { [keeper.algo]: keeper.params(), }; - const path = `/identifiers/${name}/credentials/${said}`; + const path = `/identifiers/${encodeURIComponent(name)}/credentials/${said}`; const method = 'DELETE'; const headers = new Headers({ Accept: 'application/json+cesr', @@ -423,7 +423,7 @@ export class Credentials { include: include, }; - const path = `/identifiers/${name}/credentials/${said}/presentations`; + const path = `/identifiers/${encodeURIComponent(name)}/credentials/${said}/presentations`; const method = 'POST'; const headers = new Headers({ Accept: 'application/json+cesr', @@ -486,7 +486,7 @@ export class Credentials { recipient: recipient, }; - const path = `/identifiers/${name}/requests`; + const path = `/identifiers/${encodeURIComponent(name)}/requests`; const method = 'POST'; const headers = new Headers({ Accept: 'application/json+cesr', @@ -561,7 +561,7 @@ export class Registries { * @returns {Promise} A promise to the list of registries */ async list(name: string): Promise { - const path = `/identifiers/${name}/registries`; + const path = `/identifiers/${encodeURIComponent(name)}/registries`; const method = 'GET'; const res = await this.client.fetch(path, method, null); return await res.json(); @@ -642,7 +642,7 @@ export class Registries { ixn: Dict, sigs: any[] ) { - const path = `/identifiers/${name}/registries`; + const path = `/identifiers/${encodeURIComponent(name)}/registries`; const method = 'POST'; const data: any = { @@ -772,7 +772,7 @@ export class Ipex { }; const response = await this.client.fetch( - `/identifiers/${name}/ipex/grant`, + `/identifiers/${encodeURIComponent(name)}/ipex/grant`, 'POST', body ); @@ -828,7 +828,7 @@ export class Ipex { }; const response = await this.client.fetch( - `/identifiers/${name}/ipex/admit`, + `/identifiers/${encodeURIComponent(name)}/ipex/admit`, 'POST', body ); diff --git a/src/keri/app/exchanging.ts b/src/keri/app/exchanging.ts index d000c5a8..46024881 100644 --- a/src/keri/app/exchanging.ts +++ b/src/keri/app/exchanging.ts @@ -113,7 +113,7 @@ export class Exchanges { atc: string, recipients: string[] ): Promise { - const path = `/identifiers/${name}/exchanges`; + const path = `/identifiers/${encodeURIComponent(name)}/exchanges`; const method = 'POST'; const data: any = { tpc: topic, diff --git a/src/keri/app/grouping.ts b/src/keri/app/grouping.ts index f9745499..d4316dbb 100644 --- a/src/keri/app/grouping.ts +++ b/src/keri/app/grouping.ts @@ -43,7 +43,7 @@ export class Groups { sigs: string[], atc: string ): Promise { - const path = `/identifiers/${name}/multisig/request`; + const path = `/identifiers/${encodeURIComponent(name)}/multisig/request`; const method = 'POST'; const data = { exn: exn, @@ -74,7 +74,7 @@ export class Groups { smids: string[], rmids: string[] ): Promise { - const path = `/identifiers/${name}/multisig/join`; + const path = `/identifiers/${encodeURIComponent(name)}/multisig/join`; const method = 'POST'; const data = { tpc: 'multisig', From c67f41b36b390916cd39b2ee2ce805e6c34fb1a1 Mon Sep 17 00:00:00 2001 From: Rodolfo Miranda Date: Wed, 17 Apr 2024 20:18:39 -0700 Subject: [PATCH 15/15] pretty --- src/keri/app/coring.ts | 4 +++- src/keri/app/credentialing.ts | 8 ++++++-- src/keri/app/grouping.ts | 4 +++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/keri/app/coring.ts b/src/keri/app/coring.ts index def7ceda..a609f1b3 100644 --- a/src/keri/app/coring.ts +++ b/src/keri/app/coring.ts @@ -34,7 +34,9 @@ export class Oobis { * @returns {Promise} A promise to the OOBI(s) */ async get(name: string, role: string = 'agent'): Promise { - const path = `/identifiers/${encodeURIComponent(name)}/oobis?role=${role}`; + const path = `/identifiers/${encodeURIComponent( + name + )}/oobis?role=${role}`; const method = 'GET'; const res = await this.client.fetch(path, method, null); return await res.json(); diff --git a/src/keri/app/credentialing.ts b/src/keri/app/credentialing.ts index e57ccc23..ead892cb 100644 --- a/src/keri/app/credentialing.ts +++ b/src/keri/app/credentialing.ts @@ -353,7 +353,9 @@ export class Credentials { [keeper.algo]: keeper.params(), }; - const path = `/identifiers/${encodeURIComponent(name)}/credentials/${said}`; + const path = `/identifiers/${encodeURIComponent( + name + )}/credentials/${said}`; const method = 'DELETE'; const headers = new Headers({ Accept: 'application/json+cesr', @@ -423,7 +425,9 @@ export class Credentials { include: include, }; - const path = `/identifiers/${encodeURIComponent(name)}/credentials/${said}/presentations`; + const path = `/identifiers/${encodeURIComponent( + name + )}/credentials/${said}/presentations`; const method = 'POST'; const headers = new Headers({ Accept: 'application/json+cesr', diff --git a/src/keri/app/grouping.ts b/src/keri/app/grouping.ts index d4316dbb..a29b4e85 100644 --- a/src/keri/app/grouping.ts +++ b/src/keri/app/grouping.ts @@ -43,7 +43,9 @@ export class Groups { sigs: string[], atc: string ): Promise { - const path = `/identifiers/${encodeURIComponent(name)}/multisig/request`; + const path = `/identifiers/${encodeURIComponent( + name + )}/multisig/request`; const method = 'POST'; const data = { exn: exn,