1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-12 11:38:00 -05:00

Update modules/keying/keying.go

Typo
This commit is contained in:
FermeLeLundi 2024-11-28 10:34:08 +00:00
parent 893c2f2d90
commit 229cb20f68

View file

@ -1,8 +1,8 @@
// Copyright 2024 The Forgejo Authors. All rights reserved. // Copyright 2024 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Keying is a module that allows for subkeys to be determistically generated // Keying is a module that allows for subkeys to be deterministically generated
// from the same master key. It allows for domain seperation to take place by // from the same master key. It allows for domain separation to take place by
// using new keys for new subsystems/domains. These subkeys are provided with // using new keys for new subsystems/domains. These subkeys are provided with
// an API to encrypt and decrypt data. The module panics if a bad interaction // an API to encrypt and decrypt data. The module panics if a bad interaction
// happened, the panic should be seen as an non-recoverable error. // happened, the panic should be seen as an non-recoverable error.
@ -52,8 +52,8 @@ var (
ContextTOTP Context = "totp" ContextTOTP Context = "totp"
) )
// Derive *the* key for a given context, this is a determistic function. The // Derive *the* key for a given context, this is a deterministic function.
// same key will be provided for the same context. // The same key will be provided for the same context.
func DeriveKey(context Context) *Key { func DeriveKey(context Context) *Key {
if len(prk) == 0 { if len(prk) == 0 {
panic("keying: not initialized") panic("keying: not initialized")
@ -77,7 +77,7 @@ type Key struct {
// Encrypts the specified plaintext with some additional data that is tied to // Encrypts the specified plaintext with some additional data that is tied to
// this plaintext. The additional data can be seen as the context in which the // this plaintext. The additional data can be seen as the context in which the
// data is being encrypted for, this is different than the context for which the // data is being encrypted for, this is different than the context for which the
// key was derrived this allows for more granuality without deriving new keys. // key was derived; this allows for more granularity without deriving new keys.
// Avoid any user-generated data to be passed into the additional data. The most // Avoid any user-generated data to be passed into the additional data. The most
// common usage of this would be to encrypt a database field, in that case use // common usage of this would be to encrypt a database field, in that case use
// the ID and database column name as additional data. The additional data isn't // the ID and database column name as additional data. The additional data isn't