-
-
Notifications
You must be signed in to change notification settings - Fork 903
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
115 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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copied from crypto.randomUUID() | ||
export type UUIDString = `${string}-${string}-${string}-${string}-${string}`; | ||
|
||
export type UUIDTypes = UUIDString | Uint8Array; | ||
|
||
export type Version1Options = { | ||
node?: Uint8Array; | ||
clockseq?: number; | ||
random?: Uint8Array; | ||
rng?: () => Uint8Array; | ||
msecs?: number; | ||
nsecs?: number; | ||
_v6?: boolean; // Internal use only! | ||
}; | ||
|
||
export type Version4Options = { | ||
random?: Uint8Array; | ||
rng?: () => Uint8Array; | ||
}; | ||
|
||
export type Version7Options = { | ||
random?: Uint8Array; | ||
msecs?: number; | ||
seq?: number; | ||
rng?: () => Uint8Array; | ||
}; |
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,5 +1,12 @@ | ||
import v35 from './v35.js'; | ||
import { UUIDString, UUIDTypes } from './_types.js'; | ||
import md5 from './md5.js'; | ||
import v35, { DNS } from './v35.js'; | ||
|
||
function v3(value: string | Uint8Array, namespace: UUIDTypes, buf?: Uint8Array, offset?: number) { | ||
return v35(0x30, md5, value, namespace, buf, offset); | ||
} | ||
|
||
v3.DNS = DNS; | ||
v3.URL = URL; | ||
|
||
const v3 = v35('v3', 0x30, md5); | ||
export default v3; |
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,5 +1,24 @@ | ||
import v35 from './v35.js'; | ||
import { UUIDString, UUIDTypes } from './_types.js'; | ||
import sha1 from './sha1.js'; | ||
import v35, { DNS, URL } from './v35.js'; | ||
|
||
function v5( | ||
value: string | Uint8Array, | ||
namespace: UUIDTypes, | ||
buf?: Uint8Array, | ||
offset?: number | ||
): UUIDString; | ||
function v5( | ||
value: string | Uint8Array, | ||
namespace: UUIDTypes, | ||
buf?: Uint8Array, | ||
offset?: number | ||
): UUIDString; | ||
function v5(value: string | Uint8Array, namespace: UUIDTypes, buf?: Uint8Array, offset?: number) { | ||
return v35(0x50, sha1, value, namespace, buf, offset); | ||
} | ||
|
||
v5.DNS = DNS; | ||
v5.URL = URL; | ||
|
||
const v5 = v35('v5', 0x50, sha1); | ||
export default v5; |
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