Skip to content

Conversation

@FiloSottile
Copy link
Owner

No description provided.

Copy link

@AnomalRoil AnomalRoil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a nice addition that will make using it as a library a little bit easier as well, I'm guessing the goal is to allow to have detached headers to have files with just ciphertext and no headers?


func decryptHdr(hdr *format.Header, identities ...Identity) ([]byte, error) {
if len(identities) == 0 {
return nil, errors.New("no identities specified")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an error that might be worth exporting to allow library users to easily spot it (errors.Is(err, age.ErrNoIdentity)) and issue proper guidance to their users.

Comment on lines +317 to +325
type injectedFileKeyIdentity struct {
fileKey []byte
}

// NewInjectedFileKeyIdentity returns an [Identity] that always produces
// a fixed file key, such as one returned by [DecryptHeader].
func NewInjectedFileKeyIdentity(fileKey []byte) Identity {
return injectedFileKeyIdentity{fileKey}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name isn't immediately clear imo, maybe fixedFileKeyIdentity would be clearer?

return nil, ErrIncorrectIdentity
}

// ExtractHeader returns a detched header from the src file.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: s/detched/detached/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants