Skip to content

Commit

Permalink
more url encodings for alias
Browse files Browse the repository at this point in the history
  • Loading branch information
rodolfomiranda committed Apr 19, 2024
1 parent fcfca8c commit 6fb6f34
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions examples/integration-scripts/utils/test-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ export async function getEndRoles(
): Promise<any> {
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();
Expand Down
2 changes: 1 addition & 1 deletion src/keri/app/coring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class Oobis {
* @returns {Promise<any>} A promise to the OOBI(s)
*/
async get(name: string, role: string = 'agent'): Promise<any> {
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();
Expand Down
18 changes: 9 additions & 9 deletions src/keri/app/credentialing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ export class Credentials {

const sigs = await keeper.sign(b(anc.raw));

const path = `/identifiers/${hab.name}/credentials`;
const path = `/identifiers/${encodeURIComponent(hab.name)}/credentials`;
const method = 'POST';
const body = {
acdc: acdc,
Expand Down Expand Up @@ -363,7 +363,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',
Expand Down Expand Up @@ -433,7 +433,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',
Expand Down Expand Up @@ -496,7 +496,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',
Expand Down Expand Up @@ -571,7 +571,7 @@ export class Registries {
* @returns {Promise<any>} A promise to the list of registries
*/
async list(name: string): Promise<any> {
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();
Expand Down Expand Up @@ -652,7 +652,7 @@ export class Registries {
ixn: Dict<any>,
sigs: any[]
) {
const path = `/identifiers/${name}/registries`;
const path = `/identifiers/${encodeURIComponent(name)}/registries`;
const method = 'POST';

const data: any = {
Expand Down Expand Up @@ -680,7 +680,7 @@ export class Registries {
registryName: string,
newName: string
): Promise<any> {
const path = `/identifiers/${name}/registries/${registryName}`;
const path = `/identifiers/${encodeURIComponent(name)}/registries/${registryName}`;
const method = 'PUT';
const data = {
name: newName,
Expand Down Expand Up @@ -804,7 +804,7 @@ export class Ipex {
};

const response = await this.client.fetch(
`/identifiers/${name}/ipex/grant`,
`/identifiers/${encodeURIComponent(name)}/ipex/grant`,
'POST',
body
);
Expand Down Expand Up @@ -860,7 +860,7 @@ export class Ipex {
};

const response = await this.client.fetch(
`/identifiers/${name}/ipex/admit`,
`/identifiers/${encodeURIComponent(name)}/ipex/admit`,
'POST',
body
);
Expand Down
2 changes: 1 addition & 1 deletion src/keri/app/exchanging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export class Exchanges {
atc: string,
recipients: string[]
): Promise<any> {
const path = `/identifiers/${name}/exchanges`;
const path = `/identifiers/${encodeURIComponent(name)}/exchanges`;
const method = 'POST';
const data: any = {
tpc: topic,
Expand Down
4 changes: 2 additions & 2 deletions src/keri/app/grouping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class Groups {
sigs: string[],
atc: string
): Promise<any> {
const path = `/identifiers/${name}/multisig/request`;
const path = `/identifiers/${encodeURIComponent(name)}/multisig/request`;
const method = 'POST';
const data = {
exn: exn,
Expand Down Expand Up @@ -74,7 +74,7 @@ export class Groups {
smids: string[],
rmids: string[]
): Promise<any> {
const path = `/identifiers/${name}/multisig/join`;
const path = `/identifiers/${encodeURIComponent(name)}/multisig/join`;
const method = 'POST';
const data = {
tpc: 'multisig',
Expand Down

0 comments on commit 6fb6f34

Please sign in to comment.