Commit 3a6df1b 1 parent 038759f commit 3a6df1b Copy full SHA for 3a6df1b
File tree 1 file changed +4
-1
lines changed
src/main/java/com/apicatalog/did/key
1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change 3
3
import java .net .URI ;
4
4
5
5
import com .apicatalog .did .Did ;
6
+ import com .apicatalog .multibase .Multibase ;
6
7
import com .apicatalog .multibase .MultibaseDecoder ;
7
8
import com .apicatalog .multicodec .Multicodec ;
8
9
import com .apicatalog .multicodec .Multicodec .Tag ;
@@ -67,7 +68,9 @@ public static final DidKey from(final Did did) {
67
68
throw new IllegalArgumentException ("The given DID method [" + did .getMethod () + "] is not 'key'. DID [" + did .toString () + "]." );
68
69
}
69
70
70
- final byte [] decoded = MULTIBASE .decode (did .getMethodSpecificId ());
71
+ final Multibase base = MULTIBASE .getBase (did .getMethodSpecificId ()).orElseThrow (() -> new IllegalArgumentException ("Cannot detect did:key base encoding." ));
72
+
73
+ final byte [] decoded = base .decode (did .getMethodSpecificId ());
71
74
72
75
final Multicodec codec = MULTICODEC .getCodec (decoded ).orElseThrow (() -> new IllegalArgumentException ("Cannot detect did:key codec." ));
73
76
You can’t perform that action at this time.
0 commit comments