Skip to content

Commit

Permalink
feat: Add whitelisted issuers in SDR
Browse files Browse the repository at this point in the history
  • Loading branch information
simonas-notcat committed Mar 13, 2020
1 parent a7753dd commit f486f07
Showing 1 changed file with 49 additions and 2 deletions.
51 changes: 49 additions & 2 deletions packages/daf-cli/src/sdr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,69 @@ program
{ name: 'No', value: false },
],
},
{
type: 'list',
name: 'addIssuer',
message: 'Add accepted issuer?',
choices: [
{ name: 'Yes', value: true },
{ name: 'No', value: false },
],
},
])

let addIssuer = answers2.addIssuer
const issuers = []
while (addIssuer) {
const issuerAnswers = await inquirer.prompt([
{
type: 'input',
name: 'did',
message: 'Issuer DID',
default: 'did:web:uport.me',
},
{
type: 'input',
name: 'url',
message: 'URL',
default: 'https://uport.me',
},
{
type: 'list',
name: 'addIssuer',
message: 'Add another accepted issuer?',
choices: [
{ name: 'Yes', value: true },
{ name: 'No', value: false },
],
},
])
issuers.push({
did: issuerAnswers.did,
url: issuerAnswers.url,
})
addIssuer = issuerAnswers.addIssuer
}

const answers4 = await inquirer.prompt([
{
type: 'list',
name: 'addMore',
message: 'Add another credential?',
message: 'Add another claim?',
choices: [
{ name: 'Yes', value: true },
{ name: 'No', value: false },
],
},
])

claims.push({
iss: issuers,
essential: answers2.essential,
claimType: answers2.claimType,
reason: answers2.reason,
} as SD.CredentialRequestInput)
addMoreRequests = answers2.addMore
addMoreRequests = answers4.addMore
}

const signAction: SD.ActionSignSdr = {
Expand Down

0 comments on commit f486f07

Please sign in to comment.