invite code generalizations

This commit is contained in:
Risotto Bias 2025-04-07 05:42:37 -06:00
parent 82575fbf57
commit 0a25e9fa99
6 changed files with 53 additions and 0 deletions

21
LICENSE Normal file
View file

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright © 2024 NAME HERE <EMAIL ADDRESS>
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.

8
generate.go Normal file
View file

@ -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
}

6
kv.go Normal file
View file

@ -0,0 +1,6 @@
package invite
type InviteKV struct {
URL string
store Store
}

6
new.go Normal file
View file

@ -0,0 +1,6 @@
package invite
// New creates a new invite store
func New(root_url string, store Store) InviteKV {
}

6
redeem.go Normal file
View file

@ -0,0 +1,6 @@
package invite
// returns the email allowed for this invite
func (i *InviteKV) Redeem(given_url string) string {
// check URL signature
}

6
store.go Normal file
View file

@ -0,0 +1,6 @@
package invite
type Store interface {
Get(string) string
Set(string, string)
}