@ldclabs/ic-auth 0.1.2 → 0.1.3

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.
Files changed (2) hide show
  1. package/README.md +53 -4
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,14 +1,63 @@
1
- # `@ldclabs/ic-auth`
2
- ![License](https://img.shields.io/crates/l/ic-auth.svg)
1
+ # @ldclabs/ic-auth
2
+ ![License](https://img.shields.io/npm/l/@ldclabs/ic-auth)
3
3
  [![Test](https://github.com/ldclabs/ic-auth/actions/workflows/test.yml/badge.svg)](https://github.com/ldclabs/ic-auth/actions/workflows/test.yml)
4
4
  [![NPM version](http://img.shields.io/npm/v/@ldclabs/ic-auth.svg)](https://www.npmjs.com/package/@ldclabs/ic-auth)
5
5
 
6
6
  [IC-Auth](https://github.com/ldclabs/ic-auth) is a comprehensive web authentication system based on the Internet Computer (ICP) identity.
7
7
 
8
- `@ldclabs/ic-auth` is the Typescript version of the client SDK for the ic-auth.
8
+ `@ldclabs/ic-auth` is the client-side TypeScript SDK for `ic-auth`, providing essential utilities for identity management and data serialization.
9
+
10
+ ## Installation
11
+
12
+ Install the package using your favorite package manager:
13
+
14
+ ```bash
15
+ npm install @ldclabs/ic-auth
16
+ ```
17
+
18
+ or
19
+
20
+ ```bash
21
+ yarn add @ldclabs/ic-auth
22
+ ```
23
+
24
+ This package has peer dependencies on several `@dfinity` packages, which you should also have in your project.
25
+
26
+ ```json
27
+ "peerDependencies": {
28
+ "@dfinity/candid": ">=3.2.0",
29
+ "@dfinity/agent": ">=3.2.0",
30
+ "@dfinity/identity": ">=3.2.0",
31
+ "@dfinity/principal": ">=3.2.0",
32
+ "@noble/hashes": ">=1.8.0",
33
+ "cborg": ">=4.2.0"
34
+ }
35
+ ```
36
+
37
+ ## Usage
38
+
39
+ Here is a basic example of how to use the library to create a custom identity and sign a message.
40
+
41
+ ```typescript
42
+ import { DelegationIdentity, Ed25519KeyIdentity, toDelegationIdentity, signCborMessage } from '@ldclabs/ic-auth';
43
+
44
+ async function main() {
45
+ // 1. Create a base identity (e.g., from a private key)
46
+ const baseIdentity = Ed25519KeyIdentity.generate();
47
+
48
+ // 2. Create an AuthIdentity
49
+ const authIdentity = toDelegationIdentity(baseIdentity);
50
+
51
+ // 4. Sign a message (e.g., a challenge from the backend)
52
+ const message = { challenge: 'Hello, world!' };
53
+ const signedEnvelope = await signCborMessage.signCborMessage(message);
54
+ }
55
+
56
+ main();
57
+ ```
9
58
 
10
59
  ## License
11
60
 
12
61
  Copyright © 2024-2025 [LDC Labs](https://github.com/ldclabs).
13
62
 
14
- Licensed under the MIT License. See [LICENSE](../../LICENSE-MIT) for details.
63
+ Licensed under the MIT License. See [LICENSE](../../LICENSE-MIT) for details.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ldclabs/ic-auth",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "type": "module",
5
5
  "description": "The Typescript version of the client SDK for the IC Auth.",
6
6
  "license": "MIT",