open-index/open-npm huggingface dataset:
npm package: @kth/lms-scan
Description: Scan for Canvas tokens in a npm project and git repo
Latest version: 0.1.0

# Usage

```shell
npx @kth/lms-scan
```

# Check a range of the git history

```shell
npx @kth/lms-scan history a4f2e5...b445e51
# Where a4f2e5 and b445e51 are commit hashes
```
npm package: @kth/log
Description: Logging module for Node.js applications.
Author: KTH
Latest version: 4.0.8

# @kth/log

Logging module for Node.js applications.

## Usage

The package will respect NODE_ENV and output serialized JSON in production
and use ordinary output for development.

The package uses bunyan.stdSerializers.err for err and provides serializers for req and res objects. Only subset of fields are displayed by these serializers.

### In your application

```javascript
const log = require('@kth/log')

// in application setup, see full options below
log.init({
  name: 'node-app',
  level: 'warn',
})

// log usage
log.info('hello from info, log level usually used in setup')
log.warn('error that code handled and can recover from')
log.error({ err: err }, 'error that should be fixed in code')
log.fatal('a really bad error that will crash the application')
log.debug({ req: req, res: res }, 'log a request and response, basic dev log')
log.trace('granular logging, rarely used')

// child logger
// add custom values to all of the logs
const myLog = log.child({ custom: 'value' })
myLog.info('hello')
```

## Options

```javascript
log.init({
  // name of the logger, usually the same as application name, default is 'node-log'
  name: 'node-app',

  // If developement or test, the output is sent to stdout (console) using Bunyan-format 'short', default value is retrieved from process.env.NODE_ENV
  env: 'development',

  // default logging level is INFO
  level: 'debug',

  // Provide a custom serializer if necessary, default serializer for err, req and res are included in the package.
  serializers: {
    err: customSerializer,
  },
})
```
npm package: @kth/npm-template
Description: Template repo for npm-packages. Also test for Evolene npm publishing. 
Author: KTH
Latest version: 1.0.106
Deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

# NPM Template ![Continous Integration](https://github.com/KTH/npm-template/actions/workflows/main.yml/badge.svg) ![Continous Integration](https://github.com/KTH/npm-template/actions/workflows/main-latest.yml/badge.svg)

NPM: https://www.npmjs.com/package/@kth/npm-template

## How to use

```javascript
const package = require("npm-template");

if (package.isWorking()) {
  console.log("Hello World!");
}
```

## Run tests

```bash
npm build ## Does npm install and npm test.
```

You can also view the tests at https://travis-ci.org/KTH/npm-template

### Output from tests

```text

Type of tests header
   ✓ When running tests, expect it to always return 'true'.

```
npm package: @kth/reqvars
Description: a short function for verifying that process.env contains required variables
Latest version: 2.0.1

[![Build Status](https://travis-ci.org/KTH/reqvars.svg?branch=master)](https://travis-ci.org/KTH/reqvars)

# reqvars

Check that [`process.env`](https://nodejs.org/docs/latest/api/process.html#process_process_env) contains all the **req**uired **var**iable**s**!

## Install

```sh
npm i @kth/reqvars
```

## Usage

1. Write a `.env.in` saying which environmental variables are required in your program. This will be your specification file.


  For example:

  ```ini
  DB_HOST=localhost
  DB_USER=root
  DB_PASS=
  ```

  If you commit the file (which is recommended) remember to leave the secrets (passwords, etc.) blank

2. As early as possible in your application, require and call `check`:

   ```js
   require('@kth/reqvars').check()
   ```

   It will throw an error if some variable is missing

3. If you want to use another path, pass it as argument:

   ```js
   require('@kth/reqvars').check('./requirements.conf')
   ```
npm package: @kth/server
Description: Module for initializing an Express server in a Node.js application.
Author: KTH
Latest version: 4.1.0

# @kth/server

A wrapper around express.
In it's most basic usage, it just exposes an express app, but it has support for starting with ssl.

## Simple usage, starts a server on http

Start returns a promise that resolves when startup is complete.

```JavaScript
const app = require('@kth/server')
app.start()
  .then((res) => {
    // Do something...
  })
```

The import returns an Express.js instance, so you can add middleware and functions just as in a normal express app:

```JavaScript
app.get('/', function (req, res) {
  res.send('Hello world!')
})
```

To stop the instance you call app.close() which returns a promise that resolves when done.

```JavaScript
app.close()
  .then(() => {
    // Do something...
  })
```

## Start server with options

### Secure HTTPS

```JavaScript
const app = require('@kth/server')

const optionsForSsl = {
  useSsl: true,
  pfx: '/path/to/file.pfx',
  passphrase: '/path/to/file.txt',
  port: 3000, // Optional, defaults to 3000
  logger: console // Optional, defaults to console
}

app.start(optionsForSsl)
```

### Plain HTTP

```JavaScript
const app = require('@kth/server')

const optionsForSsl = {
  port: 3000, // Optional, defaults to 3000
  logger: console // Optional, defaults to console
}

app.start(optionsForSsl)
```

## Creating a self signed cert for testing

```
  $ openssl genrsa 2048 > test/certs/private.pem
  $ openssl req -x509 -days 1000 -new -key test/certs/private.pem -out test/certs/public.pem -subj "/C=SE/ST=SWEDEN/L=Provo/O=kth-node-server/CN=www.test.com"
  $ openssl pkcs12 -export -in test/certs/public.pem -inkey test/certs/private.pem -passout pass:test -out test/certs/withpassphrase.pfx
  $ echo 'test' >> test/certs/passphrase.txt
  $ rm test/certs/private.pem test/certs/public.pem
```

## TODO

TODO: write test for signing requests with cert
npm package: @kth/session
Description: A Node.js module for setting up session middleware for Express.js apps.
Author: KTH
Latest version: 3.1.1

# @kth/session

A Node.js module for setting up session middleware for Express.js apps.

Enforces certain defaults that should improve security related to sessions.

Available session options: https://www.npmjs.com/package/express-session

Available Redis options: https://www.npmjs.com/package/connect-redis

# Usage

```javascript
const express = require('express')
const session = require('@kth/session')

const app = express()

const options = {
  // Set to true to enable session storage in RedisStore.
  // Default is to use MemoryStore.
  useRedis: false,

  // This is used as redis prefix and session cookie name.
  // Must be set here or as individual settings for redis (prefix) and session (name).
  key: 'node-app.sid',

  // https://www.npmjs.com/package/connect-redis
  redisOptions: {
    // ...
  },

  // https://www.npmjs.com/package/express-session
  sessionOptions: {
    // Secret must be set!
    secret: 'my-secret-string',

    // This should not be set when enabling Redis,
    // or if using the default value.
    store: null,
  },
  // Optional. Currently only used for RedisStore.
  storeOptions: {
    // Time in seconds.
    // Default value is 3600, i.e. one hour.
    ttl: 14400,
  },
}

app.use(session(options))
```

### Default cookie settings

The cookie has the following defult settings but each value can be overridden if needed:

```javascript
cookie: {
  secure: true,
  httpOnly: true,
  sameSite: 'Lax',
  path: '/'
},
```

The path attribute is preferably set to a more specific path so the cookie only is available where it´s needed.
npm package: @kth/sis_import_utils
Description: Utility functions for working with sis imports in the Canvas LMS.
Author: team-e-larande
Latest version: 1.2.2

# Introduction

SIS Import utils will contain utility functions for interacting with and diagnose the Canvas LMS SIS Import functionality.

# License

MIT License

Copyright (c) 2018 KTH Royal Institute of Technology

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.