Skip to content

Commit 455670b

Browse files
committed
Upgrade parent version
1 parent f213bd2 commit 455670b

5 files changed

Lines changed: 18 additions & 18 deletions

File tree

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<parent>
1212
<groupId>decentralized-identity</groupId>
1313
<artifactId>uni-resolver</artifactId>
14-
<version>0.34.0</version>
14+
<version>0.41.0</version>
1515
</parent>
1616

1717
<scm>

src/main/java/uniresolver/driver/did/btc1/crud/read/ResolveInitialDocument.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ private DIDDocument sidecarInitialDocumentValidation(DID identifier, IdentifierC
174174
// If hashBytes does not equal identifierComponents.genesisBytes MUST throw an invalidDid error.
175175

176176
if (! Arrays.equals(hashBytes, identifierComponents.genesisBytes())) {
177-
throw new ResolutionException(ResolutionException.ERROR_INVALIDDID, "Initial document cannot be validated");
177+
throw new ResolutionException(ResolutionException.ERROR_INVALID_DID, "Initial document cannot be validated");
178178
}
179179

180180
// DID DOCUMENT METADATA

src/main/java/uniresolver/driver/did/btc1/crud/read/ResolveTargetDocument.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ private static DIDDocument applyDIDUpdate(DIDDocument contemporaryDIDDocument, D
441441

442442
DataIntegrityProof dataIntegrityProof = DataIntegrityProof.getFromJsonLDObject(update);
443443
String capabilityId = JsonLDUtils.jsonLdGetString(dataIntegrityProof.getJsonObject(), "capability");
444-
if (capabilityId == null) throw new ResolutionException(ResolutionException.ERROR_INVALIDDID, "No 'capability' found in update proof: " + update);
444+
if (capabilityId == null) throw new ResolutionException(ResolutionException.ERROR_INVALID_DID, "No 'capability' found in update proof: " + update);
445445

446446
RootCapability rootCapability = RootDidBtc1UpdateCapabilities.dereferenceRootCapabilityIdentifier(capabilityId);
447447

src/main/java/uniresolver/driver/did/btc1/syntax/DidBtc1IdentifierDecoding.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ public static IdentifierComponents didBtc1IdentifierDecoding(DID identifier) thr
3434
// If components[0] is not “did”, raise invalidDid error.
3535
// If components[1] is not “btc1”, raise methodNotSupported error.
3636

37-
if (components.length != 3) throw new ResolutionException(ResolutionException.ERROR_INVALIDDID, "Invalid number of ':' characters (must be 3): " + identifier.getDidString());
38-
if (! "did".equals(components[0])) throw new ResolutionException(ResolutionException.ERROR_INVALIDDID, "Invalid URI scheme (must be 'did'): " + identifier.getDidString());
39-
if (! "btc1".equals(components[1])) throw new ResolutionException(ResolutionException.ERROR_METHODNOTSUPPORTED, "Unsupported DID method (must be 'btc1'): " + identifier.getDidString());
37+
if (components.length != 3) throw new ResolutionException(ResolutionException.ERROR_INVALID_DID, "Invalid number of ':' characters (must be 3): " + identifier.getDidString());
38+
if (! "did".equals(components[0])) throw new ResolutionException(ResolutionException.ERROR_INVALID_DID, "Invalid URI scheme (must be 'did'): " + identifier.getDidString());
39+
if (! "btc1".equals(components[1])) throw new ResolutionException(ResolutionException.ERROR_METHOD_NOT_SUPPORTED, "Unsupported DID method (must be 'btc1'): " + identifier.getDidString());
4040

4141
// Set encodedString to components[2].
4242

@@ -49,7 +49,7 @@ public static IdentifierComponents didBtc1IdentifierDecoding(DID identifier) thr
4949
try {
5050
bech32Data = Bech32mDecoding.bech32Decode(encodedString);
5151
} catch (AddressFormatException ex) {
52-
throw new ResolutionException(ResolutionException.ERROR_INVALIDDID, "Cannot bech32m-decode identifier: " + encodedString, ex);
52+
throw new ResolutionException(ResolutionException.ERROR_INVALID_DID, "Cannot bech32m-decode identifier: " + encodedString, ex);
5353
}
5454
String hrp = bech32Data.hrp;
5555
byte[] dataBytes = bech32Data.decode5to8();
@@ -59,7 +59,7 @@ public static IdentifierComponents didBtc1IdentifierDecoding(DID identifier) thr
5959
String idType = switch(hrp) {
6060
case "k" -> "key";
6161
case "x" -> "external";
62-
default -> throw new ResolutionException(ResolutionException.ERROR_INVALIDDID, "Invalid 'hrp' value in " + encodedString + ": " + bech32Data.hrp);
62+
default -> throw new ResolutionException(ResolutionException.ERROR_INVALID_DID, "Invalid 'hrp' value in " + encodedString + ": " + bech32Data.hrp);
6363
};
6464

6565
// Set version to 1.
@@ -89,7 +89,7 @@ public static IdentifierComponents didBtc1IdentifierDecoding(DID identifier) thr
8989

9090
// If version is greater than 1, raise invalidDid error.
9191

92-
if (version > 1) throw new ResolutionException(ResolutionException.ERROR_INVALIDDID, "Unsupported 'version' value in " + encodedString + ": " + version);
92+
if (version > 1) throw new ResolutionException(ResolutionException.ERROR_INVALID_DID, "Unsupported 'version' value in " + encodedString + ": " + version);
9393

9494
// Advance to the next nibble and set networkValue to its value.
9595

@@ -101,14 +101,14 @@ public static IdentifierComponents didBtc1IdentifierDecoding(DID identifier) thr
101101
try {
102102
network = Network.valueOf(networkValue);
103103
} catch (Exception ex) {
104-
throw new ResolutionException(ResolutionException.ERROR_INVALIDDID, "Unsupported 'network' value in " + encodedString + ": " + networkValue);
104+
throw new ResolutionException(ResolutionException.ERROR_INVALID_DID, "Unsupported 'network' value in " + encodedString + ": " + networkValue);
105105
}
106106

107107
// If the number of nibbles consumed is odd:
108108

109109
if (nibbleStream.isOdd()) {
110110
byte fillerNibble = nibbleStream.nextNibble();
111-
if (fillerNibble != 0) throw new ResolutionException(ResolutionException.ERROR_INVALIDDID, "Invalid filler nibble in " + encodedString + ": " + fillerNibble);
111+
if (fillerNibble != 0) throw new ResolutionException(ResolutionException.ERROR_INVALID_DID, "Invalid filler nibble in " + encodedString + ": " + fillerNibble);
112112
}
113113

114114
// Set genesisBytes to the remaining dataBytes.
@@ -151,7 +151,7 @@ public byte nextNibble() throws ResolutionException {
151151
byte nextNibble = this.nextHighNibble ? higherNibble(this.dataBytes[this.nextByteIndex]) : lowerNibble(this.dataBytes[this.nextByteIndex]);
152152
this.nextHighNibble = ! this.nextHighNibble;
153153
if (this.nextHighNibble) this.nextByteIndex++;
154-
if (this.nextByteIndex >= this.dataBytes.length) throw new ResolutionException(ResolutionException.ERROR_INVALIDDID, "Mot enough bytes left at index " + this.nextByteIndex + ": " + Hex.encodeHexString(this.dataBytes));
154+
if (this.nextByteIndex >= this.dataBytes.length) throw new ResolutionException(ResolutionException.ERROR_INVALID_DID, "Mot enough bytes left at index " + this.nextByteIndex + ": " + Hex.encodeHexString(this.dataBytes));
155155
return nextNibble;
156156
}
157157

src/main/java/uniresolver/driver/did/btc1/syntax/DidBtc1IdentifierEncoding.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,27 +29,27 @@ public static DID didBtc1IdentifierEncoding(String idType, Integer version, Obje
2929
// If idType is not a valid value per above, raise invalidDid error.
3030

3131
if (! "key".equals(idType) && ! "external".equals(idType)) {
32-
throw new ResolutionException(ResolutionException.ERROR_INVALIDDID, "Invalid 'idType' value: " + idType);
32+
throw new ResolutionException(ResolutionException.ERROR_INVALID_DID, "Invalid 'idType' value: " + idType);
3333
}
3434

3535
// If version is greater than 1, raise invalidDid error.
3636

3737
if (version > 1) {
38-
throw new ResolutionException(ResolutionException.ERROR_INVALIDDID, "Unsupported 'version' value: " + version);
38+
throw new ResolutionException(ResolutionException.ERROR_INVALID_DID, "Unsupported 'version' value: " + version);
3939
}
4040

4141
// If network is not a valid value per above, raise invalidDid error.
4242

4343
if (networkValue instanceof Network) networkValue = networkValue.toString();
4444

4545
if (! (networkValue instanceof String networkValueString && Arrays.asList(Network.values()).contains(Network.valueOf(networkValueString))) && ! (networkValue instanceof Number)) {
46-
throw new ResolutionException(ResolutionException.ERROR_INVALIDDID, "Unsupported 'network' value: " + networkValue);
46+
throw new ResolutionException(ResolutionException.ERROR_INVALID_DID, "Unsupported 'network' value: " + networkValue);
4747
}
4848

4949
// if network is a number and is outside the range of 1-8, raise invalidDid error.
5050

5151
if (networkValue instanceof Number networkValueNumber && (networkValueNumber.intValue() < 1 || networkValueNumber.intValue() > 8)) {
52-
throw new ResolutionException(ResolutionException.ERROR_INVALIDDID, "Unsupported 'network' number value: " + networkValueNumber);
52+
throw new ResolutionException(ResolutionException.ERROR_INVALID_DID, "Unsupported 'network' number value: " + networkValueNumber);
5353
}
5454

5555
// If idType is “key” and genesisBytes is not a valid compressed secp256k1 public key, raise invalidDid error.
@@ -68,7 +68,7 @@ public static DID didBtc1IdentifierEncoding(String idType, Integer version, Obje
6868
String hrp = switch (idType) {
6969
case "key" -> "k";
7070
case "external" -> "x";
71-
default -> throw new ResolutionException(ResolutionException.ERROR_INVALIDDID, "Invalid 'idType' value in: " + idType);
71+
default -> throw new ResolutionException(ResolutionException.ERROR_INVALID_DID, "Invalid 'idType' value in: " + idType);
7272
};
7373

7474
// Create an empty nibbles numeric array.
@@ -118,7 +118,7 @@ public static DID didBtc1IdentifierEncoding(String idType, Integer version, Obje
118118
try {
119119
dataBytes.write(genesisBytes);
120120
} catch (IOException ex) {
121-
throw new ResolutionException(ResolutionException.ERROR_INVALIDDID, "Cannot write genesis bytes " + Hex.encodeHexString(genesisBytes) + ": " + ex.getMessage(), ex);
121+
throw new ResolutionException(ResolutionException.ERROR_INVALID_DID, "Cannot write genesis bytes " + Hex.encodeHexString(genesisBytes) + ": " + ex.getMessage(), ex);
122122
}
123123

124124
// Set identifier to “did:btc1:”.

0 commit comments

Comments
 (0)