@pgarbe/cdk-ecr-sync 0.5.28 → 0.5.31
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/.jsii +5 -5
- package/API.md +106 -50
- package/CHANGELOG.md +91 -1
- package/lib/ecr-sync.d.ts +0 -1
- package/lib/ecr-sync.js +4 -5
- package/lib/image.d.ts +0 -1
- package/lib/index.d.ts +0 -1
- package/lib/lambda/docker-adapter.d.ts +0 -1
- package/lib/lambda/docker-adapter.js +2 -3
- package/lib/lambda/ecr-adapter.d.ts +0 -1
- package/lib/lambda/get-image-tags-handler.d.ts +0 -1
- package/lib/lambda/get-image-tags-handler.js +3 -4
- package/node_modules/aws-sdk/CHANGELOG.md +109 -1
- package/node_modules/aws-sdk/README.md +1 -1
- package/node_modules/aws-sdk/apis/appflow-2020-08-23.min.json +76 -70
- package/node_modules/aws-sdk/apis/application-insights-2018-11-25.min.json +25 -24
- package/node_modules/aws-sdk/apis/appmesh-2019-01-25.min.json +129 -121
- package/node_modules/aws-sdk/apis/auditmanager-2017-07-25.min.json +4 -0
- package/node_modules/aws-sdk/apis/backup-gateway-2021-01-01.min.json +58 -8
- package/node_modules/aws-sdk/apis/budgets-2016-10-20.min.json +53 -53
- package/node_modules/aws-sdk/apis/ce-2017-10-25.min.json +79 -0
- package/node_modules/aws-sdk/apis/ce-2017-10-25.paginators.json +5 -0
- package/node_modules/aws-sdk/apis/chime-sdk-meetings-2021-07-15.min.json +126 -33
- package/node_modules/aws-sdk/apis/chime-sdk-messaging-2021-05-15.min.json +124 -53
- package/node_modules/aws-sdk/apis/chime-sdk-messaging-2021-05-15.paginators.json +5 -0
- package/node_modules/aws-sdk/apis/cloudformation-2010-05-15.min.json +10 -8
- package/node_modules/aws-sdk/apis/cognito-idp-2016-04-18.min.json +155 -127
- package/node_modules/aws-sdk/apis/connect-2017-08-08.min.json +637 -93
- package/node_modules/aws-sdk/apis/connect-2017-08-08.paginators.json +11 -0
- package/node_modules/aws-sdk/apis/connectcampaigns-2021-01-30.examples.json +5 -0
- package/node_modules/aws-sdk/apis/connectcampaigns-2021-01-30.min.json +767 -0
- package/node_modules/aws-sdk/apis/connectcampaigns-2021-01-30.paginators.json +10 -0
- package/node_modules/aws-sdk/apis/datasync-2018-11-09.min.json +80 -74
- package/node_modules/aws-sdk/apis/datasync-2018-11-09.paginators.json +10 -5
- package/node_modules/aws-sdk/apis/dms-2016-01-01.min.json +385 -52
- package/node_modules/aws-sdk/apis/dms-2016-01-01.paginators.json +25 -0
- package/node_modules/aws-sdk/apis/drs-2020-02-26.min.json +332 -205
- package/node_modules/aws-sdk/apis/drs-2020-02-26.paginators.json +12 -0
- package/node_modules/aws-sdk/apis/ec2-2016-11-15.min.json +17 -0
- package/node_modules/aws-sdk/apis/elasticache-2015-02-02.min.json +3 -0
- package/node_modules/aws-sdk/apis/emr-serverless-2021-07-13.examples.json +5 -0
- package/node_modules/aws-sdk/apis/emr-serverless-2021-07-13.min.json +860 -0
- package/node_modules/aws-sdk/apis/emr-serverless-2021-07-13.paginators.json +16 -0
- package/node_modules/aws-sdk/apis/finspace-data-2020-07-13.min.json +278 -73
- package/node_modules/aws-sdk/apis/forecast-2018-06-26.min.json +354 -68
- package/node_modules/aws-sdk/apis/forecast-2018-06-26.paginators.json +24 -0
- package/node_modules/aws-sdk/apis/fsx-2018-03-01.min.json +135 -116
- package/node_modules/aws-sdk/apis/gamesparks-2021-08-17.min.json +13 -0
- package/node_modules/aws-sdk/apis/greengrassv2-2020-11-30.min.json +37 -18
- package/node_modules/aws-sdk/apis/guardduty-2017-11-28.min.json +325 -98
- package/node_modules/aws-sdk/apis/iotevents-data-2018-10-23.min.json +45 -0
- package/node_modules/aws-sdk/apis/iotsitewise-2019-12-02.min.json +20 -15
- package/node_modules/aws-sdk/apis/kendra-2019-02-03.min.json +179 -61
- package/node_modules/aws-sdk/apis/lightsail-2016-11-28.min.json +155 -122
- package/node_modules/aws-sdk/apis/lookoutmetrics-2017-07-25.min.json +142 -56
- package/node_modules/aws-sdk/apis/m2-2021-04-28.examples.json +5 -0
- package/node_modules/aws-sdk/apis/m2-2021-04-28.min.json +1820 -0
- package/node_modules/aws-sdk/apis/m2-2021-04-28.paginators.json +58 -0
- package/node_modules/aws-sdk/apis/mediaconvert-2017-08-29.min.json +223 -143
- package/node_modules/aws-sdk/apis/metadata.json +13 -0
- package/node_modules/aws-sdk/apis/neptune-2014-10-31.min.json +293 -100
- package/node_modules/aws-sdk/apis/networkmanager-2019-07-05.min.json +72 -3
- package/node_modules/aws-sdk/apis/outposts-2019-12-03.min.json +67 -0
- package/node_modules/aws-sdk/apis/personalize-2018-05-22.min.json +14 -8
- package/node_modules/aws-sdk/apis/proton-2020-07-20.min.json +451 -139
- package/node_modules/aws-sdk/apis/proton-2020-07-20.paginators.json +16 -0
- package/node_modules/aws-sdk/apis/proton-2020-07-20.waiters2.json +33 -0
- package/node_modules/aws-sdk/apis/quicksight-2018-04-01.min.json +35 -1
- package/node_modules/aws-sdk/apis/redshift-2012-12-01.min.json +39 -5
- package/node_modules/aws-sdk/apis/redshift-data-2019-12-20.min.json +25 -16
- package/node_modules/aws-sdk/apis/redshiftserverless-2021-04-21.examples.json +5 -0
- package/node_modules/aws-sdk/apis/redshiftserverless-2021-04-21.min.json +1206 -0
- package/node_modules/aws-sdk/apis/redshiftserverless-2021-04-21.paginators.json +40 -0
- package/node_modules/aws-sdk/apis/route53-2013-04-01.min.json +333 -78
- package/node_modules/aws-sdk/apis/route53-2013-04-01.paginators.json +18 -0
- package/node_modules/aws-sdk/apis/sagemaker-2017-07-24.min.json +673 -649
- package/node_modules/aws-sdk/apis/securityhub-2018-10-26.min.json +841 -300
- package/node_modules/aws-sdk/apis/servicecatalog-appregistry-2020-06-24.min.json +45 -0
- package/node_modules/aws-sdk/apis/servicecatalog-appregistry-2020-06-24.paginators.json +6 -0
- package/node_modules/aws-sdk/apis/transcribe-2017-10-26.min.json +37 -11
- package/node_modules/aws-sdk/apis/transfer-2018-11-05.min.json +37 -36
- package/node_modules/aws-sdk/apis/voice-id-2021-09-27.min.json +73 -53
- package/node_modules/aws-sdk/apis/voice-id-2021-09-27.paginators.json +8 -4
- package/node_modules/aws-sdk/clients/all.d.ts +4 -0
- package/node_modules/aws-sdk/clients/all.js +5 -1
- package/node_modules/aws-sdk/clients/apigateway.d.ts +327 -324
- package/node_modules/aws-sdk/clients/appflow.d.ts +17 -7
- package/node_modules/aws-sdk/clients/applicationinsights.d.ts +38 -3
- package/node_modules/aws-sdk/clients/appmesh.d.ts +70 -51
- package/node_modules/aws-sdk/clients/apprunner.d.ts +2 -2
- package/node_modules/aws-sdk/clients/auditmanager.d.ts +7 -7
- package/node_modules/aws-sdk/clients/backupgateway.d.ts +77 -2
- package/node_modules/aws-sdk/clients/batch.d.ts +4 -4
- package/node_modules/aws-sdk/clients/budgets.d.ts +2 -1
- package/node_modules/aws-sdk/clients/chimesdkmeetings.d.ts +82 -1
- package/node_modules/aws-sdk/clients/chimesdkmessaging.d.ts +81 -5
- package/node_modules/aws-sdk/clients/cloudformation.d.ts +62 -53
- package/node_modules/aws-sdk/clients/cloudwatchlogs.d.ts +4 -4
- package/node_modules/aws-sdk/clients/codeartifact.d.ts +93 -93
- package/node_modules/aws-sdk/clients/cognitoidentityserviceprovider.d.ts +197 -162
- package/node_modules/aws-sdk/clients/comprehend.d.ts +22 -22
- package/node_modules/aws-sdk/clients/connect.d.ts +708 -11
- package/node_modules/aws-sdk/clients/connectcampaigns.d.ts +446 -0
- package/node_modules/aws-sdk/clients/connectcampaigns.js +18 -0
- package/node_modules/aws-sdk/clients/costexplorer.d.ts +219 -113
- package/node_modules/aws-sdk/clients/datasync.d.ts +41 -15
- package/node_modules/aws-sdk/clients/dms.d.ts +532 -2
- package/node_modules/aws-sdk/clients/drs.d.ts +173 -6
- package/node_modules/aws-sdk/clients/dynamodb.d.ts +18 -18
- package/node_modules/aws-sdk/clients/dynamodbstreams.d.ts +1 -1
- package/node_modules/aws-sdk/clients/ec2.d.ts +35 -15
- package/node_modules/aws-sdk/clients/elasticache.d.ts +12 -8
- package/node_modules/aws-sdk/clients/emrserverless.d.ts +890 -0
- package/node_modules/aws-sdk/clients/emrserverless.js +18 -0
- package/node_modules/aws-sdk/clients/finspacedata.d.ts +201 -4
- package/node_modules/aws-sdk/clients/forecastservice.d.ts +452 -24
- package/node_modules/aws-sdk/clients/frauddetector.d.ts +5 -5
- package/node_modules/aws-sdk/clients/fsx.d.ts +28 -3
- package/node_modules/aws-sdk/clients/gamesparks.d.ts +20 -0
- package/node_modules/aws-sdk/clients/greengrassv2.d.ts +49 -18
- package/node_modules/aws-sdk/clients/guardduty.d.ts +186 -4
- package/node_modules/aws-sdk/clients/iam.d.ts +2 -2
- package/node_modules/aws-sdk/clients/ioteventsdata.d.ts +50 -0
- package/node_modules/aws-sdk/clients/iotsitewise.d.ts +23 -3
- package/node_modules/aws-sdk/clients/ivschat.d.ts +1 -1
- package/node_modules/aws-sdk/clients/kendra.d.ts +157 -4
- package/node_modules/aws-sdk/clients/lightsail.d.ts +40 -0
- package/node_modules/aws-sdk/clients/lookoutmetrics.d.ts +126 -5
- package/node_modules/aws-sdk/clients/m2.d.ts +1840 -0
- package/node_modules/aws-sdk/clients/m2.js +18 -0
- package/node_modules/aws-sdk/clients/mediaconvert.d.ts +89 -9
- package/node_modules/aws-sdk/clients/neptune.d.ts +233 -0
- package/node_modules/aws-sdk/clients/networkmanager.d.ts +56 -10
- package/node_modules/aws-sdk/clients/outposts.d.ts +94 -0
- package/node_modules/aws-sdk/clients/personalize.d.ts +12 -8
- package/node_modules/aws-sdk/clients/proton.d.ts +492 -72
- package/node_modules/aws-sdk/clients/quicksight.d.ts +37 -5
- package/node_modules/aws-sdk/clients/redshift.d.ts +41 -1
- package/node_modules/aws-sdk/clients/redshiftdata.d.ts +51 -14
- package/node_modules/aws-sdk/clients/redshiftserverless.d.ts +1525 -0
- package/node_modules/aws-sdk/clients/redshiftserverless.js +18 -0
- package/node_modules/aws-sdk/clients/route53.d.ts +267 -7
- package/node_modules/aws-sdk/clients/sagemaker.d.ts +53 -24
- package/node_modules/aws-sdk/clients/secretsmanager.d.ts +7 -7
- package/node_modules/aws-sdk/clients/securityhub.d.ts +1020 -19
- package/node_modules/aws-sdk/clients/servicecatalogappregistry.d.ts +49 -2
- package/node_modules/aws-sdk/clients/transcribeservice.d.ts +479 -447
- package/node_modules/aws-sdk/clients/transfer.d.ts +9 -4
- package/node_modules/aws-sdk/clients/voiceid.d.ts +55 -24
- package/node_modules/aws-sdk/clients/workspaces.d.ts +10 -10
- package/node_modules/aws-sdk/dist/aws-sdk-core-react-native.js +737 -241
- package/node_modules/aws-sdk/dist/aws-sdk-react-native.js +2697 -1828
- package/node_modules/aws-sdk/dist/aws-sdk.js +2319 -517
- package/node_modules/aws-sdk/dist/aws-sdk.min.js +91 -91
- package/node_modules/aws-sdk/lib/config_service_placeholders.d.ts +8 -0
- package/node_modules/aws-sdk/lib/core.js +1 -1
- package/node_modules/aws-sdk/lib/dynamodb/document_client.d.ts +11 -11
- package/node_modules/aws-sdk/lib/event_listeners.js +18 -0
- package/node_modules/aws-sdk/lib/util.js +15 -7
- package/node_modules/aws-sdk/package.json +2 -2
- package/node_modules/jszip/.github/workflows/pr.yaml +5 -6
- package/node_modules/jszip/CHANGES.md +5 -0
- package/node_modules/jszip/README.markdown +1 -3
- package/node_modules/jszip/dist/jszip.js +194 -13
- package/node_modules/jszip/dist/jszip.min.js +4 -4
- package/node_modules/jszip/index.d.ts +1 -1
- package/node_modules/jszip/lib/index.js +1 -1
- package/node_modules/jszip/lib/license_header.js +2 -2
- package/node_modules/jszip/lib/utils.js +1 -1
- package/node_modules/jszip/package.json +2 -2
- package/node_modules/jszip/vendor/FileSaver.js +1 -1
- package/node_modules/setimmediate/LICENSE.txt +20 -0
- package/node_modules/setimmediate/package.json +30 -0
- package/node_modules/setimmediate/setImmediate.js +186 -0
- package/node_modules/uuid/CHANGELOG.md +132 -44
- package/node_modules/uuid/CONTRIBUTING.md +20 -0
- package/node_modules/uuid/LICENSE.md +1 -1
- package/node_modules/uuid/README.md +298 -152
- package/node_modules/uuid/dist/bin/uuid +2 -0
- package/node_modules/uuid/dist/bytesToUuid.js +26 -0
- package/node_modules/uuid/dist/esm-browser/bytesToUuid.js +18 -0
- package/node_modules/uuid/dist/esm-browser/index.js +4 -0
- package/node_modules/uuid/dist/esm-browser/md5.js +218 -0
- package/node_modules/uuid/dist/esm-browser/rng.js +15 -0
- package/node_modules/uuid/dist/esm-browser/sha1.js +91 -0
- package/node_modules/uuid/{v1.js → dist/esm-browser/v1.js} +34 -48
- package/node_modules/uuid/dist/esm-browser/v3.js +4 -0
- package/node_modules/uuid/dist/esm-browser/v35.js +56 -0
- package/node_modules/uuid/dist/esm-browser/v4.js +27 -0
- package/node_modules/uuid/dist/esm-browser/v5.js +4 -0
- package/node_modules/uuid/dist/esm-node/bytesToUuid.js +18 -0
- package/node_modules/uuid/dist/esm-node/index.js +4 -0
- package/node_modules/uuid/dist/esm-node/md5.js +13 -0
- package/node_modules/uuid/dist/esm-node/rng.js +4 -0
- package/node_modules/uuid/dist/esm-node/sha1.js +13 -0
- package/node_modules/uuid/dist/esm-node/v1.js +95 -0
- package/node_modules/uuid/dist/esm-node/v3.js +4 -0
- package/node_modules/uuid/{lib → dist/esm-node}/v35.js +21 -22
- package/node_modules/uuid/dist/esm-node/v4.js +27 -0
- package/node_modules/uuid/dist/esm-node/v5.js +4 -0
- package/node_modules/uuid/dist/index.js +39 -0
- package/node_modules/uuid/{lib → dist}/md5-browser.js +58 -50
- package/node_modules/uuid/dist/md5.js +23 -0
- package/node_modules/uuid/dist/rng-browser.js +21 -0
- package/node_modules/uuid/dist/rng.js +14 -0
- package/node_modules/uuid/dist/sha1-browser.js +95 -0
- package/node_modules/uuid/dist/sha1.js +23 -0
- package/node_modules/uuid/dist/umd/uuid.min.js +1 -0
- package/node_modules/uuid/dist/umd/uuidv1.min.js +1 -0
- package/node_modules/uuid/dist/umd/uuidv3.min.js +1 -0
- package/node_modules/uuid/dist/umd/uuidv4.min.js +1 -0
- package/node_modules/uuid/dist/umd/uuidv5.min.js +1 -0
- package/node_modules/uuid/dist/uuid-bin.js +67 -0
- package/node_modules/uuid/dist/v1.js +107 -0
- package/node_modules/uuid/dist/v3.js +16 -0
- package/node_modules/uuid/dist/v35.js +69 -0
- package/node_modules/uuid/dist/v4.js +40 -0
- package/node_modules/uuid/dist/v5.js +16 -0
- package/node_modules/uuid/package.json +92 -19
- package/node_modules/uuid/wrapper.mjs +5 -0
- package/package.json +15 -15
- package/lib/ecr-sync.d.ts.map +0 -1
- package/lib/image.d.ts.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/lambda/docker-adapter.d.ts.map +0 -1
- package/lib/lambda/ecr-adapter.d.ts.map +0 -1
- package/lib/lambda/get-image-tags-handler.d.ts.map +0 -1
- package/node_modules/set-immediate-shim/index.js +0 -7
- package/node_modules/set-immediate-shim/package.json +0 -34
- package/node_modules/set-immediate-shim/readme.md +0 -31
- package/node_modules/uuid/.eslintrc.json +0 -47
- package/node_modules/uuid/AUTHORS +0 -5
- package/node_modules/uuid/README_js.md +0 -280
- package/node_modules/uuid/bin/uuid +0 -65
- package/node_modules/uuid/index.js +0 -8
- package/node_modules/uuid/lib/bytesToUuid.js +0 -24
- package/node_modules/uuid/lib/md5.js +0 -25
- package/node_modules/uuid/lib/rng-browser.js +0 -34
- package/node_modules/uuid/lib/rng.js +0 -8
- package/node_modules/uuid/lib/sha1-browser.js +0 -89
- package/node_modules/uuid/lib/sha1.js +0 -25
- package/node_modules/uuid/v3.js +0 -4
- package/node_modules/uuid/v4.js +0 -29
- package/node_modules/uuid/v5.js +0 -3
- package/releasetag.txt +0 -1
- package/version.txt +0 -1
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import rng from './rng.js';
|
|
2
|
+
import bytesToUuid from './bytesToUuid.js'; // **`v1()` - Generate time-based UUID**
|
|
3
|
+
//
|
|
4
|
+
// Inspired by https://github.com/LiosK/UUID.js
|
|
5
|
+
// and http://docs.python.org/library/uuid.html
|
|
6
|
+
|
|
7
|
+
var _nodeId;
|
|
8
|
+
|
|
9
|
+
var _clockseq; // Previous uuid creation time
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _lastMSecs = 0;
|
|
13
|
+
var _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details
|
|
14
|
+
|
|
15
|
+
function v1(options, buf, offset) {
|
|
16
|
+
var i = buf && offset || 0;
|
|
17
|
+
var b = buf || [];
|
|
18
|
+
options = options || {};
|
|
19
|
+
var node = options.node || _nodeId;
|
|
20
|
+
var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not
|
|
21
|
+
// specified. We do this lazily to minimize issues related to insufficient
|
|
22
|
+
// system entropy. See #189
|
|
23
|
+
|
|
24
|
+
if (node == null || clockseq == null) {
|
|
25
|
+
var seedBytes = options.random || (options.rng || rng)();
|
|
26
|
+
|
|
27
|
+
if (node == null) {
|
|
28
|
+
// Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
|
|
29
|
+
node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (clockseq == null) {
|
|
33
|
+
// Per 4.2.2, randomize (14 bit) clockseq
|
|
34
|
+
clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;
|
|
35
|
+
}
|
|
36
|
+
} // UUID timestamps are 100 nano-second units since the Gregorian epoch,
|
|
37
|
+
// (1582-10-15 00:00). JSNumbers aren't precise enough for this, so
|
|
38
|
+
// time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'
|
|
39
|
+
// (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime(); // Per 4.2.1.2, use count of uuid's generated during the current clock
|
|
43
|
+
// cycle to simulate higher resolution clock
|
|
44
|
+
|
|
45
|
+
var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs)
|
|
46
|
+
|
|
47
|
+
var dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression
|
|
48
|
+
|
|
49
|
+
if (dt < 0 && options.clockseq === undefined) {
|
|
50
|
+
clockseq = clockseq + 1 & 0x3fff;
|
|
51
|
+
} // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new
|
|
52
|
+
// time interval
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {
|
|
56
|
+
nsecs = 0;
|
|
57
|
+
} // Per 4.2.1.2 Throw error if too many uuids are requested
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
if (nsecs >= 10000) {
|
|
61
|
+
throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
_lastMSecs = msecs;
|
|
65
|
+
_lastNSecs = nsecs;
|
|
66
|
+
_clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch
|
|
67
|
+
|
|
68
|
+
msecs += 12219292800000; // `time_low`
|
|
69
|
+
|
|
70
|
+
var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
|
|
71
|
+
b[i++] = tl >>> 24 & 0xff;
|
|
72
|
+
b[i++] = tl >>> 16 & 0xff;
|
|
73
|
+
b[i++] = tl >>> 8 & 0xff;
|
|
74
|
+
b[i++] = tl & 0xff; // `time_mid`
|
|
75
|
+
|
|
76
|
+
var tmh = msecs / 0x100000000 * 10000 & 0xfffffff;
|
|
77
|
+
b[i++] = tmh >>> 8 & 0xff;
|
|
78
|
+
b[i++] = tmh & 0xff; // `time_high_and_version`
|
|
79
|
+
|
|
80
|
+
b[i++] = tmh >>> 24 & 0xf | 0x10; // include version
|
|
81
|
+
|
|
82
|
+
b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)
|
|
83
|
+
|
|
84
|
+
b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low`
|
|
85
|
+
|
|
86
|
+
b[i++] = clockseq & 0xff; // `node`
|
|
87
|
+
|
|
88
|
+
for (var n = 0; n < 6; ++n) {
|
|
89
|
+
b[i + n] = node[n];
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return buf ? buf : bytesToUuid(b);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export default v1;
|
|
@@ -1,57 +1,56 @@
|
|
|
1
|
-
|
|
1
|
+
import bytesToUuid from './bytesToUuid.js';
|
|
2
2
|
|
|
3
3
|
function uuidToBytes(uuid) {
|
|
4
4
|
// Note: We assume we're being passed a valid uuid string
|
|
5
5
|
var bytes = [];
|
|
6
|
-
uuid.replace(/[a-fA-F0-9]{2}/g, function(hex) {
|
|
6
|
+
uuid.replace(/[a-fA-F0-9]{2}/g, function (hex) {
|
|
7
7
|
bytes.push(parseInt(hex, 16));
|
|
8
8
|
});
|
|
9
|
-
|
|
10
9
|
return bytes;
|
|
11
10
|
}
|
|
12
11
|
|
|
13
12
|
function stringToBytes(str) {
|
|
14
13
|
str = unescape(encodeURIComponent(str)); // UTF8 escape
|
|
14
|
+
|
|
15
15
|
var bytes = new Array(str.length);
|
|
16
|
+
|
|
16
17
|
for (var i = 0; i < str.length; i++) {
|
|
17
18
|
bytes[i] = str.charCodeAt(i);
|
|
18
19
|
}
|
|
20
|
+
|
|
19
21
|
return bytes;
|
|
20
22
|
}
|
|
21
23
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
export const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
|
|
25
|
+
export const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
|
|
26
|
+
export default function (name, version, hashfunc) {
|
|
27
|
+
var generateUUID = function (value, namespace, buf, offset) {
|
|
24
28
|
var off = buf && offset || 0;
|
|
25
|
-
|
|
26
|
-
if (typeof
|
|
27
|
-
if (typeof(namespace) == 'string') namespace = uuidToBytes(namespace);
|
|
28
|
-
|
|
29
|
+
if (typeof value == 'string') value = stringToBytes(value);
|
|
30
|
+
if (typeof namespace == 'string') namespace = uuidToBytes(namespace);
|
|
29
31
|
if (!Array.isArray(value)) throw TypeError('value must be an array of bytes');
|
|
30
|
-
if (!Array.isArray(namespace) || namespace.length !== 16) throw TypeError('namespace must be uuid string or an Array of 16 byte values');
|
|
32
|
+
if (!Array.isArray(namespace) || namespace.length !== 16) throw TypeError('namespace must be uuid string or an Array of 16 byte values'); // Per 4.3
|
|
31
33
|
|
|
32
|
-
// Per 4.3
|
|
33
34
|
var bytes = hashfunc(namespace.concat(value));
|
|
34
|
-
bytes[6] =
|
|
35
|
-
bytes[8] =
|
|
35
|
+
bytes[6] = bytes[6] & 0x0f | version;
|
|
36
|
+
bytes[8] = bytes[8] & 0x3f | 0x80;
|
|
36
37
|
|
|
37
38
|
if (buf) {
|
|
38
39
|
for (var idx = 0; idx < 16; ++idx) {
|
|
39
|
-
buf[off+idx] = bytes[idx];
|
|
40
|
+
buf[off + idx] = bytes[idx];
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
return buf || bytesToUuid(bytes);
|
|
44
|
-
};
|
|
45
|
+
}; // Function#name is not settable on some platforms (#270)
|
|
46
|
+
|
|
45
47
|
|
|
46
|
-
// Function#name is not settable on some platforms (#270)
|
|
47
48
|
try {
|
|
48
49
|
generateUUID.name = name;
|
|
49
|
-
} catch (err) {
|
|
50
|
-
}
|
|
50
|
+
} catch (err) {} // For CommonJS default export support
|
|
51
51
|
|
|
52
|
-
// Pre-defined namespaces, per Appendix C
|
|
53
|
-
generateUUID.DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
|
|
54
|
-
generateUUID.URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
|
|
55
52
|
|
|
53
|
+
generateUUID.DNS = DNS;
|
|
54
|
+
generateUUID.URL = URL;
|
|
56
55
|
return generateUUID;
|
|
57
|
-
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import rng from './rng.js';
|
|
2
|
+
import bytesToUuid from './bytesToUuid.js';
|
|
3
|
+
|
|
4
|
+
function v4(options, buf, offset) {
|
|
5
|
+
var i = buf && offset || 0;
|
|
6
|
+
|
|
7
|
+
if (typeof options == 'string') {
|
|
8
|
+
buf = options === 'binary' ? new Array(16) : null;
|
|
9
|
+
options = null;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
options = options || {};
|
|
13
|
+
var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
14
|
+
|
|
15
|
+
rnds[6] = rnds[6] & 0x0f | 0x40;
|
|
16
|
+
rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
|
|
17
|
+
|
|
18
|
+
if (buf) {
|
|
19
|
+
for (var ii = 0; ii < 16; ++ii) {
|
|
20
|
+
buf[i + ii] = rnds[ii];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return buf || bytesToUuid(rnds);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default v4;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "v1", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _v.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "v3", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _v2.default;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "v4", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _v3.default;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "v5", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _v4.default;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
var _v = _interopRequireDefault(require("./v1.js"));
|
|
32
|
+
|
|
33
|
+
var _v2 = _interopRequireDefault(require("./v3.js"));
|
|
34
|
+
|
|
35
|
+
var _v3 = _interopRequireDefault(require("./v4.js"));
|
|
36
|
+
|
|
37
|
+
var _v4 = _interopRequireDefault(require("./v5.js"));
|
|
38
|
+
|
|
39
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
1
8
|
/*
|
|
2
9
|
* Browser-compatible JavaScript MD5
|
|
3
10
|
*
|
|
@@ -18,27 +25,22 @@
|
|
|
18
25
|
* Distributed under the BSD License
|
|
19
26
|
* See http://pajhome.org.uk/crypt/md5 for more info.
|
|
20
27
|
*/
|
|
21
|
-
|
|
22
|
-
'use strict';
|
|
23
|
-
|
|
24
28
|
function md5(bytes) {
|
|
25
|
-
if (typeof
|
|
29
|
+
if (typeof bytes == 'string') {
|
|
26
30
|
var msg = unescape(encodeURIComponent(bytes)); // UTF8 escape
|
|
31
|
+
|
|
27
32
|
bytes = new Array(msg.length);
|
|
33
|
+
|
|
28
34
|
for (var i = 0; i < msg.length; i++) bytes[i] = msg.charCodeAt(i);
|
|
29
35
|
}
|
|
30
36
|
|
|
31
|
-
return md5ToHexEncodedArray(
|
|
32
|
-
wordsToMd5(
|
|
33
|
-
bytesToWords(bytes)
|
|
34
|
-
, bytes.length * 8)
|
|
35
|
-
);
|
|
37
|
+
return md5ToHexEncodedArray(wordsToMd5(bytesToWords(bytes), bytes.length * 8));
|
|
36
38
|
}
|
|
39
|
+
/*
|
|
40
|
+
* Convert an array of little-endian words to an array of bytes
|
|
41
|
+
*/
|
|
37
42
|
|
|
38
43
|
|
|
39
|
-
/*
|
|
40
|
-
* Convert an array of little-endian words to an array of bytes
|
|
41
|
-
*/
|
|
42
44
|
function md5ToHexEncodedArray(input) {
|
|
43
45
|
var i;
|
|
44
46
|
var x;
|
|
@@ -48,23 +50,22 @@ function md5ToHexEncodedArray(input) {
|
|
|
48
50
|
var hex;
|
|
49
51
|
|
|
50
52
|
for (i = 0; i < length32; i += 8) {
|
|
51
|
-
x =
|
|
52
|
-
|
|
53
|
-
hex = parseInt(hexTab.charAt((x >>> 4) & 0x0F) + hexTab.charAt(x & 0x0F), 16);
|
|
54
|
-
|
|
53
|
+
x = input[i >> 5] >>> i % 32 & 0xff;
|
|
54
|
+
hex = parseInt(hexTab.charAt(x >>> 4 & 0x0f) + hexTab.charAt(x & 0x0f), 16);
|
|
55
55
|
output.push(hex);
|
|
56
56
|
}
|
|
57
|
+
|
|
57
58
|
return output;
|
|
58
59
|
}
|
|
59
|
-
|
|
60
60
|
/*
|
|
61
|
-
* Calculate the MD5 of an array of little-endian words, and a bit length.
|
|
62
|
-
*/
|
|
61
|
+
* Calculate the MD5 of an array of little-endian words, and a bit length.
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
|
|
63
65
|
function wordsToMd5(x, len) {
|
|
64
66
|
/* append padding */
|
|
65
|
-
x[len >> 5] |= 0x80 <<
|
|
66
|
-
x[(
|
|
67
|
-
|
|
67
|
+
x[len >> 5] |= 0x80 << len % 32;
|
|
68
|
+
x[(len + 64 >>> 9 << 4) + 14] = len;
|
|
68
69
|
var i;
|
|
69
70
|
var olda;
|
|
70
71
|
var oldb;
|
|
@@ -73,7 +74,6 @@ function wordsToMd5(x, len) {
|
|
|
73
74
|
var a = 1732584193;
|
|
74
75
|
var b = -271733879;
|
|
75
76
|
var c = -1732584194;
|
|
76
|
-
|
|
77
77
|
var d = 271733878;
|
|
78
78
|
|
|
79
79
|
for (i = 0; i < x.length; i += 16) {
|
|
@@ -81,7 +81,6 @@ function wordsToMd5(x, len) {
|
|
|
81
81
|
oldb = b;
|
|
82
82
|
oldc = c;
|
|
83
83
|
oldd = d;
|
|
84
|
-
|
|
85
84
|
a = md5ff(a, b, c, d, x[i], 7, -680876936);
|
|
86
85
|
d = md5ff(d, a, b, c, x[i + 1], 12, -389564586);
|
|
87
86
|
c = md5ff(c, d, a, b, x[i + 2], 17, 606105819);
|
|
@@ -98,7 +97,6 @@ function wordsToMd5(x, len) {
|
|
|
98
97
|
d = md5ff(d, a, b, c, x[i + 13], 12, -40341101);
|
|
99
98
|
c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290);
|
|
100
99
|
b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329);
|
|
101
|
-
|
|
102
100
|
a = md5gg(a, b, c, d, x[i + 1], 5, -165796510);
|
|
103
101
|
d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632);
|
|
104
102
|
c = md5gg(c, d, a, b, x[i + 11], 14, 643717713);
|
|
@@ -115,7 +113,6 @@ function wordsToMd5(x, len) {
|
|
|
115
113
|
d = md5gg(d, a, b, c, x[i + 2], 9, -51403784);
|
|
116
114
|
c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473);
|
|
117
115
|
b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734);
|
|
118
|
-
|
|
119
116
|
a = md5hh(a, b, c, d, x[i + 5], 4, -378558);
|
|
120
117
|
d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463);
|
|
121
118
|
c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562);
|
|
@@ -132,7 +129,6 @@ function wordsToMd5(x, len) {
|
|
|
132
129
|
d = md5hh(d, a, b, c, x[i + 12], 11, -421815835);
|
|
133
130
|
c = md5hh(c, d, a, b, x[i + 15], 16, 530742520);
|
|
134
131
|
b = md5hh(b, c, d, a, x[i + 2], 23, -995338651);
|
|
135
|
-
|
|
136
132
|
a = md5ii(a, b, c, d, x[i], 6, -198630844);
|
|
137
133
|
d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415);
|
|
138
134
|
c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905);
|
|
@@ -149,68 +145,80 @@ function wordsToMd5(x, len) {
|
|
|
149
145
|
d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379);
|
|
150
146
|
c = md5ii(c, d, a, b, x[i + 2], 15, 718787259);
|
|
151
147
|
b = md5ii(b, c, d, a, x[i + 9], 21, -343485551);
|
|
152
|
-
|
|
153
148
|
a = safeAdd(a, olda);
|
|
154
149
|
b = safeAdd(b, oldb);
|
|
155
150
|
c = safeAdd(c, oldc);
|
|
156
151
|
d = safeAdd(d, oldd);
|
|
157
152
|
}
|
|
153
|
+
|
|
158
154
|
return [a, b, c, d];
|
|
159
155
|
}
|
|
160
|
-
|
|
161
156
|
/*
|
|
162
|
-
* Convert an array bytes to an array of little-endian words
|
|
163
|
-
* Characters >255 have their high-byte silently ignored.
|
|
164
|
-
*/
|
|
157
|
+
* Convert an array bytes to an array of little-endian words
|
|
158
|
+
* Characters >255 have their high-byte silently ignored.
|
|
159
|
+
*/
|
|
160
|
+
|
|
161
|
+
|
|
165
162
|
function bytesToWords(input) {
|
|
166
163
|
var i;
|
|
167
164
|
var output = [];
|
|
168
165
|
output[(input.length >> 2) - 1] = undefined;
|
|
166
|
+
|
|
169
167
|
for (i = 0; i < output.length; i += 1) {
|
|
170
168
|
output[i] = 0;
|
|
171
169
|
}
|
|
170
|
+
|
|
172
171
|
var length8 = input.length * 8;
|
|
172
|
+
|
|
173
173
|
for (i = 0; i < length8; i += 8) {
|
|
174
|
-
output[i >> 5] |= (input[
|
|
174
|
+
output[i >> 5] |= (input[i / 8] & 0xff) << i % 32;
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
return output;
|
|
178
178
|
}
|
|
179
|
-
|
|
180
179
|
/*
|
|
181
|
-
* Add integers, wrapping at 2^32. This uses 16-bit operations internally
|
|
182
|
-
* to work around bugs in some JS interpreters.
|
|
183
|
-
*/
|
|
180
|
+
* Add integers, wrapping at 2^32. This uses 16-bit operations internally
|
|
181
|
+
* to work around bugs in some JS interpreters.
|
|
182
|
+
*/
|
|
183
|
+
|
|
184
|
+
|
|
184
185
|
function safeAdd(x, y) {
|
|
185
|
-
var lsw = (x &
|
|
186
|
+
var lsw = (x & 0xffff) + (y & 0xffff);
|
|
186
187
|
var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
|
|
187
|
-
return
|
|
188
|
+
return msw << 16 | lsw & 0xffff;
|
|
188
189
|
}
|
|
189
|
-
|
|
190
190
|
/*
|
|
191
|
-
* Bitwise rotate a 32-bit number to the left.
|
|
192
|
-
*/
|
|
191
|
+
* Bitwise rotate a 32-bit number to the left.
|
|
192
|
+
*/
|
|
193
|
+
|
|
194
|
+
|
|
193
195
|
function bitRotateLeft(num, cnt) {
|
|
194
|
-
return
|
|
196
|
+
return num << cnt | num >>> 32 - cnt;
|
|
195
197
|
}
|
|
196
|
-
|
|
197
198
|
/*
|
|
198
|
-
* These functions implement the four basic operations the algorithm uses.
|
|
199
|
-
*/
|
|
199
|
+
* These functions implement the four basic operations the algorithm uses.
|
|
200
|
+
*/
|
|
201
|
+
|
|
202
|
+
|
|
200
203
|
function md5cmn(q, a, b, x, s, t) {
|
|
201
204
|
return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b);
|
|
202
205
|
}
|
|
206
|
+
|
|
203
207
|
function md5ff(a, b, c, d, x, s, t) {
|
|
204
|
-
return md5cmn(
|
|
208
|
+
return md5cmn(b & c | ~b & d, a, b, x, s, t);
|
|
205
209
|
}
|
|
210
|
+
|
|
206
211
|
function md5gg(a, b, c, d, x, s, t) {
|
|
207
|
-
return md5cmn(
|
|
212
|
+
return md5cmn(b & d | c & ~d, a, b, x, s, t);
|
|
208
213
|
}
|
|
214
|
+
|
|
209
215
|
function md5hh(a, b, c, d, x, s, t) {
|
|
210
216
|
return md5cmn(b ^ c ^ d, a, b, x, s, t);
|
|
211
217
|
}
|
|
218
|
+
|
|
212
219
|
function md5ii(a, b, c, d, x, s, t) {
|
|
213
|
-
return md5cmn(c ^ (b |
|
|
220
|
+
return md5cmn(c ^ (b | ~d), a, b, x, s, t);
|
|
214
221
|
}
|
|
215
222
|
|
|
216
|
-
|
|
223
|
+
var _default = md5;
|
|
224
|
+
exports.default = _default;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _crypto = _interopRequireDefault(require("crypto"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
function md5(bytes) {
|
|
13
|
+
if (Array.isArray(bytes)) {
|
|
14
|
+
bytes = Buffer.from(bytes);
|
|
15
|
+
} else if (typeof bytes === 'string') {
|
|
16
|
+
bytes = Buffer.from(bytes, 'utf8');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return _crypto.default.createHash('md5').update(bytes).digest();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
var _default = md5;
|
|
23
|
+
exports.default = _default;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = rng;
|
|
7
|
+
// Unique ID creation requires a high quality random # generator. In the browser we therefore
|
|
8
|
+
// require the crypto API and do not support built-in fallback to lower quality random number
|
|
9
|
+
// generators (like Math.random()).
|
|
10
|
+
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also,
|
|
11
|
+
// find the complete implementation of crypto (msCrypto) on IE11.
|
|
12
|
+
var getRandomValues = typeof crypto != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto != 'undefined' && typeof msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto);
|
|
13
|
+
var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef
|
|
14
|
+
|
|
15
|
+
function rng() {
|
|
16
|
+
if (!getRandomValues) {
|
|
17
|
+
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return getRandomValues(rnds8);
|
|
21
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = rng;
|
|
7
|
+
|
|
8
|
+
var _crypto = _interopRequireDefault(require("crypto"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
function rng() {
|
|
13
|
+
return _crypto.default.randomBytes(16);
|
|
14
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
// Adapted from Chris Veness' SHA1 code at
|
|
9
|
+
// http://www.movable-type.co.uk/scripts/sha1.html
|
|
10
|
+
function f(s, x, y, z) {
|
|
11
|
+
switch (s) {
|
|
12
|
+
case 0:
|
|
13
|
+
return x & y ^ ~x & z;
|
|
14
|
+
|
|
15
|
+
case 1:
|
|
16
|
+
return x ^ y ^ z;
|
|
17
|
+
|
|
18
|
+
case 2:
|
|
19
|
+
return x & y ^ x & z ^ y & z;
|
|
20
|
+
|
|
21
|
+
case 3:
|
|
22
|
+
return x ^ y ^ z;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function ROTL(x, n) {
|
|
27
|
+
return x << n | x >>> 32 - n;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function sha1(bytes) {
|
|
31
|
+
var K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6];
|
|
32
|
+
var H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0];
|
|
33
|
+
|
|
34
|
+
if (typeof bytes == 'string') {
|
|
35
|
+
var msg = unescape(encodeURIComponent(bytes)); // UTF8 escape
|
|
36
|
+
|
|
37
|
+
bytes = new Array(msg.length);
|
|
38
|
+
|
|
39
|
+
for (var i = 0; i < msg.length; i++) bytes[i] = msg.charCodeAt(i);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
bytes.push(0x80);
|
|
43
|
+
var l = bytes.length / 4 + 2;
|
|
44
|
+
var N = Math.ceil(l / 16);
|
|
45
|
+
var M = new Array(N);
|
|
46
|
+
|
|
47
|
+
for (var i = 0; i < N; i++) {
|
|
48
|
+
M[i] = new Array(16);
|
|
49
|
+
|
|
50
|
+
for (var j = 0; j < 16; j++) {
|
|
51
|
+
M[i][j] = bytes[i * 64 + j * 4] << 24 | bytes[i * 64 + j * 4 + 1] << 16 | bytes[i * 64 + j * 4 + 2] << 8 | bytes[i * 64 + j * 4 + 3];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
M[N - 1][14] = (bytes.length - 1) * 8 / Math.pow(2, 32);
|
|
56
|
+
M[N - 1][14] = Math.floor(M[N - 1][14]);
|
|
57
|
+
M[N - 1][15] = (bytes.length - 1) * 8 & 0xffffffff;
|
|
58
|
+
|
|
59
|
+
for (var i = 0; i < N; i++) {
|
|
60
|
+
var W = new Array(80);
|
|
61
|
+
|
|
62
|
+
for (var t = 0; t < 16; t++) W[t] = M[i][t];
|
|
63
|
+
|
|
64
|
+
for (var t = 16; t < 80; t++) {
|
|
65
|
+
W[t] = ROTL(W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16], 1);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
var a = H[0];
|
|
69
|
+
var b = H[1];
|
|
70
|
+
var c = H[2];
|
|
71
|
+
var d = H[3];
|
|
72
|
+
var e = H[4];
|
|
73
|
+
|
|
74
|
+
for (var t = 0; t < 80; t++) {
|
|
75
|
+
var s = Math.floor(t / 20);
|
|
76
|
+
var T = ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[t] >>> 0;
|
|
77
|
+
e = d;
|
|
78
|
+
d = c;
|
|
79
|
+
c = ROTL(b, 30) >>> 0;
|
|
80
|
+
b = a;
|
|
81
|
+
a = T;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
H[0] = H[0] + a >>> 0;
|
|
85
|
+
H[1] = H[1] + b >>> 0;
|
|
86
|
+
H[2] = H[2] + c >>> 0;
|
|
87
|
+
H[3] = H[3] + d >>> 0;
|
|
88
|
+
H[4] = H[4] + e >>> 0;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return [H[0] >> 24 & 0xff, H[0] >> 16 & 0xff, H[0] >> 8 & 0xff, H[0] & 0xff, H[1] >> 24 & 0xff, H[1] >> 16 & 0xff, H[1] >> 8 & 0xff, H[1] & 0xff, H[2] >> 24 & 0xff, H[2] >> 16 & 0xff, H[2] >> 8 & 0xff, H[2] & 0xff, H[3] >> 24 & 0xff, H[3] >> 16 & 0xff, H[3] >> 8 & 0xff, H[3] & 0xff, H[4] >> 24 & 0xff, H[4] >> 16 & 0xff, H[4] >> 8 & 0xff, H[4] & 0xff];
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
var _default = sha1;
|
|
95
|
+
exports.default = _default;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _crypto = _interopRequireDefault(require("crypto"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
function sha1(bytes) {
|
|
13
|
+
if (Array.isArray(bytes)) {
|
|
14
|
+
bytes = Buffer.from(bytes);
|
|
15
|
+
} else if (typeof bytes === 'string') {
|
|
16
|
+
bytes = Buffer.from(bytes, 'utf8');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return _crypto.default.createHash('sha1').update(bytes).digest();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
var _default = sha1;
|
|
23
|
+
exports.default = _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(r,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((r=r||self).uuid={})}(this,(function(r){"use strict";var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),e=new Uint8Array(16);function t(){if(!n)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return n(e)}for(var o,a,u=[],f=0;f<256;++f)u[f]=(f+256).toString(16).substr(1);function c(r,n){var e=n||0,t=u;return[t[r[e++]],t[r[e++]],t[r[e++]],t[r[e++]],"-",t[r[e++]],t[r[e++]],"-",t[r[e++]],t[r[e++]],"-",t[r[e++]],t[r[e++]],"-",t[r[e++]],t[r[e++]],t[r[e++]],t[r[e++]],t[r[e++]],t[r[e++]]].join("")}var i=0,s=0;function v(r,n,e){var t=function(r,t,o,a){var u=o&&a||0;if("string"==typeof r&&(r=function(r){r=unescape(encodeURIComponent(r));for(var n=new Array(r.length),e=0;e<r.length;e++)n[e]=r.charCodeAt(e);return n}(r)),"string"==typeof t&&(t=function(r){var n=[];return r.replace(/[a-fA-F0-9]{2}/g,(function(r){n.push(parseInt(r,16))})),n}(t)),!Array.isArray(r))throw TypeError("value must be an array of bytes");if(!Array.isArray(t)||16!==t.length)throw TypeError("namespace must be uuid string or an Array of 16 byte values");var f=e(t.concat(r));if(f[6]=15&f[6]|n,f[8]=63&f[8]|128,o)for(var i=0;i<16;++i)o[u+i]=f[i];return o||c(f)};try{t.name=r}catch(r){}return t.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",t.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",t}function d(r,n){var e=(65535&r)+(65535&n);return(r>>16)+(n>>16)+(e>>16)<<16|65535&e}function l(r,n,e,t,o,a){return d((u=d(d(n,r),d(t,a)))<<(f=o)|u>>>32-f,e);var u,f}function p(r,n,e,t,o,a,u){return l(n&e|~n&t,r,n,o,a,u)}function y(r,n,e,t,o,a,u){return l(n&t|e&~t,r,n,o,a,u)}function h(r,n,e,t,o,a,u){return l(n^e^t,r,n,o,a,u)}function g(r,n,e,t,o,a,u){return l(e^(n|~t),r,n,o,a,u)}var m=v("v3",48,(function(r){if("string"==typeof r){var n=unescape(encodeURIComponent(r));r=new Array(n.length);for(var e=0;e<n.length;e++)r[e]=n.charCodeAt(e)}return function(r){var n,e,t,o=[],a=32*r.length;for(n=0;n<a;n+=8)e=r[n>>5]>>>n%32&255,t=parseInt("0123456789abcdef".charAt(e>>>4&15)+"0123456789abcdef".charAt(15&e),16),o.push(t);return o}(function(r,n){var e,t,o,a,u;r[n>>5]|=128<<n%32,r[14+(n+64>>>9<<4)]=n;var f=1732584193,c=-271733879,i=-1732584194,s=271733878;for(e=0;e<r.length;e+=16)t=f,o=c,a=i,u=s,f=p(f,c,i,s,r[e],7,-680876936),s=p(s,f,c,i,r[e+1],12,-389564586),i=p(i,s,f,c,r[e+2],17,606105819),c=p(c,i,s,f,r[e+3],22,-1044525330),f=p(f,c,i,s,r[e+4],7,-176418897),s=p(s,f,c,i,r[e+5],12,1200080426),i=p(i,s,f,c,r[e+6],17,-1473231341),c=p(c,i,s,f,r[e+7],22,-45705983),f=p(f,c,i,s,r[e+8],7,1770035416),s=p(s,f,c,i,r[e+9],12,-1958414417),i=p(i,s,f,c,r[e+10],17,-42063),c=p(c,i,s,f,r[e+11],22,-1990404162),f=p(f,c,i,s,r[e+12],7,1804603682),s=p(s,f,c,i,r[e+13],12,-40341101),i=p(i,s,f,c,r[e+14],17,-1502002290),c=p(c,i,s,f,r[e+15],22,1236535329),f=y(f,c,i,s,r[e+1],5,-165796510),s=y(s,f,c,i,r[e+6],9,-1069501632),i=y(i,s,f,c,r[e+11],14,643717713),c=y(c,i,s,f,r[e],20,-373897302),f=y(f,c,i,s,r[e+5],5,-701558691),s=y(s,f,c,i,r[e+10],9,38016083),i=y(i,s,f,c,r[e+15],14,-660478335),c=y(c,i,s,f,r[e+4],20,-405537848),f=y(f,c,i,s,r[e+9],5,568446438),s=y(s,f,c,i,r[e+14],9,-1019803690),i=y(i,s,f,c,r[e+3],14,-187363961),c=y(c,i,s,f,r[e+8],20,1163531501),f=y(f,c,i,s,r[e+13],5,-1444681467),s=y(s,f,c,i,r[e+2],9,-51403784),i=y(i,s,f,c,r[e+7],14,1735328473),c=y(c,i,s,f,r[e+12],20,-1926607734),f=h(f,c,i,s,r[e+5],4,-378558),s=h(s,f,c,i,r[e+8],11,-2022574463),i=h(i,s,f,c,r[e+11],16,1839030562),c=h(c,i,s,f,r[e+14],23,-35309556),f=h(f,c,i,s,r[e+1],4,-1530992060),s=h(s,f,c,i,r[e+4],11,1272893353),i=h(i,s,f,c,r[e+7],16,-155497632),c=h(c,i,s,f,r[e+10],23,-1094730640),f=h(f,c,i,s,r[e+13],4,681279174),s=h(s,f,c,i,r[e],11,-358537222),i=h(i,s,f,c,r[e+3],16,-722521979),c=h(c,i,s,f,r[e+6],23,76029189),f=h(f,c,i,s,r[e+9],4,-640364487),s=h(s,f,c,i,r[e+12],11,-421815835),i=h(i,s,f,c,r[e+15],16,530742520),c=h(c,i,s,f,r[e+2],23,-995338651),f=g(f,c,i,s,r[e],6,-198630844),s=g(s,f,c,i,r[e+7],10,1126891415),i=g(i,s,f,c,r[e+14],15,-1416354905),c=g(c,i,s,f,r[e+5],21,-57434055),f=g(f,c,i,s,r[e+12],6,1700485571),s=g(s,f,c,i,r[e+3],10,-1894986606),i=g(i,s,f,c,r[e+10],15,-1051523),c=g(c,i,s,f,r[e+1],21,-2054922799),f=g(f,c,i,s,r[e+8],6,1873313359),s=g(s,f,c,i,r[e+15],10,-30611744),i=g(i,s,f,c,r[e+6],15,-1560198380),c=g(c,i,s,f,r[e+13],21,1309151649),f=g(f,c,i,s,r[e+4],6,-145523070),s=g(s,f,c,i,r[e+11],10,-1120210379),i=g(i,s,f,c,r[e+2],15,718787259),c=g(c,i,s,f,r[e+9],21,-343485551),f=d(f,t),c=d(c,o),i=d(i,a),s=d(s,u);return[f,c,i,s]}(function(r){var n,e=[];for(e[(r.length>>2)-1]=void 0,n=0;n<e.length;n+=1)e[n]=0;var t=8*r.length;for(n=0;n<t;n+=8)e[n>>5]|=(255&r[n/8])<<n%32;return e}(r),8*r.length))}));function b(r,n,e,t){switch(r){case 0:return n&e^~n&t;case 1:return n^e^t;case 2:return n&e^n&t^e&t;case 3:return n^e^t}}function A(r,n){return r<<n|r>>>32-n}var w=v("v5",80,(function(r){var n=[1518500249,1859775393,2400959708,3395469782],e=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof r){var t=unescape(encodeURIComponent(r));r=new Array(t.length);for(var o=0;o<t.length;o++)r[o]=t.charCodeAt(o)}r.push(128);var a=r.length/4+2,u=Math.ceil(a/16),f=new Array(u);for(o=0;o<u;o++){f[o]=new Array(16);for(var c=0;c<16;c++)f[o][c]=r[64*o+4*c]<<24|r[64*o+4*c+1]<<16|r[64*o+4*c+2]<<8|r[64*o+4*c+3]}for(f[u-1][14]=8*(r.length-1)/Math.pow(2,32),f[u-1][14]=Math.floor(f[u-1][14]),f[u-1][15]=8*(r.length-1)&4294967295,o=0;o<u;o++){for(var i=new Array(80),s=0;s<16;s++)i[s]=f[o][s];for(s=16;s<80;s++)i[s]=A(i[s-3]^i[s-8]^i[s-14]^i[s-16],1);var v=e[0],d=e[1],l=e[2],p=e[3],y=e[4];for(s=0;s<80;s++){var h=Math.floor(s/20),g=A(v,5)+b(h,d,l,p)+y+n[h]+i[s]>>>0;y=p,p=l,l=A(d,30)>>>0,d=v,v=g}e[0]=e[0]+v>>>0,e[1]=e[1]+d>>>0,e[2]=e[2]+l>>>0,e[3]=e[3]+p>>>0,e[4]=e[4]+y>>>0}return[e[0]>>24&255,e[0]>>16&255,e[0]>>8&255,255&e[0],e[1]>>24&255,e[1]>>16&255,e[1]>>8&255,255&e[1],e[2]>>24&255,e[2]>>16&255,e[2]>>8&255,255&e[2],e[3]>>24&255,e[3]>>16&255,e[3]>>8&255,255&e[3],e[4]>>24&255,e[4]>>16&255,e[4]>>8&255,255&e[4]]}));r.v1=function(r,n,e){var u=n&&e||0,f=n||[],v=(r=r||{}).node||o,d=void 0!==r.clockseq?r.clockseq:a;if(null==v||null==d){var l=r.random||(r.rng||t)();null==v&&(v=o=[1|l[0],l[1],l[2],l[3],l[4],l[5]]),null==d&&(d=a=16383&(l[6]<<8|l[7]))}var p=void 0!==r.msecs?r.msecs:(new Date).getTime(),y=void 0!==r.nsecs?r.nsecs:s+1,h=p-i+(y-s)/1e4;if(h<0&&void 0===r.clockseq&&(d=d+1&16383),(h<0||p>i)&&void 0===r.nsecs&&(y=0),y>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");i=p,s=y,a=d;var g=(1e4*(268435455&(p+=122192928e5))+y)%4294967296;f[u++]=g>>>24&255,f[u++]=g>>>16&255,f[u++]=g>>>8&255,f[u++]=255&g;var m=p/4294967296*1e4&268435455;f[u++]=m>>>8&255,f[u++]=255&m,f[u++]=m>>>24&15|16,f[u++]=m>>>16&255,f[u++]=d>>>8|128,f[u++]=255&d;for(var b=0;b<6;++b)f[u+b]=v[b];return n||c(f)},r.v3=m,r.v4=function(r,n,e){var o=n&&e||0;"string"==typeof r&&(n="binary"===r?new Array(16):null,r=null);var a=(r=r||{}).random||(r.rng||t)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,n)for(var u=0;u<16;++u)n[o+u]=a[u];return n||c(a)},r.v5=w,Object.defineProperty(r,"__esModule",{value:!0})}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o():"function"==typeof define&&define.amd?define(o):(e=e||self).uuidv1=o()}(this,(function(){"use strict";var e="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),o=new Uint8Array(16);function n(){if(!e)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return e(o)}for(var t,r,u=[],s=0;s<256;++s)u[s]=(s+256).toString(16).substr(1);var i=0,d=0;return function(e,o,s){var a=o&&s||0,c=o||[],f=(e=e||{}).node||t,p=void 0!==e.clockseq?e.clockseq:r;if(null==f||null==p){var l=e.random||(e.rng||n)();null==f&&(f=t=[1|l[0],l[1],l[2],l[3],l[4],l[5]]),null==p&&(p=r=16383&(l[6]<<8|l[7]))}var m=void 0!==e.msecs?e.msecs:(new Date).getTime(),v=void 0!==e.nsecs?e.nsecs:d+1,y=m-i+(v-d)/1e4;if(y<0&&void 0===e.clockseq&&(p=p+1&16383),(y<0||m>i)&&void 0===e.nsecs&&(v=0),v>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");i=m,d=v,r=p;var g=(1e4*(268435455&(m+=122192928e5))+v)%4294967296;c[a++]=g>>>24&255,c[a++]=g>>>16&255,c[a++]=g>>>8&255,c[a++]=255&g;var h=m/4294967296*1e4&268435455;c[a++]=h>>>8&255,c[a++]=255&h,c[a++]=h>>>24&15|16,c[a++]=h>>>16&255,c[a++]=p>>>8|128,c[a++]=255&p;for(var w=0;w<6;++w)c[a+w]=f[w];return o||function(e,o){var n=o||0,t=u;return[t[e[n++]],t[e[n++]],t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],"-",t[e[n++]],t[e[n++]],t[e[n++]],t[e[n++]],t[e[n++]],t[e[n++]]].join("")}(c)}}));
|