Socket
Socket
Sign inDemoInstall

danal

Package Overview
Dependencies
48
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    danal

danal module for Node.js


Version published
Maintainers
1
Created

Readme

Source

danal

danal module for Node.js

version download

js-standard-style

Usage

var http = require('http')
var express = require('express')
var danal = require('../')
var config = require('./config.json')

var uas = new danal.UAS(config.uas)

var app = express()

app.get('/uas',
  function (req, res, next) {
    var token = {
      userid: 'userid',
      session: 'session'
    }
    uas.request(token, function (err, data) {
      if (err) {
        res.json(err)
      }

      // @todo
      // set the tid in the token data
      // ex) updateUser(user, data.tid)

      danal.API.defaults(data, {
        cancel_uri: 'http://127.0.0.1:3001/uas/cancel'
      })
      danal.API.defaults(data, {
        ci_url: config.ci_url
      })
      danal.API.defaults(data, config.user)

      res.locals.uas = data
      next()
    })
  },
  uas.redirect()
)
app.post('/uas/callback',
  uas.receive(),
  function (req, res, next) {
    uas.confirm({
      tid: res.locals.uas.tid,
      userid: 'userid'
    }, function (err, result) {
      res.json({
        uas: res.locals.uas,
        error: err,
        result: result
      })
    })
  }
)
app.post('/uas/cancel',
  uas.receive(),
  function (req, res, next) {
    res.json(res.locals)
  }
)

var port = process.env.PORT || '3001'

app.set(port)
http.createServer(app).listen(port)
// config.json
{
  "ci_url": {
    "basic": "ci logo url : size 115 x 47",
    "mobile": "ci logo url : size 77 x 29"
  },
  "uas": {
    "client_id": "CPID",
    "client_secret": "CPPWD",
    "redirect_uri": "http://127.0.0.1:3001/uas/callback"
  },
  "user": { // optional
    "carrier": "SKT",
    "phonenum": "010-0000-0000",
    "passvalue": "passvalue",
    "yearofbirth": 1982
  }
}
// return data: /uas/callback
{
  "uas": {
    "code": "0000",
    "message": "No information",
    "tid": "201601131221348871382010",
    "cancel_uri": "http://127.0.0.1:3001/uas/cancel",
    "ci_url": "ci logo url",
    "passvalue": "passvalue",
    "yearofbirth": "1982",
    "use_ci": "Y"
  },
  "error": null,
  "result": {
    "code": "0000",
    "message": "No information",
    "ci": "ci string",
    "name": "user name",
    "token": "token",
    "tid": "201601131221348871382010",
    "dateofbirth": "19820504",
    "gender": "1",
    "di": "di string",
    "userid": "userid"
  }
}
// return data: /uas/cancel
{
  "uas": {
    "code": "0000",
    "message": "No information",
    "tid": "201601131224209429051010",
    "cancel_uri": "http://127.0.0.1:3001/uas/cancel",
    "ci_url": "ci logo url",
    "passvalue": "passvalue",
    "yearofbirth": "1982",
    "use_ci": "Y"
  }
}

carrier

  • SKT
  • KTF
  • LGT
  • MVNO

Documentation

See the documentation

Release History

See the changelog

LICENSE

danal is licensed under the MIT license.

Keywords

FAQs

Last updated on 13 Jan 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc