diff --git a/js/app/src/router.tsx b/js/app/src/router.tsx index 0d8397a88..09e457fde 100644 --- a/js/app/src/router.tsx +++ b/js/app/src/router.tsx @@ -140,7 +140,7 @@ const linking: LinkingOptions = { Multi: "multi/:config", Support: "support", Settings: "settings", - KeyManagement: "settings/key-management", + KeyManagement: "key-management", GoLive: "golive", LiveDashboard: "live", Login: "login", @@ -442,7 +442,7 @@ export function StreamplaceDrawer() { /> Key Manager, diff --git a/js/docs/src/content/docs/lex-reference/place-stream-key.md b/js/docs/src/content/docs/lex-reference/place-stream-key.md index 8ef6d7036..b9b5eec5f 100644 --- a/js/docs/src/content/docs/lex-reference/place-stream-key.md +++ b/js/docs/src/content/docs/lex-reference/place-stream-key.md @@ -23,6 +23,7 @@ Record linking an atproto identity with a stream signing key | ------------ | -------- | ----- | ---------------------------------------------------- | --------------------------------- | | `signingKey` | `string` | ✅ | The did:key signing key for the stream. | Min Length: 57
Max Length: 57 | | `createdAt` | `string` | ✅ | Client-declared timestamp when this key was created. | Format: `datetime` | +| `createdBy` | `string` | ❌ | The name of the client that created this key. | | --- @@ -51,6 +52,10 @@ Record linking an atproto identity with a stream signing key "type": "string", "format": "datetime", "description": "Client-declared timestamp when this key was created." + }, + "createdBy": { + "type": "string", + "description": "The name of the client that created this key." } } } diff --git a/lexicons/place/stream/key.json b/lexicons/place/stream/key.json index d2b139210..f855591d2 100644 --- a/lexicons/place/stream/key.json +++ b/lexicons/place/stream/key.json @@ -20,6 +20,10 @@ "type": "string", "format": "datetime", "description": "Client-declared timestamp when this key was created." + }, + "createdBy": { + "type": "string", + "description": "The name of the client that created this key." } } } diff --git a/pkg/streamplace/cbor_gen.go b/pkg/streamplace/cbor_gen.go index 43f14d09f..71988462d 100644 --- a/pkg/streamplace/cbor_gen.go +++ b/pkg/streamplace/cbor_gen.go @@ -28,8 +28,13 @@ func (t *Key) MarshalCBOR(w io.Writer) error { } cw := cbg.NewCborWriter(w) + fieldCount := 4 - if _, err := cw.Write([]byte{163}); err != nil { + if t.CreatedBy == nil { + fieldCount-- + } + + if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { return err } @@ -75,6 +80,38 @@ func (t *Key) MarshalCBOR(w io.Writer) error { return err } + // t.CreatedBy (string) (string) + if t.CreatedBy != nil { + + if len("createdBy") > 1000000 { + return xerrors.Errorf("Value in field \"createdBy\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdBy"))); err != nil { + return err + } + if _, err := cw.WriteString(string("createdBy")); err != nil { + return err + } + + if t.CreatedBy == nil { + if _, err := cw.Write(cbg.CborNull); err != nil { + return err + } + } else { + if len(*t.CreatedBy) > 1000000 { + return xerrors.Errorf("Value in field t.CreatedBy was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.CreatedBy))); err != nil { + return err + } + if _, err := cw.WriteString(string(*t.CreatedBy)); err != nil { + return err + } + } + } + // t.SigningKey (string) (string) if len("signingKey") > 1000000 { return xerrors.Errorf("Value in field \"signingKey\" was too long") @@ -163,6 +200,27 @@ func (t *Key) UnmarshalCBOR(r io.Reader) (err error) { t.CreatedAt = string(sval) } + // t.CreatedBy (string) (string) + case "createdBy": + + { + b, err := cr.ReadByte() + if err != nil { + return err + } + if b != cbg.CborNull[0] { + if err := cr.UnreadByte(); err != nil { + return err + } + + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.CreatedBy = (*string)(&sval) + } + } // t.SigningKey (string) (string) case "signingKey": diff --git a/pkg/streamplace/streamkey.go b/pkg/streamplace/streamkey.go index 2e4bf28b0..c45af7fbe 100644 --- a/pkg/streamplace/streamkey.go +++ b/pkg/streamplace/streamkey.go @@ -16,6 +16,8 @@ type Key struct { LexiconTypeID string `json:"$type,const=place.stream.key" cborgen:"$type,const=place.stream.key"` // createdAt: Client-declared timestamp when this key was created. CreatedAt string `json:"createdAt" cborgen:"createdAt"` + // createdBy: The name of the client that created this key. + CreatedBy *string `json:"createdBy,omitempty" cborgen:"createdBy,omitempty"` // signingKey: The did:key signing key for the stream. SigningKey string `json:"signingKey" cborgen:"signingKey"` }