# broken-yar

> ![yar Logo](https://raw.github.com/walmartlabs/yar/master/images/yar.png)

Latest version **1.0.0** (published 2015-06-22) · ISC license · 0 weekly downloads

## Install

```sh
npm install broken-yar
pnpm add broken-yar
yarn add broken-yar
bun add broken-yar
```

## 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.0.0 |
| Published | 2015-06-22 |
| First published | 2015-06-22 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| Author | C.J. Winslow |
| Maintainers | whoaa |

## Links

- npm: https://www.npmjs.com/package/broken-yar
- npm.io page: https://npm.io/package/broken-yar

## Dependencies (2)

- [hoek](https://npm.io/package/hoek.md) ^0.6.2
- [node-uuid](https://npm.io/package/node-uuid.md) ^1.4.3

## Recent versions

- 1.0.0 (latest) — 2015-06-22

## README

<a href="https://github.com/walmartlabs/blammo"><img src="https://raw.github.com/walmartlabs/blammo/master/images/from.png" align="right" /></a>
![yar Logo](https://raw.github.com/walmartlabs/yar/master/images/yar.png)

A [**hapi**](https://github.com/walmartlabs/hapi) cookie jar

[![Build Status](https://secure.travis-ci.org/walmartlabs/yar.png)](http://travis-ci.org/walmartlabs/yar)

The ***yar*** plugin adds a simple way to set a persistant state (using an [Iron](https://github.com/hueniverse/iron) encrypted cookie) across requests.
It has support for session management - either stored on the client via cookie, in server memory, or using an external database (via custom storage code).

For example, the first handler sets the jar content and the second utilizes it:
```javascript
var handler1 = function () {

    this.plugins.yar = {
        key: 'value'
    };

    return this.reply();
};

var handler2 = function () {

    this.reply(this.state.yar.key);     // Will send back 'value'
};
```

The plugin requires a password for encryption, and the `ext` permission:
```javascript
var options = {
    permissions: {
        ext: true                   // Required
    },
    plugin: {
        name: 'yar' ,               // Optional, overrides cookie name. Defaults to 'yar'. Doesn't affect 'plugins.yar'.
        isSingleUse: false,         // Optional, clears jar after one request. Defaults to false.
        options: {
            password: 'password',   // Required
            isSecure: true          // Optional, any supported cookie options except `encoding`
        }
    }
};

var server = new Hapi.Server();

server.plugin().require('yar', options, function (err) { });
```

## Sessions

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