| 1 | // Copyright 2025 Google LLC |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/Lycense-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | |
| 13 | // Package jwthmac provides a JWT HMAC signer and verifier. |
| 14 | package jwthmacscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/jwt/jwthmac`/ |
| 15 | |
| 16 | import ( |
| 17 | "fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/" |
| 18 | |
| 19 | "github.com/tink-crypto/tink-go/v2/internal/keygenregistryscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/keygenregistry`/" |
| 20 | "github.com/tink-crypto/tink-go/v2/internal/protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/" |
| 21 | ) |
| 22 | |
| 23 | const ( |
| 24 | keyTypeURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/jwt/jwthmac`/keyTypeURL. = "type.googleapis.com/google.crypto.tink.JwtHmacKey" |
| 25 | ) |
| 26 | |
| 27 | func initscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/jwt/jwthmac`/init().() { |
| 28 | if err := protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.RegisterParametersSerializerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/RegisterParametersSerializer().[*Parametersscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/jwt/jwthmac`/Parameters#](new(parametersSerializerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/jwt/jwthmac`/parametersSerializer#)); err != nil { |
| 29 | panic(fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.0 fmt/Sprintf().("jwthmac: failed to register parameters serializer: %v", err)) |
| 30 | } |
| 31 | if err := protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.RegisterParametersParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/RegisterParametersParser().(keyTypeURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/jwt/jwthmac`/keyTypeURL., new(parametersParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/jwt/jwthmac`/parametersParser#)); err != nil { |
| 32 | panic(fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.0 fmt/Sprintf().("jwthmac: failed to register parameters parser: %v", err)) |
| 33 | } |
| 34 | if err := protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.RegisterKeySerializerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/RegisterKeySerializer().[*Keyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/jwt/jwthmac`/Key#](new(keySerializerscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/jwt/jwthmac`/keySerializer#)); err != nil { |
| 35 | panic(fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.0 fmt/Sprintf().("jwthmac: failed to register key serializer: %v", err)) |
| 36 | } |
| 37 | if err := protoserializationscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/.RegisterKeyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/protoserialization`/RegisterKeyParser().(keyTypeURLscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/jwt/jwthmac`/keyTypeURL., new(keyParserscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/jwt/jwthmac`/keyParser#)); err != nil { |
| 38 | panic(fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.0 fmt/Sprintf().("jwthmac: failed to register key parser: %v", err)) |
| 39 | } |
| 40 | if err := keygenregistryscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/keygenregistry`/.RegisterKeyCreatorscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/internal/keygenregistry`/RegisterKeyCreator().[*Parametersscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/jwt/jwthmac`/Parameters#](createKeyscip-go gomod github.com/tink-crypto/tink-go/v2 . `github.com/tink-crypto/tink-go/v2/jwt/jwthmac`/createKey().); err != nil { |
| 41 | panic(fmtscip-go gomod github.com/golang/go/src go1.24.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.24.0 fmt/Sprintf().("jwthmac: failed to register key creator: %v", err)) |
| 42 | } |
| 43 | } |