# identix-sso-client-js

> Identix.Space SSO Client JS

Latest version **2.0.1** (published 2023-04-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install identix-sso-client-js
pnpm add identix-sso-client-js
yarn add identix-sso-client-js
bun add identix-sso-client-js
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2023-04-28 |
| First published | 2022-04-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 35.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | uxname |
| Maintainers | uxname |

## Links

- npm: https://www.npmjs.com/package/identix-sso-client-js
- npm.io page: https://npm.io/package/identix-sso-client-js

## Dependencies (3)

- [typescript](https://npm.io/package/typescript.md) ^4.6.3
- [@noble/ed25519](https://npm.io/package/@noble/ed25519.md) ^1.6.0
- [graphql-request](https://npm.io/package/graphql-request.md) ^4.2.0

## Recent versions

- 2.0.1 (latest) — 2023-04-28
- 2.0.0 — 2023-04-28
- 1.2.1 — 2022-09-27
- 1.2.0 — 2022-08-10
- 1.1.2 — 2022-05-05
- 1.1.1 — 2022-05-01
- 1.1.0 — 2022-05-01
- 1.0.6 — 2022-05-01
- 1.0.5 — 2022-04-18
- 1.0.4 — 2022-04-16
- 1.0.3 — 2022-04-16
- 1.0.2 — 2022-04-16
- 1.0.1 — 2022-04-15
- 1.0.0 — 2022-04-15

## README

![](https://i.imgur.com/zWpiqag.png)

Identix SSO Client JS. Typescript supported.

## License

This code licensed under MIT license.

[![MIT License](https://img.shields.io/apm/l/atomic-design-ui.svg?)](https://github.com/tterb/atomic-design-ui/blob/master/LICENSEs)

## Installation

Install client with npm

```bash
npm install identix-sso-client-js
```

## Usage/Examples

### Client authentication

```javascript
import {SsoService} from "identix-sso-client-js";

const ssoService = new SsoService('https://sso-api-dev.identix.space/graphql');
const clientDid = 'did:ever:123456';
const otcDid = await ssoService.requestClientLogin(clientDid)
const signedOtcDid = 'signed_' + otcDid;
const sessionTokenDid = await ssoService.attemptClientLogin(clientDid, signedOtcDid);
console.log(sessionTokenDid);
```

### User authentication

```javascript
try {
    await ssoService.validateUserSession(sessionTokenDid, userSessionDid);
} catch (e) {
    console.log(e); // User session is invalid
}
const user = await ssoService.getCurrentUserInfo(sessionTokenDid, userSessionDid);
console.log(user);
```

### Sign / verify data

```javascript

const message = 'Hello World';
const privateKey: string = ED25519Signer.Uint8ArrayToHex(ed.utils.randomPrivateKey());
const publicKey: string = ED25519Signer.Uint8ArrayToHex(await ed.getPublicKey(privateKey));

const signature = await ED25519Signer.signMessage({
    message,
    privateKey
});
console.log({signature});

const isValid = await ED25519Signer.verifyMessage({
    message,
    signature,
    publicKey
});
console.log({isValid});
```

---
_Source: https://npm.io/package/identix-sso-client-js · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
