0.3.19 • Published 9 months ago

@lightsparkdev/react-native v0.3.19

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
9 months ago

The Lightspark JS+TS React Native Utility package

npm (scoped)

This package offers utilities and alternative implementations of some core Lightspark SDK interfaces to add compatibility with react-native. It can be imported in addition to the @lightsparkdev/wallet-sdk or lightsparkdev/react-wallet packages to add react-native support.

Getting started

To use the package, you'll need to install it from npm:

$ npm install @lightsparkdev/react-native

Crypto

By default the Lightspark SDKs' crypto implementation does not work on React Native. To use the react-native crypto implementation, you'll need to import this package and set it as the default crypto implementation when constructing your LightsparkClient instance:

import { LightsparkClient } from "@lightsparkdev/wallet-sdk";

// Import the react-native crypto implementation.
import { ReactNativeCrypto } from "@lightsparkdev/react-native";

// Set the crypto implementation when constructing the client.
const lightsparkClient = new LightsparkClient(
  /* authProvider */ undefined,
  /* serverUrl */ undefined,
  /* cryptoImpl */ ReactNativeCrypto
);

Alternatively, if you're using the lightsparkdev/react-wallet package, you can set the crypto implementation when constructing the LightsparkClientProvider:

import {
  EncryptedLocalTokenStorage,
  ReactNativeCrypto,
} from "@lightsparkdev/react-native";
import {
  JwtAuthProvider,
  LightsparkClientProvider,
} from "@lightsparkdev/react-wallet";
import PageContainer from "./PageContainer";

export default function App() {
  return (
    <LightsparkClientProvider customCryptoImpl={ReactNativeCrypto}>
      <JwtAuthProvider customTokenStorage={new EncryptedLocalTokenStorage()}>
        <PageContainer />
      </JwtAuthProvider>
    </LightsparkClientProvider>
  );
}

See examples/ReactNativeWallet for a full example of how to use this package with lightsparkdev/react-wallet.

0.3.19

9 months ago

0.3.18

10 months ago

0.3.17

11 months ago

0.3.16

11 months ago

0.3.15

11 months ago

0.3.14

11 months ago

0.3.13

1 year ago

0.3.12

1 year ago

0.3.11

1 year ago

0.3.10

1 year ago

0.3.9

1 year ago

0.3.8

1 year ago

0.3.6

1 year ago

0.3.5

1 year ago

0.3.4

1 year ago

0.3.3

1 year ago

0.3.2

1 year ago

0.3.1

2 years ago

0.3.0

2 years ago

0.2.27

2 years ago

0.2.26

2 years ago

0.2.25

2 years ago

0.2.24

2 years ago

0.2.23

2 years ago

0.2.22

2 years ago

0.2.21

2 years ago

0.2.20

2 years ago

0.2.19

2 years ago

0.2.18

2 years ago

0.2.17

2 years ago

0.2.16

2 years ago

0.2.15

2 years ago

0.2.14

2 years ago

0.2.13

2 years ago

0.2.12

2 years ago

0.2.11

2 years ago

0.2.10

2 years ago

0.2.7

2 years ago

0.2.6

2 years ago

0.2.9

2 years ago

0.2.8

2 years ago

0.2.5

2 years ago

0.2.4

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago