@agog/siwa

Verify user on sign in with apple (siwa)

Usage no npm install needed!

<script type="module">
  import agogSiwa from 'https://cdn.skypack.dev/@agog/siwa';
</script>

README

SIWA (Sign in with Apple)

Verification package when signing in with apple in javascript (nodejs) environments

Dependencies

SiwA uses jsonwebtoken to verify apple's identity token & jwks-rsa to retrieve RSA signing keys from apple's JWKS (JSON Web Key Set) endpoint

Installation

Using npm

$ npm i @agog/siwa

Usage

Initialise the Siwa class by passing in the necessary configurations in the constructor. The verify() method then verifies the user account and returns a promise which will resolve with the state of validity.

import Siwa from '@agog/siwa';

const siwa = new Siwa({
    user: "", //required
    package: "", //required
    identityToken: "", //required
    keySetUri: "https://appleid.apple.com/auth/keys", //NOT required
})

siwa.verify().then(response => {
    //access the validity response
})

Configurations

The apix object constructor accepts an object as a parameter that MUST contain:

  • user - (REQUIRED) user key from apple,
  • package - (REQUIRED) identifies your application
  • identityToken - (REQUIRED) identityToken from apple
  • keySetUri - (OPTIONAL) apple's keySetUri endpoint

Running the tests

In order to run the tests run the following command in the root of the application

npm run test

Built With

  • NodeJs - The framework used
  • npm - Package manager

Authors

Kisiara Francis