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

fix: demo's local generateKeypairs() changed to SDK's keypair #160

Merged
merged 2 commits into from
Jan 5, 2024
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
13 changes: 6 additions & 7 deletions demo/src/comp.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as Cord from '@cord.network/sdk'
import { UUID, Crypto } from '@cord.network/utils'
import { generateKeypairs } from './utils/generateKeypairs'
import { createDid } from './utils/generateDid'
import { createDidName } from './utils/generateDidName'
import { getDidDocFromName } from './utils/queryDidName'
Expand Down Expand Up @@ -80,23 +79,23 @@ async function main() {
const { mnemonic: verifierMnemonic, document: verifierDid } = await createDid(
authorIdentity
)
const verifierKeys = generateKeypairs(verifierMnemonic)
const verifierKeys = Cord.Utils.Keys.generateKeypairs(verifierMnemonic)
console.log(
`🏢 Verifier (${verifierDid.assertionMethod![0].type}): ${verifierDid.uri}`
)
// Create Holder DID
const { mnemonic: holderMnemonic, document: holderDid } = await createDid(
authorIdentity
)
const holderKeys = generateKeypairs(holderMnemonic)
const holderKeys = Cord.Utils.Keys.generateKeypairs(holderMnemonic)
console.log(
`👩‍⚕️ Holder (${holderDid.assertionMethod![0].type}): ${holderDid.uri}`
)
// Create issuer DID
const { mnemonic: issuerMnemonic, document: issuerDid } = await createDid(
authorIdentity
)
const issuerKeys = generateKeypairs(issuerMnemonic)
const issuerKeys = Cord.Utils.Keys.generateKeypairs(issuerMnemonic)
console.log(
`🏛 Issuer (${issuerDid?.assertionMethod![0].type}): ${issuerDid.uri}`
)
Expand All @@ -111,7 +110,7 @@ async function main() {
// Create Delegate One DID
const { mnemonic: delegateOneMnemonic, document: delegateOneDid } =
await createDid(authorIdentity)
const delegateOneKeys = generateKeypairs(delegateOneMnemonic)
const delegateOneKeys = Cord.Utils.Keys.generateKeypairs(delegateOneMnemonic)
console.log(
`🏛 Delegate (${delegateOneDid?.assertionMethod![0].type}): ${
delegateOneDid.uri
Expand All @@ -120,7 +119,7 @@ async function main() {
// Create Delegate Two DID
const { mnemonic: delegateTwoMnemonic, document: delegateTwoDid } =
await createDid(authorIdentity)
const delegateTwoKeys = generateKeypairs(delegateTwoMnemonic)
const delegateTwoKeys = Cord.Utils.Keys.generateKeypairs(delegateTwoMnemonic)
console.log(
`🏛 Delegate (${delegateTwoDid?.assertionMethod![0].type}): ${
delegateTwoDid.uri
Expand All @@ -129,7 +128,7 @@ async function main() {
// Create Delegate 3 DID
const { mnemonic: delegate3Mnemonic, document: delegate3Did } =
await createDid(authorIdentity)
const delegate3Keys = generateKeypairs(delegate3Mnemonic)
const delegate3Keys = Cord.Utils.Keys.generateKeypairs(delegate3Mnemonic)
console.log(
`🏛 Delegate (${delegate3Did?.assertionMethod![0].type}): ${
delegate3Did.uri
Expand Down
13 changes: 6 additions & 7 deletions demo/src/demo-messaging.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as Cord from '@cord.network/sdk'
import { UUID, Crypto } from '@cord.network/utils'
import { generateKeypairs } from './utils/generateKeypairs'
import { createDid } from './utils/generateDid'
import { createDidName } from './utils/generateDidName'
import { getDidDocFromName } from './utils/queryDidName'
Expand Down Expand Up @@ -54,7 +53,7 @@ async function main() {
const { mnemonic: verifierMnemonic, document: verifierDid } = await createDid(
authorIdentity
)
const verifierKeys = generateKeypairs(verifierMnemonic)
const verifierKeys = Cord.Utils.Keys.generateKeypairs(verifierMnemonic)

console.log(
`🏢 Verifier (${verifierDid.assertionMethod![0].type}): ${verifierDid.uri}`
Expand All @@ -63,15 +62,15 @@ async function main() {
const { mnemonic: holderMnemonic, document: holderDid } = await createDid(
authorIdentity
)
const holderKeys = generateKeypairs(holderMnemonic)
const holderKeys = Cord.Utils.Keys.generateKeypairs(holderMnemonic)
console.log(
`👩‍⚕️ Holder (${holderDid.assertionMethod![0].type}): ${holderDid.uri}`
)
// Create issuer DID
const { mnemonic: issuerMnemonic, document: issuerDid } = await createDid(
authorIdentity
)
const issuerKeys = generateKeypairs(issuerMnemonic)
const issuerKeys = Cord.Utils.Keys.generateKeypairs(issuerMnemonic)
console.log(
`🏛 Issuer (${issuerDid?.assertionMethod![0].type}): ${issuerDid.uri}`
)
Expand All @@ -86,7 +85,7 @@ async function main() {
// Create Delegate One DID
const { mnemonic: delegateOneMnemonic, document: delegateOneDid } =
await createDid(authorIdentity)
const delegateOneKeys = generateKeypairs(delegateOneMnemonic)
const delegateOneKeys = Cord.Utils.Keys.generateKeypairs(delegateOneMnemonic)
console.log(
`🏛 Delegate (${delegateOneDid?.assertionMethod![0].type}): ${
delegateOneDid.uri
Expand All @@ -95,7 +94,7 @@ async function main() {
// Create Delegate Two DID
const { mnemonic: delegateTwoMnemonic, document: delegateTwoDid } =
await createDid(authorIdentity)
const delegateTwoKeys = generateKeypairs(delegateTwoMnemonic)
const delegateTwoKeys = Cord.Utils.Keys.generateKeypairs(delegateTwoMnemonic)
console.log(
`🏛 Delegate (${delegateTwoDid?.assertionMethod![0].type}): ${
delegateTwoDid.uri
Expand All @@ -104,7 +103,7 @@ async function main() {
// Create Delegate 3 DID
const { mnemonic: delegate3Mnemonic, document: delegate3Did } =
await createDid(authorIdentity)
const delegate3Keys = generateKeypairs(delegate3Mnemonic)
const delegate3Keys = Cord.Utils.Keys.generateKeypairs(delegate3Mnemonic)
console.log(
`🏛 Delegate (${delegate3Did?.assertionMethod![0].type}): ${
delegate3Did.uri
Expand Down
5 changes: 2 additions & 3 deletions demo/src/demo-score.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as Cord from '@cord.network/sdk'
import { UUID, Crypto } from '@cord.network/utils'
import { generateKeypairs } from './utils/generateKeypairs'
import { createDid } from './utils/generateDid'
import { addRegistryAdminDelegate } from './utils/generateRegistry'
import { randomUUID } from 'crypto'
Expand Down Expand Up @@ -32,7 +31,7 @@ async function main() {
const { mnemonic: issuerMnemonic, document: issuerDid } = await createDid(
authorIdentity
)
const issuerKeys = generateKeypairs(issuerMnemonic)
const issuerKeys = Cord.Utils.Keys.generateKeypairs(issuerMnemonic)
console.log(
`🏛 Issuer (${issuerDid?.assertionMethod![0].type}): ${issuerDid.uri}`
)
Expand All @@ -41,7 +40,7 @@ async function main() {
const { mnemonic: delegateOneMnemonic, document: delegateOneDid } =
await createDid(authorIdentity)

const delegateOneKeys = generateKeypairs(delegateOneMnemonic)
const delegateOneKeys = Cord.Utils.Keys.generateKeypairs(delegateOneMnemonic)

console.log(
`🏛 Delegate (${delegateOneDid?.assertionMethod![0].type}): ${
Expand Down
13 changes: 6 additions & 7 deletions demo/src/demo-sparknet.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as Cord from '@cord.network/sdk'
import { UUID, Crypto } from '@cord.network/utils'
import { generateKeypairs } from './utils/generateKeypairs'
import { createDid } from './utils/generateDid'
import { createDidName } from './utils/generateDidName'
import { getDidDocFromName } from './utils/queryDidName'
Expand Down Expand Up @@ -50,23 +49,23 @@ async function main() {
const { mnemonic: verifierMnemonic, document: verifierDid } = await createDid(
authorityAuthorIdentity
)
const verifierKeys = generateKeypairs(verifierMnemonic)
const verifierKeys = Cord.Utils.Keys.generateKeypairs(verifierMnemonic)
console.log(
`🏢 Verifier (${verifierDid.assertionMethod![0].type}): ${verifierDid.uri}`
)
// Create Holder DID
const { mnemonic: holderMnemonic, document: holderDid } = await createDid(
authorityAuthorIdentity
)
const holderKeys = generateKeypairs(holderMnemonic)
const holderKeys = Cord.Utils.Keys.generateKeypairs(holderMnemonic)
console.log(
`👩‍⚕️ Holder (${holderDid.assertionMethod![0].type}): ${holderDid.uri}`
)
// Create issuer DID
const { mnemonic: issuerMnemonic, document: issuerDid } = await createDid(
authorityAuthorIdentity
)
const issuerKeys = generateKeypairs(issuerMnemonic)
const issuerKeys = Cord.Utils.Keys.generateKeypairs(issuerMnemonic)
console.log(
`🏛 Issuer (${issuerDid?.assertionMethod![0].type}): ${issuerDid.uri}`
)
Expand All @@ -81,7 +80,7 @@ async function main() {
// Create Delegate One DID
const { mnemonic: delegateOneMnemonic, document: delegateOneDid } =
await createDid(authorityAuthorIdentity)
const delegateOneKeys = generateKeypairs(delegateOneMnemonic)
const delegateOneKeys = Cord.Utils.Keys.generateKeypairs(delegateOneMnemonic)
console.log(
`🏛 Delegate (${delegateOneDid?.assertionMethod![0].type}): ${
delegateOneDid.uri
Expand All @@ -90,7 +89,7 @@ async function main() {
// Create Delegate Two DID
const { mnemonic: delegateTwoMnemonic, document: delegateTwoDid } =
await createDid(authorityAuthorIdentity)
const delegateTwoKeys = generateKeypairs(delegateTwoMnemonic)
const delegateTwoKeys = Cord.Utils.Keys.generateKeypairs(delegateTwoMnemonic)
console.log(
`🏛 Delegate (${delegateTwoDid?.assertionMethod![0].type}): ${
delegateTwoDid.uri
Expand All @@ -99,7 +98,7 @@ async function main() {
// Create Delegate 3 DID
const { mnemonic: delegate3Mnemonic, document: delegate3Did } =
await createDid(authorityAuthorIdentity)
const delegate3Keys = generateKeypairs(delegate3Mnemonic)
const delegate3Keys = Cord.Utils.Keys.generateKeypairs(delegate3Mnemonic)
console.log(
`🏛 Delegate (${delegate3Did?.assertionMethod![0].type}): ${
delegate3Did.uri
Expand Down
13 changes: 6 additions & 7 deletions demo/src/demo-staging.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as Cord from '@cord.network/sdk'
import { UUID, Crypto } from '@cord.network/utils'
import { generateKeypairs } from './utils/generateKeypairs'
import { createDid } from './utils/generateDid'
import { createDidName } from './utils/generateDidName'
import { getDidDocFromName } from './utils/queryDidName'
Expand Down Expand Up @@ -50,23 +49,23 @@ async function main() {
const { mnemonic: verifierMnemonic, document: verifierDid } = await createDid(
authorityAuthorIdentity
)
const verifierKeys = generateKeypairs(verifierMnemonic)
const verifierKeys = Cord.Utils.Keys.generateKeypairs(verifierMnemonic)
console.log(
`🏢 Verifier (${verifierDid.assertionMethod![0].type}): ${verifierDid.uri}`
)
// Create Holder DID
const { mnemonic: holderMnemonic, document: holderDid } = await createDid(
authorityAuthorIdentity
)
const holderKeys = generateKeypairs(holderMnemonic)
const holderKeys = Cord.Utils.Keys.generateKeypairs(holderMnemonic)
console.log(
`👩‍⚕️ Holder (${holderDid.assertionMethod![0].type}): ${holderDid.uri}`
)
// Create issuer DID
const { mnemonic: issuerMnemonic, document: issuerDid } = await createDid(
authorityAuthorIdentity
)
const issuerKeys = generateKeypairs(issuerMnemonic)
const issuerKeys = Cord.Utils.Keys.generateKeypairs(issuerMnemonic)
console.log(
`🏛 Issuer (${issuerDid?.assertionMethod![0].type}): ${issuerDid.uri}`
)
Expand All @@ -81,7 +80,7 @@ async function main() {
// Create Delegate One DID
const { mnemonic: delegateOneMnemonic, document: delegateOneDid } =
await createDid(authorityAuthorIdentity)
const delegateOneKeys = generateKeypairs(delegateOneMnemonic)
const delegateOneKeys = Cord.Utils.Keys.generateKeypairs(delegateOneMnemonic)
console.log(
`🏛 Delegate (${delegateOneDid?.assertionMethod![0].type}): ${
delegateOneDid.uri
Expand All @@ -90,7 +89,7 @@ async function main() {
// Create Delegate Two DID
const { mnemonic: delegateTwoMnemonic, document: delegateTwoDid } =
await createDid(authorityAuthorIdentity)
const delegateTwoKeys = generateKeypairs(delegateTwoMnemonic)
const delegateTwoKeys = Cord.Utils.Keys.generateKeypairs(delegateTwoMnemonic)
console.log(
`🏛 Delegate (${delegateTwoDid?.assertionMethod![0].type}): ${
delegateTwoDid.uri
Expand All @@ -99,7 +98,7 @@ async function main() {
// Create Delegate 3 DID
const { mnemonic: delegate3Mnemonic, document: delegate3Did } =
await createDid(authorityAuthorIdentity)
const delegate3Keys = generateKeypairs(delegate3Mnemonic)
const delegate3Keys = Cord.Utils.Keys.generateKeypairs(delegate3Mnemonic)
console.log(
`🏛 Delegate (${delegate3Did?.assertionMethod![0].type}): ${
delegate3Did.uri
Expand Down
13 changes: 6 additions & 7 deletions demo/src/demo-vc.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as VCUtils from '@cord.network/vc-export'
import * as Cord from '@cord.network/sdk'
import { UUID, Crypto } from '@cord.network/utils'
import { generateKeypairs } from './utils/generateKeypairs'
import { createDid } from './utils/generateDid'
import { createDidName } from './utils/generateDidName'
import { getDidDocFromName } from './utils/queryDidName'
Expand Down Expand Up @@ -56,23 +55,23 @@ async function main() {
const { mnemonic: verifierMnemonic, document: verifierDid } = await createDid(
authorIdentity
)
const verifierKeys = generateKeypairs(verifierMnemonic)
const verifierKeys = Cord.Utils.Keys.generateKeypairs(verifierMnemonic)
console.log(
`🏢 Verifier (${verifierDid.assertionMethod![0].type}): ${verifierDid.uri}`
)
// Create Holder DID
const { mnemonic: holderMnemonic, document: holderDid } = await createDid(
authorIdentity
)
const holderKeys = generateKeypairs(holderMnemonic)
const holderKeys = Cord.Utils.Keys.generateKeypairs(holderMnemonic)
console.log(
`👩‍⚕️ Holder (${holderDid.assertionMethod![0].type}): ${holderDid.uri}`
)
// Create issuer DID
const { mnemonic: issuerMnemonic, document: issuerDid } = await createDid(
authorIdentity
)
const issuerKeys = generateKeypairs(issuerMnemonic)
const issuerKeys = Cord.Utils.Keys.generateKeypairs(issuerMnemonic)
console.log(
`🏛 Issuer (${issuerDid?.assertionMethod![0].type}): ${issuerDid.uri}`
)
Expand All @@ -87,7 +86,7 @@ async function main() {
// Create Delegate One DID
const { mnemonic: delegateOneMnemonic, document: delegateOneDid } =
await createDid(authorIdentity)
const delegateOneKeys = generateKeypairs(delegateOneMnemonic)
const delegateOneKeys = Cord.Utils.Keys.generateKeypairs(delegateOneMnemonic)
console.log(
`🏛 Delegate (${delegateOneDid?.assertionMethod![0].type}): ${
delegateOneDid.uri
Expand All @@ -96,7 +95,7 @@ async function main() {
// Create Delegate Two DID
const { mnemonic: delegateTwoMnemonic, document: delegateTwoDid } =
await createDid(authorIdentity)
const delegateTwoKeys = generateKeypairs(delegateTwoMnemonic)
const delegateTwoKeys = Cord.Utils.Keys.generateKeypairs(delegateTwoMnemonic)
console.log(
`🏛 Delegate (${delegateTwoDid?.assertionMethod![0].type}): ${
delegateTwoDid.uri
Expand All @@ -105,7 +104,7 @@ async function main() {
// Create Delegate 3 DID
const { mnemonic: delegate3Mnemonic, document: delegate3Did } =
await createDid(authorIdentity)
const delegate3Keys = generateKeypairs(delegate3Mnemonic)
const delegate3Keys = Cord.Utils.Keys.generateKeypairs(delegate3Mnemonic)
console.log(
`🏛 Delegate (${delegate3Did?.assertionMethod![0].type}): ${
delegate3Did.uri
Expand Down
13 changes: 6 additions & 7 deletions demo/src/demo.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as Cord from '@cord.network/sdk'
import { UUID, Crypto } from '@cord.network/utils'
import { generateKeypairs } from './utils/generateKeypairs'
import { createDid } from './utils/generateDid'
import { createDidName } from './utils/generateDidName'
import { getDidDocFromName } from './utils/queryDidName'
Expand Down Expand Up @@ -78,23 +77,23 @@ async function main() {
const { mnemonic: verifierMnemonic, document: verifierDid } = await createDid(
authorIdentity
)
const verifierKeys = generateKeypairs(verifierMnemonic)
const verifierKeys = Cord.Utils.Keys.generateKeypairs(verifierMnemonic)
console.log(
`🏢 Verifier (${verifierDid.assertionMethod![0].type}): ${verifierDid.uri}`
)
// Create Holder DID
const { mnemonic: holderMnemonic, document: holderDid } = await createDid(
authorIdentity
)
const holderKeys = generateKeypairs(holderMnemonic)
const holderKeys = Cord.Utils.Keys.generateKeypairs(holderMnemonic)
console.log(
`👩‍⚕️ Holder (${holderDid.assertionMethod![0].type}): ${holderDid.uri}`
)
// Create issuer DID
const { mnemonic: issuerMnemonic, document: issuerDid } = await createDid(
authorIdentity
)
const issuerKeys = generateKeypairs(issuerMnemonic)
const issuerKeys = Cord.Utils.Keys.generateKeypairs(issuerMnemonic)
console.log(
`🏛 Issuer (${issuerDid?.assertionMethod![0].type}): ${issuerDid.uri}`
)
Expand All @@ -109,7 +108,7 @@ async function main() {
// Create Delegate One DID
const { mnemonic: delegateOneMnemonic, document: delegateOneDid } =
await createDid(authorIdentity)
const delegateOneKeys = generateKeypairs(delegateOneMnemonic)
const delegateOneKeys = Cord.Utils.Keys.generateKeypairs(delegateOneMnemonic)
console.log(
`🏛 Delegate (${delegateOneDid?.assertionMethod![0].type}): ${
delegateOneDid.uri
Expand All @@ -118,7 +117,7 @@ async function main() {
// Create Delegate Two DID
const { mnemonic: delegateTwoMnemonic, document: delegateTwoDid } =
await createDid(authorIdentity)
const delegateTwoKeys = generateKeypairs(delegateTwoMnemonic)
const delegateTwoKeys = Cord.Utils.Keys.generateKeypairs(delegateTwoMnemonic)
console.log(
`🏛 Delegate (${delegateTwoDid?.assertionMethod![0].type}): ${
delegateTwoDid.uri
Expand All @@ -127,7 +126,7 @@ async function main() {
// Create Delegate 3 DID
const { mnemonic: delegate3Mnemonic, document: delegate3Did } =
await createDid(authorIdentity)
const delegate3Keys = generateKeypairs(delegate3Mnemonic)
const delegate3Keys = Cord.Utils.Keys.generateKeypairs(delegate3Mnemonic)
console.log(
`🏛 Delegate (${delegate3Did?.assertionMethod![0].type}): ${
delegate3Did.uri
Expand Down
Loading
Loading