# authcrypto

> Create json-based token, encrypt/decrypt token at other server

Latest version **1.1.0** (published 2015-10-20) · ISC license · 0 weekly downloads

## Install

```sh
npm install authcrypto
pnpm add authcrypto
yarn add authcrypto
bun add authcrypto
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2015-10-20 |
| First published | 2015-06-29 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | isuvorov |
| Maintainers | isuvorov |
| Keywords | json, token, encrypt, decrypt |

## Links

- npm: https://www.npmjs.com/package/authcrypto
- Repository: https://github.com/isuvorov/authcrypto
- Issues: https://github.com/isuvorov/authcrypto/issues
- npm.io page: https://npm.io/package/authcrypto

## Dependencies (2)

- [crypto](https://npm.io/package/crypto.md) 0.0.3
- [2dollars](https://npm.io/package/2dollars.md) ^1.0.0

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.1.0 (latest) — 2015-10-20
- 1.0.2 — 2015-06-29
- 1.0.1 — 2015-06-29
- 1.0.0 — 2015-06-29

## README

# AuthCrypto
Create json-based token, encrypt/decrypt token at other server

## Usage Example
```coffee

###
  Primary-Server
  server1.com
###
AuthCrypto = require "authcrypto"
AuthCrypto.password = "MySercretP@ssword"

HomeController =
  adminExampleAtServer2:
    userData =
      id: req.user.id
      username: req.user.id + "@server1.com"
      name: req.user.getFullName()
      avatar: req.user.getAvatar()
      role: req.user.role || "user"

    token = AuthCrypto.encrypt userData
    url = "http://server2.com/auth/crypto?redirect=/admin/example&token=" + token
    return res.redirect url

###
  Slave-Server
  server2.com
###
AuthCrypto = require "authcrypto"
AuthCrypto.password = "MySercretP@ssword"

AdminController =
  example:  (req, res) ->
    return res.badRequest {err: "auth"} if !req.user
    return res.json {secret:"information"}

AuthController =
  crypto: (req, res) ->
    converter = ()->
      return {
        id: rawData.username
        fullname: rawData.name
        image: rawData.avatar
        role: if rawData.role == 'root' then 'admin' : 'user'
      }
    AuthCrypto.controller req, res, User, converter
```

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