ArcBlock's blockchain, as of v1.19.x, includes native support for Passkeys, allowing them to have corresponding accounts on the blockchain and to sign and send transactions like other accounts.
Because adding native Passkey support has introduced breaking changes to some underlying library APIs, please consult the upgrade guide below if you need to use the latest version.
Updating Project Dependencies
You can use any familiar tool to update the following project dependencies to their latest versions:
- @ocap/*
- @arcblock/*
- @blocklet/*
Make Code Changes
@ocap/wallet
wallet.verify is now an async method
const { fromSecretKey } = require('@ocap/wallet');
const wallet = fromSecretKey(sk, type);
const message = 'data to sign';
const signature = wallet.sign(message);
expect(await wallet.verify(message, signature)).toEqual(true); // changedSupport for new DID types has been added.
const { fromPublicKey } = require('@ocap/wallet');
const { fromBase64 } = require('@ocap/util');
const publicKey = fromBase64('pQECAyYgASFYIA3GyM4rSxM_HyV52QTRwGJOdkXurky3cwTLvb_gKSF-Ilggpd0fhMlPdxHBl45_eJxqywCRl-a4IDpeFa4pcfmrxuM');
const wallet = fromPublicKey(publicKey, 'passkey');
expect(wallet.address).toEqual('z3i165rPumFgyQZpZ1W3VLEYBPuV2xSCAjoqo');@arcblock/vc
The following methods are now async.
- Create
- verify
- Verify Presentation
const { create, verify, verifyPresentation, createCredentialList, verifyCredentialList } = require('@arcblock/vc');
const issuer = fromRandom();
const owner = fromRandom();
let vc = null;
const subject = {
id: owner.address,
key: 'value',
method: 'SHA3',
};
const issuerInfo = {
wallet: issuer,
name: 'DID.KYC.Email',
};
const vc = await create({
type: 'EmailVerificationCredential',
issuer: issuerInfo,
subject,
tag: 'abcd',
endpoint: 'https://www.arcblock.io/api/vc/status',
});
expect(await verify({ vc, ownerDid: owner.address, trustedIssuers: issuer.address })).toEqual(true);@arcblock/jwt
jwt.verifyis now anasync` method
const { sign, verify } = require('@arcblock/jwt');
const token = sign(appId, sk, { key: 'value' });
const [, bodyB64] = token.split('.');
const body = JSON.parse(fromBase64(bodyB64).toString());
const result = await verify(token, pk); // changed@ocap/asset
The preMintFromFactory method was changed to be async.
@blocklet/sdk
wallet.verify is now an async method
const getWallet = require('@blocklet/sdk/lib/wallet');
const wallet = getWallet();
const message = 'data to sign';
const signature = wallet.sign(message);
expect(await wallet.verify(message, signature)).toEqual(true); // changed