react-native-pkce-challenge

    3.0.0 • Public • Published

    React Native PKCE Challenge

    Package version MIT license PRs Welcome

    Proof Key for Code Exchange (PKCE) challenge generator for React Native.

    API Compatibility

    Method iOS Android Web Windows macOS
    asyncPkceChallenge
    pkceChallenge

    Installation

    yarn add react-native-pkce-challenge
    npx pod-install # iOS Only 

    Usage

    Asynchronous (Recommended for iOS / Android)

    import { asyncPkceChallenge } from 'react-native-pkce-challenge';
     
    const challenge = await asyncPkceChallenge();

    Synchronous (Not recommended for iOS / Android)

    import { pkceChallenge } from 'react-native-pkce-challenge';
     
    const challenge = pkceChallenge();

    The constant challenge will hold an object like the following:

    {
      codeChallenge: 'XsRstqNrXT76Iop3uMoyyCQmaGthJbKKJwXBSoQXaRk',
      codeVerifier: 'OZOHUwLddiPyTFJulnUYnU9jsf7oyULflbFpwj40bE9S77iaeisGvzvaVvvPE7oO-xaV4skxwKDFBBV7JofVNxCgUSauqUDVcVjggE4-M6zthVUmeUrSAHatmIBm_P0_'
    }

    Why asynchronous is recommended for iOS / Android?

    CryptoJS (version 3.3.0) uses Math.random() which returns a value that is not cryptographically secure as native crypto module is not supported in React Native. In asynchronous we use native codes (Java / Objective-C) to generate cryptographically secure values.

    In web this is not a problem since we are using native crypto module which can give us cryptographically secure values.

    Upgrading

    See UPGRADING.md

    Changelogs

    See CHANGELOGS.md

    Contributing

    See CONTRIBUTING.md

    License

    Copyright © 2020 David Angulo, released under the MIT license, see LICENSE.

    Keywords

    Install

    npm i react-native-pkce-challenge

    DownloadsWeekly Downloads

    490

    Version

    3.0.0

    License

    MIT

    Unpacked Size

    27 kB

    Total Files

    27

    Last publish

    Collaborators

    • dcangulo