7.6.1 • Published 4 years ago

@bloomprotocol/share-kit v7.6.1

Weekly downloads
27
License
Apache-2.0
Repository
github
Last release
4 years ago

Share Kit

Share Kit

Easily allow your users to share their verified personal information directly with your application.

Installation

npm install --save @bloomprotocol/share-kit

Implementations

NameDescriptionStatus
share-kitPlain DOM implementation:white_check_mark:
share-kit-reactReact wrapper for renderRequestElement:white_check_mark:
share-kit-reactnativeReact Native implementation for renderRequestButton:white_check_mark:
share-kit-vueVue wrapper for renderRequestElement:white_check_mark:
bloom_share_kitFlutter implementation of renderRequestButton:white_check_mark:

Usage

renderRequestElement will render a QR code or button based on the client's platform. By default it will render a button when the client is mobile or tablet and on iOS.

import {renderRequestElement, RequestData, QROptions} from '@bloomprotocol/share-kit'

const requestData: RequestData = {...}
const qrOptions: Partial<QROptions> = {
  size: 200,
}
const callbackUrl = 'https://mysite.com/bloom-callback'
const container = document.createElement('div')

const {update, remove} = renderRequestElement({container, requestData, qrOptions, callbackUrl})

// Update the element
update({requestData: newRequestData, qrOptions: newQROptions, callbackUrl: newCallbackUrl})

// Remove the element
remove()

RequestDataAuthentication

Data to be rendered into the RequestQRCode for authentication requests.

NameDescriptionType
actionAction typeAction
tokenUnique string to identify this data requeststring
urlThe API endpoint to POST the ResponseData to. See below for detailsstring
org_logo_urlA url of the logo to display to the user when requesting datastring
org_nameThe name of the organization requesting datastring
org_usage_policy_urlThe url of the usage policy for the organization requesting datastring
org_privacy_policy_urlThe url of the privacy policy for the organization requesting datastring

RequestDataAttestation

Data to be rendered into the RequestQRCode for attestation sharing requests.

NameDescriptionType
actionAction typeAction
tokenUnique string to identify this data requeststring
urlThe API endpoint to POST the ResponseData to. See below for detailsstring
org_logo_urlA url of the logo to display to the user when requesting datastring
org_nameThe name of the organization requesting datastring
typesThe type of attestions required and the amount neededTAttestationTypeNames
org_usage_policy_urlThe url of the usage policy for the organization requesting datastring
org_privacy_policy_urlThe url of the privacy policy for the organization requesting datastring

TAttestationTypeNames

TypeDescriptionSourcePlatforms
'phone'SMS verificationTwilioiOS, Web
'email'Email verificationMailguniOS, Web
'facebook'Facebook verificationFacebookiOS, Web
'google'Google verificationGoogleiOS, Web
'linkedin'LinkedIn verificationLinkedIniOS, Web
'twitter'Twitter verificationTwitteriOS, Web
'id-document'Identity document verificationAcuantWeb
'sanction-screen'Sanction person screeningBlockScoreiOS, Web
'pep-screen'Politically exposed person screenKYC2020iOS, Web
'income'Income verificationQuovoWeb
'assets'Assets verificationQuovoWeb

TAttestationTypeNames Subtypes

TypeDescriptionPlatforms
'full-name'Subtype of 'facebook', 'linkedin', 'sanction-screen', 'pep-screen', and 'id-document' attestationiOS, Web
'birth-date'Subtype of 'sanction-screen', 'pep-screen', and 'id-document' attestationsiOS, Web
'gender'Subtype of 'id-document' attestationWeb
'supplemental'Subtype of 'income' and 'assets' attestationsWeb

For more information, see the full list of attestation types that are implemented / planned to be implemented.

Appending to URL

The user can share by tapping a button or scanning a QR code, sometimes you'll need to know the difference so the query param share-kit-from is appended to your url.

The param will either be share-kit-from=qr OR share-kit-from=button.

// Input
'https://receive-kit.bloom.co/api/receive'

// Output
'https://receive-kit.bloom.co/api/receive?share-kit-from=qr'

Works if your url already has a query param too!

// Input
'https://receive-kit.bloom.co/api/receive?my-param=',

// Output
'https://receive-kit.bloom.co/api/receive?my-param=&share-kit-from=qr',

Attestation data request:

