···
const verificationMethods: VerificationMethod[] = []
for (const [keyid, key] of Object.entries(data.verificationMethods)) {
const info = formatKeyAndContext(key)
15
-
if (!context.includes(info.context)) {
15
+
if (info.context && !context.includes(info.context)) {
context.push(info.context)
verificationMethods.push({
···
60
+
publicKeyMultibase: string
const formatKeyAndContext = (key: string): KeyAndContext => {
···
keyInfo = crypto.parseDidKey(key)
68
-
throw new UnsupportedKeyError(key, err)
69
+
// we can't specify a context for a key type we don't recognize
71
+
publicKeyMultibase: key.replace(/^(did:key:)/, ''),
const { jwtAlg } = keyInfo
···
publicKeyMultibase: key.replace(/^(did:key:)/, ''),
85
-
throw new UnsupportedKeyError(key, `Unsupported key type: ${jwtAlg}`)
90
+
// this codepath might seem unreachable/redundant, but it's possible
91
+
// parseDidKey() supports more key formats in future, before this function
92
+
// can be updated likewise
94
+
// we can't specify a context for a key type we don't recognize
96
+
publicKeyMultibase: key.replace(/^(did:key:)/, ''),