chore: stub out resolver which will be main entry point of the package
This commit is contained in:
1 parent
716d79739c
commit
b186c1e1ca
3 files changed
+57
No files matched your search
@@ -0,0 +1,12 @@
|
|||||||
|
namespace StevanFreeborn.Atproto.IdentityResolver;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public interface IResolver
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
Task<DidDocument> ResolveOrThrowAsync(AtprotoId atprotoId, CancellationToken ct);
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
namespace StevanFreeborn.Atproto.IdentityResolver;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public class Resolver : IResolver
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public Task<DidDocument> 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());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class DidDocument();
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace StevanFreeborn.Atproto.IdentityResolver.Tests;
|
||||||
|
|
||||||
|
public class ResolverTests
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public async Task ResolveAsync_WhenCalledWithInvalidDid_ItShouldThrowInvalidArgumentException()
|
||||||
|
{
|
||||||
|
true.Should().BeTrue();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user