Giter Site home page Giter Site logo

nicolaa5 / bankid Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 5.83 MB

A repository for authenticating and signing with Swedish BankID

License: Apache License 2.0

Go 99.32% Dockerfile 0.68%
api-client bankid personnummer qrcode relying-party sweden secure-start

bankid's Introduction

πŸ‡ΈπŸ‡ͺ BankID

 Unit Tests

Relying Party (RP) service

To install the CLI app with which to interact with the package

go install github.com/nicolaa5/bankid/cmd/bankid

Who is this repository for?

You can use this repo if you're using BankID in your organization for one of the following purposes:

  • Authenticating users to use your services
  • Signing documents, transactions or payments related to your organization

Test Setup

Important

The personnummer you use for the Test BankID has to be valid. See the following list for Personnummers that are valid

  1. Set up Mobile BankID on your phone (Android/iOS) or the BankID Security Application on your computer with a test configuration
  2. Create a Test BankID at https://demo.bankid.com that are accepted by BankID
  3. Run the CLI program with bankid auth --test in order to test authentication with your Test BankID

Examples

// Provide certificate and URL
b, err := bankid.New(bankid.Config{
    URL: bankid.BankIDURL,
    Certificate: bankid.Certificate{
        Passphrase:     passphrase,
        SSLCertificate: sslCert,
    },
})

// Send authenticate request to BankID
authResponse, err := b.Auth(ctx, bankid.AuthRequest{
    EndUserIP: ip,
    Requirement: &bankid.Requirement{
        PersonalNumber: personNummer,
    },
})

// Poll for the status of the order
collectResponse, err := b.Collect(ctx, bankid.CollectRequest{
    OrderRef: authResponse.OrderRef,
})

fmt.Println(collectResponse)
// Success case
// {
//         "orderRef": "5cc86d87-ded0-43c3-8ce8-7693710a0092",
//         "status": "complete",
//         "completionData": {
//                 "user": {
//                         "personalNumber": "199510221287",
//                         "name": "John Doe",
//                         "givenName": "John",
//                         "surname": "Doe"
//                 },
//                 ...
//         }
//  }

bankid's People

Contributors

nicolaa5 avatar dependabot[bot] avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.