Skip to content

Commit 4053d5c

Browse files
committed
fix: align DEVICE_PREFIX with CLI storage layout (refs/auths/keys)
The widget used a stale ref prefix (refs/auths/devices/nodes) that no longer matches the CLI's StorageLayoutConfig::default(). This caused widget verification to return an empty attestation chain.
1 parent 74d9a6a commit 4053d5c

4 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/resolvers/gitea.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { didKeyToPublicKeyHex } from './did-utils';
1313

1414
// Git ref constants — mirrors auths-id/src/storage/layout.rs
1515
const IDENTITY_REF = 'refs/auths/identity';
16-
const DEVICE_PREFIX = 'refs/auths/devices/nodes';
16+
const DEVICE_PREFIX = 'refs/auths/keys';
1717
const IDENTITY_BLOB = 'identity.json';
1818
const ATTESTATION_BLOB = 'attestation.json';
1919

src/resolvers/github.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { didKeyToPublicKeyHex, sanitizeDidForRef } from './did-utils';
1616

1717
// Git ref constants — mirrors auths-id/src/storage/layout.rs
1818
const IDENTITY_REF = 'refs/auths/identity';
19-
const DEVICE_PREFIX = 'refs/auths/devices/nodes';
19+
const DEVICE_PREFIX = 'refs/auths/keys';
2020
const IDENTITY_BLOB = 'identity.json';
2121
const ATTESTATION_BLOB = 'attestation.json';
2222

@@ -103,7 +103,7 @@ export const githubAdapter: ForgeAdapter = {
103103

104104
for (const deviceRef of deviceRefs) {
105105
// Only process refs that end with a blob-bearing path
106-
// Device ref pattern: refs/auths/devices/nodes/<sanitized_did>/signatures
106+
// Device ref pattern: refs/auths/keys/<sanitized_did>/signatures
107107
try {
108108
const attestBlob = await resolveTreeBlob(
109109
config,

tests/resolvers/gitea.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ describe('giteaAdapter', () => {
7474
global.fetch = mockFetch({
7575
'git/refs/auths': [
7676
{ ref: 'refs/auths/identity', object: { sha: 'commit1' } },
77-
{ ref: 'refs/auths/devices/nodes/dev1/signatures', object: { sha: 'commit2' } },
77+
{ ref: 'refs/auths/keys/dev1/signatures', object: { sha: 'commit2' } },
7878
],
7979
'git/commits/commit1': { tree: { sha: 'tree1' } },
8080
'git/trees/tree1': {

tests/resolvers/github.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ describe('githubAdapter', () => {
3939
global.fetch = mockFetch({
4040
'matching-refs/auths/': [
4141
{ ref: 'refs/auths/identity', object: { sha: 'abc123' } },
42-
{ ref: 'refs/auths/devices/nodes/dev1/signatures', object: { sha: 'def456' } },
42+
{ ref: 'refs/auths/keys/dev1/signatures', object: { sha: 'def456' } },
4343
],
4444
});
4545

@@ -72,7 +72,7 @@ describe('githubAdapter', () => {
7272
global.fetch = mockFetch({
7373
'matching-refs/auths/': [
7474
{ ref: 'refs/auths/identity', object: { sha: 'commit1' } },
75-
{ ref: 'refs/auths/devices/nodes/dev1/signatures', object: { sha: 'commit2' } },
75+
{ ref: 'refs/auths/keys/dev1/signatures', object: { sha: 'commit2' } },
7676
],
7777
'git/commits/commit1': { tree: { sha: 'tree1' } },
7878
'git/trees/tree1': {
@@ -106,7 +106,7 @@ describe('githubAdapter', () => {
106106
it('should return error when identity ref is missing', async () => {
107107
global.fetch = mockFetch({
108108
'matching-refs/auths/': [
109-
{ ref: 'refs/auths/devices/nodes/dev1', object: { sha: 'abc' } },
109+
{ ref: 'refs/auths/keys/dev1', object: { sha: 'abc' } },
110110
],
111111
});
112112

0 commit comments

Comments
 (0)