+1
atproto/identity/apidir/apidir.go
+1
atproto/identity/apidir/apidir.go
+1
atproto/identity/base_directory.go
+1
atproto/identity/base_directory.go
···
55
55
if err != nil {
56
56
return nil, fmt.Errorf("could not verify handle/DID match: %w", err)
57
57
}
58
+
// NOTE: DeclaredHandle() returns a normalized handle, and we already normalized 'h' above
58
59
if declared != h {
59
60
return nil, fmt.Errorf("%w: %s != %s", ErrHandleMismatch, declared, h)
60
61
}
+2
atproto/identity/cache_directory.go
+2
atproto/identity/cache_directory.go
···
93
93
}
94
94
95
95
func (d *CacheDirectory) ResolveHandle(ctx context.Context, h syntax.Handle) (syntax.DID, error) {
96
+
h = h.Normalize()
96
97
if h.IsInvalidHandle() {
97
98
return "", fmt.Errorf("can not resolve handle: %w", ErrInvalidHandle)
98
99
}
···
251
252
if err != nil {
252
253
return nil, hit, fmt.Errorf("could not verify handle/DID mapping: %w", err)
253
254
}
255
+
// NOTE: DeclaredHandle() returns a normalized handle, and we already normalized 'h' above
254
256
if declared != h {
255
257
return nil, hit, fmt.Errorf("%w: %s != %s", ErrHandleMismatch, declared, h)
256
258
}
+2
atproto/identity/handle.go
+2
atproto/identity/handle.go
+1
-1
atproto/identity/mock_directory.go
+1
-1
atproto/identity/mock_directory.go
+5
atproto/identity/mock_directory_test.go
+5
atproto/identity/mock_directory_test.go
···
65
65
66
66
_, err = c.ResolveDID(ctx, syntax.DID("did:plc:abc999"))
67
67
assert.ErrorIs(err, ErrDIDNotFound)
68
+
69
+
// handle lookups should be case-insensitive
70
+
_, err = c.ResolveHandle(ctx, syntax.Handle("handle.EXAMPLE.com"))
71
+
assert.NoError(err)
72
+
assert.Equal(id1.DID, did)
68
73
}
+2
atproto/identity/redisdir/redis_directory.go
+2
atproto/identity/redisdir/redis_directory.go
···
156
156
157
157
func (d *RedisDirectory) ResolveHandle(ctx context.Context, h syntax.Handle) (syntax.DID, error) {
158
158
start := time.Now()
159
+
h = h.Normalize()
159
160
if h.IsInvalidHandle() {
160
161
return "", fmt.Errorf("can not resolve handle: %w", identity.ErrInvalidHandle)
161
162
}
···
359
360
if err != nil {
360
361
return nil, hit, err
361
362
}
363
+
// NOTE: DeclaredHandle() returns a normalized handle, and we already normalized 'h' above
362
364
if declared != h {
363
365
return nil, hit, identity.ErrHandleMismatch
364
366
}