Skip to content

Commit 27de50c

Browse files
fix(sdk-core): clarify base32 Safe root validation
Update the Ed25519 Safe root validation error to describe the canonical base32 representation used by backup and BitGo roots.\n\nThe root payload is raw publicKey32 || chainCode32 encoded as unpadded RFC 4648 base32; it is not lowercase hexadecimal or a coin-specific public-key format.\n\nTicket: WCN-2411
1 parent f498d68 commit 27de50c

2 files changed

Lines changed: 25 additions & 7 deletions

File tree

modules/sdk-core/src/bitgo/safe/safes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ export class Safes implements ISafes {
270270
!bitgoKeychain.pub ||
271271
!isDerivableEd25519Pub(bitgoKeychain.pub))
272272
) {
273-
throw new Error('Safe ed25519Multisig roots are not derivable: expected 64-byte lowercase hex material');
273+
throw new Error('Safe ed25519Multisig roots are not derivable: expected 64-byte canonical base32 material');
274274
}
275275

276276
return [userKeychain.id, backupKeychain.id, bitgoKeychain.id];

modules/sdk-core/test/unit/bitgo/safe/fixtures/derivableEd25519Pub.json

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,31 @@
1818
}
1919
],
2020
"invalid": [
21-
{ "name": "lowercase", "composite": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaakxk5lvov2xkaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" },
22-
{ "name": "short", "composite": "AA" },
23-
{ "name": "non-canonical trailing bits", "composite": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKXK5LVOV2XKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB" }
21+
{
22+
"name": "lowercase",
23+
"composite": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaakxk5lvov2xkaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
24+
},
25+
{
26+
"name": "short",
27+
"composite": "AA"
28+
},
29+
{
30+
"name": "non-canonical trailing bits",
31+
"composite": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKXK5LVOV2XKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB"
32+
}
2433
],
2534
"invalidComposite": [
26-
{ "name": "lowercase", "composite": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaakxk5lvov2xkaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" },
27-
{ "name": "short", "composite": "AA" },
28-
{ "name": "non-canonical trailing bits", "composite": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKXK5LVOV2XKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB" }
35+
{
36+
"name": "lowercase",
37+
"composite": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaakxk5lvov2xkaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
38+
},
39+
{
40+
"name": "short",
41+
"composite": "AA"
42+
},
43+
{
44+
"name": "non-canonical trailing bits",
45+
"composite": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKXK5LVOV2XKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB"
46+
}
2947
]
3048
}

0 commit comments

Comments
 (0)