Skip to content
Open
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
2 changes: 1 addition & 1 deletion 3box-identities-ed25519/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"dependencies": {
"3box": "^1.21.0",
"@emotion/react": "11.0.0-next.12",
"@textile/hub": "^5.0.0",
"@textile/hub": "^5.0.1",
"ethers": "^5.0.8",
"react": "^16.13.1",
"react-dom": "^16.13.1",
Expand Down
9 changes: 9 additions & 0 deletions basic-es-modules/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
See full [README.md here](../README.md).

Remember to edit `index.html` to include your Hub API key:

```javascript
...
const client = await Client.withKeyInfo({ key: 'HUB API KEY HERE' })
...
```
37 changes: 37 additions & 0 deletions basic-es-modules/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8" />
<title>Textile ES Modules</title>
</head>

<body>
<script type="module">
import { Client, PrivateKey } from "https://unpkg.com/@textile/hub?module";

// Example identity only. Your users should have their own private keys
const PrivateKeyIdentity = 'bbaareqhvbkss57bqe7u2jz3hmoitqntbbdflalqbnmtpm7t7yq7ee5rhyvre23iivcvttvguhghjt2ht4i2dan7zak7v7h55yblnd5cbwe3m2';

// Setup the user's PrivateKey identity
const identity = PrivateKey.fromString(PrivateKeyIdentity);
const h1 = document.createElement('h1');
h1.textContent = identity.public.toString();
document.body.appendChild(h1);

async function createAndAuthenticate() {
// Connect to the API with hub keys.
// Use withUserAuth for production.
const client = await Client.withKeyInfo({ key: 'HUB API KEY HERE' });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we encourage this pattern in a webpage?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly... no. But I'm not sure what the simple alternative is?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we could do an example on glitch or elsewhere. someplace where we can demo the use of the secret + simple token flow on npm.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeh good idea, even observablehq would work if we wanted to make others use their own secrets.

// Authorize the user to access your Huh api
return client.getToken(identity);
// Now we're authenticated... start creating buckets or threaddb updates!
}

createAndAuthenticate().then((token) => {
console.log(token)
});
</script>
</body>

</html>
2 changes: 1 addition & 1 deletion bucket-photo-gallery/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@textile/hub": "^5.0.0",
"@textile/hub": "^5.0.1",
"@types/jdenticon": "^2.2.0",
"browser-image-resizer": "^2.1.0",
"browser-image-size": "^1.1.0",
Expand Down
2 changes: 1 addition & 1 deletion hub-browser-auth-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"license": "MIT",
"dependencies": {
"@koa/cors": "^3.1.0",
"@textile/hub": "^5.0.0",
"@textile/hub": "^5.0.1",
"dotenv": "^8.2.0",
"emittery": "^0.7.0",
"jdenticon": "^2.2.0",
Expand Down
2 changes: 1 addition & 1 deletion metamask-identities-ed25519/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"dependencies": {
"@emotion/react": "11.0.0-next.12",
"@textile/hub": "^5.0.0",
"@textile/hub": "^5.0.1",
"@types/bcryptjs": "^2.4.2",
"bcryptjs": "^2.4.3",
"ethers": "^5.0.8",
Expand Down
2 changes: 1 addition & 1 deletion react-native-hub-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"bind": "adb reverse tcp:3007 tcp:3007"
},
"dependencies": {
"@textile/hub": "^5.0.0",
"@textile/hub": "^5.0.1",
"bad-words": "^3.0.3",
"buffer": "^4.9.2",
"events": "^3.1.0",
Expand Down
2 changes: 1 addition & 1 deletion simple-auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"eslint-plugin-promise": "^4.2.1"
},
"dependencies": {
"@textile/hub": "^5.0.0",
"@textile/hub": "^5.0.1",
"dotenv": "^8.2.0"
}
}
2 changes: 1 addition & 1 deletion user-mailbox-setup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"dependencies": {
"@emotion/react": "11.0.0-next.12",
"@textile/hub": "^5.0.0",
"@textile/hub": "^5.0.1",
"ethers": "^5.0.8",
"react": "^16.13.1",
"react-dom": "^16.13.1",
Expand Down