open-index/open-npm huggingface dataset:
npm package: @oslojs/asn1
Description: Encode and decode ASN.1 DER
Author: pilcrowOnPaper
Latest version: 1.0.0

# @oslojs/asn1

**Documentation: https://asn1.oslojs.dev**

A JavaScript library for encoding and decoding ASN.1 with Distinguished Encoding Rules (DER) by [Oslo](https://oslojs.dev).

- Runtime-agnostic
- No third-party dependencies
- Fully typed

```ts
import { parseASN1NoLeftoverBytes } from "@oslojs/asn1";

const parsed = parseASN1NoLeftoverBytes(encoded);
const oid = parsed.sequence().at(0).objectIdentifier();
if (!oid.is("1.2.840.10045.4.3.2")) {
	throw new Error("Invalid OID");
}
```

> This library only supports DER and not CER or BER.

## Installation

```
npm i @oslojs/asn1
```
npm package: @oslojs/binary
Description: Basic primitives for working with binary data
Author: pilcrowOnPaper
Latest version: 1.0.0

# @oslojs/binary

**Documentation: https://binary.oslojs.dev**

A JavaScript library for working with binary data by [Oslo](https://oslojs.dev).

Alongside [`@oslojs/encoding`](https://encoding.oslojs.dev) and [`@oslojs/crypto`](https://crypto.oslojs.dev), it aims to provide a basic toolbox for implementing auth and auth-related standards.

## Installation

```
npm i @oslojs/binary
```
npm package: @oslojs/cbor
Description: CBOR library
Author: pilcrowOnPaper
Latest version: 1.0.0

# @oslojs/cbor

**Documentation: https://cbor.oslojs.dev**

A CBOR library for JavaScript based on [RFC 8949](https://datatracker.ietf.org/doc/html/rfc8949).

- Runtime agnostic
- No third-party dependencies
- Fully typed

```ts
import { decodeCBORToNativeValueNoLeftoverBytes } from "@oslojs/cbor";

const MAX_DEPTH = 10;
const encoded = new Uint8Array([
	0xa1, 0x67, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x65, 0x68, 0x65, 0x6c, 0x6c, 0x6f
]);
const result = decodeCBORToNativeValueNoLeftoverBytes(encoded, MAX_DEPTH) as Result;
const message: string = result.message;

interface Result {
	message: string;
}
```

> This package currently only supports decoding

## Installation

```
npm i @oslojs/cbor
```
npm package: @oslojs/crypto
Description: A very basic crypto library
Author: pilcrowOnPaper
Latest version: 1.0.1

# @oslojs/crypto documentation

**Documentation: https://crypto.oslojs.dev**

A basic JavaScript crypto library by [Oslo](https://oslojs.dev). Includes APIs for SHA-1, SHA-2, SHA-3, HMAC, ECDSA, RSA, and cryptographically secure random generator.

- Runtime-agnostic
- No third-party dependencies
- Fully typed

Algorithms such as SHA and ECDSA are tested against NIST test vectors.

## Installation

```
npm i @oslojs/crypto
```
npm package: @oslojs/encoding
Description: Runtime-agnostic library for encoding and decoding data
Author: pilcrowOnPaper
Latest version: 1.1.0

# @oslojs/encoding

**Documentation: https://encoding.oslojs.dev**

A JavaScript library for encoding and decoding data with hexadecimal, base32, base64, and base64url encoding schemes based on [RFC 4648](https://datatracker.ietf.org/doc/html/rfc4648). Implementations may be stricter than most to follow the RFC as close as possible.

- Runtime-agnostic
- No third-party dependencies
- Fully typed

```ts
import { encodeBase64, decodeBase64 } from "@oslojs/encoding";

const data: Uint8Array = new TextEncoder().encode("hello world");
const encoded = encodeBase64(data);
const decoded = decodeBase64(encoded);
```

## Installation

```
npm i @oslojs/encoding
```
npm package: @oslojs/jwt
Description: Parse and encoding JSON web tokens
Author: pilcrowOnPaper
Latest version: 0.3.0

# @oslojs/jwt

**Documentation: https://jwt.oslojs.dev**

A JavaScript library for parsing and encoding JSON web tokens (JWT) by [Oslo](https://oslojs.dev). Only signed tokens are supported.

- Runtime-agnostic
- No third-party dependencies
- Fully typed

```ts
import { parseJWT, JWSRegisteredHeaders, JWTRegisteredClaims, joseAlgorithmHS256 } from "@oslojs/jwt";

const [header, payload, signature] = parseJWT(jwt);
const headerParameters = new JWSRegisteredHeaders(header);
if (header.algorithm() !== joseAlgorithmHS256) {
	throw new Error("Unsupported algorithm");
}
const claims = new JWTRegisteredClaims(payload);
if (!claims.verifyExpiration()) {
	throw new Error("Expired token");
}
if (claims.hasNotBefore() && !claims.verifyNotBefore()) {
	throw new Error("Invalid token");
}
```

## Installation

```
npm i @oslojs/jwt
```
npm package: @oslojs/oauth2
Description: A runtime-agnostic OAuth 2.0 library
Author: pilcrowOnPaper
Latest version: 0.5.0

# @oslojs/oauth2

**Documentation: https://oauth2.oslojs.dev**

A small JavaScript library for parsing OAuth 2.0 token, token revocation, and device authorization responses by [Oslo](https://oslojs.dev).

This package follows [RFC 6749](https://datatracker.ietf.org/doc/html/rfc6749), [RFC 7009](https://datatracker.ietf.org/doc/html/rfc7009), and [RFC 8628](https://datatracker.ietf.org/doc/html/rfc8628).

- Runtime-agnostic
- No third-party dependencies
- Fully typed

```ts
import { TokenRequestResult } from "@oslojs/oauth2";

const response = await fetch("https://github.com/login/oauth/access_token", {
	method: "POST",
	body,
	headers
});
const data = await response.json();
if (typeof data !== "object" || data === null) {
	throw new Error("Unexpected response");
}
const result = new TokenRequestResult(data);
if (result.hasErrorCode()) {
	const error = result.errorCode();
	throw new Error(`Request failed: ${error}`);
}
const accessToken = result.accessToken();
const accessTokenExpiresAt = result.accessTokenExpiresAt();
const refreshToken = result.refreshToken();
```

## Installation

```
npm i @oslojs/oauth2
```
npm package: @oslojs/otp
Description: One-time passwords with HOTP and TOTP
Author: pilcrowOnPaper
Latest version: 1.1.0

# @oslojs/otp

**Documentation: https://otp.oslojs.dev**

A JavaScript library for generating and verifying OTPs by [Oslo](https://oslojs.dev).

Supports HMAC-based one-time passwords (HOTP) and time-based one-time passwords (TOTP) as defined in [RFC 4226](https://datatracker.ietf.org/doc/html/rfc4226) and [RFC 6238](https://datatracker.ietf.org/doc/html/rfc6238).

- Runtime-agnostic
- No third-party dependencies
- Fully typed

```ts
import { generateTOTP, verifyTOTP } from "@oslojs/otp";

const totp = generateTOTP(key, 30, 6);
const valid = verifyTOTP(totp, key, 30, 6);
```

## Installation

```
npm i @oslojs/otp
```
npm package: @oslojs/webauthn
Description: Parse and verify Web Authentication data
Author: pilcrowOnPaper
Latest version: 1.0.0

# @oslojs/webauthn

**Documentation: https://webauthn.oslojs.dev**

A JavaScript library for working with the Web Authentication API on the server by [Oslo](https://oslojs.dev).

- Runtime-agnostic
- No third-party dependencies
- Fully typed

```ts
import { parseAttestationObject, COSEKeyType, coseAlgorithmES256 } from "@oslojs/webauthn";

const { attestationStatement, authenticatorData } = await parseAttestationObject(encoded);
if (!authenticatorData.userPresent || !authenticatorData.userVerified) {
	throw new Error("User must be verified");
}

if (!authenticatorData.verifyRelyingPartyIdHash("example.com")) {
	throw new Error("Invalid relying party ID hash");
}
if (authenticatorData.credential === null) {
	throw new Error("Expected credential");
}
if (authenticatorData.credential.publicKey.type() !== COSEKeyType.EC2) {
	throw new Error("Unsupported algorithm");
}
if (authenticatorData.credential.publicKey.algorithm() !== coseAlgorithmES256) {
	throw new Error("Unsupported algorithm");
}
const publicKey = authenticatorData.credential.publicKey.ec2();
```

This package currently does not support attestation extensions and also does not provide APIs for verifying attestation statements (e.g FIDO-U2F, TPM).

## Installation

```
npm i @oslojs/webauthn
```
npm package: @oslokommune/cookie-manager
Description: Cookie manager for Oslo kommune
Author: Utviklings- og kompetanseetaten - Oslo kommune
Latest version: 1.1.0

# Cookie Manager

## Install
`npm install @oslokommune/cookie-manager`

## Getting started
```js
import { CookieManager, CookieEvents } from '@oslokommune/cookie-manager'

CookieManager.setCookie(cookie: CookieInterface);
CookieManager.getCookie(name: string);
CookieManager.deleteCookie(name: string);

// Add listener
CookieEvents.on('CookieManager.setCookie', callback);
CookieEvents.on('CookieManager.getCookie', callback);
CookieEvents.on('CookieManager.deleteCookie', callback);
// Remove listener
CookieEvents.off('CookieManager.setCookie', callback);
// Listen once
CookieEvents.once('CookieManager.setCookie', callback);
```
npm package: @oslokommune/oslo-designsystem
Description: Oslo Designsystem
Author: Utviklings- og kompetanseetaten - Oslo kommune
Latest version: 3.3.0

<div align="center">

![Oslo Designsystem Banner](./src/assets/images/oslo-header.svg)

</div>
<h1 align="center">Oslo Designsystem</h1>

<div align="center">

![Version](https://img.shields.io/badge/Version-3.3.0-blue?style=for-the-badge&logo=rocket&label=Version)
[![License](https://img.shields.io/badge/License-MIT-green?style=for-the-badge&logo=open-source-initiative&label=License)](https://opensource.org/licenses/MIT)
[![JavaScript](https://img.shields.io/badge/JS-F7DF1E?style=for-the-badge&logo=javascript&logoColor=ffffff&label=JavaScript)](https://developer.mozilla.org/en-US/docs/Web/JavaScript)
[![Vue](https://img.shields.io/badge/Vue-3.x-green?style=for-the-badge&logo=vue.js&label=Vue)](https://vuejs.org/)
[![SCSS](https://img.shields.io/badge/SCSS-CC6699?style=for-the-badge&logo=sass&logoColor=ffffff&label=Sassy)](https://sass-lang.com/)

</div>

Welcome to `Oslo Designsystem` a complete library for styles and components used in Oslo kommune.

## 📚 Table of Contents

- **🎯 [Description](#-description)**
- **🚀 [Installation](#-installation)**
- **📑 [Documentation](#-documentation)**
- **🤝 [Contribution Guidelines](#-contribution)**
- **📜 [License](#-license)**
- **📬 [Contact](#-contact)**

## 🎯 Description

`Oslo Designsystem` is a collection of reusable components, guided by clear standards. Designed with functionality, accessibility and aesthetic in mind, it serves as a unifying building block for all projects in Oslo kommune.

## 🚀 Installation

```bash
npm install @oslokommune/oslo-designsystem
```

## 📑 Documentation

Please take a look at the [documentation](https://designsystem.oslo.kommune.no/#/getting_started-basics) if you want a complete understanding on how to use `Oslo Designsystem`.

## 🤝 Contribution

If you would like to contribute to this project, please take a look at our [contribute](https://designsystem.oslo.kommune.no/#/getting_started-contribute-basics) page for more information.

## 📜 License

Oslo Designsystem is distributed under a MIT-license for open source code.

[![License](https://img.shields.io/badge/License-MIT-green?style=for-the-badge&logo=open-source-initiative&label=Open%20Source)](https://opensource.org/licenses/MIT)

## 📬 Contact

Slack: [Oslo kommune](https://oslokommune.slack.com)

Join the #oslodesignsystem channel

devnull@uke.oslo.kommune.no

[Github - Oslo Designsystem](https://github.com/oslokommune/ukeweb_designsystem)

Made with ♥ by </br>
Team Devnull @ Utviklings- og kompetanseetaten
npm package: @oslokommune/oslo-designsystem-cli
Description: Oslo kommune - Oslo designsystem - CLI verktøy
Author: Ole Aasen
Latest version: 0.0.8
Deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

## Bruk av @oslokommune/oslo-designsystem-cli

<a href="https://www.npmjs.com/package/@oslokommune/oslo-designsystem-cli" target="_blank"><img src="https://img.shields.io/npm/v/@oslokommune/oslo-designsystem-cli?logo=node.js&label=cli&style=for-the-badge&color=339933" alt="CLI verktøy" /></a>

Oslo designsystem har fått et kommandolinjeverktøy; `ods` 🥳 som bruk i 
terminalen eller scripts.

## Forutsetninger
Node >= 12.22.12 installert

## Installasjon

```sh
npm install -g @oslokommune/oslo-designsystem-cli
```

## Tilgjengelige kommandoer

- `ods` gir deg en oversikt over kommandoene og options.
- `ods init` initierer designsystemet for bruk i din applikasjon. 
  Lager også en `ods.config.json` fil basert på valg som tas i oppsettet.
- `ods svg sprite` generer svg sprites basert på `ods.config.json`.

### ods init
Denne kommandoen initierer designsystemet.

**Fordeler**
- Oppretter konfig-filen for deg.
- Gir deg muligheten til å installere andre pakker i designsystemet.
- Legger til grunnleggende SVG-ikoner i appen din, om du ønsker.
- Gir deg personaliserte tips basert på dine svar og `package.json` i applikasjonen
  din.

**ods.config.json** kan eksempelvis se slik ut:

```json
{
  "svgsprite": {
    "files": [                          /* SVG-filer i svgsprite */
      "../assets/src/icons/check.svg",
      "../assets/src/icons/24h.svg",
      "../assets/src/icons/share.svg"
    ],
    "output": {
      "fileType": "html",               /* html|svg */
      "filePath": "./index.html"        /* sti til destinasjonsfilen */
    }
  }
}
```

### ods svg sprite

Komponentbibliotekene i Oslo designsystem forutsetter at en såkalt SVG Sprite eller
SVG Symbols er tilgjengelig på siden. Det kan du lese mer om her: 
[Multi-Colored SVG Symbol Icons with CSS Variables](https://frontstuff.io/multi-colored-svg-symbol-icons-with-css-variables).

Denne kommandoen genererer en slik svgsprite for deg. Den trenger at
designsystemet er initiert.

Kommandoen er avhengig av følgende verdier i konfig:
- `svgsprite.files` --> Array med stier til SVG ikoner.
- `svgsprite.output.fileType` --> Streng bestående av en av disse verdiene:
    - `html` - svgsprite inlines i et element i en html-fil (se under).
    - `svg` - svgsprite skrives i en SVG-fil.
- `svgsprite.output.filePath` --> Streng bestående av sti til output-filen.


**MERK!** Om du velger å inline i en HTML-fil skal du legge til dette elementet«:

```html
<div id="ods-icons-sprite"></div>
```

**Når brukes denne kommandoen?** Hver gang du legger til eller tar bort en SVG.

## 👮 Lisens

`Oslo designsystem` er distribuert under [MIT-lisens](https://github.com/oslokommune/oslo-designsystem/blob/main/packages/ods-cli/LICENSE) for åpen kildekode.

![NPM License](https://img.shields.io/npm/l/@oslokommune/oslo-designsystem?style=for-the-badge)
npm package: @oslokommune/oslo-designsystem-react
Description: Oslo kommune - Oslo designsystem - React komponentbibliotek
Author: Oslo Origo
Latest version: 0.2.0

## Bruk av @oslokommune/oslo-designsystem-react

<a href="https://www.npmjs.com/package/@oslokommune/oslo-designsystem-react" target="_blank"><img src="https://img.shields.io/npm/v/@oslokommune/oslo-designsystem-react?logo=react&label=react&style=for-the-badge&color=61dafb" alt="React komponenter" /></a>

Oslo Designsystems UI komponenter for React. Komponentene er laget for å fungere sammen med CSS fra designsystemet `@oslokommune/oslo-designsystem`.

## Forutsetninger

Peer dependencies: 
- nodejs `16.5`
- react `>= 16`
- @oslokommune/oslo-designsystem `>= 0.8.1`

## 📄 Dokumentasjon [UNDER ARBEID]

Hver komponent vil være dokumentert på 
[nettsiden til designsystemet](https://designsystem.oslo.kommune.no),
på en stadig bedre måte.

## 🚀 Kom i gang [UNDER ARBEID]

Vi jobber med denne!

## Versjonering

Oslo Designsystem bruker [Semantic Versioning 2.0.0](https://semver.org/spec/v2.0.0.html) for versjonering av pakkene.

Mens vi er i en beta-fase, versjonering vil følge dette mønsteret: **v0.Y.Z**, hvor

- **Y**: Major (breaking changes)
- **Z**: Minor eller patch

## 👮 Lisens

`Oslo designsystem` er distribuert under [MIT-lisens](https://github.com/oslokommune/oslo-designsystem/blob/main/packages/ods-react/LICENSE) for åpen kildekode.

![NPM License](https://img.shields.io/npm/l/@oslokommune/oslo-designsystem?style=for-the-badge)