-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: documentation and metadata for use-auth-client (#914)
- Loading branch information
Showing
6 changed files
with
79 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# @dfinity/use-auth-client | ||
|
||
`@dfinity/use-auth-client`! This is a package for Internet Computer React developers, making it easier to integrate the auth-client with your React application. | ||
|
||
You can use it to manage your identity for you, or you can pass it an `idlFactory` and `canisterId` and it will construct and manage your entire `Actor` for you. | ||
|
||
To install, use | ||
``` | ||
npm install @dfinity/use-auth-client | ||
``` | ||
|
||
and you can import and set it up like so: | ||
|
||
``` | ||
import {useAuthClient} from '@dfinity/use-auth-client'; | ||
...ts | ||
const App = () => { | ||
const identityProvider = | ||
// eslint-disable-next-line no-undef | ||
process.env.DFX_NETWORK === 'local' | ||
? // eslint-disable-next-line no-undef | ||
`http://${process.env.CANISTER_ID_INTERNET_IDENTITY}.localhost:4943` | ||
: 'https://identity.ic0.app'; | ||
const { isAuthenticated, login, logout, actor } = useAuthClient({ | ||
loginOptions: { | ||
identityProvider, | ||
}, | ||
actorOptions: { | ||
canisterId, | ||
idlFactory, | ||
}, | ||
}); | ||
... | ||
} | ||
``` | ||
|
||
There is a live demo at https://5ibdo-haaaa-aaaab-qajia-cai.icp0.io/ | ||
|
||
Additional generated documentaion is available at https://agent-js.icp.xyz/use-auth-client/index.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,11 +7,39 @@ | |
"unpkg": "./lib/esm/index", | ||
"scripts": { | ||
"build": "tsc -b && tsc -p tsconfig-cjs.json", | ||
"make:docs/reference": "typedoc src/index.ts --out ../../docs/use-auth-client --excludeInternal", | ||
"test": "jest" | ||
}, | ||
"keywords": [], | ||
"author": "Kai Peacock", | ||
"license": "ISC", | ||
"keywords": [ | ||
"internet computer", | ||
"internet-computer", | ||
"ic", | ||
"dfinity", | ||
"agent", | ||
"actor", | ||
"dfx", | ||
"canister", | ||
"candid", | ||
"motoko", | ||
"javascript", | ||
"typescript", | ||
"blockchain", | ||
"crypto", | ||
"distributed", | ||
"api", | ||
"sdk" | ||
], | ||
"bugs": { | ||
"url": "https://github.com/dfinity/agent-js/issues" | ||
}, | ||
"author": "DFINITY Stiftung <[email protected]>", | ||
"license": "Apache-2.0", | ||
"homepage": "https://internetcomputer.org", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/dfinity/agent-js.git", | ||
"directory": "packages/use-auth-client" | ||
}, | ||
"dependencies": { | ||
"@dfinity/agent": "^2.0.0", | ||
"@dfinity/auth-client": "^2.0.0", | ||
|
@@ -32,6 +60,7 @@ | |
"babel-jest": "^29.7.0", | ||
"fake-indexeddb": "^6.0.0", | ||
"jest": "^29.7.0", | ||
"typedoc": "^0.26.5", | ||
"vitest": "^2.0.5" | ||
}, | ||
"optionalDependencies": { | ||
|