From 4e6c3dfc1f60fb93cb3ed0529dfdbf051f69e875 Mon Sep 17 00:00:00 2001 From: Antonio Antonino Date: Mon, 23 Oct 2023 11:35:12 +0100 Subject: [PATCH] Fix unit tests for linked signature suites --- packages/did/src/Did.signature.spec.ts | 4 +- packages/did/src/Did.utils.ts | 2 +- .../src/DidDetails/LightDidDetails.spec.ts | 12 ++--- .../did/src/DidResolver/DidResolver.spec.ts | 46 +++++++++---------- packages/types/src/Did.ts | 2 +- packages/vc-export/src/documentLoader.ts | 4 +- .../src/suites/KiltAttestationProofV1.spec.ts | 5 +- .../src/suites/Sr25519Signature2020.spec.ts | 10 +++- .../src/suites/Sr25519Signature2020.ts | 8 ++++ .../src/suites/Sr25519VerificationKey.ts | 3 ++ tests/integration/Did.spec.ts | 32 ++++++------- 11 files changed, 72 insertions(+), 56 deletions(-) diff --git a/packages/did/src/Did.signature.spec.ts b/packages/did/src/Did.signature.spec.ts index 1b2a4ccc9..f13f8af87 100644 --- a/packages/did/src/Did.signature.spec.ts +++ b/packages/did/src/Did.signature.spec.ts @@ -334,7 +334,7 @@ describe('full DID', () => { controller: `did:kilt:${keypair.address}`, id: '#0x12345', publicKeyMultibase: keypairToMultibaseKey(keypair), - type: 'MultiKey', + type: 'Multikey', }, ], } @@ -343,7 +343,7 @@ describe('full DID', () => { verificationMethod: { id: '#0x12345', controller: signingDid, - type: 'MultiKey', + type: 'Multikey', publicKeyMultibase: keypairToMultibaseKey(keypair), }, }) diff --git a/packages/did/src/Did.utils.ts b/packages/did/src/Did.utils.ts index 5476dc145..92036fef7 100644 --- a/packages/did/src/Did.utils.ts +++ b/packages/did/src/Did.utils.ts @@ -253,7 +253,7 @@ export function didKeyToVerificationMethod( return { controller, id, - type: 'MultiKey', + type: 'Multikey', publicKeyMultibase: u8aToString( multibaseEncode('base58btc', Uint8Array.from(multiCodecPublicKey)) ) as `z${string}`, diff --git a/packages/did/src/DidDetails/LightDidDetails.spec.ts b/packages/did/src/DidDetails/LightDidDetails.spec.ts index 3c50411dd..45954b448 100644 --- a/packages/did/src/DidDetails/LightDidDetails.spec.ts +++ b/packages/did/src/DidDetails/LightDidDetails.spec.ts @@ -65,7 +65,7 @@ describe('When creating an instance from the details', () => { publicKey: authKey.publicKey, type: 'sr25519', }), - type: 'MultiKey', + type: 'Multikey', }, { controller: `did:kilt:light:00${authKey.address}:z17GNCdxLqMYTMC5pnnDrPZGxLEFcXvDamtGNXeNkfSaFf8cktX6erFJiQy8S3ugL981NNys7Rz8DJiaNPZi98v1oeFVL7PjUGNTz1g3jgZo4VgQri2SYHBifZFX9foHZH4DreZXFN66k5dPrvAtBpFXaiG2WZkkxsnxNWxYpqWPPcxvbTE6pJbXxWKjRUd7rog1h9vjA93QA9jMDxm6BSGJHACFgSPUU3UTLk2kjNwT2bjZVvihVFu1zibxwHjowb7N6UQfieJ7ny9HnaQy64qJvGqh4NNtpwkhwm5DTYUoAeAhjt3a6TWyxmBgbFdZF7`, @@ -74,7 +74,7 @@ describe('When creating an instance from the details', () => { publicKey: encKey.publicKey, type: 'x25519', }), - type: 'MultiKey', + type: 'Multikey', }, ], service: [ @@ -117,7 +117,7 @@ describe('When creating an instance from the details', () => { publicKey: authKey.publicKey, type: 'ed25519', }), - type: 'MultiKey', + type: 'Multikey', }, { controller: `did:kilt:light:01${authKey.address}:z15dZSRuzEPTFnBErPxqJie4CmmQH1gYKSQYxmwW5Qhgz5Sr7EYJA3J65KoC5YbgF3NGoBsTY2v6zwj1uDnZzgXzLy8R72Fhjmp8ujY81y2AJc8uQ6s2pVbAMZ6bnvaZ3GVe8bMjY5MiKFySS27qRi`, @@ -126,7 +126,7 @@ describe('When creating an instance from the details', () => { publicKey: encKey.publicKey, type: 'x25519', }), - type: 'MultiKey', + type: 'Multikey', }, ], }) @@ -198,7 +198,7 @@ describe('When creating an instance from a URI', () => { publicKey: authKey.publicKey, type: 'sr25519', }), - type: 'MultiKey', + type: 'Multikey', }, { controller: `did:kilt:light:00${authKey.address}:z17GNCdxLqMYTMC5pnnDrPZGxLEFcXvDamtGNXeNkfSaFf8cktX6erFJiQy8S3ugL981NNys7Rz8DJiaNPZi98v1oeFVL7PjUGNTz1g3jgZo4VgQri2SYHBifZFX9foHZH4DreZXFN66k5dPrvAtBpFXaiG2WZkkxsnxNWxYpqWPPcxvbTE6pJbXxWKjRUd7rog1h9vjA93QA9jMDxm6BSGJHACFgSPUU3UTLk2kjNwT2bjZVvihVFu1zibxwHjowb7N6UQfieJ7ny9HnaQy64qJvGqh4NNtpwkhwm5DTYUoAeAhjt3a6TWyxmBgbFdZF7`, @@ -207,7 +207,7 @@ describe('When creating an instance from a URI', () => { publicKey: encKey.publicKey, type: 'x25519', }), - type: 'MultiKey', + type: 'Multikey', }, ], service: [ diff --git a/packages/did/src/DidResolver/DidResolver.spec.ts b/packages/did/src/DidResolver/DidResolver.spec.ts index 6d4a66fc3..0fd9a377d 100644 --- a/packages/did/src/DidResolver/DidResolver.spec.ts +++ b/packages/did/src/DidResolver/DidResolver.spec.ts @@ -86,7 +86,7 @@ function generateAuthenticationVerificationMethod( return { id: '#auth', controller, - type: 'MultiKey', + type: 'Multikey', publicKeyMultibase: Did.keypairToMultibaseKey({ publicKey: new Uint8Array(32).fill(0), type: 'ed25519', @@ -100,7 +100,7 @@ function generateEncryptionVerificationMethod( return { id: '#enc', controller, - type: 'MultiKey', + type: 'Multikey', publicKeyMultibase: Did.keypairToMultibaseKey({ publicKey: new Uint8Array(32).fill(1), type: 'x25519', @@ -114,7 +114,7 @@ function generateAssertionVerificationMethod( return { id: '#att', controller, - type: 'MultiKey', + type: 'Multikey', publicKeyMultibase: Did.keypairToMultibaseKey({ publicKey: new Uint8Array(32).fill(2), type: 'sr25519', @@ -128,7 +128,7 @@ function generateCapabilityDelegationVerificationMethod( return { id: '#del', controller, - type: 'MultiKey', + type: 'Multikey', publicKeyMultibase: Did.keypairToMultibaseKey({ publicKey: new Uint8Array(33).fill(3), type: 'ecdsa', @@ -294,7 +294,7 @@ describe('When resolving a full DID', () => { { controller: fullDidWithAuthenticationKey, id: '#auth', - type: 'MultiKey', + type: 'Multikey', publicKeyMultibase: Did.keypairToMultibaseKey({ type: 'ed25519', publicKey: new Uint8Array(32).fill(0), @@ -343,7 +343,7 @@ describe('When resolving a full DID', () => { { controller: fullDidWithAllKeys, id: '#auth', - type: 'MultiKey', + type: 'Multikey', publicKeyMultibase: Did.keypairToMultibaseKey({ type: 'ed25519', publicKey: new Uint8Array(32).fill(0), @@ -352,7 +352,7 @@ describe('When resolving a full DID', () => { { controller: fullDidWithAllKeys, id: '#enc', - type: 'MultiKey', + type: 'Multikey', publicKeyMultibase: Did.keypairToMultibaseKey({ type: 'x25519', publicKey: new Uint8Array(32).fill(1), @@ -361,7 +361,7 @@ describe('When resolving a full DID', () => { { controller: fullDidWithAllKeys, id: '#att', - type: 'MultiKey', + type: 'Multikey', publicKeyMultibase: Did.keypairToMultibaseKey({ type: 'sr25519', publicKey: new Uint8Array(32).fill(2), @@ -370,7 +370,7 @@ describe('When resolving a full DID', () => { { controller: fullDidWithAllKeys, id: '#del', - type: 'MultiKey', + type: 'Multikey', publicKeyMultibase: Did.keypairToMultibaseKey({ type: 'ecdsa', publicKey: new Uint8Array(33).fill(3), @@ -414,7 +414,7 @@ describe('When resolving a full DID', () => { { controller: fullDidWithServiceEndpoints, id: '#auth', - type: 'MultiKey', + type: 'Multikey', publicKeyMultibase: Did.keypairToMultibaseKey({ type: 'ed25519', publicKey: new Uint8Array(32).fill(0), @@ -466,7 +466,7 @@ describe('When resolving a full DID', () => { { controller: didWithAuthenticationKey, id: '#auth', - type: 'MultiKey', + type: 'Multikey', publicKeyMultibase: Did.keypairToMultibaseKey({ type: 'ed25519', publicKey: new Uint8Array(32).fill(0), @@ -541,7 +541,7 @@ describe('When resolving a light DID', () => { { controller: lightDidWithAuthenticationKey.id, id: '#authentication', - type: 'MultiKey', + type: 'Multikey', publicKeyMultibase: Did.keypairToMultibaseKey({ ...authKey, type: 'sr25519', @@ -573,7 +573,7 @@ describe('When resolving a light DID', () => { { controller: lightDid.id, id: '#authentication', - type: 'MultiKey', + type: 'Multikey', publicKeyMultibase: Did.keypairToMultibaseKey({ ...authKey, type: 'sr25519', @@ -582,7 +582,7 @@ describe('When resolving a light DID', () => { { controller: lightDid.id, id: '#encryption', - type: 'MultiKey', + type: 'Multikey', publicKeyMultibase: Did.keypairToMultibaseKey(encryptionKey), }, ], @@ -707,7 +707,7 @@ describe('DID Resolution compliance', () => { { id: '#auth', controller: did, - type: 'MultiKey', + type: 'Multikey', publicKeyMultibase: Did.keypairToMultibaseKey({ publicKey: new Uint8Array(32).fill(0), type: 'ed25519', @@ -756,7 +756,7 @@ describe('DID Resolution compliance', () => { { id: '#auth', controller: did, - type: 'MultiKey', + type: 'Multikey', publicKeyMultibase: Did.keypairToMultibaseKey({ publicKey: new Uint8Array(32).fill(0), type: 'ed25519', @@ -785,7 +785,7 @@ describe('DID Resolution compliance', () => { { id: '#auth', controller: did, - type: 'MultiKey', + type: 'Multikey', publicKeyMultibase: Did.keypairToMultibaseKey({ publicKey: new Uint8Array(32).fill(0), type: 'ed25519', @@ -815,7 +815,7 @@ describe('DID Resolution compliance', () => { { id: '#auth', controller: did, - type: 'MultiKey', + type: 'Multikey', publicKeyMultibase: Did.keypairToMultibaseKey({ publicKey: new Uint8Array(32).fill(0), type: 'ed25519', @@ -879,7 +879,7 @@ describe('DID Resolution compliance', () => { { id: '#auth', controller: did, - type: 'MultiKey', + type: 'Multikey', publicKeyMultibase: Did.keypairToMultibaseKey({ publicKey: new Uint8Array(32).fill(0), type: 'ed25519', @@ -904,7 +904,7 @@ describe('DID Resolution compliance', () => { { id: '#auth', controller: did, - type: 'MultiKey', + type: 'Multikey', publicKeyMultibase: Did.keypairToMultibaseKey({ publicKey: new Uint8Array(32).fill(0), type: 'ed25519', @@ -931,7 +931,7 @@ describe('DID Resolution compliance', () => { { id: '#auth', controller: did, - type: 'MultiKey', + type: 'Multikey', publicKeyMultibase: Did.keypairToMultibaseKey({ publicKey: new Uint8Array(32).fill(0), type: 'ed25519', @@ -954,7 +954,7 @@ describe('DID Resolution compliance', () => { id: '#auth', controller: 'did:kilt:4r1WkS3t8rbCb11H8t3tJvGVCynwDXSUBiuGB6sLRHzCLCjs', - type: 'MultiKey', + type: 'Multikey', publicKeyMultibase: Did.keypairToMultibaseKey({ publicKey: new Uint8Array(32).fill(0), type: 'ed25519', @@ -1037,7 +1037,7 @@ describe('DID Resolution compliance', () => { { id: '#auth', controller: did, - type: 'MultiKey', + type: 'Multikey', publicKeyMultibase: Did.keypairToMultibaseKey({ publicKey: new Uint8Array(32).fill(0), type: 'ed25519', diff --git a/packages/types/src/Did.ts b/packages/types/src/Did.ts index 32329ffb1..131dc0f3e 100644 --- a/packages/types/src/Did.ts +++ b/packages/types/src/Did.ts @@ -59,7 +59,7 @@ export type VerificationMethod = { /** * The type of the verification method. This is fixed for KILT DIDs. */ - type: 'MultiKey' + type: 'Multikey' /** * The controller of the verification method. */ diff --git a/packages/vc-export/src/documentLoader.ts b/packages/vc-export/src/documentLoader.ts index afe9b03fd..7a4bddb91 100644 --- a/packages/vc-export/src/documentLoader.ts +++ b/packages/vc-export/src/documentLoader.ts @@ -81,9 +81,7 @@ export const kiltContextsLoader: DocumentLoader = async (url) => { export const kiltDidLoader: DocumentLoader = async (url) => { const { did } = parse(url as DidUri) - const { dereferencingMetadata, contentStream } = await dereferenceDid(did, { - accept: 'application/did+ld+json', - }) + const { dereferencingMetadata, contentStream } = await dereferenceDid(did) if (isFailedDereferenceMetadata(dereferencingMetadata)) { throw new Error(dereferencingMetadata.error) } diff --git a/packages/vc-export/src/suites/KiltAttestationProofV1.spec.ts b/packages/vc-export/src/suites/KiltAttestationProofV1.spec.ts index 3af326646..b06e64852 100644 --- a/packages/vc-export/src/suites/KiltAttestationProofV1.spec.ts +++ b/packages/vc-export/src/suites/KiltAttestationProofV1.spec.ts @@ -313,7 +313,8 @@ describe('vc-js', () => { it('creates and verifies a signed presentation (sr25519)', async () => { const signer = { sign: async ({ data }: { data: Uint8Array }) => keypair.sign(data), - id: didDocument.authentication?.[0], + // TODO: This goes against the signer interface of the rest of the SDK, where `id` is supposed to be only the verification method ID. Change this. + id: `${didDocument.id}${didDocument.authentication![0]}`, } const signingSuite = new Sr25519Signature2020({ signer }) @@ -451,7 +452,7 @@ describe('issuance', () => { signer: async () => ({ verificationMethod: { controller: attestedVc.issuer, - type: 'MultiKey', + type: 'Multikey', id: '#test', publicKeyMultibase: 'zasd', }, diff --git a/packages/vc-export/src/suites/Sr25519Signature2020.spec.ts b/packages/vc-export/src/suites/Sr25519Signature2020.spec.ts index 2de5f6497..621a66fd2 100644 --- a/packages/vc-export/src/suites/Sr25519Signature2020.spec.ts +++ b/packages/vc-export/src/suites/Sr25519Signature2020.spec.ts @@ -8,6 +8,7 @@ // @ts-expect-error not a typescript module import * as vcjs from '@digitalbazaar/vc' +import { base58Encode } from '@polkadot/util-crypto' import { Types, init, W3C_CREDENTIAL_CONTEXT_URL } from '@kiltprotocol/core' import * as Did from '@kiltprotocol/did' import { Crypto } from '@kiltprotocol/utils' @@ -90,7 +91,8 @@ beforeAll(async () => { it('issues and verifies a signed credential', async () => { const signer = { sign: async ({ data }: { data: Uint8Array }) => keypair.sign(data), - id: didDocument.assertionMethod![0], + // TODO: This goes against the signer interface of the rest of the SDK, where `id` is supposed to be only the verification method ID. Change this. + id: `${didDocument.id}${didDocument.assertionMethod![0]}`, } const attestationSigner = new Sr25519Signature2020({ signer }) @@ -121,13 +123,17 @@ it('issues and verifies a signed credential', async () => { const assertionMethod = didDocument.verificationMethod?.find(({ id }) => id.includes('assertion') ) + const { publicKey } = Did.multibaseKeyToDidKey( + assertionMethod!.publicKeyMultibase + ) + const publicKeyBase58 = base58Encode(publicKey) result = await vcjs.verifyCredential({ credential: verifiableCredential, suite: new Sr25519Signature2020({ key: new Sr25519VerificationKey2020({ ...assertionMethod, - publicKeyBase58: assertionMethod!.publicKeyMultibase.substring(1), + publicKeyBase58, }), }), documentLoader, diff --git a/packages/vc-export/src/suites/Sr25519Signature2020.ts b/packages/vc-export/src/suites/Sr25519Signature2020.ts index 19584ed0c..0d6205984 100644 --- a/packages/vc-export/src/suites/Sr25519Signature2020.ts +++ b/packages/vc-export/src/suites/Sr25519Signature2020.ts @@ -11,6 +11,7 @@ import { base58Decode, base58Encode } from '@polkadot/util-crypto' import jsigs from 'jsonld-signatures' // cjs module import { KiltCredentialV1, Types } from '@kiltprotocol/core' +import { KILT_DID_CONTEXT_URL, multibaseKeyToDidKey } from '@kiltprotocol/did' import { context } from '../context/context.js' import { Sr25519VerificationKey2020 } from './Sr25519VerificationKey.js' import { includesContext } from './utils.js' @@ -184,6 +185,8 @@ export class Sr25519Signature2020 extends LinkedDataSignature { let contextUrl if (verificationMethod.type === 'Sr25519VerificationKey2020') { contextUrl = SUITE_CONTEXT_URL + } else if (verificationMethod.type === 'Multikey') { + contextUrl = KILT_DID_CONTEXT_URL } else { throw new Error(`Unsupported key type "${verificationMethod.type}".`) } @@ -230,11 +233,16 @@ export class Sr25519Signature2020 extends LinkedDataSignature { const verificationMethod = typeof document === 'string' ? JSON.parse(document) : document + const { publicKey } = multibaseKeyToDidKey( + verificationMethod.publicKeyMultibase + ) + const publicKeyBase58 = base58Encode(publicKey) await this.assertVerificationMethod({ verificationMethod }) const verificationKey = ( await Sr25519VerificationKey2020.from({ ...verificationMethod, + publicKeyBase58, }) ).export({ publicKey: true, includeContext: true }) return verificationKey diff --git a/packages/vc-export/src/suites/Sr25519VerificationKey.ts b/packages/vc-export/src/suites/Sr25519VerificationKey.ts index 58e53837b..c9d7aa545 100644 --- a/packages/vc-export/src/suites/Sr25519VerificationKey.ts +++ b/packages/vc-export/src/suites/Sr25519VerificationKey.ts @@ -88,6 +88,9 @@ export class Sr25519VerificationKey2020 extends LDKeyPair { throw new TypeError('The "publicKeyBase58" property is required.') } this.privateKeyBase58 = options.privateKeyBase58 + if (options.id !== undefined && options.id.startsWith('#')) { + this.id = `${this.controller}${options.id}` + } } /** diff --git a/tests/integration/Did.spec.ts b/tests/integration/Did.spec.ts index 29ce021be..6f22cca31 100644 --- a/tests/integration/Did.spec.ts +++ b/tests/integration/Did.spec.ts @@ -126,7 +126,7 @@ describe('write and didDeleteTx', () => { verificationMethod: [ expect.objectContaining(>{ controller: fullDidUri, - type: 'MultiKey', + type: 'Multikey', // We cannot match the ID of the key because it will be defined by the blockchain while saving publicKeyMultibase: Did.keypairToMultibaseKey({ type: 'sr25519', @@ -353,13 +353,13 @@ describe('DID migration', () => { verificationMethod: [ expect.objectContaining(>{ controller: migratedFullDidUri, - type: 'MultiKey', + type: 'Multikey', // We cannot match the ID of the key because it will be defined by the blockchain while saving publicKeyMultibase: Did.keypairToMultibaseKey(authentication[0]), }), expect.objectContaining(>{ controller: migratedFullDidUri, - type: 'MultiKey', + type: 'Multikey', // We cannot match the ID of the key because it will be defined by the blockchain while saving publicKeyMultibase: Did.keypairToMultibaseKey(keyAgreement[0]), }), @@ -408,7 +408,7 @@ describe('DID migration', () => { verificationMethod: [ expect.objectContaining(>{ controller: migratedFullDidUri, - type: 'MultiKey', + type: 'Multikey', // We cannot match the ID of the key because it will be defined by the blockchain while saving publicKeyMultibase: Did.keypairToMultibaseKey(authentication[0]), }), @@ -469,13 +469,13 @@ describe('DID migration', () => { verificationMethod: [ expect.objectContaining(>{ controller: migratedFullDidUri, - type: 'MultiKey', + type: 'Multikey', // We cannot match the ID of the key because it will be defined by the blockchain while saving publicKeyMultibase: Did.keypairToMultibaseKey(authentication[0]), }), expect.objectContaining(>{ controller: migratedFullDidUri, - type: 'MultiKey', + type: 'Multikey', // We cannot match the ID of the key because it will be defined by the blockchain while saving publicKeyMultibase: Did.keypairToMultibaseKey(keyAgreement[0]), }), @@ -661,13 +661,13 @@ describe('DID management batching', () => { expect.objectContaining({ // Authentication controller: fullDid.id, - type: 'MultiKey', + type: 'Multikey', publicKeyMultibase: Did.keypairToMultibaseKey(authentication[0]), }), // Assertion method expect.objectContaining({ controller: fullDid.id, - type: 'MultiKey', + type: 'Multikey', publicKeyMultibase: Did.keypairToMultibaseKey({ type: 'sr25519', publicKey: new Uint8Array(32).fill(1), @@ -676,7 +676,7 @@ describe('DID management batching', () => { // Capability delegation expect.objectContaining({ controller: fullDid.id, - type: 'MultiKey', + type: 'Multikey', publicKeyMultibase: Did.keypairToMultibaseKey({ type: 'ecdsa', publicKey: new Uint8Array(33).fill(1), @@ -685,7 +685,7 @@ describe('DID management batching', () => { // Key agreement 1 expect.objectContaining({ controller: fullDid.id, - type: 'MultiKey', + type: 'Multikey', publicKeyMultibase: Did.keypairToMultibaseKey({ type: 'x25519', publicKey: new Uint8Array(32).fill(1), @@ -694,7 +694,7 @@ describe('DID management batching', () => { // Key agreement 2 expect.objectContaining({ controller: fullDid.id, - type: 'MultiKey', + type: 'Multikey', publicKeyMultibase: Did.keypairToMultibaseKey({ type: 'x25519', publicKey: new Uint8Array(32).fill(2), @@ -703,7 +703,7 @@ describe('DID management batching', () => { // Key agreement 3 expect.objectContaining({ controller: fullDid.id, - type: 'MultiKey', + type: 'Multikey', publicKeyMultibase: Did.keypairToMultibaseKey({ type: 'x25519', publicKey: new Uint8Array(32).fill(3), @@ -765,7 +765,7 @@ describe('DID management batching', () => { // Authentication expect.objectContaining(>{ controller: fullDid.id, - type: 'MultiKey', + type: 'Multikey', publicKeyMultibase: Did.keypairToMultibaseKey(didAuthKey), }), ], @@ -881,7 +881,7 @@ describe('DID management batching', () => { // Authentication expect.objectContaining(>{ controller: finalFullDid.id, - type: 'MultiKey', + type: 'Multikey', publicKeyMultibase: Did.keypairToMultibaseKey({ publicKey: keypair.publicKey, type: 'sr25519', @@ -959,7 +959,7 @@ describe('DID management batching', () => { // Authentication expect.objectContaining(>{ controller: finalFullDid.id, - type: 'MultiKey', + type: 'Multikey', publicKeyMultibase: Did.keypairToMultibaseKey({ publicKey: newAuthKey.publicKey, type: 'ed25519', @@ -1048,7 +1048,7 @@ describe('DID management batching', () => { expect.objectContaining({ // Authentication and assertionMethod controller: fullDid.id, - type: 'MultiKey', + type: 'Multikey', publicKeyMultibase: Did.keypairToMultibaseKey(authentication[0]), }), ],