moss-sdk 0.1.0__tar.gz

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.
Files changed (39) hide show
  1. moss_sdk-0.1.0/.github/CODEOWNERS +15 -0
  2. moss_sdk-0.1.0/.github/ISSUE_TEMPLATE/bug_report.md +40 -0
  3. moss_sdk-0.1.0/.github/ISSUE_TEMPLATE/feature_request.md +24 -0
  4. moss_sdk-0.1.0/.github/ISSUE_TEMPLATE/spec_change.md +47 -0
  5. moss_sdk-0.1.0/.github/PULL_REQUEST_TEMPLATE.md +37 -0
  6. moss_sdk-0.1.0/.github/dependabot.yml +23 -0
  7. moss_sdk-0.1.0/.github/workflows/ci.yml +82 -0
  8. moss_sdk-0.1.0/.github/workflows/release.yml +86 -0
  9. moss_sdk-0.1.0/.github/workflows/security.yml +46 -0
  10. moss_sdk-0.1.0/.gitignore +90 -0
  11. moss_sdk-0.1.0/CHANGELOG.md +30 -0
  12. moss_sdk-0.1.0/CODE_OF_CONDUCT.md +79 -0
  13. moss_sdk-0.1.0/CONTRIBUTING.md +140 -0
  14. moss_sdk-0.1.0/PKG-INFO +166 -0
  15. moss_sdk-0.1.0/README.md +141 -0
  16. moss_sdk-0.1.0/SECURITY.md +85 -0
  17. moss_sdk-0.1.0/SPEC.md +335 -0
  18. moss_sdk-0.1.0/conformance/vectors.json +38 -0
  19. moss_sdk-0.1.0/moss/__init__.py +28 -0
  20. moss_sdk-0.1.0/moss/__main__.py +4 -0
  21. moss_sdk-0.1.0/moss/canonical.py +29 -0
  22. moss_sdk-0.1.0/moss/cli.py +109 -0
  23. moss_sdk-0.1.0/moss/crypto.py +29 -0
  24. moss_sdk-0.1.0/moss/encoding.py +14 -0
  25. moss_sdk-0.1.0/moss/envelope.py +41 -0
  26. moss_sdk-0.1.0/moss/errors.py +38 -0
  27. moss_sdk-0.1.0/moss/keystore.py +117 -0
  28. moss_sdk-0.1.0/moss/sequence.py +30 -0
  29. moss_sdk-0.1.0/moss/subject.py +183 -0
  30. moss_sdk-0.1.0/pyproject.toml +43 -0
  31. moss_sdk-0.1.0/tests/__init__.py +1 -0
  32. moss_sdk-0.1.0/tests/conformance_test.py +89 -0
  33. moss_sdk-0.1.0/tests/test_canonical.py +59 -0
  34. moss_sdk-0.1.0/tests/test_crypto.py +48 -0
  35. moss_sdk-0.1.0/tests/test_encoding.py +59 -0
  36. moss_sdk-0.1.0/tests/test_envelope.py +71 -0
  37. moss_sdk-0.1.0/tests/test_integration.py +137 -0
  38. moss_sdk-0.1.0/tests/test_keystore.py +93 -0
  39. moss_sdk-0.1.0/tests/test_sequence.py +62 -0
