this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

crypto: add Multibase() method to PrivateKeyExportable interface (#1079)

Pretty simple one: actually add `Multibase()` output encoding to
`PrivateKeyExportable` interface, as foreshadowed by an earlier comment.

Adds a round-trip test for the two current curve types supported.

authored by

bnewbold and committed by
GitHub
903575f7 3edc6e26

+4 -1
+2 -1
atproto/crypto/keys.go
··· 30 30 // No ASN.1 or other enclosing structure is applied to the bytes. 31 31 Bytes() []byte 32 32 33 - // NOTE: should Multibase() (string, error) be part of this interface? Probably. 33 + // String serialization of the key bytes in "Multibase" format. 34 + Multibase() string 34 35 } 35 36 36 37 // Common interface for all the supported atproto cryptographic systems.
+2
atproto/crypto/keys_test.go
··· 166 166 assert.NoError(err) 167 167 _, ok := privP256FromMB.(*PrivateKeyP256) 168 168 assert.True(ok) 169 + assert.Equal(privP256MB, privP256FromMB.Multibase()) 169 170 170 171 privK256FromMB, err := ParsePrivateMultibase(privK256MB) 171 172 assert.NoError(err) 172 173 _, ok = privK256FromMB.(*PrivateKeyK256) 173 174 assert.True(ok) 175 + assert.Equal(privK256MB, privK256FromMB.Multibase()) 174 176 }