diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..2fdc5c2 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright © 2024 NAME HERE + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/generate.go b/generate.go new file mode 100644 index 0000000..17e9c07 --- /dev/null +++ b/generate.go @@ -0,0 +1,8 @@ +package invite + +// Generate makes a new invite +func (i *InviteKV) Generate(email string) (url string) { + // generate opaque token + // store relationship in store + // return domain + token +} diff --git a/kv.go b/kv.go new file mode 100644 index 0000000..023520e --- /dev/null +++ b/kv.go @@ -0,0 +1,6 @@ +package invite + +type InviteKV struct { + URL string + store Store +} diff --git a/new.go b/new.go new file mode 100644 index 0000000..67797d0 --- /dev/null +++ b/new.go @@ -0,0 +1,6 @@ +package invite + +// New creates a new invite store +func New(root_url string, store Store) InviteKV { + +} diff --git a/redeem.go b/redeem.go new file mode 100644 index 0000000..b7a0347 --- /dev/null +++ b/redeem.go @@ -0,0 +1,6 @@ +package invite + +// returns the email allowed for this invite +func (i *InviteKV) Redeem(given_url string) string { + // check URL signature +} diff --git a/store.go b/store.go new file mode 100644 index 0000000..82366eb --- /dev/null +++ b/store.go @@ -0,0 +1,6 @@ +package invite + +type Store interface { + Get(string) string + Set(string, string) +}