Skip to content
This repository has been archived by the owner on Aug 26, 2024. It is now read-only.

Commit

Permalink
Modify sample to use did:dht instead of did:ion (#22)
Browse files Browse the repository at this point in the history
* update relative path in readme

* update pfi did method ion to dht

* publish did

* adding me and kirah to codeowners

* update example script did methods ion to dht

* set publish true

---------

Co-authored-by: Jiyoon Koo <[email protected]>
  • Loading branch information
kirahsapong and jiyoontbd authored Feb 7, 2024
1 parent c516f7d commit 976967b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ based on your OS' package manager.
> Make sure you have all the [prerequisites](#development-prerequisites)
1. Clone the repo and `cd` into the project directory
2. `/db/scripts/start-pg` from your command line to start a `psql` container by
2. `./db/scripts/start-pg` from your command line to start a `psql` container by
running.
3. `./db/scripts/migrate` to perform database migrations
* This only needs to be done once and then whenever changes are made in
Expand Down
3 changes: 2 additions & 1 deletion src/client-test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { TbdexHttpClient, DevTools, Rfq } from '@tbdex/http-client'
import { DidDhtMethod } from '@web5/dids'
import fs from 'fs/promises'

//
Expand Down Expand Up @@ -101,7 +102,7 @@ async function createOrLoadDid(filename: string) {
} catch (error) {
// If the file doesn't exist, generate a new DID
if (error.code === 'ENOENT') {
const did = await DevTools.createDid()
const did = await DidDhtMethod.create({ publish: true })
await fs.writeFile(filename, JSON.stringify(did, null, 2))
return did
}
Expand Down
6 changes: 3 additions & 3 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import fs from 'node:fs'

import 'dotenv/config'

import { DidIonMethod, PortableDid } from '@web5/dids'
import { PortableDid, DidDhtMethod } from '@web5/dids'

export type Environment = 'local' | 'staging' | 'production'

Expand Down Expand Up @@ -39,11 +39,11 @@ export const config: Config = {
// a new one will be generated every time the process starts.
if (!config.did) {
console.log('Creating an ephemeral DID.....')
const DidIon = await DidIonMethod.create({
const DidDht = await DidDhtMethod.create({ publish: true,
services: [{ id: 'pfi', type: 'PFI', serviceEndpoint: config.host }]
})


config.did = DidIon
config.did = DidDht
fs.writeFileSync('server-did.txt', config.did.did)
}
4 changes: 2 additions & 2 deletions src/example/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DevTools } from '@tbdex/http-client'
import { DidDhtMethod } from '@web5/dids'
import fs from 'fs/promises'


Expand All @@ -11,7 +11,7 @@ export async function createOrLoadDid(filename: string) {
} catch (error) {
// If the file doesn't exist, generate a new DID
if (error.code === 'ENOENT') {
const did = await DevTools.createDid()
const did = await DidDhtMethod.create({ publish: true })
await fs.writeFile(filename, JSON.stringify(did, null, 2))
return did
}
Expand Down

0 comments on commit 976967b

Please sign in to comment.