@@ -0,0 +1,15 @@
1
+ # CODEOWNERS - These users must approve PRs to protected files
2
+
3
+ # Default owners for everything
4
+ * @Lechatdiabolique
5
+
6
+ # Spec changes require explicit approval
7
+ SPEC.md @Lechatdiabolique
8
+ conformance/ @Lechatdiabolique
9
+
10
+ # Core crypto requires careful review
11
+ moss/crypto.py @Lechatdiabolique
12
+ moss/keystore.py @Lechatdiabolique
13
+
14
+ # CI/CD changes
15
+ .github/ @Lechatdiabolique
@@ -0,0 +1,40 @@
1
+ ---
2
+ name: Bug Report
3
+ about: Report a bug in the MOSS SDK
4
+ title: "[BUG] "
5
+ labels: bug
6
+ assignees: ''
7
+ ---
8
+
9
+ ## Description
10
+ A clear description of the bug.
11
+
12
+ ## Steps to Reproduce
13
+ 1.
14
+ 2.
15
+ 3.
16
+
17
+ ## Expected Behavior
18
+ What you expected to happen.
19
+
20
+ ## Actual Behavior
21
+ What actually happened.
22
+
23
+ ## Environment
24
+ - OS:
25
+ - Python version:
26
+ - MOSS version:
27
+ - dilithium-py version:
28
+
29
+ ## Code to Reproduce
30
+ ```python
31
+ # Minimal code that reproduces the issue
32
+ ```
33
+
34
+ ## Error Output
35
+ ```
36
+ # Paste error messages here
37
+ ```
38
+
39
+ ## Additional Context
40
+ Any other relevant information.
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: Feature Request
3
+ about: Suggest a feature for the MOSS SDK
4
+ title: "[FEATURE] "
5
+ labels: enhancement
6
+ assignees: ''
7
+ ---
8
+
9
+ ## Problem
10
+ What problem does this feature solve?
11
+
12
+ ## Proposed Solution
13
+ Describe your proposed solution.
14
+
15
+ ## Example Usage
16
+ ```python
17
+ # How would this feature be used?
18
+ ```
19
+
20
+ ## Alternatives Considered
21
+ What alternatives have you considered?
22
+
23
+ ## Additional Context
24
+ Any other relevant information.
@@ -0,0 +1,47 @@
1
+ ---
2
+ name: Spec Change Proposal
3
+ about: Propose a change to the MOSS protocol specification
4
+ title: "[SPEC] "
5
+ labels: spec-change
6
+ assignees: ''
7
+ ---
8
+
9
+ ## Summary
10
+ One-sentence description of the proposed change.
11
+
12
+ ## Motivation
13
+ Why is this change needed? What problem does it solve?
14
+
15
+ ## Specification Change
16
+ Detailed description of the proposed change to moss-0001.
17
+
18
+ ### Current Behavior
19
+ How does the spec currently work?
20
+
21
+ ### Proposed Behavior
22
+ How should it work after this change?
23
+
24
+ ### Envelope Format Changes
25
+ ```json
26
+ // Show any changes to the envelope format
27
+ ```
28
+
29
+ ### Signed Bytes Changes
30
+ ```json
31
+ // Show any changes to signed_bytes
32
+ ```
33
+
34
+ ## Backward Compatibility
35
+ - [ ] This is backward compatible
36
+ - [ ] This breaks backward compatibility
37
+
38
+ If breaking, describe migration path:
39
+
40
+ ## Security Considerations
41
+ What are the security implications of this change?
42
+
43
+ ## Implementation Notes
44
+ Any notes for implementers.
45
+
46
+ ## Test Vectors
47
+ Provide test vectors for the new behavior if applicable.
@@ -0,0 +1,37 @@
1
+ ## Description
2
+ Brief description of the changes.
3
+
4
+ ## Type of Change
5
+ - [ ] Bug fix (non-breaking change that fixes an issue)
6
+ - [ ] New feature (non-breaking change that adds functionality)
7
+ - [ ] Breaking change (fix or feature that would cause existing functionality to change)
8
+ - [ ] Spec change (modification to moss-0001 specification)
9
+ - [ ] Documentation update
10
+ - [ ] Test improvement
11
+
12
+ ## Related Issues
13
+ Fixes #
14
+
15
+ ## Changes Made
16
+ -
17
+ -
18
+ -
19
+
20
+ ## Testing
21
+ - [ ] Tests pass locally (`pytest tests/ -v`)
22
+ - [ ] Conformance tests pass (`pytest tests/conformance_test.py -v`)
23
+ - [ ] Added new tests for changes (if applicable)
24
+
25
+ ## Checklist
26
+ - [ ] Code follows project style guidelines
27
+ - [ ] Self-review completed
28
+ - [ ] Comments added for complex logic
29
+ - [ ] Documentation updated (if applicable)
30
+ - [ ] No secrets or credentials in code
31
+ - [ ] CHANGELOG.md updated (for user-facing changes)
32
+
33
+ ## Security Considerations
34
+ Does this change have security implications? If yes, describe:
35
+
36
+ ## Additional Notes
37
+ Any other information reviewers should know.
@@ -0,0 +1,23 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "pip"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
7
+ commit-message:
8
+ prefix: "deps"
9
+ labels:
10
+ - "dependencies"
11
+ reviewers:
12
+ - "Lechatdiabolique"
13
+
14
+ - package-ecosystem: "github-actions"
15
+ directory: "/"
16
+ schedule:
17
+ interval: "weekly"
18
+ commit-message:
19
+ prefix: "ci"
20
+ labels:
21
+ - "ci"
22
+ reviewers:
23
+ - "Lechatdiabolique"
@@ -0,0 +1,82 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main, develop]
6
+ pull_request:
7
+ branches: [main, develop]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ fail-fast: false
14
+ matrix:
15
+ python-version: ["3.9", "3.10", "3.11", "3.12"]
16
+
17
+ steps:
18
+ - uses: actions/checkout@v6
19
+
20
+ - name: Set up Python ${{ matrix.python-version }}
21
+ uses: actions/setup-python@v5
22
+ with:
23
+ python-version: ${{ matrix.python-version }}
24
+
25
+ - name: Install dependencies
26
+ run: |
27
+ python -m pip install --upgrade pip
28
+ pip install -e ".[dev]"
29
+
30
+ - name: Run tests
31
+ run: pytest tests/ -v --tb=short
32
+
33
+ - name: Run conformance tests
34
+ run: pytest tests/conformance_test.py -v
35
+
36
+ - name: Verify import
37
+ run: python -c "from moss import Subject; print('Import OK')"
38
+
39
+ lint:
40
+ runs-on: ubuntu-latest
41
+ steps:
42
+ - uses: actions/checkout@v6
43
+
44
+ - name: Set up Python
45
+ uses: actions/setup-python@v5
46
+ with:
47
+ python-version: "3.11"
48
+
49
+ - name: Install linters
50
+ run: pip install ruff mypy
51
+
52
+ - name: Run ruff
53
+ run: ruff check moss/ tests/
54
+
55
+ - name: Run mypy
56
+ run: mypy moss/ --ignore-missing-imports
57
+
58
+ conformance:
59
+ runs-on: ubuntu-latest
60
+ steps:
61
+ - uses: actions/checkout@v6
62
+
63
+ - name: Set up Python
64
+ uses: actions/setup-python@v5
65
+ with:
66
+ python-version: "3.11"
67
+
68
+ - name: Install dependencies
69
+ run: |
70
+ pip install -e ".[dev]"
71
+
72
+ - name: Verify conformance vectors
73
+ run: pytest tests/conformance_test.py -v
74
+
75
+ - name: Check key lengths
76
+ run: |
77
+ python -c "
78
+ from moss.crypto import MossCrypto
79
+ pk, sk = MossCrypto.keygen()
80
+ assert len(pk) == 1312, f'Bad pk: {len(pk)}'
81
+ print('Key lengths OK')
82
+ "
@@ -0,0 +1,86 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+
8
+ jobs:
9
+ test:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v6
13
+
14
+ - name: Set up Python
15
+ uses: actions/setup-python@v5
16
+ with:
17
+ python-version: "3.11"
18
+
19
+ - name: Install dependencies
20
+ run: |
21
+ pip install -e ".[dev]"
22
+
23
+ - name: Run tests
24
+ run: pytest tests/ -v
25
+
26
+ build:
27
+ needs: test
28
+ runs-on: ubuntu-latest
29
+ steps:
30
+ - uses: actions/checkout@v6
31
+
32
+ - name: Set up Python
33
+ uses: actions/setup-python@v5
34
+ with:
35
+ python-version: "3.11"
36
+
37
+ - name: Install build tools
38
+ run: pip install build twine
39
+
40
+ - name: Build package
41
+ run: python -m build
42
+
43
+ - name: Check package
44
+ run: twine check dist/*
45
+
46
+ - name: Upload artifacts
47
+ uses: actions/upload-artifact@v4
48
+ with:
49
+ name: dist
50
+ path: dist/
51
+
52
+ publish-pypi:
53
+ needs: build
54
+ runs-on: ubuntu-latest
55
+ environment: pypi
56
+ permissions:
57
+ id-token: write
58
+ steps:
59
+ - name: Download artifacts
60
+ uses: actions/download-artifact@v4
61
+ with:
62
+ name: dist
63
+ path: dist/
64
+
65
+ - name: Publish to PyPI
66
+ uses: pypa/gh-action-pypi-publish@release/v1
67
+
68
+ github-release:
69
+ needs: build
70
+ runs-on: ubuntu-latest
71
+ permissions:
72
+ contents: write
73
+ steps:
74
+ - uses: actions/checkout@v6
75
+
76
+ - name: Download artifacts
77
+ uses: actions/download-artifact@v4
78
+ with:
79
+ name: dist
80
+ path: dist/
81
+
82
+ - name: Create GitHub Release
83
+ uses: softprops/action-gh-release@v1
84
+ with:
85
+ files: dist/*
86
+ generate_release_notes: true
@@ -0,0 +1,46 @@
1
+ name: Security
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+ schedule:
9
+ - cron: "0 0 * * 0" # Weekly on Sunday
10
+
11
+ jobs:
12
+ dependency-scan:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v6
16
+
17
+ - name: Set up Python
18
+ uses: actions/setup-python@v5
19
+ with:
20
+ python-version: "3.11"
21
+
22
+ - name: Install dependencies
23
+ run: |
24
+ pip install pip-audit safety
25
+
26
+ - name: Run pip-audit
27
+ run: pip-audit .
28
+
29
+ - name: Run safety check
30
+ run: safety check
31
+ continue-on-error: true # Advisory only
32
+
33
+ codeql:
34
+ runs-on: ubuntu-latest
35
+ permissions:
36
+ security-events: write
37
+ steps:
38
+ - uses: actions/checkout@v6
39
+
40
+ - name: Initialize CodeQL
41
+ uses: github/codeql-action/init@v3
42
+ with:
43
+ languages: python
44
+
45
+ - name: Perform CodeQL Analysis
46
+ uses: github/codeql-action/analyze@v3
@@ -0,0 +1,90 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ *.egg-info/
24
+ .installed.cfg
25
+ *.egg
26
+
27
+ # PyInstaller
28
+ *.manifest
29
+ *.spec
30
+
31
+ # Installer logs
32
+ pip-log.txt
33
+ pip-delete-this-directory.txt
34
+
35
+ # Unit test / coverage reports
36
+ htmlcov/
37
+ .tox/
38
+ .nox/
39
+ .coverage
40
+ .coverage.*
41
+ .cache
42
+ nosetests.xml
43
+ coverage.xml
44
+ *.cover
45
+ *.py,cover
46
+ .hypothesis/
47
+ .pytest_cache/
48
+
49
+ # Translations
50
+ *.mo
51
+ *.pot
52
+
53
+ # Environments
54
+ .env
55
+ .venv
56
+ env/
57
+ venv/
58
+ ENV/
59
+ env.bak/
60
+ venv.bak/
61
+
62
+ # IDE
63
+ .idea/
64
+ .vscode/
65
+ *.swp
66
+ *.swo
67
+ *~
68
+ .project
69
+ .pydevproject
70
+ .settings/
71
+
72
+ # macOS
73
+ .DS_Store
74
+ .AppleDouble
75
+ .LSOverride
76
+ __MACOSX/
77
+
78
+ # MOSS specific
79
+ ~/.moss/
80
+ .moss/
81
+
82
+ # Secrets (should never exist in repo)
83
+ *.pem
84
+ *.key
85
+ secrets.json
86
+ .env.local
87
+
88
+ # Build artifacts
89
+ *.whl
90
+ *.tar.gz
@@ -0,0 +1,30 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.1.0] - 2025-12-06
11
+
12
+ ### Added
13
+ - Initial release of MOSS SDK
14
+ - `Subject.create()` - Create agent identity with ML-DSA-44 keypair
15
+ - `Subject.load()` - Load existing identity from keystore
16
+ - `Subject.sign()` - Sign payloads and return envelopes
17
+ - `Subject.verify()` - Verify envelopes with replay protection
18
+ - CLI commands: `moss subject create`, `moss sign`, `moss verify`, `moss diff`
19
+ - Encrypted keystore (AES-256-GCM + Scrypt)
20
+ - RFC 8785 JSON canonicalization
21
+ - Conformance test vectors
22
+ - Full `moss-0001` specification
23
+
24
+ ### Security
25
+ - Post-quantum signatures (ML-DSA-44 / FIPS 204)
26
+ - Keys encrypted at rest
27
+ - Replay protection via sequence numbers
28
+
29
+ [Unreleased]: https://github.com/mosscomputing/moss/compare/v0.1.0...HEAD
30
+ [0.1.0]: https://github.com/mosscomputing/moss/releases/tag/v0.1.0
@@ -0,0 +1,79 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or advances of any kind
22
+ * Trolling, insulting or derogatory comments, and personal or political attacks
23
+ * Public or private harassment
24
+ * Publishing others' private information, such as a physical or email address, without their explicit permission
25
+ * Other conduct which could reasonably be considered inappropriate in a professional setting
26
+
27
+ ## Enforcement Responsibilities
28
+
29
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
30
+
31
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
32
+
33
+ ## Scope
34
+
35
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
36
+
37
+ ## Enforcement
38
+
39
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at ysablewolf@iampass.com.
40
+
41
+ All complaints will be reviewed and investigated promptly and fairly.
42
+
43
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
44
+
45
+ ## Enforcement Guidelines
46
+
47
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
48
+
49
+ ### 1. Correction
50
+
51
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
52
+
53
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
54
+
55
+ ### 2. Warning
56
+
57
+ **Community Impact**: A violation through a single incident or series of actions.
58
+
59
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
60
+
61
+ ### 3. Temporary Ban
62
+
63
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
64
+
65
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
66
+
67
+ ### 4. Permanent Ban
68
+
69
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
70
+
71
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
72
+
73
+ ## Attribution
74
+
75
+ This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.0, available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
76
+
77
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
78
+
79
+ For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.