This repository has been archived by the owner on Sep 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tokens): Add a
modify_meta
script.
- Loading branch information
1 parent
28f260f
commit 4411d94
Showing
7 changed files
with
94 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,50 @@ | ||
{ | ||
"name": "Tokens", | ||
"description": "Create & verify tokens for authorization purposes.", | ||
"icon": "lock", | ||
"tags": [ | ||
"core", | ||
"utility" | ||
], | ||
"authors": [ | ||
"rivet-gg", | ||
"NathanFlurry" | ||
], | ||
"status": "stable", | ||
"scripts": { | ||
"create": { | ||
"name": "Create Token" | ||
}, | ||
"fetch": { | ||
"name": "Fetch Token", | ||
"description": "Get a token by its ID." | ||
}, | ||
"fetch_by_token": { | ||
"name": "Fetch by Token", | ||
"description": "Get a token by its secret token." | ||
}, | ||
"revoke": { | ||
"name": "Revoke Token", | ||
"description": "Revoke a token, preventing it from being used again." | ||
}, | ||
"validate": { | ||
"name": "Validate Token", | ||
"description": "Validate a token. Throws an error if the token is invalid." | ||
}, | ||
"extend": { | ||
"name": "Extend Token", | ||
"description": "Extend or remove the expiration date of a token. (Only works on valid tokens.)" | ||
} | ||
}, | ||
"errors": { | ||
"token_not_found": { | ||
"name": "Token Not Found" | ||
}, | ||
"token_revoked": { | ||
"name": "Token Revoked" | ||
}, | ||
"token_expired": { | ||
"name": "Token Expired" | ||
} | ||
} | ||
"name": "Tokens", | ||
"description": "Create & verify tokens for authorization purposes.", | ||
"icon": "lock", | ||
"tags": [ | ||
"core", | ||
"utility" | ||
], | ||
"authors": [ | ||
"rivet-gg", | ||
"NathanFlurry" | ||
], | ||
"status": "stable", | ||
"scripts": { | ||
"create": { | ||
"name": "Create Token" | ||
}, | ||
"fetch": { | ||
"name": "Fetch Token", | ||
"description": "Get a token by its ID." | ||
}, | ||
"fetch_by_token": { | ||
"name": "Fetch by Token", | ||
"description": "Get a token by its secret token." | ||
}, | ||
"revoke": { | ||
"name": "Revoke Token", | ||
"description": "Revoke a token, preventing it from being used again." | ||
}, | ||
"validate": { | ||
"name": "Validate Token", | ||
"description": "Validate a token. Throws an error if the token is invalid." | ||
}, | ||
"extend": { | ||
"name": "Extend Token", | ||
"description": "Extend or remove the expiration date of a token. (Only works on valid tokens.)" | ||
} | ||
}, | ||
"errors": { | ||
"token_not_found": { | ||
"name": "Token Not Found" | ||
}, | ||
"token_revoked": { | ||
"name": "Token Revoked" | ||
}, | ||
"token_expired": { | ||
"name": "Token Expired" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { test, TestContext } from "../module.gen.ts"; | ||
import { | ||
assertEquals, | ||
assertExists, | ||
} from "https://deno.land/[email protected]/assert/mod.ts"; | ||
|
||
const METADATA = { meta: "data", test: "data" }; | ||
|
||
test("get_and_check_meta", async (ctx: TestContext) => { | ||
const { token } = await ctx.modules.tokens.create({ | ||
type: "test", | ||
meta: METADATA, | ||
}); | ||
|
||
const { tokens: [returnedToken] } = await ctx.modules.tokens.fetch({ | ||
tokenIds: [token.id], | ||
}); | ||
assertExists(returnedToken); | ||
assertEquals(returnedToken.meta, METADATA); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import { RuntimeError, test, TestContext } from "../module.gen.ts"; | ||
import { | ||
assertEquals, | ||
assertRejects, | ||
assertGreater, | ||
assertRejects, | ||
} from "https://deno.land/[email protected]/assert/mod.ts"; | ||
|
||
test( | ||
|
@@ -97,6 +97,6 @@ test( | |
}, { | ||
...token, | ||
expireAt: null, | ||
}) | ||
}); | ||
}, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.