diff --git a/src/StevanFreeborn.Atproto.IdentityResolver/IResolver.cs b/src/StevanFreeborn.Atproto.IdentityResolver/IResolver.cs new file mode 100644 index 0000000..5c888af --- /dev/null +++ b/src/StevanFreeborn.Atproto.IdentityResolver/IResolver.cs @@ -0,0 +1,12 @@ +namespace StevanFreeborn.Atproto.IdentityResolver; + +/// +/// +/// +public interface IResolver +{ + /// + /// + /// + Task ResolveOrThrowAsync(AtprotoId atprotoId, CancellationToken ct); +} \ No newline at end of file diff --git a/src/StevanFreeborn.Atproto.IdentityResolver/Resolver.cs b/src/StevanFreeborn.Atproto.IdentityResolver/Resolver.cs new file mode 100644 index 0000000..b7781b9 --- /dev/null +++ b/src/StevanFreeborn.Atproto.IdentityResolver/Resolver.cs @@ -0,0 +1,35 @@ +namespace StevanFreeborn.Atproto.IdentityResolver; + +/// +public class Resolver : IResolver +{ + /// + public Task ResolveOrThrowAsync(AtprotoId atprotoId, CancellationToken ct) + { + // you need to retrieve the did document based on what you got + // if you have domain + // you are going to try to retrieve the did + // either through using /.well-known/did.json + // or looking for _atproto.domain txt record + // + // you now for sure have a did + // check method + // if method is web + // retrieve doc from domain/.well-known/did.json + // if method is plc + // retrieve doc from plc.directory/{did} + // you now have the document + // extract alsoKnownAs which is the handle + // make sure you can get back the same did + // from the handle's domain at /.well-known/did.json + // or _atproto.domain txt record + + return Task.FromResult(new DidDocument()); + } + +} + +/// +/// +/// +public class DidDocument(); \ No newline at end of file diff --git a/tests/StevanFreeborn.Atproto.IdentityResolver.Tests/ResolverTests.cs b/tests/StevanFreeborn.Atproto.IdentityResolver.Tests/ResolverTests.cs new file mode 100644 index 0000000..92e7685 --- /dev/null +++ b/tests/StevanFreeborn.Atproto.IdentityResolver.Tests/ResolverTests.cs @@ -0,0 +1,10 @@ +namespace StevanFreeborn.Atproto.IdentityResolver.Tests; + +public class ResolverTests +{ + [Fact] + public async Task ResolveAsync_WhenCalledWithInvalidDid_ItShouldThrowInvalidArgumentException() + { + true.Should().BeTrue(); + } +} \ No newline at end of file