Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maintatance #62

Merged
merged 3 commits into from Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -15,6 +15,7 @@
# vendor/

./k6
k6

# we use the config from the main k6's repository
# https://github.com/grafana/k6/blob/master/.golangci.yml
Expand Down
2 changes: 1 addition & 1 deletion examples/sign_verify/sign-verify-hmac.js
Expand Up @@ -16,7 +16,7 @@ import { crypto } from "k6/x/webcrypto";

const encoded = string2ArrayBuffer("Hello World");

// Signes the encoded data with the provided key using the HMAC algorithm
// Signs the encoded data with the provided key using the HMAC algorithm
// the returned signature can be verified using the verify method.
const signature = await crypto.subtle.sign("HMAC", generatedKey, encoded);

Expand Down
40 changes: 20 additions & 20 deletions go.mod
Expand Up @@ -4,18 +4,18 @@ go 1.19

require (
github.com/dop251/goja v0.0.0-20231027120936-b396bb4c349d
github.com/google/uuid v1.3.0
github.com/google/uuid v1.3.1
github.com/stretchr/testify v1.8.4
go.k6.io/k6 v0.48.0
go.k6.io/k6 v0.49.0
gopkg.in/guregu/null.v3 v3.3.0
)

require (
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dlclark/regexp2 v1.9.0 // indirect
github.com/fatih/color v1.15.0 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-sourcemap/sourcemap v2.1.4-0.20211119122758-180fcef48034+incompatible // indirect
github.com/golang/protobuf v1.5.3 // indirect
Expand All @@ -24,29 +24,29 @@ require (
github.com/josharian/intern v1.0.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mstoykov/atlas v0.0.0-20220811071828-388f114305dd // indirect
github.com/onsi/ginkgo v1.16.5 // indirect
github.com/onsi/gomega v1.20.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/serenize/snaker v0.0.0-20201027110005-a7ad2135616e // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/spf13/afero v1.1.2 // indirect
go.opentelemetry.io/otel v1.19.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.19.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.19.0 // indirect
go.opentelemetry.io/otel/metric v1.19.0 // indirect
go.opentelemetry.io/otel/sdk v1.19.0 // indirect
go.opentelemetry.io/otel/trace v1.19.0 // indirect
go.opentelemetry.io/otel v1.21.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.21.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.21.0 // indirect
go.opentelemetry.io/otel/metric v1.21.0 // indirect
go.opentelemetry.io/otel/sdk v1.21.0 // indirect
go.opentelemetry.io/otel/trace v1.21.0 // indirect
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.3.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230731193218-e0aa005b6bdf // indirect
google.golang.org/grpc v1.58.3 // indirect
google.golang.org/protobuf v1.31.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.5.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 // indirect
google.golang.org/grpc v1.60.0 // indirect
google.golang.org/protobuf v1.31.1-0.20231027082548-f4a6c1f6e5c1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
96 changes: 48 additions & 48 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion webcrypto/algorithm.go
Expand Up @@ -145,7 +145,7 @@ func normalizeAlgorithm(rt *goja.Runtime, v goja.Value, op AlgorithmIdentifier)
return Algorithm{}, NewError(SyntaxError, "algorithm cannot be interpreted as a string or an object")
}

// Algorithm identifers are always upper cased.
// Algorithm identifiers are always upper cased.
// A registered algorithm provided in lower case format, should
// be considered valid.
algorithm.Name = strings.ToUpper(algorithm.Name)
Expand Down
6 changes: 1 addition & 5 deletions webcrypto/errors.go
@@ -1,9 +1,5 @@
package webcrypto

import (
"fmt"
)

// ErrorName is a type alias for the name of a WebCryptoError.
//
// Note that it is a type alias, and not a binding, so that it is
Expand Down Expand Up @@ -53,7 +49,7 @@ type Error struct {

// Error implements the `error` interface, so WebCryptoError are normal Go errors.
func (e *Error) Error() string {
return fmt.Sprintf(e.Name)
return e.Name + ": " + e.Message
}

// NewError returns a new WebCryptoError with the given name and message.
Expand Down
2 changes: 1 addition & 1 deletion webcrypto/hmac.go
Expand Up @@ -172,7 +172,7 @@ type HMACKeyAlgorithm struct {
func exportHMACKey(ck *CryptoKey, format KeyFormat) ([]byte, error) {
// 1.
if ck.handle == nil {
return nil, NewError(OperationError, "key data is not accesible")
return nil, NewError(OperationError, "key data is not accessible")
}

// 2.
Expand Down
2 changes: 1 addition & 1 deletion webcrypto/params.go
Expand Up @@ -188,7 +188,7 @@ type RSAPssParams struct {

// SaltLength holds (a Number) the length of the random salt to use, in bytes.
// RFC 3447 says that "typical salt lengths" are either 0 or the length of the output
// of the digest algorithm selected whe this key was generated. For instance,
// of the digest algorithm selected when this key was generated. For instance,
// when using the SHA256 digest algorithm, the salt length could be 32.
SaltLength int
}
Expand Down