Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run npm run lint -- --fix #154

Merged
merged 1 commit into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-namespace": "warn",
"@typescript-eslint/ban-types": "warn",
"@typescript-eslint/no-unused-vars": "warn",
"@typescript-eslint/ban-ts-comment": "warn"
"@typescript-eslint/no-unused-vars": "warn"
}
}
10 changes: 5 additions & 5 deletions examples/integration-scripts/challenge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ async function run() {
assert.equal(challenge1_big.words.length, 24);

// Create two identifiers, one for each client
let icpResult1 = await client1.identifiers().create('alice', {
const icpResult1 = await client1.identifiers().create('alice', {
toad: 3,
wits: [
'BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha',
Expand All @@ -68,7 +68,7 @@ async function run() {
.addEndRole('alice', 'agent', client1!.agent!.pre);
console.log("Alice's AID:", aid1.i);

let icpResult2 = await client2.identifiers().create('bob', {
const icpResult2 = await client2.identifiers().create('bob', {
toad: 3,
wits: [
'BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha',
Expand All @@ -86,8 +86,8 @@ async function run() {
console.log("Bob's AID:", aid2.i);

// Exchenge OOBIs
let oobi1 = await client1.oobis().get('alice', 'agent');
let oobi2 = await client2.oobis().get('bob', 'agent');
const oobi1 = await client1.oobis().get('alice', 'agent');
const oobi2 = await client2.oobis().get('bob', 'agent');

op1 = await client1.oobis().resolve(oobi2.oobis[0], 'bob');
while (!op1['done']) {
Expand Down Expand Up @@ -121,7 +121,7 @@ async function run() {
console.log('Alice verified challenge response');

//Alice mark response as accepted
let exn = new Serder(op1.response.exn);
const exn = new Serder(op1.response.exn);
op1 = await client1.challenges().responded('alice', aid2.i, exn.ked.d);
console.log('Alice marked challenge response as accepted');

Expand Down
24 changes: 12 additions & 12 deletions examples/integration-scripts/credentials.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ async function waitForNotifications(
): Promise<Notification[]> {
const awaitedNotifications = [];
while (true) {
let notifications = await client.notifications().list();
for (let note of notifications.notes) {
const notifications = await client.notifications().list();
for (const note of notifications.notes) {
if (note.a.r === route) {
awaitedNotifications.push(note);
}
Expand Down Expand Up @@ -115,7 +115,7 @@ test('credentials', async () => {
const verifierAidName = 'verifier';

// Create two identifiers, one for each client
let issuerIcpRes = await issuerClient.identifiers().create(issuerAidName, {
const issuerIcpRes = await issuerClient.identifiers().create(issuerAidName, {
toad: 3,
wits: [...KLI_WITNESS_DEMO_PREFIXES],
});
Expand All @@ -131,7 +131,7 @@ test('credentials', async () => {
.addEndRole(issuerAidName, 'agent', issuerClient!.agent!.pre);
console.log("Issuer's AID:", issuerAID);

let holderIcpRes = await holderClient.identifiers().create(holderAidName, {
const holderIcpRes = await holderClient.identifiers().create(holderAidName, {
toad: 3,
wits: [...KLI_WITNESS_DEMO_PREFIXES],
});
Expand All @@ -147,7 +147,7 @@ test('credentials', async () => {
.addEndRole(holderAidName, 'agent', holderClient!.agent!.pre);
console.log("Recipient's AID:", holderAID);

let verifierIcpRes = await verifierClient
const verifierIcpRes = await verifierClient
.identifiers()
.create(verifierAidName, {
toad: 3,
Expand Down Expand Up @@ -187,18 +187,18 @@ test('credentials', async () => {
await new Promise((resolve) => setTimeout(resolve, 250));
}

let issSchema = await issuerClient.schemas().get(schemaSAID);
const issSchema = await issuerClient.schemas().get(schemaSAID);
assert.equal(issSchema.$id, schemaSAID);
let hldSchemas = await holderClient.schemas().list();
const hldSchemas = await holderClient.schemas().list();
assert.equal(hldSchemas.length, 1);
assert.equal(hldSchemas[0].$id, schemaSAID);
console.log('Resolved QVI Schema OOBI for issuer, holder, and verifier');

// Agent discovery through OOBI exchange between issuer, holder, and verifier
console.log('Getting Agent OOBIs for issuer, holder, and verifier');
let issAgentOOBI = await issuerClient.oobis().get(issuerAidName, 'agent');
let hldAgentOOBI = await holderClient.oobis().get(holderAidName, 'agent');
let vfyAgentOOBI = await verifierClient
const issAgentOOBI = await issuerClient.oobis().get(issuerAidName, 'agent');
const hldAgentOOBI = await holderClient.oobis().get(holderAidName, 'agent');
const vfyAgentOOBI = await verifierClient
.oobis()
.get(verifierAidName, 'agent');

Expand Down Expand Up @@ -263,7 +263,7 @@ test('credentials', async () => {
issOp = await issuerClient.operations().get(issOp.name);
await new Promise((resolve) => setTimeout(resolve, 250));
}
let registries = await issuerClient.registries().list(issuerAidName);
const registries = await issuerClient.registries().list(issuerAidName);
const registry = registries[0];
assert.equal(registries.length, 1);
assert.equal(registry.name, registryName);
Expand Down Expand Up @@ -373,7 +373,7 @@ test('credentials', async () => {
verifierClient,
'/exn/ipex/grant'
);
let verifierGrantNote = verifierNotifications[0];
const verifierGrantNote = verifierNotifications[0];

const [admit3, sigs3, aend3] = await verifierClient
.ipex()
Expand Down
8 changes: 4 additions & 4 deletions examples/integration-scripts/delegation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ async function run() {
);

// Client 1 create delegator AID
let icpResult1 = await client1.identifiers().create('delegator', {
const icpResult1 = await client1.identifiers().create('delegator', {
toad: 3,
wits: [
'BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha',
Expand All @@ -64,7 +64,7 @@ async function run() {

// Client 2 resolves delegator OOBI
console.log('Client 2 resolving delegator OOBI');
let oobi1 = await client1.oobis().get('delegator', 'agent');
const oobi1 = await client1.oobis().get('delegator', 'agent');
let op2 = await client2.oobis().resolve(oobi1.oobis[0], 'delegator');
while (!op2['done']) {
op2 = await client2.operations().get(op2.name);
Expand All @@ -73,11 +73,11 @@ async function run() {
console.log('OOBI resolved');

// Client 2 creates delegate AID
let icpResult2 = await client2
const icpResult2 = await client2
.identifiers()
.create('delegate', { delpre: aid1.prefix });
op2 = await icpResult2.op();
let delegatePrefix = op2.name.split('.')[1];
const delegatePrefix = op2.name.split('.')[1];
console.log("Delegate's prefix:", delegatePrefix);
console.log('Delegate waiting for approval...');

Expand Down
6 changes: 3 additions & 3 deletions examples/integration-scripts/externalModule.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ test('bip39_shim', async () => {
'Agent AID: ',
state1.agent.i
);
let words = new BIP39Shim(0, {}).generateMnemonic(256);
let icpResult = await client1.identifiers().create('aid1', {
const words = new BIP39Shim(0, {}).generateMnemonic(256);
const icpResult = await client1.identifiers().create('aid1', {
algo: signify.Algos.extern,
extern_type: 'bip39_shim',
extern: { mnemonics: words },
});
let op = await icpResult.op();
const op = await icpResult.op();
assert.equal(op['done'], true);
}, 30000);
30 changes: 15 additions & 15 deletions examples/integration-scripts/modules/bip39_shim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ export class BIP39Shim {
}

keys(count: number, kidx: number, transferable: boolean) {
let keys = [];
const keys = [];
for (let idx = 0; idx < count; idx++) {
let keyId = `${this.stem}-${this.pidx}-${kidx + idx}`;
let seed = mnemonicToSeedSync(this.mnemonics, keyId);
let signer = new Signer({
const keyId = `${this.stem}-${this.pidx}-${kidx + idx}`;
const seed = mnemonicToSeedSync(this.mnemonics, keyId);
const signer = new Signer({
raw: new Uint8Array(seed),
code: MtrDex.Ed25519_Seed,
transferable: transferable,
Expand All @@ -48,39 +48,39 @@ export class BIP39Shim {
}

incept(transferable: boolean) {
let signers = this.keys(this.icount, this.kidx, transferable);
let verfers = signers.map((signer) => signer.verfer.qb64);
const signers = this.keys(this.icount, this.kidx, transferable);
const verfers = signers.map((signer) => signer.verfer.qb64);

let nsigners = this.keys(
const nsigners = this.keys(
this.ncount,
this.kidx + this.icount,
transferable
);
let digers = nsigners.map(
const digers = nsigners.map(
(nsigner) =>
new Diger({ code: this.dcode }, nsigner.verfer.qb64b).qb64
);
return [verfers, digers];
}

rotate(ncount: number, transferable: boolean) {
let signers = this.keys(
const signers = this.keys(
this.ncount,
this.kidx + this.icount,
transferable
);
let verfers = signers.map((signer) => signer.verfer.qb64);
const verfers = signers.map((signer) => signer.verfer.qb64);

this.kidx = this.kidx + this.icount;
this.icount = this.ncount;
this.ncount = ncount;

let nsigners = this.keys(
const nsigners = this.keys(
this.ncount,
this.kidx + this.icount,
this.transferable
);
let digers = nsigners.map(
const digers = nsigners.map(
(nsigner) =>
new Diger({ code: this.dcode }, nsigner.verfer.qb64b).qb64
);
Expand All @@ -94,10 +94,10 @@ export class BIP39Shim {
indices: number[] | undefined = undefined,
ondices: number[] | undefined = undefined
) {
let signers = this.keys(this.icount, this.kidx, this.transferable);
const signers = this.keys(this.icount, this.kidx, this.transferable);

if (indexed) {
let sigers = [];
const sigers = [];
let i = 0;
for (const [j, signer] of signers.entries()) {
if (indices != undefined) {
Expand Down Expand Up @@ -132,7 +132,7 @@ export class BIP39Shim {
}
return sigers.map((siger) => siger.qb64);
} else {
let cigars = [];
const cigars = [];
for (const [_, signer] of signers.entries()) {
cigars.push(signer.sign(ser));
}
Expand Down
Loading
Loading