Skip to content

Commit

Permalink
feat(examples): add browser sdk integration example - keys and dids (#14
Browse files Browse the repository at this point in the history
)
  • Loading branch information
milosh86 authored Mar 10, 2023
1 parent 54579e5 commit 4cd0e75
Show file tree
Hide file tree
Showing 17 changed files with 479 additions and 126 deletions.
1 change: 1 addition & 0 deletions domain/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ export * from "./DIDUrl";
export * from "./PrismDIDMethodId";
export * from "./DIDResolver";
export * from "./PeerDID";
export * from "./WordList";
export type JsonString = string;
21 changes: 5 additions & 16 deletions examples/browser-ts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Polyfills
Using SDK in browser requires some polyfills.
- `npm install assert util buffer`
- import `polyfills.ts` in `src/index.tsx`
- add "stream": "npm:stream-browserify@3.0.0" as a dependency in `package.json`
## Available Scripts

In the project directory, you can run:
Expand All @@ -28,19 +33,3 @@ The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `npm run eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).
139 changes: 123 additions & 16 deletions examples/browser-ts/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions examples/browser-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,14 @@
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"assert": "^2.0.0",
"buffer": "^6.0.3",
"jose": "^4.13.1",
"jotai": "^2.0.3",
"prettier": "^2.8.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"stream": "npm:[email protected]",
"typescript": "^4.9.5",
"util": "^0.12.5",
"web-vitals": "^2.1.4"
Expand Down
36 changes: 1 addition & 35 deletions examples/browser-ts/src/App.css
Original file line number Diff line number Diff line change
@@ -1,38 +1,4 @@
.App {
text-align: center;
}

.App-logo {
height: 40vmin;
pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
.App-logo {
animation: App-logo-spin infinite 20s linear;
}
}

.App-header {
background-color: #282c34;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}

.App-link {
color: #61dafb;
}

@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
padding: 20px 40px;
}
9 changes: 0 additions & 9 deletions examples/browser-ts/src/App.test.tsx

This file was deleted.

Loading

0 comments on commit 4cd0e75

Please sign in to comment.