generated from fission-codes/project-template
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
User creation and authentication (#25)
- Loading branch information
Showing
12 changed files
with
837 additions
and
36 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
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,2 +1,3 @@ | ||
declare module 'base58-universal/main.js' | ||
declare module 'ipld-dag-pb' | ||
declare module 'borc' |
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,24 @@ | ||
import { KeyStore } from 'keystore-idb/types' | ||
|
||
|
||
// CONSTANTS | ||
|
||
|
||
export const API_ENDPOINT = 'https://runfission.com' | ||
|
||
|
||
|
||
// BASE64 | ||
|
||
|
||
export function base64UrlDecode(a: string): string { | ||
return atob(a).replace(/\_/g, "/").replace(/\-/g, "+") | ||
} | ||
|
||
export function base64UrlEncode(b: string): string { | ||
return makeBase64UrlSafe(btoa(b)) | ||
} | ||
|
||
export function makeBase64UrlSafe(a: string): string { | ||
return a.replace(/\//g, "_").replace(/\+/g, "-").replace(/=+$/, "") | ||
} |
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
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,10 +1,16 @@ | ||
import { getKeystore } from './config' | ||
import keystore from 'keystore-idb' | ||
|
||
export const clear = (): Promise<void> => { | ||
return keystore.clear() | ||
} | ||
|
||
export const getKeyByName = async (keyName: string): Promise<string> => { | ||
const ks = await getKeystore() | ||
return ks.exportSymmKey(keyName) | ||
} | ||
|
||
export default { | ||
clear, | ||
getKeyByName | ||
} |
Oops, something went wrong.