magiclinkcore 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,2 +1,9 @@
1
- /** The first stable surface of the package. */
2
- export declare const magiclinkcore = "0.0.1";
1
+ export interface MagicLink {
2
+ id: string;
3
+ email: string;
4
+ issuedAt: number;
5
+ expiresAt: number;
6
+ redirectTo?: string;
7
+ }
8
+ export declare function createMagicLink(link: MagicLink): Readonly<MagicLink>;
9
+ export declare function isMagicLinkValid(link: MagicLink, now?: number): boolean;
package/dist/index.js CHANGED
@@ -1,2 +1 @@
1
- /** The first stable surface of the package. */
2
- export const magiclinkcore = "0.0.1";
1
+ function r(e){if(!/^\S+@\S+\.\S+$/.test(e.email)||e.expiresAt<=e.issuedAt)throw new TypeError("Invalid magic link.");return Object.freeze({...e})}function i(e,t=Date.now()){return t<e.expiresAt}export{r as createMagicLink,i as isMagicLinkValid};
package/package.json CHANGED
@@ -1,20 +1,49 @@
1
1
  {
2
2
  "name": "magiclinkcore",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "Small, framework-neutral primitives for magic-link authentication.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
8
- "exports": { ".": { "types": "./dist/index.d.ts", "import": "./dist/index.js", "default": "./dist/index.js" } },
9
- "files": ["dist", "README.md"],
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js",
12
+ "default": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "README.md"
18
+ ],
10
19
  "sideEffects": false,
11
- "scripts": { "build": "tsc --project tsconfig.json", "prepublishOnly": "npm run build" },
12
- "keywords": ["auth", "authentication", "magic-link", "passwordless"],
20
+ "scripts": {
21
+ "build": "tsc --project tsconfig.json",
22
+ "postbuild": "npm run dist --prefix \"$npm_config_local_prefix\" -- \"$PWD\"",
23
+ "prepack": "npm run build",
24
+ "prepublishOnly": "npm run build"
25
+ },
26
+ "keywords": [
27
+ "auth",
28
+ "authentication",
29
+ "magic-link",
30
+ "passwordless"
31
+ ],
13
32
  "homepage": "https://signway.dev/",
14
33
  "author": "Mosanic <dev@mosanic.io>",
15
34
  "license": "MIT",
16
- "engines": { "node": ">=20" },
17
- "publishConfig": { "access": "public" },
18
- "devDependencies": { "typescript": "^5.9.3" },
19
- "repository": { "type": "git", "url": "git+https://github.com/mosanic/mosa-platform.git", "directory": "packages/magiclinkcore" }
35
+ "engines": {
36
+ "node": ">=20"
37
+ },
38
+ "publishConfig": {
39
+ "access": "public"
40
+ },
41
+ "devDependencies": {
42
+ "typescript": "^5.9.3"
43
+ },
44
+ "repository": {
45
+ "type": "git",
46
+ "url": "git+https://github.com/mosanic/mosa-platform.git",
47
+ "directory": "packages/magiclinkcore"
48
+ }
20
49
  }