{
  action: Action.attestation,
  token: '0x8f31e48a585fd12ba58e70e03292cac712cbae39bc7eb980ec189aa88e24d043',
  url: 'https://receive-kit.bloom.co/api/receive',
  org_logo_url: 'https://bloom.co/images/notif/bloom-logo.png',
  org_name: 'Bloom',
  org_usage_policy_url: 'https://bloom.co/legal/terms',
  org_privacy_policy_url: 'https://bloom.co/legal/privacy',
  types: ['full-name', 'phone', 'email'],
}

Authentication/login request:

{
  action: Action.authentication,
  token: '0xabcdee48a585fd12ba58e70e03292cac7fbac958b591baf9cbe9ac157cbadefa',
  url: 'https://receive-kit.bloom.co/api/receive',
  org_logo_url: 'https://bloom.co/images/notif/bloom-logo.png',
  org_name: 'Bloom',
  org_usage_policy_url: 'https://bloom.co/legal/terms',
  org_privacy_policy_url: 'https://bloom.co/legal/privacy',
  types: [],
}

Sample QR

Sample Button

QROptions

NOTE: Does not apply to the rendered button

Display options for the rendered QR code.

NameDescriptionTypeDefault
sizeThe height and width of the QR code.number128
bgColorThe background color of the QR code.string#fff
fgColorThe foreground color of the QR code.string#6067f1
logoImageThe <img /> src to displayed over the QR code.stringBloom logo
hideLogoWhether the logoImage should be rendered.booleanfalse
paddingPercentage of the size of the QR code that will be padding. This will be the same color as bgColornumber0

ButtonOptions

NOTE: This is only used with the rendered button and not the QR code.

Rendering options for the rendered button.

NameDescriptionTypeRequiredDefault
buttonCallbackUrlThe url the user will be sent back to after they share their data.stringYN/A
sizeThe size of the button'sm' | 'md' | 'lg'N'lg'
typeThe type of button, based on the given sizeSee belowNSee below

ButtonType

The type of button to rendered based on it's size

SizeTypeRequiredDefault
sm'square' \| 'rounded-square' \| 'circle' \| 'squircle'YN/A
md'log-in' \| 'sign-up' \| 'connect' \| 'bloom' \| 'verify'N'verify'
lg'log-in' \| 'sign-up' \| 'connect' \| 'bloom' \| 'verify'N'verify'

Example:

  • Small:

    • Square

      small sqaure

    • Rounded Square

      small rounded-sqaure

    • Circle

      small circle

    • Squircle

      small squircle

  • Small Inverted:

    • Small buttons can have thier foreground and background colors swaped with the invert flag

      small inverted buttons

  • Medium:

    • Log In

      medium log-in

    • Sign Up

      medium sign-up

    • Connect

      medium connect

    • Bloom

      medium bloom

    • Verify

      medium verify

  • Large:

    • Log In

      large log-in

    • Sign Up

      large sign-up

    • Connect

      large connect

    • Bloom

      large bloom

    • Verify

      large verify

Using Share Kit for BloomID Sign-In

In conjuction with this libary you will use Verify Kit to verify shared data on your server.

Complete examples are available at Bloom Starter.

7.6.1

4 years ago

7.6.0-beta.2

4 years ago

7.6.0

4 years ago

7.6.0-beta.0

4 years ago

7.6.0-beta.1

4 years ago

7.5.2

4 years ago

7.5.1

4 years ago

7.5.0

4 years ago

7.3.0

4 years ago

7.2.2

5 years ago

7.2.2-beta.0

5 years ago

7.2.1

5 years ago

7.2.0

5 years ago

7.1.0

5 years ago

7.0.0

5 years ago

7.0.0-alpha.1

5 years ago

7.0.0-alpha.0

5 years ago

6.0.0

5 years ago

6.0.0-beta.4

5 years ago

6.0.0-beta.3

5 years ago

6.0.0-beta.2

5 years ago

6.0.0-beta.1

5 years ago

5.0.1

5 years ago

6.0.0-beta.0

5 years ago

5.0.0

5 years ago

4.1.0

5 years ago

4.0.1

5 years ago

4.0.0

5 years ago

3.1.2

5 years ago

3.1.1

5 years ago

3.1.0

5 years ago

3.0.1

5 years ago

3.0.0

5 years ago

2.2.0

5 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago