You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DateKeys/locator/open.go

38 lines
1.2 KiB

package locator
import (
"errors"
"g.activething.com/go/DateKeys/extension"
"g.activething.com/go/DateKeys/profile"
"g.activething.com/go/DateKeys/provider"
)
// OpenLocator opens the sealed locator of the extension with the release of
// the round of its own DateKey, in the profile that DateKey names: a locator
// for another round or another chain does not open, and is unusable (spec
// v0.11, §44.1). It fails when the extension has no locator.
func (i *Info) OpenLocator(reg profile.Registry, release provider.Release) (*Locator, error) {
if i.Sealed == nil {
return nil, errors.New("locator: the extension has no locator")
}
Review fixes: author keys, the writer, the CLI, extensions and the locator Fixes of the review of the session of 1 and 2 October that the text of spec v0.11 already asks for: - authorkey: String and GoString hide the secret key, which only Secret returns; ParsePublic refuses a key that is not a point of the curve (ed25519strict.OnCurve, checked against the square root of testkit). - capsule: a typed nil in AuthorKey, CMSSigner or Sealer is an error, never a capsule without the signature or the seal that was asked for. A panic while evaluating the signature or the seal fails only that part, F1 or S2, not both. OpenOptions.Accept sees the verdicts before step 18 and can refuse to publish the files. - extension.CheckWrite, the rule of encoders of spec 72: the writers of capsules and .dkk files refuse datekeys.note and datekeys.capsule outside the arrays where they are registered, or with invalid data. - CLI: encrypt -sign shows the author key and the code of AUTHOR_MESSAGE before it signs (rule 20); decrypt -expect-author compares the key of an F4 and writes nothing unless it matches; decrypt notifies a public note that it does not show; the lines of the verdicts break at the last space that fits, each row after the first behind a mark, so that the terminal never breaks them; L is the payload, not the content. - locator: a reader rejects an address that breaks 44.1 and keeps the others; addresses refuse the special-purpose blocks of IANA, IPv6 outside 2000::/3, localhost and local names, characters outside RFC 3986, dot segments, and a CID that does not decode to version 1 and a multihash; ParseInfo checks that the locator is an age file with one tlock stanza for the round of its DateKey; Info.Extension reads what it writes; its errors carry no normative code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6 days ago
if reg == nil {
return nil, errors.New("locator: no registry of pinned profiles")
}
p, ok := reg.Lookup(i.DateKey.ProfileID)
if !ok {
return nil, errors.New("locator: the profile of the DateKey is not pinned")
}
return Open(p, i.DateKey.Round, release, i.Sealed)
}
// Standard returns the registry of the extensions of spec v0.11 with the
// data of datekeys.capsule validated by ParseInfo, as spec §54 asks of a
// reader that knows an extension.
func Standard() extension.Standard {
return extension.Standard{ValidateCapsule: func(e extension.Extension) error {
_, err := ParseInfo(e)
return err
}}
}

Powered by TurnKey Linux.