Skip to content

Commit

Permalink
docs: Updated examples to use SecretBox
Browse files Browse the repository at this point in the history
  • Loading branch information
simonas-notcat committed Apr 24, 2020
1 parent b8cbdd4 commit f55b712
Show file tree
Hide file tree
Showing 8 changed files with 373 additions and 362 deletions.
8 changes: 5 additions & 3 deletions examples/expressjs-ethr/src/framework.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ import { DafUniversalResolver } from 'daf-resolver-universal'
import * as Daf from 'daf-core'
import { JwtMessageHandler } from 'daf-did-jwt'
import * as EthrDid from 'daf-ethr-did'
import * as DafLibSodium from 'daf-libsodium'
import { KeyManagementSystem, SecretBox } from 'daf-libsodium'
import { W3cMessageHandler, W3cActionHandler } from 'daf-w3c'
import { SdrMessageHandler, SdrActionHandler } from 'daf-selective-disclosure'
import { DIDCommMessageHandler, DIDCommActionHandler } from 'daf-did-comm'
import { UrlMessageHandler } from 'daf-url'
import { createConnection } from 'typeorm'

const infuraProjectId = process.env.DAF_INFURA_ID ?? '5ffc47f65c4042ce847ef66a3fa70d4c'
const infuraProjectId = '5ffc47f65c4042ce847ef66a3fa70d4c'
// Generate this by running `npx daf-cli crypto -s`
const secretKey = '29739248cad1bd1a0fc4d9b75cd4d2990de535baf5caadfdf8d8f86664aa830c'

// DID Document Resolver
let didResolver: Daf.Resolver = new DafResolver({
Expand All @@ -35,7 +37,7 @@ const dbConnection = createConnection({
const identityProviders = [
new EthrDid.IdentityProvider({
identityStore: new Daf.IdentityStore('rinkeby-ethr', dbConnection),
kms: new DafLibSodium.KeyManagementSystem(new Daf.KeyStore(dbConnection)),
kms: new KeyManagementSystem(new Daf.KeyStore(dbConnection, new SecretBox(secretKey))),
network: 'rinkeby',
rpcUrl: 'https://rinkeby.infura.io/v3/' + infuraProjectId,
}),
Expand Down
Loading

0 comments on commit f55b712

Please sign in to comment.