@humaneworld/auth 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -0
- package/package.json +34 -0
- package/src/index.js +9 -0
package/README.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# @humaneworld/auth
|
|
2
|
+
|
|
3
|
+
HUMANE authentication — decentralized identity for any application.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install @humaneworld/auth
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```javascript
|
|
12
|
+
import { HumaneAuthWidget, generateChallenge, verifySignature } from '@humaneworld/auth'
|
|
13
|
+
|
|
14
|
+
// Check if user has a HUMANE identity
|
|
15
|
+
const humane = new HumaneAuthWidget()
|
|
16
|
+
const hasIdentity = await humane.hasIdentity()
|
|
17
|
+
|
|
18
|
+
// Sign a challenge
|
|
19
|
+
const challenge = generateChallenge()
|
|
20
|
+
const signature = await humane.sign(challenge, did, { siteName: 'Your App' })
|
|
21
|
+
|
|
22
|
+
// Verify on your server
|
|
23
|
+
const valid = await verifySignature(challenge, signature, publicKeyHex)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Full documentation: [humaneworld.network/developers](https://humaneworld.network/developers)
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@humaneworld/auth",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "HUMANE authentication — decentralized identity for any application",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./src/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"src/",
|
|
12
|
+
"README.md"
|
|
13
|
+
],
|
|
14
|
+
"keywords": [
|
|
15
|
+
"humane",
|
|
16
|
+
"did",
|
|
17
|
+
"decentralized-identity",
|
|
18
|
+
"authentication",
|
|
19
|
+
"passwordless",
|
|
20
|
+
"ed25519",
|
|
21
|
+
"web3",
|
|
22
|
+
"identity"
|
|
23
|
+
],
|
|
24
|
+
"author": "Owyn <hello@humaneworld.network>",
|
|
25
|
+
"license": "Apache-2.0",
|
|
26
|
+
"homepage": "https://humaneworld.network/developers",
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "https://github.com/svendijkstra-lab/humane-did"
|
|
30
|
+
},
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public"
|
|
33
|
+
}
|
|
34
|
+
}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @humaneworld/auth
|
|
3
|
+
* HUMANE authentication — decentralized identity for any application
|
|
4
|
+
* https://humaneworld.network/developers
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export { HumaneAuthWidget } from './widget.js'
|
|
8
|
+
export { verifySignature, generateChallenge } from './crypto.js'
|
|
9
|
+
export { resolveDID } from './resolver.js'
|