Automata 2.0 Attestation SDK
This SDK includes the following modules:
-
setup.ts
: Provides a method that deploys a SafeWallet, which enables AuthModule
and creates an attestation of the user's device upon the initial setup of the wallet.
-
challenge.ts
: Deterministically pre-computes the address of a SafeWallet prior to its deployment. This address is included as a challenge data for the initial attestation.
To install the SDK, do the following:
NPM:
npm install --save-dev @automata-network/safe-authmodule-sdk
YARN:
yarn add --dev @automata-network/safe-authmodule-sdk
To use the SDK, you must first import the two essential functions.
import {
computeSafeAddress,
createNewWallet,
AUTH_MODULE_ADDRESS,
ANDROID_SAFETYNET_ATTESTATION_ADDRESS
} from @automata-network/safe-authmodule-sdk;
const nonce = Math.floor(Math.random()) * MAX_NUMBER;
const ownerAddress = await signer.getAddress();
const threshold = 5;
const safeAddress = await computeSafeAddress(nonce, [ownerAddress], threshold);
const response = await createNewWallet(
nonce,
{
authDataBytes,
clientDataJSONBytes
},
attStmt,
ANDROID_SAFETYNET_ATTESTATION_ADDRESS,
threshold,
[ownerAddress],
provider
);
All contract deployment addresses can be found in constants.ts
.