resolve method
Resolves a handle (alice.example, optionally @/at:// prefixed) or a
DID (did:plc: / did:web:) to its atproto identity.
Implementation
@override
Future<ResolvedIdentity> resolve(final String identity) async {
final normalized = _normalizeIdentity(identity, name: 'identity');
final String did;
final String? suppliedHandle;
if (normalized.startsWith('did:')) {
did = normalized;
suppliedHandle = null;
} else {
suppliedHandle = normalized.toLowerCase();
did = await _resolveHandle(suppliedHandle);
}
final didDocument = await _resolveDidDocument(did);
final String handle;
if (suppliedHandle != null) {
final claimed = _claimedHandleOf(didDocument);
if (claimed != suppliedHandle) {
throw IdentityException(
'Bidirectional handle verification failed: the DID document for '
'"$did" claims ${claimed == null ? 'no handle' : '"$claimed"'}, '
'not "$suppliedHandle"',
);
}
handle = suppliedHandle;
} else {
handle = await _verifiedHandleOf(didDocument, did);
}
return ResolvedIdentity(
did: did,
pds: _extractPdsEndpoint(didDocument, did),
handle: handle,
signingKey: signingKeyOf(didDocument, did),
);
}