Skip to content

Commit f9937c2

Browse files
authored
Update license headers, minor refactors, add comments (bytemare#99)
* Update license headers, minor refactors, add comments Signed-off-by: bytemare <[email protected]> * memory alignment Signed-off-by: bytemare <[email protected]> * fix linter selection Signed-off-by: bytemare <[email protected]> --------- Signed-off-by: bytemare <[email protected]>
1 parent 22bc367 commit f9937c2

34 files changed

+198
-94
lines changed

.github/.golangci.yml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,111 @@ linters:
55
- funcorder
66
- nonamedreturns
77
- varnamelen
8+
enable:
9+
- asasalint
10+
- asciicheck
11+
- bidichk
12+
- bodyclose
13+
- canonicalheader
14+
- containedctx
15+
- contextcheck
16+
- copyloopvar
17+
- cyclop
18+
- decorder
19+
- depguard
20+
- dogsled
21+
- dupl
22+
- dupword
23+
- durationcheck
24+
- err113
25+
- errcheck
26+
- errchkjson
27+
- errname
28+
- errorlint
29+
- exhaustive
30+
- exhaustruct
31+
- exptostd
32+
- fatcontext
33+
- forbidigo
34+
- forcetypeassert
35+
- funcorder
36+
- funlen
37+
- ginkgolinter
38+
- gocheckcompilerdirectives
39+
- gochecknoglobals
40+
- gochecknoinits
41+
- gochecksumtype
42+
- gocognit
43+
- goconst
44+
- gocritic
45+
- gocyclo
46+
- godot
47+
- godox
48+
- goheader
49+
- gomoddirectives
50+
- gomodguard
51+
- goprintffuncname
52+
- gosec
53+
- gosmopolitan
54+
- govet
55+
- grouper
56+
- iface
57+
- importas
58+
- inamedparam
59+
- ineffassign
60+
- interfacebloat
61+
- intrange
62+
- ireturn
63+
- lll
64+
- loggercheck
65+
- maintidx
66+
- makezero
67+
- mirror
68+
- misspell
69+
- mnd
70+
- musttag
71+
- nakedret
72+
- nestif
73+
- nilerr
74+
- nilnesserr
75+
- nilnil
76+
- nlreturn
77+
- noctx
78+
- nolintlint
79+
- nonamedreturns
80+
- nosprintfhostport
81+
- paralleltest
82+
- perfsprint
83+
- prealloc
84+
- predeclared
85+
- promlinter
86+
- protogetter
87+
- reassign
88+
- recvcheck
89+
- revive
90+
- rowserrcheck
91+
- sloglint
92+
- spancheck
93+
- sqlclosecheck
94+
- staticcheck
95+
- tagalign
96+
- tagliatelle
97+
- testableexamples
98+
- testifylint
99+
- testpackage
100+
- thelper
101+
- tparallel
102+
- unconvert
103+
- unparam
104+
- unused
105+
- usestdlibvars
106+
- usetesting
107+
- varnamelen
108+
- wastedassign
109+
- whitespace
110+
- wrapcheck
111+
- wsl
112+
- zerologlint
8113
settings:
9114
cyclop:
10115
max-complexity: 13
@@ -19,6 +124,8 @@ linters:
19124
check-blank: true
20125
gocritic:
21126
enable-all: true
127+
disabled-checks:
128+
- unnamedResult
22129
govet:
23130
enable-all: true
24131
settings:

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021 Daniel Bourdrez
3+
Copyright (c) 2020-2025 Daniel Bourdrez
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

client.go

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: MIT
22
//
3-
// Copyright (C) 2020-2022 Daniel Bourdrez. All Rights Reserved.
3+
// Copyright (C) 2020-2025 Daniel Bourdrez. All Rights Reserved.
44
//
55
// This source code is licensed under the MIT license found in the
66
// LICENSE file in the root directory of this source tree or at
@@ -74,7 +74,7 @@ func (c *Client) buildPRK(evaluation *ecc.Element) []byte {
7474

7575
// ClientRegistrationInitOptions enables setting internal client values for the client registration.
7676
type ClientRegistrationInitOptions struct {
77-
// OPRFBlind: optional
77+
// OPRFBlind: optional.
7878
OPRFBlind *ecc.Scalar
7979
}
8080

@@ -100,11 +100,11 @@ func (c *Client) RegistrationInit(
100100

101101
// ClientRegistrationFinalizeOptions enables setting optional client values for the client registration.
102102
type ClientRegistrationFinalizeOptions struct {
103-
// ClientIdentity: optional
103+
// ClientIdentity: optional.
104104
ClientIdentity []byte
105-
// ServerIdentity: optional
105+
// ServerIdentity: optional.
106106
ServerIdentity []byte
107-
// EnvelopeNonce : optional
107+
// EnvelopeNonce : optional.
108108
EnvelopeNonce []byte
109109
}
110110

@@ -141,24 +141,24 @@ func (c *Client) RegistrationFinalize(
141141
}, exportKey
142142
}
143143

144-
// GenerateKE1Options enables setting optional values for the session, which default to secure random values if not
144+
// GenerateKE1Options enable setting optional values for the session, which default to secure random values if not
145145
// set.
146146
type GenerateKE1Options struct {
147-
// Blind: optional
148-
Blind *ecc.Scalar
149-
// KeyShareSeed: optional
147+
// OPRFBlind: optional.
148+
OPRFBlind *ecc.Scalar
149+
// KeyShareSeed: optional.
150150
KeyShareSeed []byte
151-
// Nonce: optional
152-
Nonce []byte
153-
// NonceLength: optional
154-
NonceLength uint
151+
// AKENonce: optional.
152+
AKENonce []byte
153+
// AKENonceLength: optional, overrides the default length of the nonce to be created if no nonce is provided.
154+
AKENonceLength uint
155155
}
156156

157157
func (c GenerateKE1Options) get() (*ecc.Scalar, ake.Options) {
158-
return c.Blind, ake.Options{
158+
return c.OPRFBlind, ake.Options{
159159
KeyShareSeed: c.KeyShareSeed,
160-
Nonce: c.Nonce,
161-
NonceLength: c.NonceLength,
160+
Nonce: c.AKENonce,
161+
NonceLength: c.AKENonceLength,
162162
}
163163
}
164164

@@ -185,11 +185,11 @@ func (c *Client) GenerateKE1(password []byte, options ...GenerateKE1Options) *me
185185
return ke1
186186
}
187187

188-
// GenerateKE3Options enables setting optional client values for the client registration.
188+
// GenerateKE3Options enable setting optional client values for the client registration.
189189
type GenerateKE3Options struct {
190-
// ClientIdentity: optional
190+
// ClientIdentity: optional.
191191
ClientIdentity []byte
192-
// ServerIdentity: optional
192+
// ServerIdentity: optional.
193193
ServerIdentity []byte
194194
}
195195

deserializer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: MIT
22
//
3-
// Copyright (C) 2020-2022 Daniel Bourdrez. All Rights Reserved.
3+
// Copyright (C) 2020-2025 Daniel Bourdrez. All Rights Reserved.
44
//
55
// This source code is licensed under the MIT license found in the
66
// LICENSE file in the root directory of this source tree or at

examples_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: MIT
22
//
3-
// Copyright (C) 2020-2022 Daniel Bourdrez. All Rights Reserved.
3+
// Copyright (C) 2020-2025 Daniel Bourdrez. All Rights Reserved.
44
//
55
// This source code is licensed under the MIT license found in the
66
// LICENSE file in the root directory of this source tree or at

internal/ake/3dh.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: MIT
22
//
3-
// Copyright (C) 2020-2022 Daniel Bourdrez. All Rights Reserved.
3+
// Copyright (C) 2020-2025 Daniel Bourdrez. All Rights Reserved.
44
//
55
// This source code is licensed under the MIT license found in the
66
// LICENSE file in the root directory of this source tree or at
@@ -61,13 +61,13 @@ func (id *Identities) SetIdentities(clientPublicKey *ecc.Element, serverPublicKe
6161
return id
6262
}
6363

64-
// Options enables setting optional ephemeral values, which default to secure random values if not set.
64+
// Options enable setting optional ephemeral values, which default to secure random values if not set.
6565
type Options struct {
66-
// KeyShareSeed: optional
66+
// KeyShareSeed: optional.
6767
KeyShareSeed []byte
68-
// Nonce: optional
68+
// Nonce: optional.
6969
Nonce []byte
70-
// NonceLength: optional
70+
// NonceLength: optional, overrides the default length of the nonce to be created if no nonce is provided.
7171
NonceLength uint
7272
}
7373

internal/ake/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: MIT
22
//
3-
// Copyright (C) 2020-2022 Daniel Bourdrez. All Rights Reserved.
3+
// Copyright (C) 2020-2025 Daniel Bourdrez. All Rights Reserved.
44
//
55
// This source code is licensed under the MIT license found in the
66
// LICENSE file in the root directory of this source tree or at

internal/ake/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: MIT
22
//
3-
// Copyright (C) 2020-2022 Daniel Bourdrez. All Rights Reserved.
3+
// Copyright (C) 2020-2025 Daniel Bourdrez. All Rights Reserved.
44
//
55
// This source code is licensed under the MIT license found in the
66
// LICENSE file in the root directory of this source tree or at

internal/configuration.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: MIT
22
//
3-
// Copyright (C) 2020-2022 Daniel Bourdrez. All Rights Reserved.
3+
// Copyright (C) 2020-2025 Daniel Bourdrez. All Rights Reserved.
44
//
55
// This source code is licensed under the MIT license found in the
66
// LICENSE file in the root directory of this source tree or at

internal/encoding/encoding.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: MIT
22
//
3-
// Copyright (C) 2020-2022 Daniel Bourdrez. All Rights Reserved.
3+
// Copyright (C) 2020-2025 Daniel Bourdrez. All Rights Reserved.
44
//
55
// This source code is licensed under the MIT license found in the
66
// LICENSE file in the root directory of this source tree or at

0 commit comments

Comments
 (0)