aboutsummaryrefslogtreecommitdiff
path: root/lib/paseto/v2/key.go
diff options
context:
space:
mode:
Diffstat (limited to 'lib/paseto/v2/key.go')
-rw-r--r--lib/paseto/v2/key.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/paseto/v2/key.go b/lib/paseto/v2/key.go
new file mode 100644
index 00000000..fdd51988
--- /dev/null
+++ b/lib/paseto/v2/key.go
@@ -0,0 +1,25 @@
+// SPDX-License-Identifier: BSD-3-Clause
+// SPDX-FileCopyrightText: 2020 Shulhan <ms@kilabit.info>
+
+package pasetov2
+
+import "crypto/ed25519"
+
+// Key define private and public key for public mode.
+type Key struct {
+ // AllowedSubjects contains list of subject that are allowed in the
+ // token's claim "sub" to be signed by this public key.
+ // This field is used by receiver to check the claim "sub" and compare
+ // it with this list.
+ // Empty list means allowing all subjects.
+ AllowedSubjects map[string]struct{}
+
+ // ID is a unique key ID.
+ ID string
+
+ // PrivateKey for signing public token.
+ Private ed25519.PrivateKey
+
+ // PublicKey for verifying public token.
+ Public ed25519.PublicKey
+}